File indexing completed on 2024-04-28 13:37:29
0001 #!/bin/sh 0002 0003 cd $(dirname $0)/../ 0004 0005 OUTDIR=$PWD 0006 0007 PREFIX=/opt 0008 0009 if [ ! -z "$1" ]; then 0010 PREFIX=$1 0011 fi 0012 0013 if [ ! -z "$2" ]; then 0014 OUTDIR="$2" 0015 fi 0016 0017 ZSTD=$(which zstd) 0018 0019 if [ -z "$ZSTD" ]; then 0020 echo "ERROR: cannot find zstd in PATH" 0021 exit 1 0022 fi 0023 0024 if [ -z "$(which linuxdeployqt)" ]; then 0025 echo "ERROR: cannot find linuxdeployqt in PATH" 0026 exit 1 0027 fi 0028 0029 if [ -z "$(which appimagetool)" ]; then 0030 echo "ERROR: cannot find appimagetool in PATH" 0031 exit 1 0032 fi 0033 0034 if [ ! -d build-appimage ]; then 0035 mkdir build-appimage 0036 fi 0037 0038 cd build-appimage 0039 0040 cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release -DAPPIMAGE_BUILD=ON .. 0041 make -j$(nproc) 0042 make DESTDIR=appdir install 0043 0044 # copy the zstd binary into the app image 0045 cp $ZSTD ./appdir/$PREFIX/bin/zstd 0046 0047 linuxdeployqt "./appdir/$PREFIX/share/applications/org.kde.heaptrack.desktop" \ 0048 -executable="./appdir/$PREFIX/lib/heaptrack/libexec/heaptrack_interpret" \ 0049 -executable="./appdir/$PREFIX/lib/heaptrack/libheaptrack_preload.so" \ 0050 -executable="./appdir/$PREFIX/lib/heaptrack/libheaptrack_inject.so" \ 0051 -executable="./appdir/$PREFIX/bin/zstd" \ 0052 -bundle-non-qt-libs 0053 0054 # Ensure we prefer the bundled libs also when calling dlopen, cf.: https://github.com/KDAB/hotspot/issues/89 0055 mv "./appdir/$PREFIX/bin/heaptrack_gui" "./appdir/$PREFIX/bin/heaptrack_gui_bin" 0056 cat << WRAPPER_SCRIPT > ./appdir/$PREFIX/bin/heaptrack_gui 0057 #!/bin/bash 0058 f="\$(readlink -f "\${0}")" 0059 d="\$(dirname "\$f")" 0060 LD_LIBRARY_PATH="\$d/../lib:\$LD_LIBRARY_PATH" "\$d/heaptrack_gui_bin" "\$@" 0061 WRAPPER_SCRIPT 0062 chmod +x ./appdir/$PREFIX/bin/heaptrack_gui 0063 0064 # include breeze icons 0065 if [ -d /opt/share/icons/breeze ]; then 0066 cp -va /opt/share/icons/breeze ./appdir/$PREFIX/share/icons/ 0067 fi 0068 0069 # use the shell script as AppRun entry point 0070 # also make sure we find the bundled zstd 0071 rm ./appdir/AppRun 0072 cat << WRAPPER_SCRIPT > ./appdir/AppRun 0073 #!/bin/bash 0074 f="\$(readlink -f "\${0}")" 0075 d="\$(dirname "\$f")" 0076 bin="\$d/$PREFIX/bin" 0077 PATH="\$PATH:\$bin" "\$bin/heaptrack" "\$@" 0078 WRAPPER_SCRIPT 0079 chmod +x ./appdir/AppRun 0080 0081 # Actually create the final image 0082 appimagetool ./appdir $OUTDIR/heaptrack-x86_64.AppImage