Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Aug 24, 2018
0 parents commit 166f73e
Show file tree
Hide file tree
Showing 7 changed files with 1,098 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.kdev4
key/
daily/
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# How to build the desktop client on Windows

## General
- Grab a cup of coffee
- Download the Windows VM: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

### Install list
- [ ] OpenSSL: https://indy.fulgan.com/SSL/
- [ ] zlib: https://github.com/maxirmx/Dist_zlib
- [ ] qtkeychain: https://github.com/frankosterfeld/qtkeychain
- [ ] Visual Studio
- [ ] Git bash (it comes with the Github tool or maybe Visual Studio(?))


## CMake options

For the desktop client (Release/Debug):
```
cmake -G "Visual Studio 15 2017 Win64" .. -DCMAKE_INSTALL_PREFIX=..\..\install -DCMAKE_BUILD_TYPE=Release
```

For qtkeychain:
```
cmake -G "Visual Studio 15 2017 Win64" .. -DCMAKE_INSTALL_PREFIX=c:\qt5keychain
```
And then (Release/Debug):
```
cmake --build . --config Release --target install
```

## DLL's
- To put all dependencies together: http://doc.qt.io/qt-5/windows-deployment.html

### Missing dll's even after running windeployqt
- [ ] Qt5CoreD.dll (C:\Qt\Qt5.9.5\5.9.5\msvc2017_64\bin)
- [ ] MSVCP140D.dll (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.14.26405\debug_nonredist\x64\Microsoft.VC141.DebugCRT)
- [ ] VCRUNTIME140D.dll (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.14.26405\debug_nonredist\x64\Microsoft.VC141.DebugCRT)
- [ ] ocsync.dll (nc install path/bin/nextcloud)
- [ ] libcrypto-1_1-x86.dll (C:\OpenSSL-Win64\bin)
- [ ] ucrtbased.dll (C:\Windows/System32)
- [ ] MSVCR120.dll (C:\OpenSSL-Win64\bin)
- [ ] sync-exclude.lst (C:\Users\IEUser\Desktop\nc\install\config\Nextcloud)
- [ ] had to fetch the extra dll's from https://indy.fulgan.com/SSL/openssl-1.0.1h-x64_86-win64.zip (libeay32.dll and ssleay32.dll)

## NSIS
- Install NSIS: http://nsis.sourceforge.net/Download/

## NSIS plugins to install
- [ ] http://nsis.sourceforge.net/UAC_plug-in
- [ ] http://nsis.sourceforge.net/NsProcess_plugin

## To upload builds
- https://success.tanaza.com/s/article/How-to-use-SCP-command-on-Windows

## Git submodules
- shell_integration

## ENV VARS TO SET
- [ ] OPENSSL_PATH (openssl path installation)
- [ ] P12_KEY_PASSWORD (certificate key password used to sign the installer)
- [ ] PROJECT_PATH (nextcloud source code path)
- [ ] QT_PATH (qt installation path)
- [ ] SFTP_SERVER (server url)
- [ ] SFTP_USER (server user)
- [ ] SSH_SESSION (session settings + private key saved with Putty)
- [ ] VCINSTALLDIR (Visual Code installation path)

56 changes: 56 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@echo off
cls

Rem ******************************************************************************************
rem "enviroment Varibles"
Rem ******************************************************************************************

rem Release or Debug
set BUILD_TYPE=Debug
if [%1] == "Release" (set BUILD_TYPE=%1)

echo "* BUILD_TYPE=%BUILD_TYPE%"
echo "* PROJECT_PATH=%PROJECT_PATH%"
echo "* VCINSTALLDIR=%VCINSTALLDIR%"
echo "* PATH=%PATH%"

Rem ******************************************************************************************
rem "clean up"
Rem ******************************************************************************************

