2017-11-21 12:40:10 +03:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
set -xe
|
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
export APPNAME=${APPNAME:-nextcloud}
|
|
|
|
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-13 12:33:50 +03:00
|
|
|
#Set Qt-5.15
|
|
|
|
export QT_BASE_DIR=/opt/qt5.15
|
2021-08-17 10:13:48 +03:00
|
|
|
|
2017-11-21 12:40:10 +03:00
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# QtKeyChain
|
2017-11-21 12:40:10 +03:00
|
|
|
git clone https://github.com/frankosterfeld/qtkeychain.git
|
|
|
|
cd qtkeychain
|
2020-11-30 14:41:12 +03:00
|
|
|
git checkout v0.10.0
|
2017-11-21 12:40:10 +03:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2022-03-23 17:09:36 +03:00
|
|
|
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=/usr ..
|
2021-08-17 10:13:48 +03:00
|
|
|
cmake --build . --target all
|
2022-04-05 19:13:26 +03:00
|
|
|
DESTDIR=/app cmake --install .
|
2021-08-17 10:13:48 +03:00
|
|
|
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
# 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 \
|
2022-03-23 17:09:36 +03:00
|
|
|
-D CMAKE_INSTALL_PREFIX=/usr \
|
2020-12-11 04:22:48 +03:00
|
|
|
-D BUILD_TESTING=OFF \
|
2021-08-17 10:13:48 +03:00
|
|
|
-D BUILD_UPDATER=$BUILD_UPDATER \
|
|
|
|
-D MIRALL_VERSION_BUILD=$BUILDNR \
|
|
|
|
-D MIRALL_VERSION_SUFFIX="$VERSION_SUFFIX" \
|
|
|
|
${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
|
|
|
|
|
|
|
# Don't bundle the explorer extentions 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)
|
2019-11-16 23:34:13 +03:00
|
|
|
sed -i -e 's|Icon=nextcloud|Icon=Nextcloud|g' ${DESKTOP_FILE} # Bug in desktop file?
|
2022-04-05 19:13:26 +03:00
|
|
|
cp ./usr/share/icons/hicolor/512x512/apps/*.png . # Workaround for linuxeployqt bug, FIXME
|
2017-11-21 12:40:10 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Because distros need to get their shit together
|
2021-08-13 12:33:50 +03:00
|
|
|
cp -R /usr/lib/x86_64-linux-gnu/libssl.so* ./usr/lib/
|
|
|
|
cp -R /usr/lib/x86_64-linux-gnu/libcrypto.so* ./usr/lib/
|
2018-06-23 22:24:02 +03:00
|
|
|
cp -P /usr/local/lib/libssl.so* ./usr/lib/
|
|
|
|
cp -P /usr/local/lib/libcrypto.so* ./usr/lib/
|
|
|
|
|
|
|
|
# NSS fun
|
|
|
|
cp -P -r /usr/lib/x86_64-linux-gnu/nss ./usr/lib/
|
2017-11-21 12:40:10 +03:00
|
|
|
|
|
|
|
# Use linuxdeployqt to deploy
|
2021-08-17 10:13:48 +03:00
|
|
|
wget --ca-directory=/etc/ssl/certs -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
|
2017-11-21 12:40:10 +03:00
|
|
|
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
|
2022-03-23 17:09:36 +03:00
|
|
|
export LD_LIBRARY_PATH=/usr/lib/
|
2021-08-17 10:13:48 +03:00
|
|
|
./squashfs-root/AppRun ${DESKTOP_FILE} -bundle-non-qt-libs -qmldir=${DESKTOP_CLIENT_ROOT}/src/gui
|
2017-11-21 12:40:10 +03:00
|
|
|
|
|
|
|
# Set origin
|
2022-04-05 19:13:26 +03:00
|
|
|
./squashfs-root/usr/bin/patchelf --set-rpath '$ORIGIN/' /app/usr/lib/lib*sync.so.0
|
2017-11-21 12:40:10 +03:00
|
|
|
|
|
|
|
# Build AppImage
|
2021-10-16 00:14:20 +03:00
|
|
|
./squashfs-root/AppRun ${DESKTOP_FILE} -appimage -updateinformation="gh-releases-zsync|nextcloud-releases|desktop|latest|Nextcloud-*-x86_64.AppImage.zsync"
|
2017-11-21 12:40:10 +03:00
|
|
|
|
2021-08-17 10:13:48 +03:00
|
|
|
#move AppImage
|
|
|
|
if [ ! -z "$DRONE_COMMIT" ]
|
|
|
|
then
|
|
|
|
mv Nextcloud*.AppImage Nextcloud-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
|
|
|
|
fi
|
|
|
|
mv *.AppImage ${DESKTOP_CLIENT_ROOT}/
|