]>
Commit | Line | Data |
---|---|---|
54207903 | 1 | #!/bin/bash |
3d2ed47b UH |
2 | ## |
3 | ## Copyright (C) 2016 Simon Peter | |
ea193494 | 4 | ## Copyright (C) 2017-2018 Uwe Hermann <uwe@hermann-uwe.de> |
3d2ed47b UH |
5 | ## This file is licensed under the terms of the MIT license. |
6 | ## | |
54207903 | 7 | |
ea193494 | 8 | # Bundle PulseView/sigrok-cli (and deps) as an AppImage for x86_64/i386 Linux. |
3d2ed47b | 9 | # Note: This assumes the full sigrok stack has been installed into $PREFIX. |
54207903 | 10 | |
3d2ed47b | 11 | PREFIX=$HOME/sr |
54207903 | 12 | |
d693424c | 13 | APPIMAGEKIT_OUTDIR=$HOME/AppImageKit/build/out |
a8115a71 | 14 | |
8c7df980 | 15 | # ARCH=i386 |
54207903 | 16 | ARCH=x86_64 |
17 | ||
bb8e5714 | 18 | PYVER=3.5 |
90badf4c | 19 | |
a8115a71 UH |
20 | ######################################################################## |
21 | # You usually don't have to change anything below this line | |
22 | ######################################################################## | |
23 | ||
ea193494 UH |
24 | if [ "x$1" = "xsigrok-cli" ]; then |
25 | APP=sigrok-cli | |
26 | else | |
27 | APP=PulseView | |
28 | fi | |
3d2ed47b UH |
29 | LOWERAPP=${APP,,} |
30 | ||
006ffd96 | 31 | export ARCH |
a8115a71 UH |
32 | export STATIC_FILES=`pwd`/contrib |
33 | ||
34 | # Add $APPIMAGEKIT_OUTDIR so we can find all the binaries there. | |
35 | export PATH=$APPIMAGEKIT_OUTDIR:$PATH | |
36 | ||
3d2ed47b UH |
37 | A="./$APP/$APP.AppDir" |
38 | mkdir -p $A/usr/bin $A/usr/lib $A/usr/share | |
54207903 | 39 | cd ./$APP |
40 | ||
9cacd19e | 41 | . $STATIC_FILES/functions.sh |
54207903 | 42 | |
43 | ######################################################################## | |
3d2ed47b | 44 | # Get build products from $PREFIX |
54207903 | 45 | ######################################################################## |
46 | ||
54207903 | 47 | cd $APP.AppDir/ |
48 | ||
ea193494 | 49 | cp $PREFIX/bin/$LOWERAPP usr/bin/ |
54207903 | 50 | chmod a+x usr/bin/* |
3d2ed47b UH |
51 | cp $PREFIX/lib/lib*.so* usr/lib/ |
52 | cp -r $PREFIX/share/libsigrokdecode usr/share/ | |
53 | cp -r $PREFIX/share/sigrok-firmware usr/share/ | |
ea193494 UH |
54 | mkdir -p usr/share/applications |
55 | cp $PREFIX/share/applications/org.sigrok.$APP.desktop usr/share/applications | |
fe8f66a9 UH |
56 | cp -r $PREFIX/share/icons usr/share/ |
57 | cp -r $PREFIX/share/metainfo usr/share/ | |
58 | cp -r $PREFIX/share/mime usr/share/ | |
54207903 | 59 | |
ea193494 UH |
60 | # Drop unneeded stuff. |
61 | if [ "x$1" = "xsigrok-cli" ]; then | |
62 | rm -f usr/lib/libsigc* | |
63 | rm -f usr/lib/libglibmm* | |
64 | rm -f usr/lib/libsigrokcxx* | |
65 | rm -f usr/share/icons/hicolor/*/apps/pulseview.* | |
66 | rm -f usr/share/metainfo/org.sigrok.PulseView.appdata.xml | |
67 | else | |
68 | rm -f usr/share/icons/hicolor/scalable/apps/sigrok-cli.svg | |
69 | fi | |
70 | ||
54207903 | 71 | # Reduce binary size |
72 | strip usr/bin/* | |
73 | strip usr/lib/* | |
74 | ||
75 | ######################################################################## | |
76 | # AppRun is the main launcher that gets executed when AppImage is run | |
77 | ######################################################################## | |
78 | ||
a8115a71 | 79 | cp $APPIMAGEKIT_OUTDIR/AppRun . |
54207903 | 80 | |
81 | ######################################################################## | |
82 | # Copy desktop and icon file to AppDir for AppRun to pick them up | |
83 | ######################################################################## | |
84 | ||
ea193494 UH |
85 | cp $PREFIX/share/applications/org.sigrok.$APP.desktop . |
86 | cp $PREFIX/share/icons/hicolor/scalable/apps/$LOWERAPP.svg . | |
54207903 | 87 | |
54207903 | 88 | ######################################################################## |
89 | # Copy in the dependencies that cannot be assumed to be available | |
90 | # on all target systems | |
91 | ######################################################################## | |
92 | ||
54207903 | 93 | copy_deps |
94 | ||
ea193494 UH |
95 | if [ "x$1" != "xsigrok-cli" ]; then |
96 | # Get all Qt5 plugins (won't be copied automatically). | |
97 | QT5PLUGINS=/usr/lib/$ARCH-linux-gnu/qt5/plugins # Host (+ AppRun) path. | |
98 | mkdir -p .$QT5PLUGINS | |
bb8e5714 UH |
99 | cp -r $QT5PLUGINS/bearer .$QT5PLUGINS |
100 | cp -r $QT5PLUGINS/egldeviceintegrations .$QT5PLUGINS | |
ea193494 UH |
101 | cp -r $QT5PLUGINS/generic .$QT5PLUGINS |
102 | cp -r $QT5PLUGINS/iconengines .$QT5PLUGINS | |
103 | cp -r $QT5PLUGINS/imageformats .$QT5PLUGINS | |
104 | cp -r $QT5PLUGINS/platforminputcontexts .$QT5PLUGINS | |
105 | cp -r $QT5PLUGINS/platforms .$QT5PLUGINS | |
bb8e5714 UH |
106 | cp -r $QT5PLUGINS/printsupport .$QT5PLUGINS |
107 | cp -r $QT5PLUGINS/xcbglintegrations .$QT5PLUGINS | |
ea193494 UH |
108 | |
109 | # Get some additional dependencies of the Qt5 plugins. | |
110 | ldd .$QT5PLUGINS/platforms/libqxcb.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true | |
111 | ldd .$QT5PLUGINS/imageformats/libqsvg.so | grep "=>" | awk '{print $3}' | xargs -I '{}' cp -v '{}' ./usr/lib || true | |
112 | fi | |
6e8a37a4 | 113 | |
90badf4c | 114 | # Python 3 |
9118290a | 115 | cp /usr/lib/$ARCH-linux-gnu/libpython$PYVER* ./usr/lib |
90badf4c UH |
116 | mkdir -p ./usr/share/pyshared |
117 | cp -r /usr/lib/python$PYVER/* ./usr/share/pyshared # AppRun expects this path. | |
118 | ||
9118290a | 119 | cp -r ./usr/share/pyshared/plat-$ARCH-linux-gnu/* ./usr/share/pyshared |
90badf4c | 120 | |
54207903 | 121 | ######################################################################## |
122 | # Delete stuff that should not go into the AppImage | |
123 | ######################################################################## | |
124 | ||
54207903 | 125 | move_lib |
9118290a UH |
126 | mv ./usr/lib/$ARCH-linux-gnu/* usr/lib/ |
127 | rm -r ./usr/lib/$ARCH-linux-gnu/ | |
54207903 | 128 | |
e163385a UH |
129 | delete_blacklisted |
130 | ||
3d2ed47b UH |
131 | # Remove some incorrectly/unintentionally copied files. |
132 | rm -r ./home | |
133 | ||
54207903 | 134 | ######################################################################## |
35accad0 | 135 | # Determine the version of the app |
54207903 | 136 | ######################################################################## |
137 | ||
35accad0 | 138 | VERSION="NIGHTLY" |
54207903 | 139 | echo $VERSION |
140 | ||
141 | ######################################################################## | |
142 | # Patch away absolute paths; it would be nice if they were relative | |
143 | ######################################################################## | |
144 | ||
8fa1956a | 145 | find usr/ -type f -executable -exec sed -i -e "s|/usr|././|g" {} \; |
54207903 | 146 | |
147 | ######################################################################## | |
148 | # AppDir complete | |
149 | # Now packaging it as an AppImage | |
150 | ######################################################################## | |
151 | ||
152 | cd .. | |
153 | ||
837d376b UH |
154 | VERSION=$VERSION $APPIMAGEKIT_OUTDIR/appimagetool ./$APP.AppDir/ |
155 | mkdir -p ../out/ || true | |
156 | mv *.AppImage* ../out/ |