Просмотр исходного кода

Merge pull request #53 from nextcloud/build_appimage

Automatically start building AppImages on PR's
Roeland Jago Douma 8 лет назад
Родитель
Сommit
84a093e450
2 измененных файлов с 115 добавлено и 3 удалено
  1. 14 3
      .drone.yml
  2. 101 0
      admin/linux/build-appimage.sh

+ 14 - 3
.drone.yml

@@ -1,7 +1,9 @@
+clone:
+  git:
+    image: plugins/git
+    depth: 1
+
 pipeline:
-    clone:
-        image: plugins/git
-        depth: 1
     qt-5.7:
         image: nextcloudci/client-5.7:latest
         commands:
@@ -78,10 +80,19 @@ pipeline:
             matrix:
                 TESTS: qt-5.9
 
+    AppImage-5.9:
+        image: nextcloudci/client-appimage-ci:client-appimage-ci-4
+        commands:
+            - /bin/bash -c "./admin/linux/build-appimage.sh"
+        when:
+            matrix:
+                BUILD: AppImage
+
 matrix:
     include:
         - TESTS: qt-5.7
         - TESTS: qt-5.8
         - TESTS: qt-5.9
+        - BUILD: AppImage
 
 branches: [ master, 2.* ]

+ 101 - 0
admin/linux/build-appimage.sh

@@ -0,0 +1,101 @@
+#! /bin/bash
+
+set -xe
+
+mkdir /app
+mkdir /build
+
+export CC=/usr/bin/gcc-7
+export CXX=/usr/bin/g++-7
+
+#Set Qt-5.9
+export QT_BASE_DIR=/opt/qt59
+export QTDIR=$QT_BASE_DIR
+export PATH=$QT_BASE_DIR/bin:$PATH
+export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib:$LD_LIBRARY_PATH
+export PKG_CONFIG_PATH=$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
+
+#set defaults
+export SUFFIX=${DRONE_PULL_REQUEST:=master}
+if [ $SUFFIX != "master" ]; then
+    SUFFIX="PR-$SUFFIX"
+fi
+
+#QtKeyChain 0.8.0
+cd /build
+git clone https://github.com/frankosterfeld/qtkeychain.git
+cd qtkeychain
+git checkout v0.8.0
+mkdir build
+cd build
+cmake -D CMAKE_INSTALL_PREFIX=/usr ../
+make -j4
+make DESTDIR=/app install 
+
+#Build client
+cd /build
+mkdir build-client
+cd build-client
+cmake -D CMAKE_INSTALL_PREFIX=/usr \
+    -D NO_SHIBBOLETH=1 \
+    -D QTKEYCHAIN_LIBRARY=/app/usr/lib/x86_64-linux-gnu/libqt5keychain.so \
+    -D QTKEYCHAIN_INCLUDE_DIR=/app/usr/include/qt5keychain/ \
+    -DMIRALL_VERSION_SUFFIX=PR-$DRONE_PULL_REQUEST \
+    -DMIRALL_VERSION_BUILD=$DRONE_BUILD_NUMBER \
+    $DRONE_WORKSPACE
+make -j4
+make DESTDIR=/app install
+
+# Move stuff around
+cd /app
+
+mv ./usr/lib/x86_64-linux-gnu/nextcloud/* ./usr/lib/x86_64-linux-gnu/
+mv ./usr/lib/x86_64-linux-gnu/* ./usr/lib/
+rm -rf ./usr/lib/nextcloud
+rm -rf ./usr/lib/cmake
+rm -rf ./usr/include
+rm -rf ./usr/mkspecs
+rm -rf ./usr/lib/x86_64-linux-gnu/
+
+# Don't bundle nextcloudcmd as we don't run it anyway
+rm -rf ./usr/bin/nextcloudcmd
+
+# Don't bundle the explorer extentions as we can't do anything with them in the AppImage
+rm -rf ./usr/share/caja-python/
+rm -rf ./usr/share/nautilus-python/
+rm -rf ./usr/share/nemo-python/
+
+# Move sync exlucde to right location
+mv ./etc/Nextcloud/sync-exclude.lst ./usr/bin/
+rm -rf ./etc
+
+sed -i -e 's|Icon=nextcloud|Icon=Nextcloud|g' usr/share/applications/nextcloud.desktop # Bug in desktop file?
+cp ./usr/share/icons/hicolor/512x512/apps/Nextcloud.png . # Workaround for linuxeployqt bug, FIXME
+
+
+# Because distros need to get their shit together
+cp -P /lib/x86_64-linux-gnu/libssl.so* ./usr/lib/
+cp -P /lib/x86_64-linux-gnu/libcrypto.so* ./usr/lib/
+
+# Use linuxdeployqt to deploy
+cd /build
+wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
+chmod a+x linuxdeployqt*.AppImage
+./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract
+rm ./linuxdeployqt-continuous-x86_64.AppImage
+unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
+export LD_LIBRARY_PATH=/app/usr/lib/
+./squashfs-root/AppRun /app/usr/share/applications/nextcloud.desktop -bundle-non-qt-libs
+
+# Set origin
+./squashfs-root/usr/bin/patchelf --set-rpath '$ORIGIN/' /app/usr/lib/libnextcloudsync.so.0
+
+# Build AppImage
+./squashfs-root/AppRun /app/usr/share/applications/nextcloud.desktop -appimage
+
+mv Nextcloud*.AppImage Nextcloud-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
+
+curl --upload-file $(readlink -f ./Nextcloud*.AppImage) https://transfer.sh/Nextcloud-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
+
+echo
+echo "Get the AppImage at the link above!"