annotate deploy/linux/deploy-appimage.sh @ 1890:fb9a63059d25 appimage

Attempt to handle libraries in /lib. I have a bad feeling about this
author Chris Cannam
date Wed, 27 Jun 2018 21:08:26 +0100
parents d8dfd30d6d41
children 8ce9fd471188
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@1883 9 targetdir="${program}.AppDir"
Chris@1883 10
Chris@1883 11 echo "Target dir is $targetdir"
Chris@1883 12
Chris@1883 13 if [ -d "$targetdir" ]; then
Chris@1883 14 echo "Target directory exists, not overwriting"
Chris@1883 15 exit
Chris@1883 16 fi
Chris@1883 17
Chris@1883 18 mkdir "$targetdir"
Chris@1883 19
Chris@1883 20 mkdir -p "$targetdir"/usr/bin
Chris@1883 21 mkdir -p "$targetdir"/usr/lib
Chris@1883 22
Chris@1883 23 cp "$program" "$checker" "$piper" "$targetdir"/usr/bin/
Chris@1883 24
Chris@1889 25 ldd /usr/lib/x86_64-linux-gnu/libpulse.so.0 || true
Chris@1889 26
Chris@1888 27 add_dependencies() {
Chris@1888 28 local binary="$1"
Chris@1890 29 for lib in $(ldd "$binary" | egrep '=> (/usr)?/lib/' | sed 's/^.*=> //' | sed 's/ .*$//' | grep -v 'libc.so' | grep -v 'libm.so'); do
Chris@1888 30 mkdir -p "$targetdir/$(dirname $lib)"
Chris@1888 31 if [ ! -f "$targetdir/$lib" ]; then
Chris@1888 32 cp -Lv "$lib" "$targetdir/$lib"
Chris@1888 33 chmod +x "$targetdir/$lib"
Chris@1888 34 add_dependencies "$lib"
Chris@1888 35 fi
Chris@1888 36 done
Chris@1888 37 }
Chris@1888 38
Chris@1888 39 add_dependencies "$program"
Chris@1883 40
Chris@1883 41 cp "$program.desktop" "$targetdir/"
Chris@1883 42
Chris@1883 43 cp "icons/sv-icon.svg" "$targetdir/"
Chris@1883 44
Chris@1883 45 cp sv-dependency-builds/linux/appimage/AppRun-x86_64 "$targetdir/AppRun"
Chris@1883 46 chmod +x "$targetdir/AppRun"
Chris@1883 47
Chris@1883 48 ARCH=x86_64 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage "$targetdir"
Chris@1883 49