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