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@1898
|
28
|
Chris@1888
|
29 local binary="$1"
|
Chris@1898
|
30
|
Chris@1898
|
31 for lib in $(ldd "$binary" | egrep '=> (/usr)?(/local)?/lib/' | \
|
Chris@1898
|
32 sed 's/^.*=> //' | sed 's/ .*$//' | \
|
Chris@1898
|
33 grep -v 'libc.so' | grep -v 'libm.so'); do
|
Chris@1898
|
34
|
Chris@1888
|
35 mkdir -p "$targetdir/$(dirname $lib)"
|
Chris@1898
|
36
|
Chris@1888
|
37 if [ ! -f "$targetdir/$lib" ]; then
|
Chris@1898
|
38
|
Chris@1888
|
39 cp -Lv "$lib" "$targetdir/$lib"
|
Chris@1888
|
40 chmod +x "$targetdir/$lib"
|
Chris@1898
|
41
|
Chris@1898
|
42 # copy e.g. /usr/lib/pulseaudio/libpulsecommon-*.so up a
|
Chris@1898
|
43 # level to something in the load path
|
Chris@1898
|
44 last_element=$(basename $(dirname "$lib"))
|
Chris@1898
|
45 case "$last_element" in
|
Chris@1898
|
46 lib) ;;
|
Chris@1898
|
47 *-gnu) ;;
|
Chris@1898
|
48 *) cp -v "$targetdir/$lib" "$targetdir/$(dirname $(dirname $lib))"
|
Chris@1898
|
49 esac
|
Chris@1898
|
50
|
Chris@1888
|
51 add_dependencies "$lib"
|
Chris@1898
|
52
|
Chris@1888
|
53 fi
|
Chris@1888
|
54 done
|
Chris@1888
|
55 }
|
Chris@1888
|
56
|
Chris@1888
|
57 add_dependencies "$program"
|
Chris@1883
|
58
|
Chris@1901
|
59 cp -v "$targetdir/usr/local/lib/"* "$targetdir/usr/lib/"
|
Chris@1901
|
60
|
Chris@1883
|
61 cp "$program.desktop" "$targetdir/"
|
Chris@1883
|
62
|
Chris@1883
|
63 cp "icons/sv-icon.svg" "$targetdir/"
|
Chris@1883
|
64
|
Chris@1883
|
65 cp sv-dependency-builds/linux/appimage/AppRun-x86_64 "$targetdir/AppRun"
|
Chris@1883
|
66 chmod +x "$targetdir/AppRun"
|
Chris@1883
|
67
|
Chris@1883
|
68 ARCH=x86_64 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage "$targetdir"
|
Chris@1883
|
69
|