annotate deploy/linux/deploy-appimage.sh @ 1922:b676ebebe74f

Without portaudio, we need this
author Chris Cannam
date Tue, 03 Jul 2018 12:51:10 +0100
parents 55241126e0e4
children 4ec4c1b9d367
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@1915 44 echo "ldd $binary yields:"
Chris@1915 45 ldd "$binary"
Chris@1915 46
Chris@1915 47 for lib in $(ldd "$binary" | grep '=> [^ ]*/lib/' | \
Chris@1903 48 sed 's/^.*=> //' | sed 's/ .*$//'); do
Chris@1898 49
Chris@1903 50 base=$(basename "$lib")
Chris@1903 51 if grep -v '^#' sv-dependency-builds/linux/appimage/excludelist |
Chris@1903 52 grep -q "^$base$" ; then
Chris@1915 53 echo "excluding: $lib"
Chris@1903 54 continue
Chris@1903 55 fi
Chris@1915 56
Chris@1915 57 target="$targetdir/usr/lib/$(basename $lib)"
Chris@1903 58
Chris@1915 59 mkdir -p "$(dirname $target)"
Chris@1898 60
Chris@1915 61 if [ ! -f "$target" ]; then
Chris@1898 62
Chris@1915 63 cp -Lv "$lib" "$target"
Chris@1915 64 chmod +x "$target"
Chris@1898 65
Chris@1915 66 # # copy e.g. /usr/lib/pulseaudio/libpulsecommon-*.so up a
Chris@1915 67 # # level to something in the load path
Chris@1915 68 # last_element=$(basename $(dirname "$lib"))
Chris@1915 69 # case "$last_element" in
Chris@1915 70 # lib) ;;
Chris@1915 71 # *-gnu) ;;
Chris@1915 72 # *) cp -v "$targetdir/$lib" "$targetdir/$(dirname $(dirname $lib))"
Chris@1915 73 # esac
Chris@1898 74
Chris@1888 75 add_dependencies "$lib"
Chris@1898 76
Chris@1888 77 fi
Chris@1888 78 done
Chris@1888 79 }
Chris@1888 80
Chris@1888 81 add_dependencies "$program"
Chris@1915 82 add_dependencies "$checker"
Chris@1915 83 add_dependencies "$piper"
Chris@1883 84
Chris@1915 85 #cp -v "$targetdir/usr/local/lib/"* "$targetdir/usr/lib/"
Chris@1901 86
Chris@1905 87 qtplugins="gif icns ico jpeg tga tiff wbmp webp cocoa minimal offscreen xcb"
Chris@1909 88 qtlibdirs="/usr/lib/x86_64-linux-gnu/qt5 /usr/lib/x86_64-linux-gnu/qt /usr/lib/qt5 /usr/lib/qt"
Chris@1909 89
Chris@1909 90 QTDIR=${QTDIR:-}
Chris@1909 91 if [ -n "$QTDIR" ]; then
Chris@1909 92 qtlibdirs="$QTDIR $qtlibdirs"
Chris@1909 93 fi
Chris@1905 94
Chris@1905 95 for plug in $qtplugins; do
Chris@1905 96 for libdir in $qtlibdirs; do
Chris@1905 97 lib=$(find $libdir/plugins -name libq$plug.so -print 2>/dev/null || true)
Chris@1905 98 if [ -n "$lib" ]; then
Chris@1905 99 if [ -f "$lib" ]; then
Chris@1920 100 subdir=$(basename $(dirname $lib))
Chris@1920 101 if [ t"$subdir" = t"plugins" ]; then
Chris@1920 102 subdir=""
Chris@1920 103 fi
Chris@1920 104 target="$targetdir/usr/lib/qt5/plugins/$subdir/$(basename $lib)"
Chris@1915 105 mkdir -p "$(dirname $target)"
Chris@1915 106 cp -v "$lib" "$target"
Chris@1915 107 chmod +x "$target"
Chris@1905 108 add_dependencies "$lib"
Chris@1905 109 break
Chris@1905 110 fi
Chris@1905 111 fi
Chris@1905 112 done
Chris@1905 113 done
Chris@1905 114
Chris@1883 115 cp "$program.desktop" "$targetdir/"
Chris@1883 116
Chris@1883 117 cp "icons/sv-icon.svg" "$targetdir/"
Chris@1883 118
Chris@1883 119 cp sv-dependency-builds/linux/appimage/AppRun-x86_64 "$targetdir/AppRun"
Chris@1883 120 chmod +x "$targetdir/AppRun"
Chris@1883 121
Chris@1909 122 # Do this with a separate extraction step, so as to make it work even
Chris@1909 123 # in situations where FUSE is unavailable like in a Docker container
Chris@1909 124 export ARCH=x86_64
Chris@1909 125 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage --appimage-extract
Chris@1909 126 ./squashfs-root/AppRun "$targetdir" "SonicVisualiser-$version-x86_64.AppImage"
Chris@1883 127