-
Notifications
You must be signed in to change notification settings - Fork 125
Expand file tree
/
Copy pathbundle.sh
More file actions
125 lines (101 loc) · 4.57 KB
/
bundle.sh
File metadata and controls
125 lines (101 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
cat /proc/1/cgroup # Check if we run in Docker; https://github.com/AppImage/AppImageKit/issues/912
# for docker images:
# if qt is not in the standard path, load its environment variables
. /opt/qt*/bin/qt*-env.sh || true
SCRIBUS_VERSION=nightly
########################################################################
# Build Plaform Theme for Gtk+
# https://askubuntu.com/a/910143
# https://askubuntu.com/a/748186
# Deploy with linuxdeployqt using
# -extra-plugins=platformthemes/libqgtk2.so,styles/libqgtk2style.so
# At runtime, export QT_QPA_PLATFORMTHEME=gtk2 (Xfce does this itself)
########################################################################
git clone http://code.qt.io/qt/qtstyleplugins.git
cd qtstyleplugins
qmake
make -j$(nproc)
make install
cd -
########################################################################
# Build Scribus and install to appdir/
########################################################################
cmake . -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=/usr \
-DWANT_RELOCATABLE=1 \
-DWANT_HUNSPELL=1 \
-DWITH_PODOFO=1 \
-DWANT_GRAPHICSMAGICK=1 \
-DWANT_DEBUG=0 \
-DWANT_SVNVERSION=0
make -j$(nproc)
make DESTDIR=appdir -j$(nproc) install
#find appdir/
# TODO: make sure that the appdir directory exits
cp AppImage-package/AppRun appdir/
chmod +x appdir/AppRun
cp ./appdir/usr/share/icons/hicolor/256x256/apps/net.scribus.Scribus.png ./appdir/
########################################################################
# Bundle everyhting
# to allow the AppImage to run on older systems as well
########################################################################
cd appdir/
# Bundle all of glibc; this should eventually be done by linuxdeployqt
apt-get update -q
apt-get download libc6
find *.deb -exec dpkg-deb -x {} . \;
rm *deb
# Make absolutely sure it will not load stuff from /lib or /usr
sed -i -e 's|/usr|/xxx|g' lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
sed -i -e 's|/usr/lib|/ooo/ooo|g' lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
# Bundle fontconfig settings
mkdir -p etc/fonts/
cp /etc/fonts/fonts.conf etc/fonts/
# Bundle Python
apt-get download python3.6 python3.6-minimal libpython3.6-minimal libpython3.6-stdlib python3-tk
find *.deb -exec dpkg-deb -x {} . \;
rm *deb
cd -
########################################################################
# Work around side effect of bundling everything
########################################################################
# https://github.com/scribusproject/scribus/issues/111#issuecomment-457823282
# applicationDirPath() is not usr/bin but lib/x86_64-linux-gnu/
# when AppRun invokes the binary with
# exec "${HERE}/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2" --inhibit-cache --library-path "${LIBRARY_PATH}" "${MAIN}" "$@"
# hence we add a symlink here to mitigate this
cd appdir/lib/
ln -s ../usr/* .
cd -
########################################################################
# Also bundle Tcl/Tk, Tkinter (for Calendar script)
########################################################################
mkdir -p appdir/usr/lib appdir/usr/share
cp -r /usr/lib/tcltk appdir/usr/lib/
cp -r /usr/share/tcltk appdir/usr/share/
########################################################################
# Create extra qt.conf in a strange location;
# FIXME: why is this needed?
########################################################################
mkdir -p appdir/lib/x86_64-linux-gnu/
cat > appdir/lib/x86_64-linux-gnu/qt.conf <<\EOF
# Why is this needed here? Bug?
[Paths]
Prefix = ../../usr
Plugins = plugins
Imports = qml
Qml2Imports = qml
EOF
########################################################################
# Generate AppImage
########################################################################
# Finalize AppDir but do not turn into AppImage just yet
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
ARCH=x86_64 VERSION=$SCRIBUS_VERSION ./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract-and-run appdir/usr/share/applications/net.scribus.Scribus.desktop \
-appimage -unsupported-bundle-everything \
-executable=appdir/usr/bin/python3.6 \
-executable=appdir/usr/lib/python3.6/lib-dynload/_tkinter.cpython-36m-x86_64-linux-gnu.so \
-extra-plugins=platformthemes/libqgtk2.so,styles/libqgtk2style.so