Use build-appimage.sh from Brander

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
This commit is contained in:
Felix Weilbach 2021-08-17 09:13:48 +02:00 committed by Felix Weilbach (Rebase PR Action)
parent 087b908445
commit ae3d10d3a7
2 changed files with 52 additions and 42 deletions

View file

@ -105,7 +105,7 @@ steps:
CI_UPLOAD_GIT_USERNAME:
from_secret: CI_UPLOAD_GIT_USERNAME
commands:
- /bin/bash -c "./admin/linux/build-appimage.sh"
- BUILDNR=$DRONE_BUILD_NUMBER VERSION_SUFFIX=$DRONE_PULL_REQUEST BUILD_UPDATER=ON DESKTOP_CLIENT_ROOT=$DRONE_WORKSPACE /bin/bash -c "./admin/linux/build-appimage.sh"
- /bin/bash -c "./admin/linux/upload-appimage.sh" || echo "Upload failed, however this is an optional step."
trigger:
branch:

View file

@ -2,74 +2,80 @@
set -xe
mkdir /app
mkdir /build
export APPNAME=${APPNAME:-nextcloud}
export BUILD_UPDATER=${BUILD_UPDATER:-OFF}
export BUILDNR=${BUILDNR:-0000}
export DESKTOP_CLIENT_ROOT=${DESKTOP_CLIENT_ROOT:-/home/user}
#Set Qt-5.15
export QT_BASE_DIR=/opt/qt5.15
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 APPID for .desktop file processing
export LINUX_APPLICATION_ID=com.nextcloud.desktopclient.nextcloud
#set defaults
# Set defaults
export SUFFIX=${DRONE_PULL_REQUEST:=master}
if [ $SUFFIX != "master" ]; then
SUFFIX="PR-$SUFFIX"
fi
if [ "$BUILD_UPDATER" != "OFF" ]; then
BUILD_UPDATER=ON
fi
#QtKeyChain v0.10.0
cd /build
mkdir /app
# QtKeyChain
git clone https://github.com/frankosterfeld/qtkeychain.git
cd qtkeychain
git checkout v0.10.0
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/usr ../
make -j4
make install
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=/app/usr ..
cmake --build . --target all
cmake --build . --target install
#Build client
cd /build
# Build client
mkdir build-client
cd build-client
cmake -D CMAKE_INSTALL_PREFIX=/usr \
cmake \
-G Ninja \
-D CMAKE_INSTALL_PREFIX=/app/usr \
-D BUILD_TESTING=OFF \
-D BUILD_UPDATER=ON \
-DMIRALL_VERSION_SUFFIX=PR-$DRONE_PULL_REQUEST \
-DMIRALL_VERSION_BUILD=$DRONE_BUILD_NUMBER \
$DRONE_WORKSPACE
make -j4
make DESTDIR=/app install
-D BUILD_UPDATER=$BUILD_UPDATER \
-D MIRALL_VERSION_BUILD=$BUILDNR \
-D MIRALL_VERSION_SUFFIX="$VERSION_SUFFIX" \
${DESKTOP_CLIENT_ROOT}
cmake --build . --target all
cmake --build . --target install
# Move stuff around
cd /app
mv ./usr/lib/x86_64-linux-gnu/* ./usr/lib/
mkdir ./usr/plugins
mv ./usr/lib/nextcloudsync_vfs_suffix.so ./usr/plugins
mv ./usr/lib/nextcloudsync_vfs_xattr.so ./usr/plugins
rm -rf ./usr/lib/cmake
rm -rf ./usr/include
rm -rf ./usr/mkspecs
rm -rf ./usr/lib/x86_64-linux-gnu/
mv usr/lib/x86_64-linux-gnu/* usr/lib/
# Don't bundle nextcloudcmd as we don't run it anyway
rm -rf ./usr/bin/nextcloudcmd
mkdir usr/plugins
mv usr/lib/nextcloudsync_vfs_suffix.so usr/plugins
mv usr/lib/nextcloudsync_vfs_xattr.so usr/plugins
rm -rf usr/lib/cmake
rm -rf usr/include
rm -rf usr/mkspecs
rm -rf usr/lib/x86_64-linux-gnu/
# 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/
rm -rf usr/share/caja-python/
rm -rf usr/share/nautilus-python/
rm -rf usr/share/nemo-python/
# Move sync exclude to right location
mv ./etc/Nextcloud/sync-exclude.lst ./usr/bin/
rm -rf ./etc
mv usr/etc/*/sync-exclude.lst usr/bin/
rm -rf etc
DESKTOP_FILE=/app/usr/share/applications/${LINUX_APPLICATION_ID}.desktop
# com.nextcloud.desktopclient.nextcloud.desktop
DESKTOP_FILE=$(ls /app/usr/share/applications/*.desktop)
sed -i -e 's|Icon=nextcloud|Icon=Nextcloud|g' ${DESKTOP_FILE} # Bug in desktop file?
cp ./usr/share/icons/hicolor/512x512/apps/Nextcloud.png . # Workaround for linuxeployqt bug, FIXME
@ -84,19 +90,23 @@ cp -P /usr/local/lib/libcrypto.so* ./usr/lib/
cp -P -r /usr/lib/x86_64-linux-gnu/nss ./usr/lib/
# Use linuxdeployqt to deploy
cd /build
wget --ca-directory=/etc/ssl/certs/ -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
wget --ca-directory=/etc/ssl/certs -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 ${DESKTOP_FILE} -bundle-non-qt-libs -qmldir=$DRONE_WORKSPACE/src/gui
./squashfs-root/AppRun ${DESKTOP_FILE} -bundle-non-qt-libs -qmldir=${DESKTOP_CLIENT_ROOT}/src/gui
# Set origin
./squashfs-root/usr/bin/patchelf --set-rpath '$ORIGIN/' /app/usr/lib/libnextcloudsync.so.0
./squashfs-root/usr/bin/patchelf --set-rpath '$ORIGIN/' /app/usr/lib/lib${APPNAME}sync.so.0
# Build AppImage
./squashfs-root/AppRun ${DESKTOP_FILE} -appimage
mv Nextcloud*.AppImage Nextcloud-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
#move AppImage
if [ ! -z "$DRONE_COMMIT" ]
then
mv Nextcloud*.AppImage Nextcloud-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
fi
mv *.AppImage ${DESKTOP_CLIENT_ROOT}/