]> sigrok.org Git - sigrok-util.git/blob - cross-compile/appimage/sigrok-native-appimage
a044cee181d5c32d56cbe79a274292ea59e0f877
[sigrok-util.git] / cross-compile / appimage / sigrok-native-appimage
1 #!/bin/bash
2
3 # (c) 2016 Simon Peter
4 # This file is licensed under the terms of the MIT license.
5 #
6 # Bundle PulseView and its dependencies as an AppImage for x86_64 Linux
7 # TODO: Change it to use build products and libraries from a more mature
8 # distribution such as Debian oldstable, CentOS 6 or Ubuntu Trusty or older.
9
10 APP=PulseView
11 LOWERAPP=${APP,,} 
12
13 ARCH=x86_64
14
15 mkdir -p ./$APP/$APP.AppDir/usr/bin ./$APP/$APP.AppDir/usr/lib
16 cd ./$APP
17
18 wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
19 . ./functions.sh
20
21 ########################################################################
22 # Get build products from Jenkins
23 # FIXME: Do the actual building here instead
24 ########################################################################
25
26 wget http://sigrok.org/jenkins/job/pulseview/buildtype=shared,compiler=gcc,platform=native-amd64/ws/_inst/bin/*zip*/bin.zip
27 unzip bin.zip
28
29 FW=$(wget -q "http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/?C=M;O=D" -O - | grep .tar.gz | head -n 1 | cut -d '"' -f 13 | cut -d ">" -f 2 | cut -d "<" -f 1)
30 wget -c "http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/$FW"
31 tar xf sigrok-firmware-fx2lafw-bin-*.tar.gz
32 rm sigrok-firmware-fx2lafw-bin-*.tar.gz
33
34 cd $APP.AppDir/
35
36 mv ../bin/pulseview usr/bin/
37 chmod a+x usr/bin/*
38
39 cd usr/lib/
40 wget http://sigrok.org/jenkins/job/libsigrok/buildtype=shared,compiler=gcc,platform=native-amd64/ws/_inst/lib/libsigrok.so.3
41 wget http://sigrok.org/jenkins/job/libsigrok/buildtype=shared,compiler=gcc,platform=native-amd64/ws/_inst/lib/libsigrokcxx.so.3
42 wget http://sigrok.org/jenkins/job/libserialport/buildtype=shared,compiler=gcc,platform=native-amd64/lastSuccessfulBuild/artifact/_inst/lib/libserialport.so.0
43 cd ../../
44
45 wget "http://sigrok.org/jenkins/job/libsigrokdecode/buildtype=shared,compiler=gcc,platform=native-amd64/lastSuccessfulBuild/artifact/*zip*/archive.zip"
46 unzip archive.zip
47 mv archive/_inst/share/libsigrokdecode usr/share/libsigrokdecode
48 mv archive/_inst/lib/libsigrokdecode.so.3 usr/lib/
49 rm -rf archive*
50
51 # Reduce binary size
52 strip usr/bin/*
53 strip usr/lib/*
54
55 ########################################################################
56 # AppRun is the main launcher that gets executed when AppImage is run
57 ########################################################################
58
59 get_apprun
60
61 ########################################################################
62 # Copy desktop and icon file to AppDir for AppRun to pick them up
63 ########################################################################
64
65 wget http://sigrok.org/jenkins/job/pulseview/buildtype=shared,compiler=gcc,platform=native-amd64/ws/contrib/pulseview.desktop
66 wget -q "http://sigrok.org/gitweb/?p=pulseview.git;a=blob_plain;f=icons/sigrok-logo-notext.png" -O sigrok-logo-notext.png
67
68 ########################################################################
69 # Patch away absolute paths; it would be nice if they were relative
70 ########################################################################
71
72 sed -i -e 's|/home/jenkins_slave/fsroot/workspace/libsigrokdecode/buildtype/shared/compiler/gcc/platform/native-amd64/_inst/share/|.//////////////////////////////////////////////////////////////////////////////////////////////////////////////share/|g' usr/lib/libsigrokdecode.so.3
73
74 ########################################################################
75 # Copy in the dependencies that cannot be assumed to be available
76 # on all target systems
77 ########################################################################
78
79 mkdir -p usr/share/
80 mv ../sigrok-firmware-* usr/share/sigrok-firmware
81
82 copy_deps
83
84 ########################################################################
85 # Delete stuff that should not go into the AppImage
86 ########################################################################
87
88 delete_blacklisted
89 move_lib
90 mv ./usr/lib/x86_64-linux-gnu/* usr/lib/
91 rm -r ./usr/lib/x86_64-linux-gnu/
92
93 ########################################################################
94 # Determine the version of the app; also include needed glibc version
95 ########################################################################
96
97 VER1=$(./AppRun --version | cut -d " "  -f 2)
98 GLIBC_NEEDED=$(glibc_needed)
99 VERSION=$VER1.glibc$GLIBC_NEEDED
100 echo $VERSION
101
102 ########################################################################
103 # Patch away absolute paths; it would be nice if they were relative
104 ########################################################################
105
106 patch_usr
107
108 ########################################################################
109 # AppDir complete
110 # Now packaging it as an AppImage
111 ########################################################################
112
113 cd ..
114
115 generate_appimage