echo "* Remove old installation files %PROJECT_PATH%/install from previous build."
start "rm-rf" /B /wait rm -rf %PROJECT_PATH%/install/*

echo "* Remove old dependencies files %PROJECT_PATH%/libs from previous build."
start "rm -rf" /B /wait rm -rf %PROJECT_PATH%/libs/*

echo "* Remove %PROJECT_PATH%/desktop/build/CMakeFiles from previous build."
start "rm -rf" /B /wait rm -rf %PROJECT_PATH%/desktop/build/*

Rem ******************************************************************************************
rem "git pull, build, collect dependencies"
Rem ******************************************************************************************

rem Reference: https://ss64.com/nt/start.html

echo "* git pull from origin master at %PROJECT_PATH%/desktop/."
start "git pull origin master" /D "%PROJECT_PATH%/desktop/" /B /wait git pull origin master

echo "* save git HEAD commit hash from repo %PROJECT_PATH%/desktop/."
start "git rev-parse HEAD" /D "%PROJECT_PATH%/desktop/" /B /wait git rev-parse HEAD > tmp
set /p GIT_REVISION= < tmp
del tmp

echo "* Run cmake with CMAKE_INSTALL_PREFIX and CMAKE_BUILD_TYPE set at %PROJECT_PATH%/desktop/build."
start "cmake.." /D "%PROJECT_PATH%/desktop/build" /B /wait cmake "-GVisual Studio 15 2017 Win64" .. -DCMAKE_INSTALL_PREFIX="%PROJECT_PATH%/install" -DCMAKE_BUILD_TYPE="%BUILD_TYPE%" -DNO_SHIBBOLETH=1

echo "* Run cmake to compile and install."
start "cmake build" /D "%PROJECT_PATH%/desktop/build" /B /wait cmake --build . --config %BUILD_TYPE% --target install

echo "* Run windeployqt to collect all nextcloud.exe dependencies and output it to %PROJECT_PATH%/libs/."
start "windeployqt" /B /wait windeployqt.exe %PROJECT_PATH%/install/bin/nextcloud.exe --dir %PROJECT_PATH%/libs/

echo "* Run NSIS script with parameters BUILD_TYPE=%BUILD_TYPE% and GIT_REVISION=%GIT_REVISION% to create installer."
start "NSIS" /B /wait makensis.exe /DBUILD_TYPE=%BUILD_TYPE% /DGIT_REVISION=%GIT_REVISION:~0,6% nextcloud.nsi

exit
106 changes: 106 additions & 0 deletions linux/build-appimage-daily.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#! /bin/bash

set -xe

export CC=gcc-7
export CXX=g++-7

useradd user -u ${1:-1000}

mkdir /app
mkdir /build

#Set Qt-5.11
export QT_BASE_DIR=/opt/qt511
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

#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
git clone --depth 1 https://github.com/nextcloud/desktop.git
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=daily \
-DMIRALL_VERSION_BUILD=`date +%Y%m%d` \
/build/desktop
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 -R /lib/x86_64-linux-gnu/libssl.so* ./usr/lib/
cp -R /lib/x86_64-linux-gnu/libcrypto.so* ./usr/lib/
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/

# 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

export VERSION_MAJOR=$(cat build-client/version.h | grep MIRALL_VERSION_MAJOR | cut -d ' ' -f 3)
export VERSION_MINOR=$(cat build-client/version.h | grep MIRALL_VERSION_MINOR | cut -d ' ' -f 3)
export VERSION_PATCH=$(cat build-client/version.h | grep MIRALL_VERSION_PATCH | cut -d ' ' -f 3)
export VERSION_BUILD=$(cat build-client/version.h | grep MIRALL_VERSION_BUILD | cut -d ' ' -f 3)

mv Nextcloud*.AppImage Nextcloud-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_BUILD}-daily-x86_64.AppImage

mv Nextcloud*.AppImage /output/
chown user /output/Nextcloud*.AppImage
25 changes: 25 additions & 0 deletions linux/build-daily.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /bin/bash

set -xe

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DATE=`date +%Y%m%d`

mkdir -p ~/output/$DATE

#Build
docker run \
--name desktop-$DATE \
-v $DIR:/input \
-v ~/output/$DATE:/output \
nextcloudci/client-5.11:client-5.11-3 \
/input/build-appimage-daily.sh $(id -u)

#Save the logs!
docker logs desktop-$DATE > ~/output/$DATE/log

#Kill the container!
docker rm desktop-$DATE

#Copy to the download server
scp ~/output/$DATE/*.AppImage daily_desktop_uploader@download.nextcloud.com:/var/www/html/desktop/daily/Linux
Loading

0 comments on commit 166f73e

Please sign in to comment.