Commit 1b85faa61abcec253f9fb5aab6f94c844e4df816
Committed by
Jay Berkenbilt
1 parent
3a902ad2
Convert AppImage build to use cmake
Showing
4 changed files
with
52 additions
and
29 deletions
README-maintainer
| @@ -462,10 +462,12 @@ rsync -vrlcO ./ jay_berkenbilt,qpdf@frs.sourceforge.net:/home/frs/project/q/qp/q | @@ -462,10 +462,12 @@ rsync -vrlcO ./ jay_berkenbilt,qpdf@frs.sourceforge.net:/home/frs/project/q/qp/q | ||
| 462 | OTHER NOTES | 462 | OTHER NOTES |
| 463 | 463 | ||
| 464 | For local iteration on the AppImage generation, it works to just | 464 | For local iteration on the AppImage generation, it works to just |
| 465 | -./build-scripts/build-appimage and get the resulting AppImage from | ||
| 466 | -the distribution directory. You can also pass -e SKIP_TESTS=1 | ||
| 467 | -build-appimage, which passes it along to to docker, to skip the test | ||
| 468 | -suite, which useful for rapid iteration. | 465 | +./build-scripts/build-appimage and get the resulting AppImage from the |
| 466 | +distribution directory. You can pass additional arguments to | ||
| 467 | +build-appimage, which passes them along to to docker. | ||
| 468 | + | ||
| 469 | +Use -e SKIP_TESTS=1 to skip the test suite. | ||
| 470 | +Use -ti -e RUN_SHELL=1 to run a shell instead of the build script. | ||
| 469 | 471 | ||
| 470 | 472 | ||
| 471 | GENERAL BUILD STUFF | 473 | GENERAL BUILD STUFF |
appimage/Dockerfile
| 1 | -FROM ubuntu:18.04 | 1 | +FROM ubuntu:18.04 as start |
| 2 | ENV DEBIAN_FRONTEND=noninteractive | 2 | ENV DEBIAN_FRONTEND=noninteractive |
| 3 | -RUN apt-get update && \ | ||
| 4 | - apt-get -y install screen autoconf git sudo \ | ||
| 5 | - build-essential zlib1g-dev libjpeg-dev libgnutls28-dev \ | ||
| 6 | - python3-pip texlive-latex-extra latexmk \ | ||
| 7 | - inkscape imagemagick busybox-static wget fuse && \ | ||
| 8 | - apt-get clean && \ | ||
| 9 | - rm -rf /var/lib/apt/lists/* | 3 | +RUN apt-get update |
| 4 | +RUN apt-get -y install screen git sudo \ | ||
| 5 | + build-essential pkg-config \ | ||
| 6 | + zlib1g-dev libjpeg-dev libgnutls28-dev \ | ||
| 7 | + python3-pip texlive-latex-extra latexmk \ | ||
| 8 | + inkscape imagemagick busybox-static wget fuse | ||
| 9 | + | ||
| 10 | +# Until we move to ubuntu:20.04, we need a newer cmake. After 20.04, | ||
| 11 | +# we can remove this and add cmake to the install above. | ||
| 12 | +RUN apt-get -y install software-properties-common wget | ||
| 13 | +RUN wget -O /etc/apt/trusted.gpg.d/kitware.asc \ | ||
| 14 | + https://apt.kitware.com/keys/kitware-archive-latest.asc | ||
| 15 | +RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' | ||
| 16 | +RUN apt-get update | ||
| 17 | +RUN apt-get -y install cmake | ||
| 18 | +# End cmake | ||
| 19 | + | ||
| 20 | +RUN apt-get clean && rm -rf /var/lib/apt/lists/* | ||
| 21 | + | ||
| 10 | RUN pip3 install sphinx sphinx_rtd_theme | 22 | RUN pip3 install sphinx sphinx_rtd_theme |
| 23 | + | ||
| 24 | +FROM ubuntu:18.04 as run | ||
| 25 | +COPY --from=start / / | ||
| 11 | COPY entrypoint /entrypoint | 26 | COPY entrypoint /entrypoint |
| 12 | RUN chmod +x /entrypoint | 27 | RUN chmod +x /entrypoint |
| 13 | ENTRYPOINT [ "/entrypoint" ] | 28 | ENTRYPOINT [ "/entrypoint" ] |
appimage/build-appimage
| @@ -82,32 +82,35 @@ appdir=$here/build/appdir | @@ -82,32 +82,35 @@ appdir=$here/build/appdir | ||
| 82 | rm -rf $here/build | 82 | rm -rf $here/build |
| 83 | 83 | ||
| 84 | # Prepare build of QPDF from sources: | 84 | # Prepare build of QPDF from sources: |
| 85 | -./configure --prefix=/usr --enable-werror \ | ||
| 86 | - --enable-crypto-gnutls --disable-implicit-crypto \ | ||
| 87 | - --enable-show-failed-test-output \ | ||
| 88 | - --enable-html-doc --enable-pdf-doc "$CUSTOM_CONFIGURE" | 85 | +rm -rf build.appimage |
| 86 | +mkdir build.appimage | ||
| 87 | +cd build.appimage | ||
| 88 | +cmake -DWERROR=1 -DBUILD_DOC=1 -DCMAKE_BUILD_TYPE=Release \ | ||
| 89 | + -DBUILD_DOC_DIST=1 -DINSTALL_MANUAL=1 \ | ||
| 90 | + -DREQUIRE_CRYPTO_GNUTLS=1 -DUSE_IMPLICIT_CRYPTO=0 \ | ||
| 91 | + -DSHOW_FAILED_TEST_OUTPUT=1 -DBUILD_STATIC_LIBRARIES=0 \ | ||
| 92 | + "$CUSTOM_CONFIGURE" .. | ||
| 89 | 93 | ||
| 90 | # Build! | 94 | # Build! |
| 91 | -make -j$(nproc) | 95 | +cmake --build . -j$(nproc) |
| 92 | 96 | ||
| 93 | if [ "$SKIP_TESTS" = "" ]; then | 97 | if [ "$SKIP_TESTS" = "" ]; then |
| 94 | # Run built-in QPDF checks: | 98 | # Run built-in QPDF checks: |
| 95 | - make -k check | 99 | + ctest --verbose |
| 96 | fi | 100 | fi |
| 97 | 101 | ||
| 98 | # Prepare AppDir which is the basis for the AppImage: | 102 | # Prepare AppDir which is the basis for the AppImage: |
| 99 | mkdir -p $appdir | 103 | mkdir -p $appdir |
| 100 | 104 | ||
| 101 | # Install build result into AppDir: | 105 | # Install build result into AppDir: |
| 102 | -make install DESTDIR=$appdir; find $appdir | ||
| 103 | -make doc-dist DOC_DEST=appdir/usr/share/doc/qpdf | 106 | +for i in lib cli doc; do |
| 107 | + DESTDIR=$appdir cmake --install . --prefix /usr --component $i | ||
| 108 | +done | ||
| 109 | +find $appdir | ||
| 104 | 110 | ||
| 105 | # Change into build directory: | 111 | # Change into build directory: |
| 106 | cd $here/build | 112 | cd $here/build |
| 107 | 113 | ||
| 108 | -# Don't bundle developer stuff | ||
| 109 | -rm -rf appdir/usr/include appdir/usr/lib/pkgconfig appdir/usr/lib/*.{a,la,so} | ||
| 110 | - | ||
| 111 | # Copy icon which is needed for desktop integration into place: | 114 | # Copy icon which is needed for desktop integration into place: |
| 112 | for width in 64 128 256 512; do | 115 | for width in 64 128 256 512; do |
| 113 | dir=appdir/usr/share/icons/hicolor/${width}x${width}/apps | 116 | dir=appdir/usr/share/icons/hicolor/${width}x${width}/apps |
appimage/entrypoint
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | set -e | 2 | set -e |
| 3 | -if [ "$SKIP_TESTS" = "1" ]; then | ||
| 4 | - touch /tmp/skip-tests | ||
| 5 | -fi | ||
| 6 | if [ $(id -u) = 0 ]; then | 3 | if [ $(id -u) = 0 ]; then |
| 7 | if [ ! -d /tmp/build ]; then | 4 | if [ ! -d /tmp/build ]; then |
| 8 | echo "/tmp/build must exist" | 5 | echo "/tmp/build must exist" |
| @@ -10,6 +7,10 @@ if [ $(id -u) = 0 ]; then | @@ -10,6 +7,10 @@ if [ $(id -u) = 0 ]; then | ||
| 10 | fi | 7 | fi |
| 11 | id=$(stat -c %u /tmp/build) | 8 | id=$(stat -c %u /tmp/build) |
| 12 | adduser --home /tmp/build --no-create-home --uid $id --disabled-password --gecos build build | 9 | adduser --home /tmp/build --no-create-home --uid $id --disabled-password --gecos build build |
| 10 | + touch /tmp/.env | ||
| 11 | + echo "export SKIP_TESTS=$SKIP_TESTS" >> /tmp/.env | ||
| 12 | + echo "export RUN_SHELL=$RUN_SHELL" >> /tmp/.env | ||
| 13 | + chown build /tmp/.env | ||
| 13 | exec sudo -iu build $0 "$@" | 14 | exec sudo -iu build $0 "$@" |
| 14 | fi | 15 | fi |
| 15 | 16 | ||
| @@ -22,7 +23,9 @@ if [ ! -d qpdf ]; then | @@ -22,7 +23,9 @@ if [ ! -d qpdf ]; then | ||
| 22 | git clone "$@" qpdf | 23 | git clone "$@" qpdf |
| 23 | fi | 24 | fi |
| 24 | cd qpdf | 25 | cd qpdf |
| 25 | -if [ -f /tmp/skip-tests ]; then | ||
| 26 | - export SKIP_TESTS=1 | 26 | +source /tmp/.env |
| 27 | +if [ "$RUN_SHELL" = "1" ]; then | ||
| 28 | + bash | ||
| 29 | +else | ||
| 30 | + ./appimage/build-appimage | ||
| 27 | fi | 31 | fi |
| 28 | -./appimage/build-appimage |