2017-11-21 12:40:10 +03:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
set -xe
|
|
|
|
|
2023-09-18 23:18:04 +03:00
|
|
|
export APPNAME=${APPNAME:-Nextcloud}
|
|
|
|
export EXECUTABLE_NAME=${EXECUTABLE_NAME:-nextcloud}
|
2021-08-17 10:13:48 +03:00
|
|
|
export BUILD_UPDATER=${BUILD_UPDATER:-OFF}
|
|
|
|
export BUILDNR=${BUILDNR:-0000}
|
|
|
|
export DESKTOP_CLIENT_ROOT=${DESKTOP_CLIENT_ROOT:-/home/user}
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
# Set defaults
|
2017-11-21 12:40:10 +03:00
|
|
|
export SUFFIX=${DRONE_PULL_REQUEST:=master}
|
|
|
|
if [ $SUFFIX != "master" ]; then
|
|
|
|
SUFFIX="PR-$SUFFIX"
|
|
|
|
fi
|
2021-08-17 10:13:48 +03:00
|
|
|
if [ "$BUILD_UPDATER" != "OFF" ]; then
|
|
|
|
BUILD_UPDATER=ON
|
|
|
|
fi
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
mkdir /app
|
|
|
|
|
|
|
|
# Build client
|
2017-11-21 12:40:10 +03:00
|
|
|
mkdir build-client
|
|
|
|
cd build-client
|
2021-08-17 10:13:48 +03:00
|
|
|
cmake \
|
|
|
|
-G Ninja \
|
2024-04-22 13:50:10 +03:00
|
|
|
-DCMAKE_PREFIX_PATH=/opt/qt6.6.3 \
|
|
|
|
-DOPENSSL_ROOT_DIR=/usr/local/lib64 \
|
2023-09-18 23:18:04 +03:00
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DBUILD_TESTING=OFF \
|
|
|
|
-DBUILD_UPDATER=$BUILD_UPDATER \
|
|
|
|
-DMIRALL_VERSION_BUILD=$BUILDNR \
|
|
|
|
-DMIRALL_VERSION_SUFFIX="$VERSION_SUFFIX" \
|
|
|
|
-DCMAKE_UNITY_BUILD=ON \
|
2021-08-17 10:13:48 +03:00
|
|
|
${DESKTOP_CLIENT_ROOT}
|
|
|
|
cmake --build . --target all
|
2022-04-05 19:13:26 +03:00
|
|
|
DESTDIR=/app cmake --install .
|
2017-11-21 12:40:10 +03:00
|
|
|
|
|
|
|
# Move stuff around
|
|
|
|
cd /app
|
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
mv usr/lib/x86_64-linux-gnu/* usr/lib/
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
mkdir usr/plugins
|
2022-04-05 19:13:26 +03:00
|
|
|
mv usr/lib/*sync_vfs_suffix.so usr/plugins
|
|
|
|
mv usr/lib/*sync_vfs_xattr.so usr/plugins
|
2021-11-10 17:13:25 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
rm -rf usr/lib/cmake
|
|
|
|
rm -rf usr/include
|
|
|
|
rm -rf usr/mkspecs
|
|
|
|
rm -rf usr/lib/x86_64-linux-gnu/
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2023-06-02 14:55:08 +03:00
|
|
|
# Don't bundle the explorer extensions as we can't do anything with them in the AppImage
|
2021-08-17 10:13:48 +03:00
|
|
|
rm -rf usr/share/caja-python/
|
|
|
|
rm -rf usr/share/nautilus-python/
|
|
|
|
rm -rf usr/share/nemo-python/
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2019-09-26 22:01:01 +03:00
|
|
|
# Move sync exclude to right location
|
2022-04-05 19:13:26 +03:00
|
|
|
mv /app/etc/*/sync-exclude.lst usr/bin/
|
2021-08-17 10:13:48 +03:00
|
|
|
rm -rf etc
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
# com.nextcloud.desktopclient.nextcloud.desktop
|
|
|
|
DESKTOP_FILE=$(ls /app/usr/share/applications/*.desktop)
|
2023-09-18 23:18:04 +03:00
|
|
|
|
|
|
|
# Use linuxdeploy to deploy
|
|
|
|
export APPIMAGE_NAME=linuxdeploy-x86_64.AppImage
|
|
|
|
wget -O ${APPIMAGE_NAME} --ca-directory=/etc/ssl/certs -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
|
|
|
chmod a+x ${APPIMAGE_NAME}
|
|
|
|
./${APPIMAGE_NAME} --appimage-extract
|
|
|
|
rm ./${APPIMAGE_NAME}
|
2024-04-22 13:50:10 +03:00
|
|
|
cp -r ./squashfs-root ./linuxdeploy-squashfs-root
|
|
|
|
|
|
|
|
export LD_LIBRARY_PATH=/app/usr/lib:/opt/qt6.6.3/lib:/usr/local/lib/x86_64-linux-gnu:/usr/local/lib:/usr/local/lib64
|
|
|
|
./linuxdeploy-squashfs-root/AppRun --desktop-file=${DESKTOP_FILE} --icon-file=usr/share/icons/hicolor/512x512/apps/${APPNAME}.png --executable=usr/bin/${EXECUTABLE_NAME} --appdir=AppDir
|
2023-09-18 23:18:04 +03:00
|
|
|
|
|
|
|
# Use linuxdeploy-plugin-qt to deploy qt dependencies
|
2024-04-22 13:50:10 +03:00
|
|
|
export APPIMAGE_NAME=linuxdeploy-plugin-qt-x86_64.AppImage
|
|
|
|
wget -O ${APPIMAGE_NAME} --ca-directory=/etc/ssl/certs -c "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
|
|
|
|
chmod a+x ${APPIMAGE_NAME}
|
|
|
|
./${APPIMAGE_NAME} --appimage-extract
|
|
|
|
rm ./${APPIMAGE_NAME}
|
|
|
|
cp -r ./squashfs-root ./linuxdeploy-plugin-qt-squashfs-root
|
|
|
|
|
2024-04-24 13:07:27 +03:00
|
|
|
export PATH=/opt/qt6.6.3/bin:${PATH}
|
|
|
|
export QML_SOURCES_PATHS=${DESKTOP_CLIENT_ROOT}/src/gui
|
2024-04-22 13:50:10 +03:00
|
|
|
./linuxdeploy-plugin-qt-squashfs-root/AppRun --appdir=AppDir
|
|
|
|
|
|
|
|
./linuxdeploy-squashfs-root/AppRun --desktop-file=${DESKTOP_FILE} --icon-file=usr/share/icons/hicolor/512x512/apps/${APPNAME}.png --executable=usr/bin/${EXECUTABLE_NAME} --appdir=AppDir --output appimage
|
2022-08-09 16:19:51 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
#move AppImage
|
|
|
|
if [ ! -z "$DRONE_COMMIT" ]
|
|
|
|
then
|
2023-09-19 01:28:32 +03:00
|
|
|
mv *.AppImage ${EXECUTABLE_NAME}-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
|
|
|
|
else
|
|
|
|
mv *.AppImage ${EXECUTABLE_NAME}-${SUFFIX}-x86_64.AppImage
|
2021-08-17 10:13:48 +03:00
|
|
|
fi
|
|
|
|
mv *.AppImage ${DESKTOP_CLIENT_ROOT}/
|