aboutsummaryrefslogtreecommitdiffstats
path: root/build-scripts/build-appimage
blob: a9fba23c7d3b1e2e884e31ee5e269e102e07426d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
#
# Any extra args are passed to the docker run command before the
# invocation of qpdfbuild. This is useful for iterating locally as
# described in README-maintainer.
#
set -ex
cd appimage
docker build -t qpdfbuild .
rm -rf build
mkdir build
cd ..
git clone .git appimage/build/qpdf
docker run --privileged --rm \
       -v $PWD/appimage/build:/tmp/build ${1+"$@"} qpdfbuild
rm -rf distribution
mkdir distribution
cp -p appimage/build/qpdf/appimage/build/qpdf*AppImage* distribution
for i in distribution/*; do
    mv $i $(echo $i | sed -e 's/\.AppImage/-ci.AppImage/')
done

# Extract a standalone copy of binaries and libraries from the
# AppImage. This is suitable for use in AWS Lambda, docker, or other
# self-contained environments.
version=$(basename distribution/qpdf*AppImage | cut -d- -f 2)
./distribution/qpdf*AppImage --appimage-extract
D=$PWD/distribution
if ! (readelf -d squashfs-root/usr/bin/qpdf | \
          grep RUNPATH | grep -q -F ..); then
    # We are relying on the AppImage build to create an executable
    # whose runpath is relative to the binary so that the extract zip
    # file is relocatable.
    echo "Standalone linux binary lacks relative RUNPATH"
fi
(cd squashfs-root/usr; \
 zip -9 --symlinks $D/qpdf-$version-bin-linux-x86_64-ci.zip \
     bin/{qpdf,fix-qdf,zlib-flate} lib/*)

sha256sum distribution/*