Commit e3c1e1fbcbf50d86bdbc6d6cf31ea6c87b1ed407

Authored by Jay Berkenbilt
1 parent 706e37a4

Validate RUNPATH of standalone Linux binaries in CI

@@ -19,10 +19,6 @@ Pending changes: @@ -19,10 +19,6 @@ Pending changes:
19 19
20 * Consider also exposing a way to set a new logger and to get the 20 * Consider also exposing a way to set a new logger and to get the
21 logger from QPDF and QPDFJob in the C API. 21 logger from QPDF and QPDFJob in the C API.
22 -* Check about runpath in the linux-bin distribution. I think the  
23 - appimage build specifically is setting the runpath, which is  
24 - actually desirable in this case. Make sure to understand and  
25 - document this. Maybe add a check for it in the build.  
26 22
27 Soon: Break ground on "Document-level work" 23 Soon: Break ground on "Document-level work"
28 24
build-scripts/build-appimage
@@ -26,6 +26,13 @@ done @@ -26,6 +26,13 @@ done
26 version=$(basename distribution/qpdf*AppImage | cut -d- -f 2) 26 version=$(basename distribution/qpdf*AppImage | cut -d- -f 2)
27 ./distribution/qpdf*AppImage --appimage-extract 27 ./distribution/qpdf*AppImage --appimage-extract
28 D=$PWD/distribution 28 D=$PWD/distribution
  29 +if ! (readelf -d squashfs-root/usr/bin/qpdf | \
  30 + grep RUNPATH | grep -q -F ..); then
  31 + # We are relying on the AppImage build to create an executable
  32 + # whose runpath is relative to the binary so that the extract zip
  33 + # file is relocatable.
  34 + echo "Standalone linux binary lacks relative RUNPATH"
  35 +fi
29 (cd squashfs-root/usr; \ 36 (cd squashfs-root/usr; \
30 zip -9 --symlinks $D/qpdf-$version-bin-linux-x86_64-ci.zip \ 37 zip -9 --symlinks $D/qpdf-$version-bin-linux-x86_64-ci.zip \
31 bin/{qpdf,fix-qdf,zlib-flate} lib/*) 38 bin/{qpdf,fix-qdf,zlib-flate} lib/*)