Subversion Repositories Scribus

Rev

Rev 23056 | Rev 23151 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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