annotate deploy/linux/deploy-appimage.sh @ 1888:f8f3fa1b1286 appimage

Recursive dependencies
author Chris Cannam
date Wed, 27 Jun 2018 15:57:08 +0100
parents 033fcd33e125
children d8dfd30d6d41
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@1888 25 add_dependencies() {
Chris@1888 26 local binary="$1"
Chris@1888 27 for lib in $(ldd "$binary" | grep '=> /usr/lib/' | sed 's/^.*=> //' | sed 's/ .*$//' | grep -v 'libc.so' | grep -v 'libm.so'); do
Chris@1888 28 mkdir -p "$targetdir/$(dirname $lib)"
Chris@1888 29 if [ ! -f "$targetdir/$lib" ]; then
Chris@1888 30 cp -Lv "$lib" "$targetdir/$lib"
Chris@1888 31 chmod +x "$targetdir/$lib"
Chris@1888 32 add_dependencies "$lib"
Chris@1888 33 fi
Chris@1888 34 done
Chris@1888 35 }
Chris@1888 36
Chris@1888 37 add_dependencies "$program"
Chris@1883 38
Chris@1883 39 cp "$program.desktop" "$targetdir/"
Chris@1883 40
Chris@1883 41 cp "icons/sv-icon.svg" "$targetdir/"
Chris@1883 42
Chris@1883 43 cp sv-dependency-builds/linux/appimage/AppRun-x86_64 "$targetdir/AppRun"
Chris@1883 44 chmod +x "$targetdir/AppRun"
Chris@1883 45
Chris@1883 46 ARCH=x86_64 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage "$targetdir"
Chris@1883 47