Convert AppImage build to use cmake

This commit is contained in:
Jay Berkenbilt 2022-03-11 20:54:48 -05:00 committed by Jay Berkenbilt
parent 3a902ad20a
commit 1b85faa61a
4 changed files with 52 additions and 29 deletions

View File

@ -462,10 +462,12 @@ rsync -vrlcO ./ jay_berkenbilt,qpdf@frs.sourceforge.net:/home/frs/project/q/qp/q
OTHER NOTES
For local iteration on the AppImage generation, it works to just
./build-scripts/build-appimage and get the resulting AppImage from
the distribution directory. You can also pass -e SKIP_TESTS=1
build-appimage, which passes it along to to docker, to skip the test
suite, which useful for rapid iteration.
./build-scripts/build-appimage and get the resulting AppImage from the
distribution directory. You can pass additional arguments to
build-appimage, which passes them along to to docker.
Use -e SKIP_TESTS=1 to skip the test suite.
Use -ti -e RUN_SHELL=1 to run a shell instead of the build script.
GENERAL BUILD STUFF

View File

@ -1,13 +1,28 @@
FROM ubuntu:18.04
FROM ubuntu:18.04 as start
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y install screen autoconf git sudo \
build-essential zlib1g-dev libjpeg-dev libgnutls28-dev \
python3-pip texlive-latex-extra latexmk \
inkscape imagemagick busybox-static wget fuse && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update
RUN apt-get -y install screen git sudo \
build-essential pkg-config \
zlib1g-dev libjpeg-dev libgnutls28-dev \
python3-pip texlive-latex-extra latexmk \
inkscape imagemagick busybox-static wget fuse
# Until we move to ubuntu:20.04, we need a newer cmake. After 20.04,
# we can remove this and add cmake to the install above.
RUN apt-get -y install software-properties-common wget
RUN wget -O /etc/apt/trusted.gpg.d/kitware.asc \
https://apt.kitware.com/keys/kitware-archive-latest.asc
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
RUN apt-get update
RUN apt-get -y install cmake
# End cmake
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip3 install sphinx sphinx_rtd_theme
FROM ubuntu:18.04 as run
COPY --from=start / /
COPY entrypoint /entrypoint
RUN chmod +x /entrypoint
ENTRYPOINT [ "/entrypoint" ]

View File

@ -82,32 +82,35 @@ appdir=$here/build/appdir
rm -rf $here/build
# Prepare build of QPDF from sources:
./configure --prefix=/usr --enable-werror \
--enable-crypto-gnutls --disable-implicit-crypto \
--enable-show-failed-test-output \
--enable-html-doc --enable-pdf-doc "$CUSTOM_CONFIGURE"
rm -rf build.appimage
mkdir build.appimage
cd build.appimage
cmake -DWERROR=1 -DBUILD_DOC=1 -DCMAKE_BUILD_TYPE=Release \
-DBUILD_DOC_DIST=1 -DINSTALL_MANUAL=1 \
-DREQUIRE_CRYPTO_GNUTLS=1 -DUSE_IMPLICIT_CRYPTO=0 \
-DSHOW_FAILED_TEST_OUTPUT=1 -DBUILD_STATIC_LIBRARIES=0 \
"$CUSTOM_CONFIGURE" ..
# Build!
make -j$(nproc)
cmake --build . -j$(nproc)
if [ "$SKIP_TESTS" = "" ]; then
# Run built-in QPDF checks:
make -k check
ctest --verbose
fi
# Prepare AppDir which is the basis for the AppImage:
mkdir -p $appdir
# Install build result into AppDir:
make install DESTDIR=$appdir; find $appdir
make doc-dist DOC_DEST=appdir/usr/share/doc/qpdf
for i in lib cli doc; do
DESTDIR=$appdir cmake --install . --prefix /usr --component $i
done
find $appdir
# Change into build directory:
cd $here/build
# Don't bundle developer stuff
rm -rf appdir/usr/include appdir/usr/lib/pkgconfig appdir/usr/lib/*.{a,la,so}
# Copy icon which is needed for desktop integration into place:
for width in 64 128 256 512; do
dir=appdir/usr/share/icons/hicolor/${width}x${width}/apps

View File

@ -1,8 +1,5 @@
#!/bin/bash
set -e
if [ "$SKIP_TESTS" = "1" ]; then
touch /tmp/skip-tests
fi
if [ $(id -u) = 0 ]; then
if [ ! -d /tmp/build ]; then
echo "/tmp/build must exist"
@ -10,6 +7,10 @@ if [ $(id -u) = 0 ]; then
fi
id=$(stat -c %u /tmp/build)
adduser --home /tmp/build --no-create-home --uid $id --disabled-password --gecos build build
touch /tmp/.env
echo "export SKIP_TESTS=$SKIP_TESTS" >> /tmp/.env
echo "export RUN_SHELL=$RUN_SHELL" >> /tmp/.env
chown build /tmp/.env
exec sudo -iu build $0 "$@"
fi
@ -22,7 +23,9 @@ if [ ! -d qpdf ]; then
git clone "$@" qpdf
fi
cd qpdf
if [ -f /tmp/skip-tests ]; then
export SKIP_TESTS=1
source /tmp/.env
if [ "$RUN_SHELL" = "1" ]; then
bash
else
./appimage/build-appimage
fi
./appimage/build-appimage