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@1903: get_id() { Chris@1903: if [ -d .hg ]; then Chris@1903: hg id | sed 's/[+ ].*$//' Chris@1903: elif [ -d .git ]; then Chris@1903: git rev-parse --short HEAD Chris@1903: else Chris@1903: echo "WARNING: can't figure out revision from VCS metadata" 1>&2 Chris@1903: echo "unknown" Chris@1903: fi Chris@1903: } Chris@1903: Chris@1903: version=$(get_id) Chris@1903: 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@1903: sed 's/^.*=> //' | sed 's/ .*$//'); do Chris@1898: Chris@1903: base=$(basename "$lib") Chris@1903: if grep -v '^#' sv-dependency-builds/linux/appimage/excludelist | Chris@1903: grep -q "^$base$" ; then Chris@1903: echo "excluding: $lib" Chris@1903: continue Chris@1903: fi Chris@1903: 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@1901: cp -v "$targetdir/usr/local/lib/"* "$targetdir/usr/lib/" Chris@1901: 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@1903: ARCH=x86_64 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage "$targetdir" "SonicVisualiser-$version-x86_64.AppImage" Chris@1883: