building.rst 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. .. _building-label:
  2. Appendix A: Building the Client
  3. ===============================
  4. This section explains how to build the ownCloud Client from source for all
  5. major platforms. You should read this section if you want to develop for the
  6. desktop client.
  7. .. note:: Building instruction are subject to change as development proceeds.
  8. Please check the version for which you want to build.
  9. The instructions contained in this topic were updated to work with version 1.7 of the ownCloud Client.
  10. Linux
  11. -----
  12. 1. Add the `ownCloud repository from OBS`_.
  13. 2. Install the dependencies (as root, or using ``sudo``) using the following
  14. commands for your specific Linux distribution:
  15. * Debian/Ubuntu: ``apt-get update; apt-get build-dep owncloud-client``
  16. * openSUSE: ``zypper ref; zypper si -d owncloud-client``
  17. * Fedora/CentOS: ``yum install yum-utils; yum-builddep owncloud-client``
  18. 3. Follow the `generic build instructions`_.
  19. 4. (Optional) Call ``make install`` to install the client to the ``/usr/local/bin`` directory.
  20. .. note:: This step requires the ``mingw32-cross-nsis`` packages be installed on
  21. Windows.
  22. Mac OS X
  23. --------
  24. In additon to needing XCode (along with the command line tools), developing in
  25. the Mac OS X environment requires extra dependencies. You can install these
  26. dependencies through MacPorts_ or Homebrew_. These dependencies are required
  27. only on the build machine, because non-standard libs are deployed in the app
  28. bundle.
  29. The tested and preferred way to develop in this environment is through the use
  30. of HomeBrew_. The ownCloud team has its own repository containing non-standard
  31. recipes.
  32. To set up your build enviroment for development using HomeBrew_:
  33. 1. Add the ownCloud repository using the following command::
  34. brew tap owncloud/owncloud
  35. 2. Install any missing dependencies::
  36. brew install $(brew deps mirall)
  37. 3. Add Qt from brew to the path::
  38. export PATH=/usr/local/Cellar/qt5/5.x.y/bin/qmake
  39. Where ``x.z`` is the current version of Qt 5 that brew has installed
  40. on your machine.
  41. 5. For compilation of mirall, follow the `generic build instructions`_.
  42. 6. In the build directory, run ``admin/osx/create_mac.sh <build_dir>
  43. <install_dir>``. If you have a developer signing certificate, you can specify
  44. its Common Name as a third parameter (use quotes) to have the package
  45. signed automatically.
  46. .. note:: Contrary to earlier versions, ownCloud 1.7 and later are packaged
  47. as a ``pkg`` installer. Do not call "make package" at any time when
  48. compiling for OS X, as this will build a disk image, and will not
  49. work correctly.
  50. Windows (Cross-Compile)
  51. -----------------------
  52. Due to the large number of dependencies, building the client for Windows is
  53. **currently only supported on openSUSE**, by using the MinGW cross compiler.
  54. You can set up openSUSE 12.1, 12.2, or 13.1 in a virtual machine if you do not
  55. have it installed already.
  56. To cross-compile:
  57. 1. Add the following repositories using YaST or ``zypper ar`` (adjust when using openSUSE 12.2 or 13.1)::
  58. zypper ar http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_13.1/windows:mingw:win32.repo
  59. zypper ar http://download.opensuse.org/repositories/windows:/mingw/openSUSE_13.1/windows:mingw.repo
  60. 2. Install the cross-compiler packages and the cross-compiled dependencies::
  61. zypper install cmake make mingw32-cross-binutils mingw32-cross-cpp mingw32-cross-gcc \
  62. mingw32-cross-gcc-c++ mingw32-cross-pkg-config mingw32-filesystem \
  63. mingw32-headers mingw32-runtime site-config mingw32-libqt4-sql \
  64. mingw32-libqt4-sql-sqlite mingw32-sqlite mingw32-libsqlite-devel \
  65. mingw32-dlfcn-devel mingw32-libssh2-devel kdewin-png2ico \
  66. mingw32-libqt4 mingw32-libqt4-devel mingw32-libgcrypt \
  67. mingw32-libgnutls mingw32-libneon-openssl mingw32-libneon-devel \
  68. mingw32-libbeecrypt mingw32-libopenssl mingw32-openssl \
  69. mingw32-libpng-devel mingw32-libsqlite mingw32-qtkeychain \
  70. mingw32-qtkeychain-devel mingw32-dlfcn mingw32-libintl-devel \
  71. mingw32-libneon-devel mingw32-libopenssl-devel mingw32-libproxy-devel \
  72. mingw32-libxml2-devel mingw32-zlib-devel
  73. 3. For the installer, install the NSIS installer package::
  74. zypper install mingw32-cross-nsis
  75. 4. Install the following plugin::
  76. mingw32-cross-nsis-plugin-processes mingw32-cross-nsis-plugin-uac
  77. .. note:: This plugin is typically required. However, due to a current bug
  78. in ``mingw``, the plugins do not currently build properly from source.
  79. 5. Manually download and install the following files using ``rpm -ivh <package>``:
  80. .. note:: These files also work for more recent openSUSE versions!
  81. ::
  82. rpm -ivh http://download.tomahawk-player.org/packman/mingw:32/openSUSE_12.1/x86_64/mingw32-cross-nsis-plugin-processes-0-1.1.x86_64.rpm
  83. rpm -ivh http://download.tomahawk-player.org/packman/mingw:32/openSUSE_12.1/x86_64/mingw32-cross-nsis-plugin-uac-0-3.1.x86_64.rpm
  84. 6. Follow the `generic build instructions`_
  85. .. note:: When building for Windows platforms, you must specify a special
  86. toolchain file that enables cmake to locate the platform-specific tools. To add
  87. this parameter to the call to cmake, enter
  88. ``-DCMAKE_TOOLCHAIN_FILE=../mirall/admin/win/Toolchain-mingw32-openSUSE.cmake``.
  89. 7. Build by running ``make``.
  90. .. note:: Using ``make package`` produces an NSIS-based installer, provided
  91. the NSIS mingw32 packages are installed.
  92. .. _`generic build instructions`:
  93. Generic Build Instructions
  94. --------------------------
  95. Compared to previous versions, building Mirall has become easier. Unlike
  96. earlier versions, CSync, which is the sync engine library of Mirall, is now
  97. part of the Mirall source repository and not a separate module.
  98. You can download Mirall from the ownCloud `Client Download Page`_.
  99. To build the most up to date version of the client:
  100. 1. Clone the latest versions of Mirall from Git_ as follows:
  101. ``git clone git://github.com/owncloud/mirall.git``
  102. 2. Create build directories:
  103. ``mkdir mirall-build``
  104. 3. Build mirall:
  105. ``cd ../mirall-build``
  106. ``cmake -DCMAKE_BUILD_TYPE="Debug" ../mirall``
  107. ..note:: You must use absolute paths for the ``include`` and ``library``
  108. directories.
  109. ..note:: On Mac OS X, you need to specify ``-DCMAKE_INSTALL_PREFIX=target``,
  110. where ``target`` is a private location, i.e. in parallel to your build
  111. dir by specifying ``../install``.
  112. 4. Call ``make``.
  113. The owncloud binary appear in the ``bin`` directory.
  114. The following are known cmake parameters:
  115. * ``QTKEYCHAIN_LIBRARY=/path/to/qtkeychain.dylib -DQTKEYCHAIN_INCLUDE_DIR=/path/to/qtkeychain/``:
  116. Used for stored credentials. When compiling with Qt5, the library is called ``qt5keychain.dylib.``
  117. You need to compile QtKeychain with the same Qt version.
  118. * ``WITH_DOC=TRUE``: Creates doc and manpages through running ``make``; also adds install statements,
  119. providing the ability to install using ``make install``.
  120. * ``CMAKE_PREFIX_PATH=/path/to/Qt5.2.0/5.2.0/yourarch/lib/cmake/``: Builds using Qt5.
  121. * ``BUILD_WITH_QT4=ON``: Builds using Qt4 (even if Qt5 is found).
  122. * ``CMAKE_INSTALL_PREFIX=path``: Set an install prefix. This is mandatory on Mac OS
  123. .. _`ownCloud repository from OBS`: http://software.opensuse.org/download/package?project=isv:ownCloud:desktop&package=owncloud-client
  124. .. _CSync: http://www.csync.org
  125. .. _`Client Download Page`: http://owncloud.org/sync-clients/
  126. .. _Git: http://git-scm.com
  127. .. _MacPorts: http://www.macports.org
  128. .. _Homebrew: http://mxcl.github.com/homebrew/
  129. .. _QtKeychain: https://github.com/frankosterfeld/qtkeychain