2018-10-13 16:07:16 +00:00
|
|
|
#!/bin/bash
|
2019-06-22 20:38:17 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2018-10-13 16:07:16 +00:00
|
|
|
set -ex
|
2022-09-27 13:33:52 +00:00
|
|
|
pushd appimage
|
2018-10-15 18:13:52 +00:00
|
|
|
docker build -t qpdfbuild .
|
|
|
|
rm -rf build
|
|
|
|
mkdir build
|
2022-09-27 13:33:52 +00:00
|
|
|
popd
|
2018-10-15 18:13:52 +00:00
|
|
|
git clone .git appimage/build/qpdf
|
2019-06-22 20:38:17 +00:00
|
|
|
docker run --privileged --rm \
|
|
|
|
-v $PWD/appimage/build:/tmp/build ${1+"$@"} qpdfbuild
|
|
|
|
rm -rf distribution
|
2018-10-13 16:07:16 +00:00
|
|
|
mkdir distribution
|
2018-10-15 18:13:52 +00:00
|
|
|
cp -p appimage/build/qpdf/appimage/build/qpdf*AppImage* distribution
|
2018-10-13 16:07:16 +00:00
|
|
|
for i in distribution/*; do
|
|
|
|
mv $i $(echo $i | sed -e 's/\.AppImage/-ci.AppImage/')
|
|
|
|
done
|
2022-09-27 13:33:52 +00:00
|
|
|
version=$(basename distribution/qpdf*AppImage | cut -d- -f 2)
|
|
|
|
|
|
|
|
# Smoke test the AppImage
|
2022-11-19 17:30:33 +00:00
|
|
|
sudo apt-get install libfuse2
|
2022-09-27 13:33:52 +00:00
|
|
|
app_image=$(echo distribution/qpdf*AppImage)
|
|
|
|
# Directly invoking the AppImage should behave like qpdf
|
|
|
|
${app_image} --version | grep -E "^qpdf version $version"
|
|
|
|
# Invoking the AppImage with a subcommand should behave like the subcommand
|
|
|
|
${app_image} qpdf --version | grep -E "^qpdf version $version"
|
|
|
|
${app_image} fix-qdf --version | grep -E "^fix-qdf from qpdf version $version"
|
|
|
|
${app_image} zlib-flate --version | grep -E "^zlib-flate from qpdf version $version"
|
|
|
|
# Symlinking a command to the AppImage should invoke as that command
|
|
|
|
mkdir appimage/build/argv0-test
|
|
|
|
pushd appimage/build/argv0-test
|
|
|
|
for i in qpdf fix-qdf zlib-flate; do
|
|
|
|
ln -s ../../../${app_image} ./$i
|
|
|
|
done
|
|
|
|
./qpdf --version | grep -E "^qpdf version $version"
|
|
|
|
./fix-qdf --version | grep -E "^fix-qdf from qpdf version $version"
|
|
|
|
./zlib-flate --version | grep -E "^zlib-flate from qpdf version $version"
|
|
|
|
popd
|
2020-10-21 14:07:34 +00:00
|
|
|
|
|
|
|
# Extract a standalone copy of binaries and libraries from the
|
|
|
|
# AppImage. This is suitable for use in AWS Lambda, docker, or other
|
2022-09-27 13:33:52 +00:00
|
|
|
# self-contained environments. 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.
|
|
|
|
${app_image} --appimage-extract
|
2020-10-21 14:07:34 +00:00
|
|
|
D=$PWD/distribution
|
2022-09-27 13:33:52 +00:00
|
|
|
for i in qpdf fix-qdf zlib-flate; do
|
|
|
|
if ! (readelf -d squashfs-root/usr/bin/$i | \
|
|
|
|
grep RUNPATH | grep -q -F ..); then
|
|
|
|
echo "Standalone linux binary $i lacks relative RUNPATH"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
done
|
2020-10-21 14:07:34 +00:00
|
|
|
(cd squashfs-root/usr; \
|
|
|
|
zip -9 --symlinks $D/qpdf-$version-bin-linux-x86_64-ci.zip \
|
|
|
|
bin/{qpdf,fix-qdf,zlib-flate} lib/*)
|
|
|
|
|
2018-10-13 16:07:16 +00:00
|
|
|
sha256sum distribution/*
|