2013-09-03 14:34:29 +04:00
|
|
|
.. _building-label:
|
|
|
|
|
2015-08-31 11:48:43 +03:00
|
|
|
===============================
|
2013-09-03 14:34:29 +04:00
|
|
|
Appendix A: Building the Client
|
|
|
|
===============================
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
This section explains how to build the Nextcloud Client from source for all
|
2014-06-26 00:04:33 +04:00
|
|
|
major platforms. You should read this section if you want to develop for the
|
|
|
|
desktop client.
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2015-08-14 14:56:02 +03:00
|
|
|
.. note:: Build instructions are subject to change as development proceeds.
|
2014-10-27 22:50:07 +03:00
|
|
|
Please check the version for which you want to build.
|
2013-11-06 14:13:55 +04:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
These instructions are updated to work with version |version| of the Nextcloud Client.
|
2016-02-25 00:31:19 +03:00
|
|
|
|
|
|
|
Getting Source Code
|
|
|
|
-------------------
|
|
|
|
|
2018-06-04 12:44:03 +03:00
|
|
|
The :ref:`generic-build-instructions` pull the latest code directly from
|
|
|
|
GitHub, and work on Linux, macOS, and Windows.
|
2013-11-06 14:13:55 +04:00
|
|
|
|
2018-06-04 12:44:03 +03:00
|
|
|
macOS
|
|
|
|
-----
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2017-01-18 14:24:42 +03:00
|
|
|
In addition to needing XCode (along with the command line tools), developing in
|
2018-06-04 12:44:03 +03:00
|
|
|
the macOS environment requires extra dependencies. You can install these
|
2014-06-26 00:04:33 +04:00
|
|
|
dependencies through MacPorts_ or Homebrew_. These dependencies are required
|
|
|
|
only on the build machine, because non-standard libs are deployed in the app
|
|
|
|
bundle.
|
2013-01-22 18:08:56 +04:00
|
|
|
|
2014-06-26 00:04:33 +04:00
|
|
|
The tested and preferred way to develop in this environment is through the use
|
2018-01-29 03:15:00 +03:00
|
|
|
of HomeBrew_. The team has its own repository containing non-standard
|
2014-06-26 00:04:33 +04:00
|
|
|
recipes.
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2015-08-31 11:48:43 +03:00
|
|
|
To set up your build environment for development using HomeBrew_:
|
2014-06-26 00:04:33 +04:00
|
|
|
|
2016-10-19 12:12:11 +03:00
|
|
|
1. Install Xcode
|
|
|
|
2. Install Xcode command line tools::
|
|
|
|
xcode-select --install
|
|
|
|
|
|
|
|
3. Install homebrew::
|
|
|
|
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
4. Add the Nextcloud repository using the following command::
|
2012-10-31 18:19:00 +04:00
|
|
|
|
2014-10-27 21:53:12 +03:00
|
|
|
brew tap owncloud/owncloud
|
2012-10-31 18:19:00 +04:00
|
|
|
|
2017-01-18 16:46:47 +03:00
|
|
|
5. Install a Qt5 version with qtwebkit support::
|
|
|
|
|
|
|
|
brew install qt5 --with-qtwebkit
|
|
|
|
|
|
|
|
6. Install any missing dependencies::
|
2013-05-17 13:40:43 +04:00
|
|
|
|
2014-11-10 01:09:52 +03:00
|
|
|
brew install $(brew deps owncloud-client)
|
2013-05-17 13:40:43 +04:00
|
|
|
|
2017-01-18 16:46:47 +03:00
|
|
|
7. Add Qt from brew to the path::
|
2014-10-27 22:50:07 +03:00
|
|
|
|
2016-12-20 19:32:05 +03:00
|
|
|
export PATH=/usr/local/Cellar/qt5/5.x.y/bin:$PATH
|
2014-10-27 22:50:07 +03:00
|
|
|
|
2017-01-18 16:46:47 +03:00
|
|
|
Where ``x.y`` is the current version of Qt 5 that brew has installed
|
2014-10-27 22:50:07 +03:00
|
|
|
on your machine.
|
2017-01-18 16:46:47 +03:00
|
|
|
8. Install qtkeychain from here: git clone https://github.com/frankosterfeld/qtkeychain.git
|
2018-06-04 12:44:03 +03:00
|
|
|
make sure you make the same install prefix as later while building the client e.g. -
|
2016-10-24 10:00:07 +03:00
|
|
|
``DCMAKE_INSTALL_PREFIX=/Path/to/client-install``
|
2014-10-27 22:50:07 +03:00
|
|
|
|
2017-01-18 16:46:47 +03:00
|
|
|
9. For compilation of the client, follow the :ref:`generic-build-instructions`.
|
2014-10-27 22:50:07 +03:00
|
|
|
|
2017-01-18 16:46:47 +03:00
|
|
|
10. Install the Packages_ package creation tool.
|
2016-02-05 16:55:29 +03:00
|
|
|
|
2018-06-04 12:44:03 +03:00
|
|
|
11. In the build directory, run ``admin/osx/create_mac.sh <build_dir> <install_dir>``.
|
2017-04-03 15:49:41 +03:00
|
|
|
If you have a developer signing certificate, you can specify
|
|
|
|
its Common Name as a third parameter (use quotes) to have the package
|
|
|
|
signed automatically.
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
.. note:: Contrary to earlier versions, Nextcloud 1.7 and later are packaged
|
2016-02-05 16:55:29 +03:00
|
|
|
as a ``pkg`` installer. Do not call "make package" at any time when
|
|
|
|
compiling for OS X, as this will build a disk image, and will not
|
|
|
|
work correctly.
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2015-02-04 18:51:28 +03:00
|
|
|
Windows Development Build
|
2017-02-20 12:52:22 +03:00
|
|
|
-------------------------
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2015-02-04 18:51:28 +03:00
|
|
|
If you want to test some changes and deploy them locally, you can build natively
|
|
|
|
on Windows using MinGW. If you want to generate an installer for deployment, please
|
|
|
|
follow `Windows Installer Build (Cross-Compile)`_ instead.
|
|
|
|
|
|
|
|
1. Get the required dependencies:
|
|
|
|
|
|
|
|
* Make sure that you have CMake_ and Git_.
|
|
|
|
* Download the Qt_ MinGW package. You will use the MinGW version bundled with it.
|
2017-07-21 09:54:06 +03:00
|
|
|
* Download an `OpenSSL Windows Build`_ (the non-"Light" version)
|
2015-02-04 18:51:28 +03:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
2. Get the QtKeychain_ sources as well as the latest versions of the Nextcloud client
|
2015-02-04 18:51:28 +03:00
|
|
|
from Git as follows::
|
|
|
|
|
|
|
|
git clone https://github.com/frankosterfeld/qtkeychain.git
|
2018-01-29 03:15:00 +03:00
|
|
|
git clone git://github.com/nextcloud/client.git
|
2015-02-04 18:51:28 +03:00
|
|
|
|
|
|
|
3. Open the Qt MinGW shortcut console from the Start Menu
|
|
|
|
|
2017-07-21 09:54:06 +03:00
|
|
|
4. Make sure that OpenSSL's ``bin`` directory as well as your qtkeychain source
|
|
|
|
directories are in your PATH. This will allow CMake to find the library and
|
2018-01-29 03:15:00 +03:00
|
|
|
headers, as well as allow the Nextcloud client to find the DLLs at runtime::
|
2015-02-04 18:51:28 +03:00
|
|
|
|
2017-07-21 09:54:06 +03:00
|
|
|
set PATH=C:\<OpenSSL Install Dir>\bin;%PATH%
|
2015-02-04 18:51:28 +03:00
|
|
|
set PATH=C:\<qtkeychain Clone Dir>;%PATH%
|
|
|
|
|
2015-02-06 19:10:23 +03:00
|
|
|
5. Build qtkeychain **directly in the source directory** so that the DLL is built
|
|
|
|
in the same directory as the headers to let CMake find them together through PATH::
|
2015-02-04 18:51:28 +03:00
|
|
|
|
|
|
|
cd <qtkeychain Clone Dir>
|
|
|
|
cmake -G "MinGW Makefiles" .
|
|
|
|
mingw32-make
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
6. Create the build directory::
|
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
mkdir client-build
|
|
|
|
cd client-build
|
2015-02-04 18:51:28 +03:00
|
|
|
|
|
|
|
7. Build the client::
|
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
cmake -G "MinGW Makefiles" ../client
|
|
|
|
mingw32-make
|
2015-02-04 18:51:28 +03:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
.. note:: You can try using ninja to build in parallel using
|
|
|
|
``cmake -G Ninja ../client`` and ``ninja`` instead.
|
|
|
|
.. note:: Refer to the :ref:`generic-build-instructions` section for additional options.
|
2015-02-04 18:51:28 +03:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
The Nextcloud binary will appear in the ``bin`` directory.
|
2015-02-04 18:51:28 +03:00
|
|
|
|
|
|
|
Windows Installer Build (Cross-Compile)
|
2015-08-31 12:12:47 +03:00
|
|
|
---------------------------------------
|
2015-02-04 18:51:28 +03:00
|
|
|
|
|
|
|
Due to the large number of dependencies, building the client installer for Windows
|
|
|
|
is **currently only officially supported on openSUSE**, by using the MinGW cross compiler.
|
2016-02-05 16:55:29 +03:00
|
|
|
You can set up any currently supported version of openSUSE in a virtual machine if you do not
|
2014-06-26 00:04:33 +04:00
|
|
|
have it installed already.
|
|
|
|
|
2018-06-04 12:44:03 +03:00
|
|
|
In order to make setup simple, you can use the provided Dockerfile to build your own image.
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
1. Assuming you are in the root of the Nextcloud Client's source tree, you can
|
2016-02-05 16:55:29 +03:00
|
|
|
build an image from this Dockerfile like this::
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2016-06-05 11:56:56 +03:00
|
|
|
cd admin/win/docker
|
2018-01-29 03:15:00 +03:00
|
|
|
docker build . -t nextcloud-client-win32:<version>
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
Replace ``<version>`` by the version of the client you are building, e.g.
|
|
|
|
|version| for the release of the client that this document describes.
|
|
|
|
If you do not wish to use docker, you can run the commands in ``RUN`` manually
|
|
|
|
in a shell, e.g. to create your own build environment in a virtual machine.
|
2014-06-26 00:04:33 +04:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
.. note:: Docker images are specific to releases. This one refers to |version|.
|
|
|
|
Newer releases may have different dependencies, and thus require a later
|
|
|
|
version of the docker image! Always pick the docker image fitting your release
|
2018-01-29 03:15:00 +03:00
|
|
|
of Nextcloud client!
|
2014-06-26 00:04:33 +04:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
2. From within the source tree Run the docker instance::
|
2012-11-19 21:15:25 +04:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
docker run -v "$PWD:/home/user/client" nextcloud-client-win32:<version> \
|
2016-06-13 16:30:06 +03:00
|
|
|
/home/user/client/admin/win/docker/build.sh client/ $(id -u)
|
2012-11-21 17:57:04 +04:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
It will run the build, create an NSIS based installer, as well as run tests.
|
|
|
|
You will find the resulting binary in an newly created ``build-win32`` subfolder.
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
If you do not wish to use docker, and ran the ``RUN`` commands above in a virtual machine,
|
|
|
|
you can run the indented commands in the lower section of ``build.sh`` manually in your
|
|
|
|
source tree.
|
2014-06-26 00:04:33 +04:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
4. Finally, you should sign the installer to avoid warnings upon installation.
|
|
|
|
This requires a `Microsoft Authenticode`_ Certificate ``osslsigncode`` to sign the installer::
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2016-02-06 17:01:04 +03:00
|
|
|
osslsigncode -pkcs12 $HOME/.codesign/packages.pfx -h sha256 \
|
2015-02-27 19:13:14 +03:00
|
|
|
-pass yourpass \
|
|
|
|
-n "ACME Client" \
|
|
|
|
-i "http://acme.com" \
|
|
|
|
-ts "http://timestamp.server/" \
|
|
|
|
-in ${unsigned_file} \
|
|
|
|
-out ${installer_file}
|
2014-10-27 21:53:12 +03:00
|
|
|
|
2017-02-20 12:52:22 +03:00
|
|
|
For ``-in``, use the URL to the time stamping server provided by your CA along with the Authenticode certificate. Alternatively,
|
2015-02-27 19:13:14 +03:00
|
|
|
you may use the official Microsoft ``signtool`` utility on Microsoft Windows.
|
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
If you're familiar with docker, you can use the version of ``osslsigncode`` that is part of the docker image.
|
2015-02-27 19:13:14 +03:00
|
|
|
|
2015-08-31 12:12:47 +03:00
|
|
|
.. _generic-build-instructions:
|
2015-08-31 11:48:43 +03:00
|
|
|
|
2012-10-31 17:44:18 +04:00
|
|
|
Generic Build Instructions
|
|
|
|
--------------------------
|
2012-10-31 18:19:00 +04:00
|
|
|
|
2015-01-30 20:14:42 +03:00
|
|
|
Compared to previous versions, building the desktop sync client has become easier. Unlike
|
|
|
|
earlier versions, CSync, which is the sync engine library of the client, is now
|
|
|
|
part of the client source repository and not a separate module.
|
2014-06-26 00:04:33 +04:00
|
|
|
|
2016-02-26 19:37:54 +03:00
|
|
|
To build the most up-to-date version of the client:
|
2014-06-26 00:04:33 +04:00
|
|
|
|
2015-11-26 13:55:23 +03:00
|
|
|
1. Clone the latest versions of the client from Git_ as follows::
|
2014-06-26 00:04:33 +04:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
git clone git://github.com/nextcloud/client.git
|
2016-02-08 16:28:25 +03:00
|
|
|
cd client
|
2016-02-05 16:55:29 +03:00
|
|
|
git submodule init
|
|
|
|
git submodule update
|
2014-03-07 12:56:28 +04:00
|
|
|
|
2015-11-26 13:55:23 +03:00
|
|
|
2. Create the build directory::
|
2014-03-07 12:56:28 +04:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
mkdir client-build
|
|
|
|
cd client-build
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2015-11-26 13:55:23 +03:00
|
|
|
3. Configure the client build::
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2017-04-03 15:49:41 +03:00
|
|
|
cmake -DCMAKE_BUILD_TYPE="Debug" ..
|
2018-06-04 12:44:03 +03:00
|
|
|
|
2016-02-05 16:55:29 +03:00
|
|
|
.. note:: You must use absolute paths for the ``include`` and ``library``
|
|
|
|
directories.
|
2014-10-27 22:50:07 +03:00
|
|
|
|
2018-06-04 12:44:03 +03:00
|
|
|
.. note:: On macOS, you need to specify ``-DCMAKE_INSTALL_PREFIX=target``,
|
2016-02-05 16:55:29 +03:00
|
|
|
where ``target`` is a private location, i.e. in parallel to your build
|
|
|
|
dir by specifying ``../install``.
|
2018-06-04 12:44:03 +03:00
|
|
|
|
2017-04-03 15:49:41 +03:00
|
|
|
.. note:: qtkeychain must be compiled with the same prefix e.g ``CMAKE_INSTALL_PREFIX=/Users/path/to/client/install/ .``
|
2018-06-04 12:44:03 +03:00
|
|
|
|
2017-06-13 10:58:20 +03:00
|
|
|
.. note:: Example:: ``cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 -DCMAKE_INSTALL_PREFIX=/Users/path/to/client/install/ -DNO_SHIBBOLETH=1``
|
2018-06-04 12:44:03 +03:00
|
|
|
|
2014-06-26 00:04:33 +04:00
|
|
|
4. Call ``make``.
|
2014-03-07 12:56:28 +04:00
|
|
|
|
2018-01-29 03:15:00 +03:00
|
|
|
The Nextcloud binary will appear in the ``bin`` directory.
|
2018-06-04 12:44:03 +03:00
|
|
|
|
|
|
|
5. (Optional) Call ``make install`` to install the client to the
|
|
|
|
``/usr/local/bin`` directory.
|
2012-10-31 17:44:18 +04:00
|
|
|
|
2014-06-26 00:04:33 +04:00
|
|
|
The following are known cmake parameters:
|
2013-03-11 19:18:20 +04:00
|
|
|
|
2014-06-26 00:04:33 +04:00
|
|
|
* ``QTKEYCHAIN_LIBRARY=/path/to/qtkeychain.dylib -DQTKEYCHAIN_INCLUDE_DIR=/path/to/qtkeychain/``:
|
|
|
|
Used for stored credentials. When compiling with Qt5, the library is called ``qt5keychain.dylib.``
|
|
|
|
You need to compile QtKeychain with the same Qt version.
|
2014-10-27 21:53:12 +03:00
|
|
|
* ``WITH_DOC=TRUE``: Creates doc and manpages through running ``make``; also adds install statements,
|
|
|
|
providing the ability to install using ``make install``.
|
2014-06-26 00:04:33 +04:00
|
|
|
* ``CMAKE_PREFIX_PATH=/path/to/Qt5.2.0/5.2.0/yourarch/lib/cmake/``: Builds using Qt5.
|
|
|
|
* ``BUILD_WITH_QT4=ON``: Builds using Qt4 (even if Qt5 is found).
|
2014-10-27 22:50:07 +03:00
|
|
|
* ``CMAKE_INSTALL_PREFIX=path``: Set an install prefix. This is mandatory on Mac OS
|
2013-03-11 19:18:20 +04:00
|
|
|
|
2015-02-04 18:51:28 +03:00
|
|
|
.. _CMake: http://www.cmake.org/download
|
2012-10-31 17:44:18 +04:00
|
|
|
.. _CSync: http://www.csync.org
|
2018-01-29 03:15:00 +03:00
|
|
|
.. _Client Download Page: https://nextcloud.com/install/#install-clients
|
2012-10-31 17:44:18 +04:00
|
|
|
.. _Git: http://git-scm.com
|
|
|
|
.. _MacPorts: http://www.macports.org
|
|
|
|
.. _Homebrew: http://mxcl.github.com/homebrew/
|
2017-07-21 09:54:06 +03:00
|
|
|
.. _OpenSSL Windows Build: http://slproweb.com/products/Win32OpenSSL.html
|
2015-02-04 18:51:28 +03:00
|
|
|
.. _Qt: http://www.qt.io/download
|
2016-02-25 00:31:19 +03:00
|
|
|
.. _Microsoft Authenticode: https://msdn.microsoft.com/en-us/library/ie/ms537361%28v=vs.85%29.aspx
|
2014-10-27 21:53:12 +03:00
|
|
|
.. _QtKeychain: https://github.com/frankosterfeld/qtkeychain
|
2016-02-05 16:55:29 +03:00
|
|
|
.. _Packages: http://s.sudre.free.fr/Software/Packages/about.html
|