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 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. *******************************************************************************
  2. ** Building TigerVNC
  3. *******************************************************************************
  4. ================================
  5. Build Requirements (All Systems)
  6. ================================
  7. -- CMake (http://www.cmake.org) v2.8 or later
  8. -- FLTK 1.3.0
  9. * Must be patched using fltk/extensions.patch (in the TigerVNC source
  10. directory) to get full functionality
  11. * See "Building FLTK" below.
  12. -- If building TLS support:
  13. * GnuTLS and its dependencies (libgcrypt, libtasn1, libgpg-error)
  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 SDK
  18. * If your system does not include libjpeg-turbo, then you can download the
  19. SDK from http://sourceforge.net/projects/libjpeg-turbo/files/
  20. =========================
  21. Build Requirements (Unix)
  22. =========================
  23. -- Non-Mac platforms:
  24. * X11 development kit
  25. -- If building Xvnc:
  26. * autoconf 2.57 or later
  27. * automake 1.7 or later
  28. * libtool 1.4 or later
  29. * OpenSSL v0.9.7 or later
  30. * Python v2.3 or later
  31. * zlib v1.2 or later
  32. * pkgconfig 0.20 or later
  33. If you are using an older RPM-based system which does not meet this
  34. minimum requirement (such as Red Hat Enterprise Linux 4), then you can
  35. build pkgconfig 0.20 from the Fedora 5 source RPM:
  36. http://archive.fedoraproject.org/pub/archive/fedora/linux/core/5/source/SRPMS/pkgconfig-0.20-2.2.1.src.rpm
  37. * gettext 0.14.4 or later
  38. If you are using an older RPM-based system which does not meet this
  39. minimum requirement (such as Red Hat Enterprise Linux 4), then you can
  40. build gettext 0.14.5 from the Fedora 5 source RPM:
  41. http://archive.fedoraproject.org/pub/archive/fedora/linux/core/5/source/SRPMS/gettext-0.14.5-3.src.rpm
  42. NOTE: gcj and libgcj are required when building the above source RPM.
  43. ============================
  44. Build Requirements (Windows)
  45. ============================
  46. -- Microsoft Visual C++ 2005 or later
  47. If you don't already have Visual C++, then the easiest way to get it is by
  48. installing the Windows SDK:
  49. http://msdn.microsoft.com/en-us/windows/bb980924.aspx
  50. The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
  51. everything necessary to build TigerVNC.
  52. * For 32-bit builds, you can also use Microsoft Visual C++ Express
  53. Edition. Visual C++ Express Edition is a free download.
  54. * If you intend to build TigerVNC from the command line, then add the
  55. appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH
  56. environment variables. This is generally accomplished by executing
  57. vcvars32.bat or vcvars64.bat and SetEnv.cmd. vcvars32.bat and
  58. vcvars64.bat are part of Visual C++ and are located in the same directory
  59. as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass
  60. optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build
  61. environment.
  62. ... OR ...
  63. -- MinGW
  64. -- Inno Setup (needed to build the TigerVNC installer)
  65. Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php.
  66. You also need the Inno Setup Preprocessor, which is available in the
  67. Inno Setup QuickStart Pack.
  68. Add the directory containing iscc.exe (for instance,
  69. C:\Program Files\Inno Setup 5) to the system or user PATH environment
  70. variable prior to building TigerVNC.
  71. =============
  72. Building FLTK
  73. =============
  74. Currently, TigerVNC requires functionality that is not yet included in the
  75. upstream version of FLTK. Thus, it will be necessary to build FLTK from
  76. source. To do this:
  77. 1. Download the FLTK 1.3.0 source tarball from http://www.fltk.org/
  78. 2. Extract the source tarball
  79. 3. cd fltk-1.3.0
  80. 4. patch -p1 < {tigervnc_source_directory}/fltk/extensions.patch
  81. 5. Use CMake to build FLTK using the same procedures described below for
  82. building TigerVNC. The recipes in the "Build Recipes" section also apply.
  83. 6. (optional) Use 'make install' to install FLTK into a directory of your
  84. choosing.
  85. 7. When building TigerVNC, set the FLTK_FLUID_EXECUTABLE CMake variable to the
  86. location of the fluid executable that was built in Step 5 or installed in
  87. Step 6. This gives CMake a hint as to where to find the FLTK library.
  88. 8. If you did not install FLTK, then set the FLTK_INCLUDE_DIR CMake variable to
  89. the location of the FLTK source directory.
  90. ==================
  91. Out-of-Tree Builds
  92. ==================
  93. Binary objects, libraries, and executables are generated in the same directory
  94. from which cmake was executed (the "binary directory"), and this directory need
  95. not necessarily be the same as the TigerVNC source directory. You can create
  96. multiple independent binary directories, in which different versions of
  97. TigerVNC can be built from the same source tree using different compilers or
  98. settings. In the sections below, {build_directory} refers to the binary
  99. directory, whereas {source_directory} refers to the TigerVNC source directory.
  100. For in-tree builds, these directories are the same.
  101. =================
  102. Building TigerVNC
  103. =================
  104. Unix/Mac
  105. --------
  106. The following procedure will build the TigerVNC Viewer on Linux and Unix
  107. systems. On 64-bit systems, this will build a 64-bit version of TigerVNC. See
  108. "Build Recipes" for specific build instructions for building a 32-bit version
  109. of TigerVNC on 64-bit systems.
  110. cd {build_directory}
  111. cmake -G "Unix Makefiles" {source_directory} [additional CMake flags]
  112. make
  113. Building the TigerVNC Server (Xvnc) is a bit trickier. On newer systems
  114. containing Xorg 7.4 or later (such as Fedora), Xvnc is typically built to use
  115. the X11 shared libraries provided with the system. The procedure for this is
  116. very system-specific, since it requires specifying such things as font and X
  117. resource directories. Thus, it cannot be described in terms general enough for
  118. this document.
  119. Those using systems with older versions of Xorg must build a "legacy-friendly"
  120. version of the TigerVNC Server. This is accomplished by downloading and
  121. building the more recent Xorg modules in a local directory and then building
  122. Xvnc such that it links against the local build of these libraries, not the X11
  123. libraries installed on the system. The "build-xorg" script in the TigerVNC
  124. source distribution (located under unix/) automates this process.
  125. The following procedure will build both the TigerVNC Viewer and a
  126. "legacy-friendly" version of the TigerVNC Server:
  127. cd {build_directory}
  128. sh {source_directory}/unix/build-xorg init
  129. sh {source_directory}/unix/build-xorg build [additional CMake flags]
  130. build-xorg generates a version of Xvnc that has no external dependencies on the
  131. X11 shared libraries or any other distribution-specific shared libraries. This
  132. version of Xvnc should be transportable across multiple O/S distributions.
  133. build-xorg should work on Red Hat Enterprise 4, its contemporaries, and later
  134. systems. It probably will not work on older systems. It has not been tested
  135. on non-Linux systems (yet).
  136. build-xorg can also be used to rebuild just the TigerVNC Server and Viewer,
  137. once the X11 modules and other dependencies have been built for the first time.
  138. This is convenient for testing changes that just apply to the TigerVNC source
  139. code. To accomplish this, run:
  140. sh {source_directory}/unix/build-xorg rebuild [additional make flags]
  141. For instance,
  142. sh {source_directory}/unix/build-xorg rebuild clean
  143. will clean both the Xvnc and vncviewer builds without destroying any of the
  144. build configuration or module dependencies.
  145. Visual C++ (Command Line)
  146. -------------------------
  147. cd {build_directory}
  148. cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
  149. nmake
  150. This will build either a 32-bit or a 64-bit version of TigerVNC, depending
  151. on which version of cl.exe is in the PATH.
  152. Visual C++ (IDE)
  153. ----------------
  154. Choose the appropriate CMake generator option for your version of Visual Studio
  155. (run "cmake" with no arguments for a list of available generators.) For
  156. instance:
  157. cd {build_directory}
  158. cmake -G "Visual Studio 9 2008" {source_directory}
  159. You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
  160. configurations in that project ("Debug", "Release", etc.) to generate a full
  161. build of TigerVNC.
  162. MinGW
  163. -----
  164. cd {build_directory}
  165. cmake -G "MSYS Makefiles" {source_directory}
  166. make
  167. This will generate only vncviewer. Currently, Visual C++ must be used to build
  168. WinVNC.
  169. Debug Build
  170. -----------
  171. Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line. Or, if building with
  172. NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
  173. NMake.)
  174. Self-Contained MinGW Build
  175. --------------------------
  176. If TigerVNC is built using MinGW, then it may depend on the MinGW libgcc DLL.
  177. To eliminate this dependency, add
  178. -DCMAKE_C_FLAGS=-static-libgcc -DCMAKE_CXX_FLAGS=-static-libgcc
  179. to the CMake command line.
  180. ======================================
  181. Building Native Language Support (NLS)
  182. ======================================
  183. NLS requires gettext, which is supplied with most Linux distributions but not
  184. with most other operating systems. Building gettext from source is
  185. straightforward on Mac and other Unix variants, but on Windows it requires
  186. MinGW. Thus, it is not possible to enable NLS when building TigerVNC with
  187. Visual C++.
  188. You can override the ICONV_LIBRARIES and LIBINTL_LIBRARY CMake variables to
  189. specify the locations of libiconv and libintl, respectively. For instance,
  190. adding
  191. -DLIBINTL_LIBRARY=/opt/gettext/lib/libintl.a
  192. to the CMake command line would link TigerVNC against a static version of
  193. libintl located under /opt/gettext. Adding
  194. -DICONV_INCLUDE_DIR=/mingw/include \
  195. -DICONV_LIBRARIES=/mingw/lib/libiconv.a \
  196. -DGETTEXT_INCLUDE_DIR=/mingw/include \
  197. -DLIBINTL_LIBRARY=/mingw/lib/libintl.a
  198. to the CMake command line would link TigerVNC against the static versions of
  199. libiconv and libintl included in the MinGW Developer Toolkit.
  200. ===============================================
  201. Building Transport Layer Security (TLS) support
  202. ===============================================
  203. VeNCrypt (the TigerVNC security and authentication extensions) can be built
  204. with TLS support, which provides built-in encryption for VNC sessions. This
  205. requires GnuTLS, which is readily available in many Linux distributions but not
  206. as readily available in binary form on other types of systems. This section
  207. describes the issues associated with building a version of TigerVNC with TLS
  208. support and how to work around those issues.
  209. Unix/Mac
  210. --------
  211. In general, if you are building on a Unix-ish platform that has the GnuTLS
  212. libraries and include files installed in the standard system locations, then
  213. the TigerVNC build system should detect the system version of GnuTLS
  214. automatically and link against it. However, this produces a version of
  215. TigerVNC that depends on the GnuTLS dynamic libraries, and thus the TigerVNC
  216. binaries are not portable.
  217. To build a fully portable, cross-compatible version of TigerVNC with TLS
  218. support, it is necessary to link against the GnuTLS static library (as well
  219. as the static libraries of its dependencies.) If you are lucky enough, then
  220. your O/S distribution may include pre-packaged versions of these static
  221. libraries. Otherwise, it will be necessary to build GnuTLS, libgcrypt,
  222. libtasn1, and libgpg-error from source.
  223. You can manipulate the GNUTLS_INCLUDE_DIR and GNUTLS_LIBRARY CMake variables to
  224. build TigerVNC against a custom build of GnuTLS that is installed in a
  225. non-system directory. For instance, adding
  226. -DGNUTLS_INCLUDE_DIR=/opt/gnutls/include \
  227. -DGNUTLS_LIBRARY='/opt/gnutls/lib/libgnutls.a;/opt/gnutls/lib/libgcrypt.a;/opt/gnutls/lib/libgpg-error.a;/opt/gnutls/lib/libtasn1.a' \
  228. -DUSE_INCLUDED_ZLIB=1
  229. to the CMake or 'build-xorg build' command line will cause TigerVNC to be
  230. statically linked against a custom installation of GnuTLS that resides under
  231. /opt/gnutls. GnuTLS depends on zlib, so specifying -DUSE_INCLUDED_ZLIB=1 will
  232. satisfy that dependency using TigerVNC's in-tree version of zlib, which
  233. prevents TigerVNC from depending on the libz dynamic library.
  234. MinGW
  235. -----
  236. An installer containing the GnuTLS header files, as well as static and dynamic
  237. link libraries for 32-bit MinGW, can be downloaded from the following site:
  238. http://josefsson.org/gnutls4win/
  239. As of this writing, GnuTLS cannot be built cleanly with MinGW64 due to the fact
  240. that portions of the code assume an LP64 data model (Windows uses LLP64.)
  241. Thus, it is not possible at this time to produce a Win64 version of TigerVNC
  242. with TLS support.
  243. Whether you use the above installer or build GnuTLS from source, make sure that
  244. you install the libraries and headers into a pathname that doesn't contain
  245. spaces (the installer will try to install under c:\Program Files unless you
  246. tell it otherwise.) If the GnuTLS include path contains spaces, then the MinGW
  247. resource compiler will barf when you try to build TigerVNC.
  248. You can manipulate the GNUTLS_INCLUDE_DIR and GNUTLS_LIBRARY CMake variables to
  249. specify the directory under which you installed GnuTLS. For instance, adding
  250. -DGNUTLS_INCLUDE_DIR=/c/gnutls/include \
  251. -DGNUTLS_LIBRARY=/c/gnutls/lib/libgnutls.dll.a
  252. to the CMake command line when using MinGW will cause TigerVNC to be linked
  253. against GnuTLS DLLs that are installed under c:\gnutls.
  254. Adding
  255. -DGNUTLS_INCLUDE_DIR=/c/gnutls/include \
  256. -DGNUTLS_LIBRARY='/c/gnutls/lib/libgnutls.a;/c/gnutls/lib/libgcrypt.a;/c/gnutls/lib/libtasn1.a;/c/gnutls/lib/libgpg-error.a'
  257. to the CMake command line will cause TigerVNC to be statically linked against
  258. GnuTLS libraries that are installed under c:\gnutls.
  259. Note that the use of MinGW means that only the TigerVNC viewer can be built,
  260. not the server.
  261. Visual C++
  262. ----------
  263. There is generally no sane way to build GnuTLS and its dependencies using
  264. Visual C++. Thus, it is necessary to either build the libraries with MinGW (or
  265. download 32-bit versions of these from the link above), generate Visual C++
  266. import libraries from the DLLs, then link TigerVNC against the Visual C++
  267. import libraries.
  268. In the instructions below, {gnutls_path} indicates the path under which GnuTLS
  269. is installed (Example: c:\Program Files\GnuTLS-2.10.1).
  270. To generate Visual C++ import libraries:
  271. cd {gnutls_path}\lib
  272. lib /def:..\bin\libgnutls-{version}.def /out:libgnutls.lib
  273. Now, you can add the following arguments to the CMake command line:
  274. -DGNUTLS_INCLUDE_DIR={gnutls_path}\include \
  275. -DGNUTLS_LIBRARY={gnutls_path}\lib\libgnutls.lib
  276. to build TigerVNC against the GnuTLS DLLs installed under {gnutls_path}.
  277. ===================
  278. Installing TigerVNC
  279. ===================
  280. You can use the build system to install TigerVNC into a directory of your
  281. choosing. To do this, add:
  282. -DCMAKE_INSTALL_PREFIX={install_directory}
  283. to the CMake command line. Then, after building TigerVNC, you can run
  284. 'make install' or 'nmake install' (or build the "install" target in the Visual
  285. Studio IDE) to install it.
  286. If you don't specify CMAKE_INSTALL_PREFIX, then the default is
  287. c:\Program Files\TigerVNC on Windows and /usr/local on Unix.
  288. =========================
  289. Creating Release Packages
  290. =========================
  291. The following commands can be used to create various types of release packages:
  292. Unix
  293. ----
  294. (TODO: implement these in CMake. OS X viewer also needs to be packaged into
  295. an app instead of a package, since it can run stand-alone now.)
  296. make tarball
  297. Create a binary tarball containing the TigerVNC Viewer
  298. make servertarball
  299. Create a binary tarball containing both the TigerVNC Server and Viewer
  300. make dmg
  301. Create Macintosh package/disk image. This requires the PackageMaker
  302. application, which must be installed in /Developer/Applications/Utilities.
  303. make udmg [BUILDDIR32={32-bit build directory}]
  304. On 64-bit OS X systems, this creates a version of the Macintosh package and
  305. disk image which contains universal i386/x86-64 binaries. You should first
  306. configure a 32-bit out-of-tree build of TigerVNC, then configure a 64-bit
  307. out-of-tree build, then run 'make udmg' from the 64-bit build directory. The
  308. build system will look for the 32-bit build under {source_directory}/osxx86
  309. by default, but you can override this by setting the BUILDDIR32 variable on
  310. the make command line as shown above. Either the 64-bit or 32-bit build can
  311. be configured to be backward-compatible by using the instructions in the
  312. "Unix Build Recipes" section.
  313. Windows
  314. -------
  315. If using NMake:
  316. cd {build_directory}
  317. nmake installer
  318. If using MinGW:
  319. cd {build_directory}
  320. make installer
  321. If using the Visual Studio IDE, build the "installer" project.
  322. The installer package (TigerVNC[64].exe) will be located under
  323. {build_directory}. If building using the Visual Studio IDE, then the installer
  324. package will be located in a subdirectory with the same name as the
  325. configuration you built (such as {build_directory}\Debug\ or
  326. {build_directory}\Release\).
  327. NOTE: If TigerVNC is built with TLS support, then the build system will
  328. attempt to package the GnuTLS DLLs into the Windows installer. It looks for
  329. these DLLs in a directory called "bin" one level up from GNUTLS_INCLUDE_DIR.
  330. =============
  331. Build Recipes
  332. =============
  333. 32-bit Build on 64-bit Linux/Unix (including OS X)
  334. --------------------------------------------------
  335. Set the following environment variables before running CMake or
  336. 'build-xorg build':
  337. CFLAGS='-O3 -m32'
  338. CXXFLAGS='-O3 -m32'
  339. LDFLAGS=-m32
  340. 64-bit Backward-Compatible Build on 64-bit OS X
  341. -----------------------------------------------
  342. Add
  343. -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk \
  344. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.5
  345. to the CMake command line. The OS X 10.5 SDK must be installed.
  346. 32-bit Backward-Compatible Build on 64-bit OS X
  347. -----------------------------------------------
  348. Set the following environment variables:
  349. CC=gcc-4.0
  350. CXX=g++-4.0
  351. CFLAGS='-O3 -m32'
  352. CXXFLAGS='-O3 -m32'
  353. LDFLAGS=-m32
  354. and add
  355. -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk \
  356. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.4
  357. to the CMake command line. The OS X 10.4 SDK must be installed.
  358. 64-bit MinGW Build on Cygwin
  359. ----------------------------
  360. cd {build_directory}
  361. CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ \
  362. RC=/usr/bin/x86_64-w64-mingw32-windres \
  363. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  364. -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
  365. -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
  366. make
  367. This produces a 64-bit build of TigerVNC that does not depend on cygwin1.dll or
  368. other Cygwin DLL's. The mingw64-x86_64-gcc-core and mingw64-x86_64-gcc-g++
  369. packages (and their dependencies) must be installed.
  370. 32-bit MinGW Build on Cygwin
  371. ----------------------------
  372. cd {build_directory}
  373. CC=/usr/bin/i686-w64-mingw32-gcc CXX=/usr/bin/i686-w64-mingw32-g++ \
  374. RC=/usr/bin/i686-w64-mingw32-windres \
  375. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  376. -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
  377. -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
  378. make
  379. This produces a 32-bit build of TigerVNC that does not depend on cygwin1.dll or
  380. other Cygwin DLL's. The mingw64-i686-gcc-core and mingw64-i686-gcc-g++
  381. packages (and their dependencies) must be installed.
  382. MinGW-w64 Build on Windows
  383. --------------------------
  384. This produces a 64-bit build of TigerVNC using the "native" MinGW-w64 toolchain
  385. (which is faster than the Cygwin version):
  386. cd {build_directory}
  387. CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
  388. CXX={mingw-w64_binary_path}/x86_64-w64-mingw32-g++ \
  389. RC={mingw-w64_binary_path}/x86_64-w64-mingw32-windres \
  390. cmake -G "MSYS Makefiles" \
  391. -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
  392. -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
  393. {source_directory}
  394. make
  395. MinGW Build on Linux
  396. --------------------
  397. cd {build_directory}
  398. CC={mingw_binary_path}/i386-mingw32-gcc \
  399. CXX={mingw_binary_path}/i386-mingw32-g++ \
  400. RC={mingw_binary_path}/i386-mingw32-windres \
  401. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  402. -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
  403. -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
  404. {source_directory}
  405. make