]> sigrok.org Git - sigrok-util.git/blob - cross-compile/appimage/sigrok-native-appimage
71f81955664e45c4cf3ca3d1ede2672fc0a25281
[sigrok-util.git] / cross-compile / appimage / sigrok-native-appimage
1 #!/bin/bash
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 ##
7
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.
10
11 PREFIX=$HOME/sr
12
13 APPIMAGEKIT_OUTDIR=$HOME/AppImageKit/out
14
15 ARCH=x86_64
16
17 ########################################################################
18 # You usually don't have to change anything below this line
19 ########################################################################
20
21 APP=PulseView
22 LOWERAPP=${APP,,} 
23
24 export STATIC_FILES=`pwd`/contrib
25
26 # Add $APPIMAGEKIT_OUTDIR so we can find all the binaries there.
27 export PATH=$APPIMAGEKIT_OUTDIR:$PATH
28
29 A="./$APP/$APP.AppDir"
30 mkdir -p $A/usr/bin $A/usr/lib $A/usr/share
31 cd ./$APP
32
33 . ../contrib/functions.sh
34
35 ########################################################################
36 # Get build products from $PREFIX
37 ########################################################################
38
39 cd $APP.AppDir/
40
41 cp $PREFIX/bin/pulseview usr/bin/
42 chmod a+x usr/bin/*
43 cp $PREFIX/lib/lib*.so* usr/lib/
44 cp -r $PREFIX/share/libsigrokdecode usr/share/
45 cp -r $PREFIX/share/sigrok-firmware usr/share/
46
47 # Reduce binary size
48 strip usr/bin/*
49 strip usr/lib/*
50
51 ########################################################################
52 # AppRun is the main launcher that gets executed when AppImage is run
53 ########################################################################
54
55 cp $APPIMAGEKIT_OUTDIR/AppRun .
56
57 ########################################################################
58 # Copy desktop and icon file to AppDir for AppRun to pick them up
59 ########################################################################
60
61 cp ../../contrib/pulseview.desktop ../../contrib/sigrok-logo-notext.png .
62
63 ########################################################################
64 # Copy in the dependencies that cannot be assumed to be available
65 # on all target systems
66 ########################################################################
67
68 copy_deps
69
70 ########################################################################
71 # Delete stuff that should not go into the AppImage
72 ########################################################################
73
74 delete_blacklisted
75 move_lib
76 mv ./usr/lib/x86_64-linux-gnu/* usr/lib/
77 rm -r ./usr/lib/x86_64-linux-gnu/
78
79 # Remove some incorrectly/unintentionally copied files.
80 rm -r ./home
81
82 ########################################################################
83 # Determine the version of the app; also include needed glibc version
84 ########################################################################
85
86 VER1="NIGHTLY"
87 GLIBC_NEEDED=$(glibc_needed)
88 VERSION=$VER1.glibc$GLIBC_NEEDED
89 echo $VERSION
90
91 ########################################################################
92 # Patch away absolute paths; it would be nice if they were relative
93 ########################################################################
94
95 patch_usr
96
97 ########################################################################
98 # AppDir complete
99 # Now packaging it as an AppImage
100 ########################################################################
101
102 cd ..
103
104 VERSION=$VERSION $APPIMAGEKIT_OUTDIR/appimagetool ./$APP.AppDir/
105 mkdir -p ../out/ || true
106 mv *.AppImage* ../out/