Commit c5a9e765 authored by SeeLook's avatar SeeLook 🎸
Browse files

Better, modern way to build AppImage - use Ubuntu 18.04

- prepare_build
parent 59a9c8af
Pipeline #4371 failed with stage
in 56 seconds
......@@ -3,7 +3,7 @@ appimage-amd64:
variables:
- $CI_COMMIT_MESSAGE =~ /prepare_build/
image: ubuntu:16.04
image: ubuntu:18.04
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
......
......@@ -15,9 +15,12 @@
# or they will be downloaded #
# #
# To correctly generate AppImage set install prefix to '/usr' #
# and when using with older Linux system (i.e. Ubuntu Trusty 14.04) #
# call #
# cmake with -DQT_QMAKE_EXECUTABLE=/opt/qtXX/bin/qmake #
# and when using with older Linux system (i.e. Ubuntu 18.04) use: #
# -DQT_QMAKE_EXECUTABLE=/opt/qtXX/bin/qmake #
# Also -DWITH_STATIC_LIB=ON is required to generate proper AppImage #
# so call #
# cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr\ #
# -DWITH_STATIC_LIB=ON -DQT_QMAKE_EXECUTABLE=/opt/qt512/bin/qmake #
###################################################################################
......@@ -38,24 +41,11 @@ if [ "$( whereis linuxdeployqt | grep '\/' )" ]; then
LIN_DEP_QT=linuxdeployqt
else
echo "-- fetching linuxdeployqt"
wget -c -nv "https://www.opencode.net/seelook/nootka-build/raw/master/3rdParty/linuxdeployqt-5-x86_64.AppImage"
chmod a+x linuxdeployqt-5-x86_64.AppImage
LIN_DEP_QT="./linuxdeployqt-5-x86_64.AppImage --appimage-extract-and-run"
# exit
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
LIN_DEP_QT="./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract-and-run"
fi
if [ "$( whereis appimagetool | grep '\/' )" ]; then
echo "-- appimagetool was found"
APP_IMG_TOOL=appimagetool
else
echo "-- fetching appimagetool"
wget https://www.opencode.net/seelook/nootka-build/raw/master/3rdParty/appimagetool-x86_64.AppImage
chmod a+x appimagetool-x86_64.AppImage
APP_IMG_TOOL="./appimagetool-x86_64.AppImage --appimage-extract-and-run"
# exit
fi
if [ -d AppDir ]; then
echo "AppDir already exists... deleting"
rm -r AppDir
......@@ -70,57 +60,29 @@ export PATH="$QMAKE:$PATH"
# Qt base translations
TRANS_PATH=$(qmake -query QT_INSTALL_TRANSLATIONS)
cp $TRANS_PATH/qtbase_cs.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_de.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_es.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_fr.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_hu.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_it.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_pl.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_ru.qm AppDir/usr/share/nootka/lang
cp $TRANS_PATH/qtbase_uk.qm AppDir/usr/share/nootka/lang
mkdir AppDir/usr/translations
cp $TRANS_PATH/qtbase_cs.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_de.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_es.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_fr.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_hu.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_it.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_pl.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_ru.qm AppDir/usr/translations
cp $TRANS_PATH/qtbase_uk.qm AppDir/usr/translations
# desktop integration files
cp AppDir/usr/share/nootka/picts/nootka.png AppDir/usr/
cp AppDir/usr/share/applications/nootka.desktop AppDir/usr/
rm -r AppDir/usr/share/icons/hicolor
mv AppDir/usr/share/metainfo/nootka.appdata.xml AppDir/usr/share/metainfo/sf.net.nootka.appdata.xml
mv AppDir/usr/share/metainfo/nootka.appdata.xml AppDir/usr/share/metainfo/net.sf.nootka.appdata.xml
mv AppDir/usr/share/applications/nootka.desktop AppDir/usr/share/applications/net.sf.nootka.desktop
# Due to AppImage is usually built under Ubuntu/Debian, full license file is not copied by install target
cp $SRC_DIR/LICENSE AppDir/usr/share/nootka/gpl
LD_LIBRARY_PATH="$BIN_DIR/AppDir/usr/lib/nootka:$LD_LIBRARY_PATH" $LIN_DEP_QT AppDir/usr/bin/nootka -bundle-non-qt-libs -qmldir=$SRC_DIR/src/qml -qmake=$QMAKE
# launch it twice to find more libs
LD_LIBRARY_PATH="$BIN_DIR/AppDir/usr/lib/nootka:$LD_LIBRARY_PATH" $LIN_DEP_QT AppDir/usr/bin/nootka -bundle-non-qt-libs -qmldir=$SRC_DIR/src/qml -qmake=$QMAKE
# qt.conf with translations path pointing inside AppDir and plugins path
cp $SRC_DIR/packaging/appimage/qt.conf AppDir/usr/bin/
# AppRun is a bash script with proper LD_LIBRARY_PATH
cp $SRC_DIR/packaging/nootka AppDir/usr/AppRun
#linuxdeployqt skips xcbglintegrations plugin, so copy it manually
if [ -d AppDir/usr/plugins/xcbglintegrations ]; then
echo "xcbglintegrations plugin was found"
else
echo "xcbglintegrations is missing, copying it manually"
XCB=$(qmake -query QT_INSTALL_PLUGINS)
cp -r $XCB/xcbglintegrations AppDir/usr/plugins/
fi
# Fix for XCB platform plugin - copy X11 library and remove freetype
cp /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0 AppDir/usr/lib/libX11.so.6
cp /lib/x86_64-linux-gnu/libnsl-2.23.so AppDir/usr/lib/libnsl.so.1
rm AppDir/usr/lib/libfreetype*
# make all contents pointing to itself as a usr/
cd AppDir/usr
ln -s ./. usr
cd ../..
$LIN_DEP_QT AppDir/usr/share/applications/*.desktop -bundle-non-qt-libs -no-translations -qmldir=$SRC_DIR/src/qml -qmake=$QMAKE -appimage
# Obtain git commits number
BUILD=$(git -C $SRC_DIR rev-list HEAD --count)
mv Nootka*.AppImage Nootka-$VERSION-b$BUILD-x86_64.AppImage
# finally, generate AppImage (appdata.xml is not compatible between appimage and flatpack, so skip it here)
$APP_IMG_TOOL --no-appstream AppDir/usr nootka-$VERSION-b$BUILD-x86_64.AppImage
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment