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