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 }
2024-04-29 10:52:54 +03:00
export QT_BASE_DIR = ${ QT_BASE_DIR :- /usr }
export OPENSSL_ROOT_DIR = ${ OPENSSL_ROOT_DIR :- /usr/lib/x86_64-linux-gnu }
2024-04-29 22:12:13 +03:00
export VERSION_SUFFIX = ${ VERSION_SUFFIX : stable }
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-29 10:52:54 +03:00
-DCMAKE_PREFIX_PATH= ${ QT_BASE_DIR } \
-DOPENSSL_ROOT_DIR= ${ OPENSSL_ROOT_DIR } \
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
2024-04-29 10:52:54 +03:00
export LD_LIBRARY_PATH = /app/usr/lib:${ QT_BASE_DIR } /lib:/usr/local/lib/x86_64-linux-gnu:/usr/local/lib:/usr/local/lib64
2024-04-29 12:13:56 +03:00
./linuxdeploy-squashfs-root/AppRun --desktop-file= ${ DESKTOP_FILE } --icon-file= usr/share/icons/hicolor/512x512/apps/Nextcloud.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
2024-09-19 17:32:32 +03:00
# TODO: this share link is supposed to be a workaround, we need an url pointing to github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/tag/continuous, see github.com/linuxdeploy/linuxdeploy-plugin-qt/pull/186
wget -O ${ APPIMAGE_NAME } --ca-directory= /etc/ssl/certs -c "https://cloud.nextcloud.com/s/TxcGkDiSs2enKoN/download/linuxdeploy-plugin-qt-x86_64.AppImage"
2024-04-22 13:50:10 +03:00
chmod a+x ${ APPIMAGE_NAME }
./${ APPIMAGE_NAME } --appimage-extract
rm ./${ APPIMAGE_NAME }
cp -r ./squashfs-root ./linuxdeploy-plugin-qt-squashfs-root
2024-04-29 10:52:54 +03:00
export PATH = ${ QT_BASE_DIR } /bin:${ PATH }
2024-04-24 13:07:27 +03:00
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
2024-04-29 12:13:56 +03:00
./linuxdeploy-squashfs-root/AppRun --desktop-file= ${ DESKTOP_FILE } --icon-file= usr/share/icons/hicolor/512x512/apps/Nextcloud.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 } /