| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | srcdir=$(readlinkscip-shell system . . readlink. -f "$1") |
| 6 | buildir=$(readlinkscip-shell system . . readlink. -f "$2") |
| 7 | |
| 8 | if [scip-shell system . . `[`. -z "$srcdir" ] || [scip-shell system . . `[`. -z "$buildir" ]; then |
| 9 | echoscip-shell system . . echo. "usage: $0 <srcdir> <builddir>" |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
| 13 | gitversion=$(gitscip-shell system . . git. -C "$srcdir" describe) |
| 14 | |
| 15 | ZSTD=$(whichscip-shell system . . which. zstd) |
| 16 | |
| 17 | if [scip-shell system . . `[`. -z "$ZSTD" ]; then |
| 18 | echoscip-shell system . . echo. "ERROR: cannot find zstd in PATH" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | if [scip-shell system . . `[`. -z "$(whichscip-shell system . . which. linuxdeploy)" ]; then |
| 23 | echoscip-shell system . . echo. "ERROR: cannot find linuxdeploy in PATH" |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | . /opt/rh/gcc-toolset-14/enablescip-shell source . . `/opt/rh/gcc-toolset-14/enable`. |
| 28 | |
| 29 | mkdirscip-shell system . . mkdir. -p "$buildir" && cd "$buildir" |
| 30 | cmakescip-shell system . . cmake. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/opt/rh/gcc-toolset-14/root/ \ |
| 31 | -DCMAKE_BUILD_TYPE=Release -DAPPIMAGE_BUILD=ON "$srcdir" |
| 32 | makescip-shell system . . make. -j$(nprocscip-shell system . . nproc.) |
| 33 | rmscip-shell system . . rm. -Rf appdir |
| 34 | makescip-shell system . . make. DESTDIR=appdir install |
| 35 | |
| 36 | # copy the zstd binary into the app image |
| 37 | cpscip-shell system . . cp. $ZSTD ./appdir/usr/bin/zstd |
| 38 | |
| 39 | # Ensure we prefer the bundled libs also when calling dlopen, cf.: https://github.com/KDAB/hotspot/issues/89 |
| 40 | mvscip-shell system . . mv. "./appdir/usr/bin/heaptrack_gui" "./appdir/usr/bin/heaptrack_gui_bin" |
| 41 | catscip-shell system . . cat. << WRAPPER_SCRIPT > ./appdir/usr/bin/heaptrack_gui |
| 42 | #!/bin/bash |
| 43 | f="\$(readlink -f "\${0}")" |
| 44 | d="\$(dirname "\$f")" |
| 45 | unset QT_PLUGIN_PATH |
| 46 | LD_LIBRARY_PATH="\$d/../lib:\$LD_LIBRARY_PATH" "\$d/heaptrack_gui_bin" "\$@" |
| 47 | WRAPPER_SCRIPT |
| 48 | chmodscip-shell system . . chmod. +x ./appdir/usr/bin/heaptrack_gui |
| 49 | |
| 50 | mvscip-shell system . . mv. "./appdir/usr/lib/heaptrack/libexec/heaptrack_interpret" "./appdir/usr/lib/heaptrack/libexec/heaptrack_interpret_bin" |
| 51 | catscip-shell system . . cat. << WRAPPER_SCRIPT > ./appdir/usr/lib/heaptrack/libexec/heaptrack_interpret |
| 52 | #!/bin/bash |
| 53 | f="\$(readlink -f "\${0}")" |
| 54 | d="\$(dirname "\$f")" |
| 55 | LD_LIBRARY_PATH="\$d/../../:\$LD_LIBRARY_PATH" "\$d/heaptrack_interpret_bin" "\$@" |
| 56 | WRAPPER_SCRIPT |
| 57 | chmodscip-shell system . . chmod. +x ./appdir/usr/lib/heaptrack/libexec/heaptrack_interpret |
| 58 | |
| 59 | # include breeze icons |
| 60 | mkdirscip-shell system . . mkdir. -p "appdir/usr/share/icons/breeze" |
| 61 | cpscip-shell system . . cp. -v "/usr/share/icons/breeze/breeze-icons.rccscip-shell filesystem . . `/usr/share/icons/breeze/breeze-icons.rcc`." "appdir/usr/share/icons/breeze/" |
| 62 | |
| 63 | # use the shell script as AppRun entry point |
| 64 | # also make sure we find the bundled zstd |
| 65 | catscip-shell system . . cat. << WRAPPER_SCRIPT > ./appdir/AppRun |
| 66 | #!/bin/bash |
| 67 | f="\$(readlink -f "\${0}")" |
| 68 | d="\$(dirname "\$f")" |
| 69 | bin="\$d/usr/bin" |
| 70 | PATH="\$PATH:\$bin" "\$bin/heaptrack" "\$@" |
| 71 | WRAPPER_SCRIPT |
| 72 | chmodscip-shell system . . chmod. +x ./appdir/AppRun |
| 73 | |
| 74 | # tell the linuxdeploy qt plugin to include these platform plugins |
| 75 | export EXTRA_PLATFORM_PLUGINS="libqoffscreen.so;libqwayland-generic.so" |
| 76 | |
| 77 | mkdirscip-shell system . . mkdir. -p appdir/usr/plugins/wayland-shell-integration/ |
| 78 | cpscip-shell system . . cp. /usr/plugins/wayland-shell-integration/libxdg-shell.soscip-shell filesystem . . `/usr/plugins/wayland-shell-integration/libxdg-shell.so`. appdir/usr/plugins/wayland-shell-integration/ |
| 79 | |
| 80 | linuxdeploy --appdir appdir --plugin qt \ |
| 81 | -e "./appdir/usr/lib/heaptrack/libexec/heaptrack_interpret_bin" \ |
| 82 | -e "./appdir/usr/lib/heaptrack/libheaptrack_preload.so" \ |
| 83 | -e "./appdir/usr/lib/heaptrack/libheaptrack_inject.so" \ |
| 84 | -e "./appdir/usr/bin/heaptrack_gui_bin" \ |
| 85 | -e "./appdir/usr/bin/zstd" \ |
| 86 | -l "/usr/lib64/libz.so.1scip-shell filesystem . . `/usr/lib64/libz.so.1`." \ |
| 87 | -l /usr/lib64/libharfbuzz.so.0scip-shell filesystem . . `/usr/lib64/libharfbuzz.so.0`. \ |
| 88 | -l /usr/lib64/libfreetype.so.6scip-shell filesystem . . `/usr/lib64/libfreetype.so.6`. \ |
| 89 | -l /usr/lib64/libfontconfig.so.1scip-shell filesystem . . `/usr/lib64/libfontconfig.so.1`. \ |
| 90 | -l /usr/lib64/libwayland-egl.soscip-shell filesystem . . `/usr/lib64/libwayland-egl.so`. \ |
| 91 | -i "$srcdir/src/analyze/gui/128-apps-heaptrack.png" --icon-filename=heaptrack \ |
| 92 | -d "./appdir/usr/share/applications/org.kde.heaptrack.desktop" \ |
| 93 | --output appimage |
| 94 | |
| 95 | mvscip-shell system . . mv. Heaptrack*x86_64.AppImage "/github/workspace/heaptrack-$gitversion-x86_64.AppImage" |