You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BUILDING.txt 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. *******************************************************************************
  2. ** Building TigerVNC
  3. *******************************************************************************
  4. ================================
  5. Build Requirements (All Systems)
  6. ================================
  7. -- CMake (http://www.cmake.org) v2.8 or later
  8. -- zlib
  9. -- pixman
  10. -- FLTK 1.3.3 or later
  11. -- If building TLS support:
  12. * GnuTLS 3.x
  13. * See "Building TLS Support" below.
  14. -- If building native language support (NLS):
  15. * Gnu gettext 0.14.4 or later
  16. * See "Building Native Language Support" below.
  17. -- libjpeg-turbo
  18. * "Normal" libjpegv6 is also supported, although it is not
  19. recommended as it is much slower.
  20. =========================
  21. Build Requirements (Unix)
  22. =========================
  23. -- Non-Mac platforms:
  24. * X11 development kit
  25. * PAM
  26. -- If building Xvnc/libvnc.so:
  27. * Xorg server source code, 1.16 or never
  28. * All build requirements Xorg imposes (see its documentation)
  29. ============================
  30. Build Requirements (Windows)
  31. ============================
  32. -- MinGW or MinGW-w64
  33. -- Inno Setup (needed to build the TigerVNC installer)
  34. Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php.
  35. You also need the Inno Setup Preprocessor, which is available in the
  36. Inno Setup QuickStart Pack.
  37. Add the directory containing iscc.exe (for instance,
  38. C:\Program Files\Inno Setup 5) to the system or user PATH environment
  39. variable prior to building TigerVNC.
  40. =========================
  41. Build Requirements (Java)
  42. =========================
  43. -- Sun/Oracle JDK 1.7 or later or OpenJDK 7 or later
  44. -- See "Building Java Support" below.
  45. ==================
  46. Out-of-Tree Builds
  47. ==================
  48. Binary objects, libraries, and executables are generated in the same directory
  49. from which cmake was executed (the "binary directory"), and this directory need
  50. not necessarily be the same as the TigerVNC source directory. You can create
  51. multiple independent binary directories, in which different versions of
  52. TigerVNC can be built from the same source tree using different compilers or
  53. settings. In the sections below, {build_directory} refers to the binary
  54. directory, whereas {source_directory} refers to the TigerVNC source directory.
  55. For in-tree builds, these directories are the same.
  56. =================
  57. Building TigerVNC
  58. =================
  59. Building the TigerVNC Viewer on Unix/Mac Systems
  60. ------------------------------------------------
  61. The following procedure will build the TigerVNC Viewer on Linux and Unix
  62. systems. On 64-bit systems, this will build a 64-bit version of TigerVNC. See
  63. "Build Recipes" for specific build instructions for building a 32-bit version
  64. of TigerVNC on 64-bit systems.
  65. cd {build_directory}
  66. cmake -G "Unix Makefiles" [additional CMake flags] {source_directory}
  67. make
  68. Building the TigerVNC Server on Unix/Linux Systems
  69. --------------------------------------------------
  70. Building the TigerVNC Server (Xvnc) is a bit trickier. Xvnc is typically built
  71. to use the X11 shared libraries provided with the system. The procedure for
  72. this is system-specific, since it requires specifying such things as font
  73. directories, but the general outline is as follows (this procedure assumes
  74. that the viewer has already been built, per above.)
  75. > cd {build_directory}
  76. If performing an out-of-tree build:
  77. > mkdir unix
  78. > cp -R {source_directory}/unix/xserver unix/
  79. > cp -R {xorg_source}/* unix/xserver/
  80. (NOTE: {xorg_source} is the directory containing the Xorg source for the
  81. machine on which you are building TigerVNC. The most recent versions of
  82. Red Hat/CentOS/Fedora, for instance, provide an RPM called
  83. "xorg-x11-server-source", which installs the Xorg source under
  84. /usr/share/xorg-x11-server-source.)
  85. > cd unix/xserver/
  86. > patch -p1 < {source_directory}/unix/xserver{version}.patch
  87. (where {version} matches the X server version you are building, such as
  88. "120" for version 1.20.x.)
  89. > autoreconf -fiv
  90. > ./configure --with-pic --without-dtrace --disable-static --disable-dri \
  91. --disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \
  92. --disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \
  93. --disable-config-dbus --disable-config-hal --disable-config-udev \
  94. --disable-dri2 --enable-install-libxf86config --enable-glx \
  95. --with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \
  96. --with-fontdir=/usr/share/X11/fonts \
  97. --with-xkb-path=/usr/share/X11/xkb \
  98. --with-xkb-output=/var/lib/xkb \
  99. --with-xkb-bin-directory=/usr/bin \
  100. --with-serverconfig-path=/usr/lib[64]/xorg \
  101. --with-dri-driver-path=/usr/lib[64]/dri \
  102. {additional configure options}
  103. (NOTE: This is merely an example that works with Red Hat Enterprise/CentOS
  104. 6 and recent Fedora releases. You should customize it for your particular
  105. system. In particular, it will be necessary to customize the font, XKB,
  106. and DRI directories.)
  107. > make TIGERVNC_SRCDIR={source_directory}
  108. Building the Windows TigerVNC Viewer with MinGW
  109. -----------------------------------------------
  110. If building the Windows version of TigerVNC on a Windows build system, use
  111. the following procedure.
  112. cd {build_directory}
  113. cmake -G "MSYS Makefiles" [additional CMake flags] {source_directory}
  114. make
  115. If cross-compiling on a Unix/Linux system, then see the "Build Recipes" section
  116. below.
  117. Debug Build
  118. -----------
  119. Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line.
  120. Portable (semi-static) Build
  121. ----------------------------
  122. TigerVNC can under favourble circumstances be built in a way that allows
  123. the resulting binaries to run on any system without having to also install
  124. all the dynamic libraries it depends on. Enable this mode by adding:
  125. -DBUILD_STATIC=1
  126. to the CMake command line.
  127. Note that the method used to achieve this is very fragile and it may be
  128. necessary to tweak cmake/StaticBuild.cmake to make things work on your
  129. specific system.
  130. =====================
  131. Building Java Support
  132. =====================
  133. TigerVNC includes a Java version of the TigerVNC Viewer, which can be used on
  134. any platform that has a Java Runtime Environment (JRE) installed. The Java
  135. viewer works similarly to the native viewer, but with lower performance.
  136. To build the Java TigerVNC Viewer, add
  137. -DBUILD_JAVA=1
  138. to the CMake or build-xorg command line. The build system will attempt to find
  139. an installed Java Development Kit (JDK) and determine the appropriate paths for
  140. the Java compiler (javac) and the JAR creation utility (jar). You can override
  141. these paths by setting the Java_JAVAC_EXECUTABLE and Java_JAR_EXECUTABLE CMake
  142. variables. You can also override the default flags that are passed to javac
  143. by setting the JAVACFLAGS CMake variable. The build system will look for
  144. keytool and jarsigner in the same directory as Java_JAR_EXECUTABLE. These
  145. tools are needed to sign the JAR file, which is necessary to enable certain
  146. functionality (such as clipboard transfers) when the Java viewer is used as an
  147. applet.
  148. If the Java viewer is built along with the Windows TigerVNC Server (WinVNC),
  149. then the build system will embed the Java viewer into WinVNC4.exe so that it
  150. will automatically be served up using WinVNC's built-in HTTP server.
  151. Similarly, if the Java viewer is built along with the Unix TigerVNC Server
  152. (Xvnc), then the build system will include the Java viewer in the server
  153. tarball.
  154. By default, a self-signed certificate will be generated and used to sign the
  155. jar file. By specifying the following command line arguments to the CMake
  156. command line, an alternate certificate may be used for signing.
  157. -DJAVA_KEYSTORE=${keystore_location_or_url}
  158. -DJAVA_KEYSTORE_TYPE=${keystore_type} (Default: "jks")
  159. -DJAVA_KEY_ALIAS=${keytore_key_alias}
  160. -DJAVA_STOREPASS=${keystore_password}
  161. -DJAVA_KEYPASS=${keystore_entry_password}
  162. -DJAVA_TSA_URL=${url_of_timestamping_authority}
  163. The values of the JAVA_STOREPASS and JAVA_KEYPASS arguments may optionally be
  164. read from file or environment variables by prefixing the value with ":env "
  165. or ":file " (see the jarsigner documentation for more info):
  166. export StorePass=tigervnc
  167. export KeyPass=tigervnc
  168. cmake \
  169. ...
  170. -DJAVA_STOREPASS=":env StorePass"
  171. -DJAVA_KEYPASS=":env KeyPass"
  172. ======================================
  173. Building TLS Support
  174. ======================================
  175. TLS requires GnuTLS, which is supplied with most Linux distributions and
  176. with MinGW for Windows and can be built from source on OS X and other
  177. Unix variants. However, GnuTLS versions > 2.12.x && < 3.3.x should be
  178. avoided because of potential incompatibilities during initial handshaking.
  179. You can override the GNUTLS_LIBRARY and GNUTLS_INCLUDE_DIR CMake variables
  180. to specify the locations of libgnutls and any dependencies. For instance,
  181. adding
  182. -DGNUTLS_INCLUDE_DIR=/usr/local/include \
  183. -DGNUTLS_LIBRARY=/usr/local/lib/libgnutls.a
  184. to the CMake command line would link TigerVNC against a static version of
  185. libgnutls located under /usr/local.
  186. ======================================
  187. Building Native Language Support (NLS)
  188. ======================================
  189. NLS requires gettext, which is supplied with most Linux distributions and
  190. with MinGW for Windows and which can easily be built from source on OS X and
  191. other Unix variants.
  192. You can override the ICONV_LIBRARIES and LIBINTL_LIBRARY CMake variables to
  193. specify the locations of libiconv and libintl, respectively. For instance,
  194. adding
  195. -DLIBINTL_LIBRARY=/opt/gettext/lib/libintl.a
  196. to the CMake command line would link TigerVNC against a static version of
  197. libintl located under /opt/gettext. Adding
  198. -DICONV_INCLUDE_DIR=/mingw/include \
  199. -DICONV_LIBRARIES=/mingw/lib/libiconv.a \
  200. -DGETTEXT_INCLUDE_DIR=/mingw/include \
  201. -DLIBINTL_LIBRARY=/mingw/lib/libintl.a
  202. to the CMake command line would link TigerVNC against the static versions of
  203. libiconv and libintl included in the MinGW Developer Toolkit.
  204. ===================
  205. Installing TigerVNC
  206. ===================
  207. You can use the build system to install TigerVNC into a directory of your
  208. choosing. To do this, add:
  209. -DCMAKE_INSTALL_PREFIX={install_directory}
  210. to the CMake command line. Then, you can run 'make install' to build and
  211. install it.
  212. If you don't specify CMAKE_INSTALL_PREFIX, then the default is
  213. c:\Program Files\TigerVNC on Windows and /usr/local on Unix.
  214. =========================
  215. Creating Release Packages
  216. =========================
  217. The following commands can be used to create various types of release packages:
  218. Unix
  219. ----
  220. make tarball
  221. Create a binary tarball containing the TigerVNC Viewer
  222. make servertarball
  223. Create a binary tarball containing both the TigerVNC Server and Viewer
  224. make dmg
  225. Create Macintosh disk image file that contains an application bundle of the
  226. TigerVNC Viewer
  227. make udmg
  228. On 64-bit OS X systems, this creates a version of the Macintosh package and
  229. disk image which contains universal i386/x86-64 binaries. You should first
  230. configure a 32-bit out-of-tree build of TigerVNC, then configure a 64-bit
  231. out-of-tree build, then run 'make udmg' from the 64-bit build directory. The
  232. build system will look for the 32-bit build under {source_directory}/osxx86
  233. by default, but you can override this by setting the OSX_X86_BUILD CMake
  234. variable to the directory containing your configured 32-bit build. Either
  235. the 64-bit or 32-bit build can be configured to be backward compatible by
  236. using the instructions in the "Build Recipes" section.
  237. Windows
  238. -------
  239. make installer
  240. Create a Windows installer using Inno Setup. The installer package
  241. (TigerVNC[64].exe) will be located under {build_directory}.
  242. =============
  243. Build Recipes
  244. =============
  245. 32-bit Build on 64-bit Linux/Unix (including OS X)
  246. --------------------------------------------------
  247. Set the following environment variables before building TigerVNC.
  248. CFLAGS='-O3 -m32'
  249. CXXFLAGS='-O3 -m32'
  250. LDFLAGS=-m32
  251. If you are building the TigerVNC Server on a modern Unix/Linux system, then
  252. you will also need to pass the appropriate --host argument when configuring the
  253. X server source (for instance, --host=i686-pc-linux-gnu).
  254. 64-bit Backward-Compatible Build on 64-bit OS X
  255. -----------------------------------------------
  256. Add
  257. -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk \
  258. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.5
  259. to the CMake command line. The OS X 10.5 SDK must be installed.
  260. 32-bit Backward-Compatible Build on 64-bit OS X
  261. -----------------------------------------------
  262. Set the following environment variables:
  263. CC=gcc-4.0
  264. CXX=g++-4.0
  265. CFLAGS='-O3 -m32'
  266. CXXFLAGS='-O3 -m32'
  267. LDFLAGS=-m32
  268. and add
  269. -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk \
  270. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.4
  271. to the CMake command line. The OS X 10.4 SDK must be installed.
  272. 64-bit MinGW Build on Cygwin
  273. ----------------------------
  274. cd {build_directory}
  275. CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ \
  276. RC=/usr/bin/x86_64-w64-mingw32-windres \
  277. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  278. -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
  279. -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
  280. make
  281. This produces a 64-bit build of TigerVNC that does not depend on cygwin1.dll or
  282. other Cygwin DLL's. The mingw64-x86_64-gcc-core and mingw64-x86_64-gcc-g++
  283. packages (and their dependencies) must be installed.
  284. 32-bit MinGW Build on Cygwin
  285. ----------------------------
  286. cd {build_directory}
  287. CC=/usr/bin/i686-w64-mingw32-gcc CXX=/usr/bin/i686-w64-mingw32-g++ \
  288. RC=/usr/bin/i686-w64-mingw32-windres \
  289. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  290. -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
  291. -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
  292. make
  293. This produces a 32-bit build of TigerVNC that does not depend on cygwin1.dll or
  294. other Cygwin DLL's. The mingw64-i686-gcc-core and mingw64-i686-gcc-g++
  295. packages (and their dependencies) must be installed.
  296. MinGW-w64 Build on Windows
  297. --------------------------
  298. This produces a 64-bit build of TigerVNC using the "native" MinGW-w64 toolchain
  299. (which is faster than the Cygwin version):
  300. cd {build_directory}
  301. CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
  302. CXX={mingw-w64_binary_path}/x86_64-w64-mingw32-g++ \
  303. RC={mingw-w64_binary_path}/x86_64-w64-mingw32-windres \
  304. cmake -G "MSYS Makefiles" \
  305. -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
  306. -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
  307. {source_directory}
  308. make
  309. MinGW Build on Linux
  310. --------------------
  311. cd {build_directory}
  312. CC={mingw_binary_path}/i386-mingw32-gcc \
  313. CXX={mingw_binary_path}/i386-mingw32-g++ \
  314. RC={mingw_binary_path}/i386-mingw32-windres \
  315. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  316. -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
  317. -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
  318. {source_directory}
  319. make
  320. ===============================
  321. Distribution-Specific Packaging
  322. ===============================
  323. RPM Packages for RHEL / CentOS
  324. ------------------------------
  325. The RPM spec files and patches used to create the nightly builds
  326. and releases can be found in the "contrib/rpm/el{5,6}" directories
  327. of the TigerVNC subversion trunk. All external source tarballs
  328. must be fetched manually and placed into the 'SOURCES' directory
  329. under the rpmbuild root. Additionally, the following macros need
  330. to be defined:
  331. EL6:
  332. %debug_package %{nil}
  333. EL5:
  334. %dist .el5
  335. %_smp_mflags -j3
  336. %debug_package %{nil}
  337. %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
  338. Debian packages for Ubuntu 12.04LTS
  339. -----------------------------------
  340. The debian folder used to create the nightly builds and releases
  341. can be found in the "contrib/deb/ubuntu-precise" directory of the
  342. TigerVNC subversion trunk.