Subversion Repositories Scribus

Rev

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