Chris@1883: #!/bin/bash Chris@1883: Chris@1883: set -eu Chris@1883: Chris@1883: program=sonic-visualiser Chris@1883: checker=vamp-plugin-load-checker Chris@1883: piper=piper-vamp-simple-server Chris@1883: Chris@1883: targetdir="${program}.AppDir" Chris@1883: Chris@1883: echo "Target dir is $targetdir" Chris@1883: Chris@1883: if [ -d "$targetdir" ]; then Chris@1883: echo "Target directory exists, not overwriting" Chris@1883: exit Chris@1883: fi Chris@1883: Chris@1883: mkdir "$targetdir" Chris@1883: Chris@1883: mkdir -p "$targetdir"/usr/bin Chris@1883: mkdir -p "$targetdir"/usr/lib Chris@1883: Chris@1883: cp "$program" "$checker" "$piper" "$targetdir"/usr/bin/ Chris@1883: Chris@1889: ldd /usr/lib/x86_64-linux-gnu/libpulse.so.0 || true Chris@1889: Chris@1888: add_dependencies() { Chris@1898: Chris@1888: local binary="$1" Chris@1898: Chris@1898: for lib in $(ldd "$binary" | egrep '=> (/usr)?(/local)?/lib/' | \ Chris@1898: sed 's/^.*=> //' | sed 's/ .*$//' | \ Chris@1898: grep -v 'libc.so' | grep -v 'libm.so'); do Chris@1898: Chris@1888: mkdir -p "$targetdir/$(dirname $lib)" Chris@1898: Chris@1888: if [ ! -f "$targetdir/$lib" ]; then Chris@1898: Chris@1888: cp -Lv "$lib" "$targetdir/$lib" Chris@1888: chmod +x "$targetdir/$lib" Chris@1898: Chris@1898: # copy e.g. /usr/lib/pulseaudio/libpulsecommon-*.so up a Chris@1898: # level to something in the load path Chris@1898: last_element=$(basename $(dirname "$lib")) Chris@1898: case "$last_element" in Chris@1898: lib) ;; Chris@1898: *-gnu) ;; Chris@1898: *) cp -v "$targetdir/$lib" "$targetdir/$(dirname $(dirname $lib))" Chris@1898: esac Chris@1898: Chris@1888: add_dependencies "$lib" Chris@1898: Chris@1888: fi Chris@1888: done Chris@1888: } Chris@1888: Chris@1888: add_dependencies "$program" Chris@1883: Chris@1883: cp "$program.desktop" "$targetdir/" Chris@1883: Chris@1883: cp "icons/sv-icon.svg" "$targetdir/" Chris@1883: Chris@1883: cp sv-dependency-builds/linux/appimage/AppRun-x86_64 "$targetdir/AppRun" Chris@1883: chmod +x "$targetdir/AppRun" Chris@1883: Chris@1883: ARCH=x86_64 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage "$targetdir" Chris@1883: