]> sigrok.org Git - sigrok-util.git/blame - cross-compile/appimage/bundle.sh
Create bundle.sh
[sigrok-util.git] / cross-compile / appimage / bundle.sh
CommitLineData
54207903 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
10APP=PulseView
11LOWERAPP=${APP,,}
12
13ARCH=x86_64
14
15mkdir -p ./$APP/$APP.AppDir/usr/bin ./$APP/$APP.AppDir/usr/lib
16cd ./$APP
17
18wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
19. ./functions.sh
20
21########################################################################
22# Get runtime dependencies
23########################################################################
24
25sudo apt-get update
26
27# The following are installed into the host system so that we can bundle them into the AppImage as dependencies
28sudo apt-get -y --force-yes install libqt5svg5 libqt5gui5 libboost-thread1.58.0 libboost-test1.58.0 libboost-chrono1.58.0 libboost-atomic1.58.0 libftdi1-2 libzip4
29
30########################################################################
31# Get build products from Jenkins
32# FIXME: Do the actual building here instead
33########################################################################
34
35wget http://sigrok.org/jenkins/job/pulseview/buildtype=shared,compiler=gcc,platform=native-amd64/ws/_inst/bin/*zip*/bin.zip
36unzip bin.zip
37
38FW=$(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)
39wget -c "http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/$FW"
40tar xf sigrok-firmware-fx2lafw-bin-*.tar.gz
41rm sigrok-firmware-fx2lafw-bin-*.tar.gz
42
43cd $APP.AppDir/
44
45mv ../bin/pulseview usr/bin/
46chmod a+x usr/bin/*
47
48cd usr/lib/
49wget http://sigrok.org/jenkins/job/libsigrok/buildtype=shared,compiler=gcc,platform=native-amd64/ws/_inst/lib/libsigrok.so.3
50wget http://sigrok.org/jenkins/job/libsigrok/buildtype=shared,compiler=gcc,platform=native-amd64/ws/_inst/lib/libsigrokcxx.so.3
51wget http://sigrok.org/jenkins/job/libserialport/buildtype=shared,compiler=gcc,platform=native-amd64/lastSuccessfulBuild/artifact/_inst/lib/libserialport.so.0
52cd ../../
53
54wget "http://sigrok.org/jenkins/job/libsigrokdecode/buildtype=shared,compiler=gcc,platform=native-amd64/lastSuccessfulBuild/artifact/*zip*/archive.zip"
55unzip archive.zip
56mv archive/_inst/share/libsigrokdecode usr/share/libsigrokdecode
57mv archive/_inst/lib/libsigrokdecode.so.3 usr/lib/
58rm -rf archive*
59
60# Reduce binary size
61strip usr/bin/*
62strip usr/lib/*
63
64########################################################################
65# AppRun is the main launcher that gets executed when AppImage is run
66########################################################################
67
68get_apprun
69
70########################################################################
71# Copy desktop and icon file to AppDir for AppRun to pick them up
72########################################################################
73
74wget http://sigrok.org/jenkins/job/pulseview/buildtype=shared,compiler=gcc,platform=native-amd64/ws/contrib/pulseview.desktop
75wget -q "http://sigrok.org/gitweb/?p=pulseview.git;a=blob_plain;f=icons/sigrok-logo-notext.png" -O sigrok-logo-notext.png
76
77########################################################################
78# Patch away absolute paths; it would be nice if they were relative
79########################################################################
80
81sed -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
82
83########################################################################
84# Copy in the dependencies that cannot be assumed to be available
85# on all target systems
86########################################################################
87
88mkdir -p usr/share/
89mv ../sigrok-firmware-* usr/share/sigrok-firmware
90
91copy_deps
92
93########################################################################
94# Delete stuff that should not go into the AppImage
95########################################################################
96
97delete_blacklisted
98move_lib
99mv ./usr/lib/x86_64-linux-gnu/* usr/lib/
100rm -r ./usr/lib/x86_64-linux-gnu/
101
102########################################################################
103# Determine the version of the app; also include needed glibc version
104########################################################################
105
106VER1=$(./AppRun --version | cut -d " " -f 2)
107GLIBC_NEEDED=$(glibc_needed)
108VERSION=$VER1.glibc$GLIBC_NEEDED
109echo $VERSION
110
111########################################################################
112# Patch away absolute paths; it would be nice if they were relative
113########################################################################
114
115patch_usr
116
117########################################################################
118# AppDir complete
119# Now packaging it as an AppImage
120########################################################################
121
122cd ..
123
124generate_appimage