Mercurial > hg > sonic-visualiser
comparison deploy/linux/deploy-appimage.sh @ 2008:55d9bbf1fe45 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 14:05:41 +0100 |
parents | 4a1b7b175807 |
children | c0afaca5a029 |
comparison
equal
deleted
inserted
replaced
2007:246bdf94ef7b | 2008:55d9bbf1fe45 |
---|---|
1 #!/bin/bash | |
2 | |
3 set -eu | |
4 | |
5 program=sonic-visualiser | |
6 checker=vamp-plugin-load-checker | |
7 piper=piper-vamp-simple-server | |
8 | |
9 get_id() { | |
10 if [ -d .hg ]; then | |
11 hg id | sed 's/[+ ].*$//' | |
12 elif [ -d .git ]; then | |
13 git rev-parse --short HEAD | |
14 else | |
15 echo "WARNING: can't figure out revision from VCS metadata" 1>&2 | |
16 echo "unknown" | |
17 fi | |
18 } | |
19 | |
20 version=$(get_id) | |
21 | |
22 targetdir="${program}.AppDir" | |
23 | |
24 echo "Target dir is $targetdir" | |
25 | |
26 if [ -d "$targetdir" ]; then | |
27 echo "Target directory exists, not overwriting" | |
28 exit | |
29 fi | |
30 | |
31 mkdir "$targetdir" | |
32 | |
33 mkdir -p "$targetdir"/usr/bin | |
34 mkdir -p "$targetdir"/usr/lib | |
35 | |
36 cp "$program" "$checker" "$piper" "$targetdir"/usr/bin/ | |
37 | |
38 ldd /usr/lib/x86_64-linux-gnu/libpulse.so.0 || true | |
39 | |
40 add_dependencies() { | |
41 | |
42 local binary="$1" | |
43 | |
44 echo "ldd $binary yields:" | |
45 ldd "$binary" | |
46 | |
47 for lib in $(ldd "$binary" | grep '=> [^ ]*/lib/' | \ | |
48 sed 's/^.*=> //' | sed 's/ .*$//'); do | |
49 | |
50 base=$(basename "$lib") | |
51 if grep -v '^#' sv-dependency-builds/linux/appimage/excludelist | | |
52 grep -q "^$base$" ; then | |
53 echo "excluding: $lib" | |
54 continue | |
55 fi | |
56 | |
57 target="$targetdir/usr/lib/$(basename $lib)" | |
58 | |
59 mkdir -p "$(dirname $target)" | |
60 | |
61 if [ ! -f "$target" ]; then | |
62 | |
63 cp -Lv "$lib" "$target" | |
64 chmod +x "$target" | |
65 | |
66 add_dependencies "$lib" | |
67 | |
68 fi | |
69 done | |
70 } | |
71 | |
72 add_dependencies "$program" | |
73 add_dependencies "$checker" | |
74 add_dependencies "$piper" | |
75 | |
76 qtplugins="gif icns ico jpeg tga tiff wbmp webp cocoa minimal offscreen xcb" | |
77 qtlibdirs="/usr/lib/x86_64-linux-gnu/qt5 /usr/lib/x86_64-linux-gnu/qt /usr/lib/qt5 /usr/lib/qt" | |
78 | |
79 QTDIR=${QTDIR:-} | |
80 if [ -n "$QTDIR" ]; then | |
81 qtlibdirs="$QTDIR $qtlibdirs" | |
82 fi | |
83 | |
84 for plug in $qtplugins; do | |
85 for libdir in $qtlibdirs; do | |
86 lib=$(find $libdir/plugins -name libq$plug.so -print 2>/dev/null || true) | |
87 if [ -n "$lib" ]; then | |
88 if [ -f "$lib" ]; then | |
89 subdir=$(basename $(dirname $lib)) | |
90 if [ t"$subdir" = t"plugins" ]; then | |
91 subdir="" | |
92 fi | |
93 target="$targetdir/usr/lib/qt5/plugins/$subdir/$(basename $lib)" | |
94 mkdir -p "$(dirname $target)" | |
95 cp -v "$lib" "$target" | |
96 chmod +x "$target" | |
97 add_dependencies "$lib" | |
98 break | |
99 fi | |
100 fi | |
101 done | |
102 done | |
103 | |
104 cp "$program.desktop" "$targetdir/" | |
105 | |
106 cp "icons/sv-icon.svg" "$targetdir/" | |
107 cp "icons/sonic-visualiser.svg" "$targetdir/" | |
108 | |
109 cp sv-dependency-builds/linux/appimage/AppRun-x86_64 "$targetdir/AppRun" | |
110 chmod +x "$targetdir/AppRun" | |
111 | |
112 # Do this with a separate extraction step, so as to make it work even | |
113 # in situations where FUSE is unavailable like in a Docker container | |
114 export ARCH=x86_64 | |
115 sv-dependency-builds/linux/appimage/appimagetool-x86_64.AppImage --appimage-extract | |
116 ./squashfs-root/AppRun "$targetdir" "SonicVisualiser-$version-x86_64.AppImage" | |
117 |