annotate deploy/linux/deploy-appimage.sh @ 1903:d2ee0bde1705 appimage

Attempt to follow exclusion list and name package from revision
author Chris Cannam
date Thu, 28 Jun 2018 15:31:32 +0100
parents 4b772833fe1c
children 9bd1dea5f412
rev   line source
Chris@1883 1 #!/bin/bash
Chris@1883 2
Chris@1883 3 set -eu
Chris@1883 4
Chris@1883 5 program=sonic-visualiser
Chris@1883 6 checker=vamp-plugin-load-checker
Chris@1883 7 piper=piper-vamp-simple-server
Chris@1883 8
Chris@1903 9 get_id() {
Chris@1903 10 if [ -d .hg ]; then
Chris@1903 11 hg id | sed 's/[+ ].*$//'
Chris@1903 12 elif [ -d .git ]; then
Chris@1903 13 git rev-parse --short HEAD
Chris@1903 14 else
Chris@1903 15 echo "WARNING: can't figure out revision from VCS metadata" 1>&2
Chris@1903 16 echo "unknown"
Chris@1903 17 fi
Chris@1903 18 }
Chris@1903 19
Chris@1903 20 version=$(get_id)
Chris@1903 21
Chris@1883 22 targetdir="${program}.AppDir"
Chris@1883 23
Chris@1883 24 echo "Target dir is $targetdir"
Chris@1883 25
Chris@1883 26 if [ -d "$targetdir" ]; then
Chris@1883 27 echo "Target directory exists, not overwriting"
Chris@1883 28 exit
Chris@1883 29 fi
Chris@1883 30
Chris@1883 31 mkdir "$targetdir"
Chris@1883 32
Chris@1883 33 mkdir -p "$targetdir"/usr/bin
Chris@1883 34 mkdir -p "$targetdir"/usr/lib
Chris@1883 35
Chris@1883 36 cp "$program" "$checker" "$piper" "$targetdir"/usr/bin/
Chris@1883 37
Chris@1889 38 ldd /usr/lib/x86_64-linux-gnu/libpulse.so.0 || true
Chris@1889 39
Chris@1888 40 add_dependencies() {
Chris@1898 41
Chris@1888 42 local binary="$1"
Chris@1898 43
Chris@1898 44 for lib in $(ldd "$binary" | egrep '=> (/usr)?(/local)?/lib/' | \
Chris@1903 45 sed 's/^.*=> //' | sed 's/ .*$//'); do
Chris@1898 46
Chris@1903 47 base=$(basename "$lib")
Chris@1903 48 if grep -v '^#' sv-dependency-builds/linux/appimage/excludelist |
Chris@1903 49 grep -q "^$base$" ; then
Chris@1903 50 echo "excluding: $lib"
Chris@1903 51 continue
Chris@1903 52 fi
Chris@1903 53
Chris@1888 54 mkdir -p "$targetdir/$(dirname $lib)"
Chris@1898 55
Chris@1888 56 if [ ! -f "$targetdir/$lib" ]; then
Chris@1898 57
Chris@1888 58 cp -Lv "$lib" "$targetdir/$lib"
Chris@1888 59 chmod +x "$targetdir/$lib"
Chris@1898 60
Chris@1898 61 # copy e.g. /usr/lib/pulseaudio/libpulsecommon-*.so up a
Chris@1898 62 # level to something in the load path
Chris@1898 63 last_element=$(basename $(dirname "$lib"))
Chris@1898 64 case "$last_element" in
Chris@1898 65 lib) ;;
Chris@1898 66 *-gnu) ;;
Chris@1898 67 *) cp -v "$targetdir/$lib" "$targetdir/$(dirname $(dirname $lib))"
Chris@1898 68 esac
Chris@1898 69
Chris@1888 70 add_dependencies "$lib"
Chris@1898 71
Chris@1888 72 fi
Chris@1888 73 done
Chris@1888 74 }
Chris@1888 75
Chris@1888 76 add_dependencies "$program"
Chris@1883 77
Chris@1901 78 cp -v "$targetdir/usr/local/lib/"* "$targetdir/usr/lib/"
Chris@1901 79
Chris@1883 80 cp "$program.desktop" "$targetdir/"
Chris@1883 81
Chris@1883 82 cp "icons/sv-icon.svg" "$targetdir/"
Chris@1883 83
Chris@1883 84 cp sv-dependency-builds/linux/appimage/AppRun-x86_64 "$targetdir/AppRun"
Chris@1883 85 chmod +x "$targetdir/AppRun"
Chris@1883 86
Chris@1903 87 ARCH=x86_64 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage "$targetdir" "SonicVisualiser-$version-x86_64.AppImage"
Chris@1883 88