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