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