blob: b2241b47ccda593b0395d4ed2f8c33c2282a3e76 [file] [log] [blame]
DRC2c0ea902010-04-16 07:33:41 +00001*******************************************************************************
DRC667df922011-06-23 10:11:22 +00002** Building TigerVNC
DRC2c0ea902010-04-16 07:33:41 +00003*******************************************************************************
4
5
DRC667df922011-06-23 10:11:22 +00006================================
7Build Requirements (All Systems)
8================================
DRC2c0ea902010-04-16 07:33:41 +00009
DRC667df922011-06-23 10:11:22 +000010-- CMake (http://www.cmake.org) v2.8 or later
11
12-- FLTK 1.3.0
13 * Must be patched using fltk/extensions.patch to get full functionality
14 * See "Building FLTK" below.
DRC2c0ea902010-04-16 07:33:41 +000015
DRC69854b42011-05-13 09:31:24 +000016-- If building TLS support:
17 * GnuTLS and its dependencies (libgcrypt, libtasn1, libgpg-error)
18
DRC667df922011-06-23 10:11:22 +000019-- libjpeg-turbo SDK
20 * If your system does not include libjpeg-turbo, you can download the SDK
21 from http://sourceforge.net/projects/libjpeg-turbo/files/
22
23
24=========================
25Build Requirements (Unix)
26=========================
27
28-- Non-Mac platforms:
29 * X11 development kit
30
DRC2c0ea902010-04-16 07:33:41 +000031-- If building Xvnc:
DRC667df922011-06-23 10:11:22 +000032 * autoconf 2.57 or later
33 * automake 1.7 or later
34 * libtool 1.4 or later
35 * OpenSSL v0.9.7 or later
DRC2c0ea902010-04-16 07:33:41 +000036 * Python v2.3 or later
37 * zlib v1.2 or later
DRC2c0ea902010-04-16 07:33:41 +000038
DRC69854b42011-05-13 09:31:24 +000039 * pkgconfig 0.20 or later
40 If you are using an older RPM-based system which does not meet this
41 minimum requirement (such as Red Hat Enterprise Linux 4), then you can
42 build pkgconfig 0.20 from the Fedora 5 source RPM:
43 http://archive.fedoraproject.org/pub/archive/fedora/linux/core/5/source/SRPMS/pkgconfig-0.20-2.2.1.src.rpm
44
DRC69854b42011-05-13 09:31:24 +000045 * gettext 0.14.4 or later
46 If you are using an older RPM-based system which does not meet this
47 minimum requirement (such as Red Hat Enterprise Linux 4), then you can
48 build gettext 0.14.5 from the Fedora 5 source RPM:
49 http://archive.fedoraproject.org/pub/archive/fedora/linux/core/5/source/SRPMS/gettext-0.14.5-3.src.rpm
50 NOTE: gcj and libgcj are required when building the above source RPM.
DRC2b0b1942011-02-09 03:10:44 +000051
DRC2c0ea902010-04-16 07:33:41 +000052
DRC667df922011-06-23 10:11:22 +000053============================
54Build Requirements (Windows)
55============================
DRC180c0162010-10-27 07:20:27 +000056
57-- Microsoft Visual C++ 2005 or later
58
59 If you don't already have Visual C++, then the easiest way to get it is by
60 installing the Windows SDK:
61
62 http://msdn.microsoft.com/en-us/windows/bb980924.aspx
63
64 The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
65 everything necessary to build TigerVNC.
66
67 * For 32-bit builds, you can also use Microsoft Visual C++ Express
68 Edition. Visual C++ Express Edition is a free download.
69 * If you intend to build TigerVNC from the command line, then add the
70 appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH
71 environment variables. This is generally accomplished by executing
72 vcvars32.bat or vcvars64.bat and SetEnv.cmd. vcvars32.bat and
73 vcvars64.bat are part of Visual C++ and are located in the same directory
74 as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass
75 optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build
76 environment.
77
78... OR ...
79
80-- MinGW
81
DRC180c0162010-10-27 07:20:27 +000082-- Inno Setup (needed to build the TigerVNC installer)
83 Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php.
84 You also need the Inno Setup Preprocessor, which is available in the
85 Inno Setup QuickStart Pack.
86
87 Add the directory containing iscc.exe (for instance,
88 C:\Program Files\Inno Setup 5) to the system or user PATH environment
89 variable prior to building TigerVNC.
90
DRC667df922011-06-23 10:11:22 +000091
92=============
93Building FLTK
94=============
95
96Currently, TigerVNC requires functionality that is not yet included in the
97upstream version of FLTK. Thus, it will be necessary to build FLTK from
98source. To do this:
99
1001. Download the FLTK 1.3.0 source tarball from http://www.fltk.org/
1012. Extract the source tarball
1023. cd fltk-1.3.0
1034. patch -p1 < {tigervnc_source_directory}/fltk/extensions.patch
1045. Use CMake to build FLTK using the same procedures described below for
105 building TigerVNC. The recipes in the "Build Recipes" section also apply.
1066. (optional) Use 'make install' to install FLTK into a directory of your
107 choosing.
1087. When building TigerVNC, set the FLTK_FLUID_EXECUTABLE CMake variable to the
109 location of the fluid executable that was built in Step 5 or installed in
110 Step 6. This gives CMake a hint as to where to find the FLTK library.
1118. If you did not install FLTK, then set the FLTK_INCLUDE_DIR CMake variable to
112 the location of the FLTK source directory.
DRC2b0b1942011-02-09 03:10:44 +0000113
DRC180c0162010-10-27 07:20:27 +0000114
115==================
116Out-of-Tree Builds
117==================
118
119Binary objects, libraries, and executables are generated in the same directory
120from which cmake was executed (the "binary directory"), and this directory need
121not necessarily be the same as the TigerVNC source directory. You can create
122multiple independent binary directories, in which different versions of
123TigerVNC can be built from the same source tree using different compilers or
124settings. In the sections below, {build_directory} refers to the binary
125directory, whereas {source_directory} refers to the TigerVNC source directory.
126For in-tree builds, these directories are the same.
127
128
129=================
130Building TigerVNC
131=================
132
133
DRC667df922011-06-23 10:11:22 +0000134Unix/Mac
135--------
136
137The following procedure will build the TigerVNC Viewer on Linux and Unix
138systems. On 64-bit systems, this will build a 64-bit version of TigerVNC. See
139"Build Recipes" for specific build instructions for building a 32-bit version
140of TigerVNC on 64-bit systems.
141
142 cd {build_directory}
143 cmake -G "Unix Makefiles" {source_directory} [additional CMake flags]
144 make
145
146Building the TigerVNC Server (Xvnc) is a bit trickier. On newer systems
147containing Xorg 7.4 or later (such as Fedora), Xvnc is typically built to use
148the X11 shared libraries provided with the system. The procedure for this is
149very system-specific, since it requires specifying such things as font and X
150resource directories. Thus, it cannot be described in terms general enough for
151this document.
152
153Those using systems with older versions of Xorg must build a "legacy-friendly"
154version of the TigerVNC Server. This is accomplished by downloading and
155building the more recent Xorg modules in a local directory and then building
156Xvnc such that it links against the local build of these libraries, not the X11
157libraries installed on the system. The "build-xorg" script in the TigerVNC
158source distribution (located under unix/) automates this process.
159
160The following procedure will build both the TigerVNC Viewer and a
161"legacy-friendly" version of the TigerVNC Server:
162
163 cd {build_directory}
164 sh {source_directory}/unix/build-xorg init
165 sh {source_directory}/unix/build-xorg build [additional CMake flags]
166
167build-xorg generates a version of Xvnc that has no external dependencies on the
168X11 shared libraries or any other distribution-specific shared libraries. This
169version of Xvnc should be transportable across multiple O/S distributions.
170build-xorg should work on Red Hat Enterprise 4, its contemporaries, and later
171systems. It probably will not work on older systems. It has not been tested
172on non-Linux systems (yet).
173
174build-xorg can also be used to rebuild just the TigerVNC Server and Viewer,
175once the X11 modules and other dependencies have been built for the first time.
176This is convenient for testing changes that just apply to the TigerVNC source
177code. To accomplish this, run:
178
179 sh {source_directory}/unix/build-xorg rebuild [additional make flags]
180
181For instance,
182
183 sh {source_directory}/unix/build-xorg rebuild clean
184
185will clean both the Xvnc and vncviewer builds without destroying any of the
186build configuration or module dependencies.
187
188
DRC180c0162010-10-27 07:20:27 +0000189Visual C++ (Command Line)
190-------------------------
191
192 cd {build_directory}
193 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
194 nmake
195
196This will build either a 32-bit or a 64-bit version of TigerVNC, depending
197on which version of cl.exe is in the PATH.
198
199
200Visual C++ (IDE)
201----------------
202
203Choose the appropriate CMake generator option for your version of Visual Studio
204(run "cmake" with no arguments for a list of available generators.) For
205instance:
206
207 cd {build_directory}
208 cmake -G "Visual Studio 9 2008" {source_directory}
209
210You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
211configurations in that project ("Debug", "Release", etc.) to generate a full
212build of TigerVNC.
213
214
215MinGW
216-----
217
218 cd {build_directory}
219 cmake -G "MSYS Makefiles" {source_directory}
220 make
221
222This will generate only vncviewer. Currently, Visual C++ must be used to build
223WinVNC.
224
225
226Debug Build
227-----------
228
Adam Tkacf586b842011-04-27 11:20:18 +0000229Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line. Or, if building with
DRC180c0162010-10-27 07:20:27 +0000230NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
231NMake.)
232
233
DRC8290dd62011-02-10 22:54:36 +0000234Self-Contained MinGW Build
235--------------------------
236
237If TigerVNC is built using MinGW, then it may depend on the MinGW libgcc DLL.
238To eliminate this dependency, add
239
240 -DCMAKE_C_FLAGS=-static-libgcc -DCMAKE_CXX_FLAGS=-static-libgcc
241
Adam Tkacf586b842011-04-27 11:20:18 +0000242to the CMake command line.
DRC8290dd62011-02-10 22:54:36 +0000243
244
Adam Tkacf586b842011-04-27 11:20:18 +0000245====================
246Building TLS support
247====================
DRC8290dd62011-02-10 22:54:36 +0000248
Adam Tkac445d4ed2011-04-27 11:04:01 +0000249VeNCrypt (the TigerVNC security and authentication extensions) can be built
250with TLS support, which provides built-in encryption for VNC sessions. This
DRC667df922011-06-23 10:11:22 +0000251requires GnuTLS, which is not pre-installed on all platforms. This section
252describes the issues associated with building a version of TigerVNC with TLS
253support and how to work around those issues.
Adam Tkacf586b842011-04-27 11:20:18 +0000254
DRC667df922011-06-23 10:11:22 +0000255
256Unix/Mac
257--------
258
259In general, if you are building on a Unix-ish platform that has the GnuTLS
260libraries and include files installed in the standard system locations, then
261the TigerVNC build system should detect the system version of GnuTLS
262automatically and link against it. However, this produces a version of
263TigerVNC that depends on the GnuTLS dynamic libraries, and thus the TigerVNC
264binaries are not portable.
265
266To build a fully portable, cross-compatible version of TigerVNC with VeNCrypt
267support, it is necessary to link against the GnuTLS static library (as well
268as the static libraries of its dependencies.) If you are lucky enough, then
269your O/S distribution may include pre-packaged versions of these static
270libraries. Otherwise, it will be necessary to build GnuTLS, libgcrypt,
271libtasn1, and libgpg-error from source.
272
273You can manipulate the GNUTLS_INCLUDE_DIR and GNUTLS_LIBRARY CMake variables to
274accommodate a custom build of GnuTLS that is installed in a non-system
275directory. For instance, adding
276
277 -DGNUTLS_INCLUDE_DIR=/opt/gnutls/include \
278 -DGNUTLS_LIBRARY='/opt/gnutls/lib/libgnutls.a;/opt/gnutls/lib/libgcrypt.a;/opt/gnutls/lib/libgpg-error.a;/opt/gnutls/lib/libtasn1.a' \
279 -DUSE_INCLUDED_ZLIB=1
280
281to the CMake or 'build-xorg build' command line will cause TigerVNC to be
282statically linked against a custom installation of GnuTLS that resides under
283/opt/gnutls. GnuTLS depends on zlib, so specifying --with-included-zlib will
284satisfy that dependency using TigerVNC's in-tree version of zlib, which
285prevents TigerVNC from depending on the libz dynamic library.
286
287
288MinGW
289-----
DRC8290dd62011-02-10 22:54:36 +0000290
291An installer containing the GnuTLS header files, as well as static and dynamic
Adam Tkacf586b842011-04-27 11:20:18 +0000292link libraries for 32-bit MinGW, can be downloaded from the following site:
DRC8290dd62011-02-10 22:54:36 +0000293
294http://josefsson.org/gnutls4win/
295
Adam Tkacf586b842011-04-27 11:20:18 +0000296As of this writing, GnuTLS cannot be built cleanly with MinGW64 due to the fact
297that portions of the code assume an LP64 data model (Windows uses LLP64.)
298Thus, it is not possible at this time to produce a Win64 version of TigerVNC
299with TLS support.
DRC8290dd62011-02-10 22:54:36 +0000300
Adam Tkacf586b842011-04-27 11:20:18 +0000301Whether you use the above installer or build GnuTLS from source, make sure that
302you install the libraries and headers into a pathname that doesn't contain
303spaces (the installer will try to install under c:\Program Files unless you
304tell it otherwise.) If the GnuTLS include path contains spaces, then the MinGW
305resource compiler will barf when you try to build TigerVNC.
306
307You can manipulate the GNUTLS_INCLUDE_DIR and GNUTLS_LIBRARY CMake variables to
DRC8290dd62011-02-10 22:54:36 +0000308specify the directory under which you installed GnuTLS. For instance, adding
309
310 -DGNUTLS_INCLUDE_DIR=/c/gnutls/include \
Adam Tkacf586b842011-04-27 11:20:18 +0000311 -DGNUTLS_LIBRARY=/c/gnutls/lib/libgnutls.dll.a
312
313to the CMake command line when using MinGW will cause TigerVNC to be linked
314against GnuTLS DLLs that are installed under c:\gnutls.
315
316Adding
317
318 -DGNUTLS_INCLUDE_DIR=/c/gnutls/include \
DRC8290dd62011-02-10 22:54:36 +0000319 -DGNUTLS_LIBRARY='/c/gnutls/lib/libgnutls.a;/c/gnutls/lib/libgcrypt.a;/c/gnutls/lib/libtasn1.a;/c/gnutls/lib/libgpg-error.a'
320
Adam Tkacf586b842011-04-27 11:20:18 +0000321to the CMake command line will cause TigerVNC to be statically linked against
322GnuTLS libraries that are installed under c:\gnutls.
323
324Note that the use of MinGW means that only the TigerVNC viewer can be built,
325not the server.
326
DRC667df922011-06-23 10:11:22 +0000327
Adam Tkacf586b842011-04-27 11:20:18 +0000328Visual C++
329----------
330
331There is generally no sane way to build GnuTLS and its dependencies using
332Visual C++. Thus, it is necessary to either build the libraries with MinGW (or
333download 32-bit versions of these from the link above), generate Visual C++
334import libraries from the DLLs, then link TigerVNC against the Visual C++
335import libraries.
336
337In the instructions below, {gnutls_path} indicates the path under which GnuTLS
338is installed (Example: c:\Program Files\GnuTLS-2.10.1).
339
340To generate Visual C++ import libraries:
341
342cd {gnutls_path}\lib
343lib /def:..\bin\libgnutls-{version}.def /out:libgnutls.lib
344
345Now, you can add the following arguments to the CMake command line:
346
347 -DGNUTLS_INCLUDE_DIR={gnutls_path}\include \
348 -DGNUTLS_LIBRARY={gnutls_path}\lib\libgnutls.lib
349
350to build TigerVNC against the GnuTLS DLLs installed under {gnutls_path}.
DRC8290dd62011-02-10 22:54:36 +0000351
352
DRC180c0162010-10-27 07:20:27 +0000353===================
354Installing TigerVNC
355===================
356
357You can use the build system to install TigerVNC into a directory of your
DRC667df922011-06-23 10:11:22 +0000358choosing. To do this, add:
DRC180c0162010-10-27 07:20:27 +0000359
360 -DCMAKE_INSTALL_PREFIX={install_directory}
361
DRC667df922011-06-23 10:11:22 +0000362to the CMake command line. Then, after building TigerVNC, you can run
363'make install' or 'nmake install' (or build the "install" target in the Visual
364Studio IDE) to install it.
DRC180c0162010-10-27 07:20:27 +0000365
366If you don't specify CMAKE_INSTALL_PREFIX, then the default is
DRC667df922011-06-23 10:11:22 +0000367c:\Program Files\TigerVNC on Windows and /usr/local on Unix.
DRC180c0162010-10-27 07:20:27 +0000368
369
DRC667df922011-06-23 10:11:22 +0000370=========================
371Creating Release Packages
372=========================
373
374The following commands can be used to create various types of release packages:
375
376
377Unix
378----
379
380(TODO: implement these in CMake. OS X viewer also needs to be packaged into
381an app instead of a package, since it can run stand-alone now.)
382
383make tarball
384
385 Create a binary tarball containing the TigerVNC Viewer
386
387make servertarball
388
389 Create a binary tarball containing both the TigerVNC Server and Viewer
390
391make dmg
392
393 Create Macintosh package/disk image. This requires the PackageMaker
394 application, which must be installed in /Developer/Applications/Utilities.
395
396make udmg [BUILDDIR32={32-bit build directory}]
397
398 On 64-bit OS X systems, this creates a version of the Macintosh package and
399 disk image which contains universal i386/x86-64 binaries. You should first
400 configure a 32-bit out-of-tree build of TigerVNC, then configure a 64-bit
401 out-of-tree build, then run 'make udmg' from the 64-bit build directory. The
402 build system will look for the 32-bit build under {source_directory}/osxx86
403 by default, but you can override this by setting the BUILDDIR32 variable on
404 the make command line as shown above. Either the 64-bit or 32-bit build can
405 be configured to be backward-compatible by using the instructions in the
406 "Unix Build Recipes" section.
407
408
409Windows
410-------
411
412If using NMake:
413
414 cd {build_directory}
415 nmake installer
416
417If using MinGW:
418
419 cd {build_directory}
420 make installer
421
422If using the Visual Studio IDE, build the "installer" project.
423
424The installer package (TigerVNC[64].exe) will be located under
425{build_directory}. If building using the Visual Studio IDE, then the installer
426package will be located in a subdirectory with the same name as the
427configuration you built (such as {build_directory}\Debug\ or
428{build_directory}\Release\).
429
430NOTE: If TigerVNC is built with TLS support, then the build system will
431attempt to package the GnuTLS DLLs into the Windows installer. It looks for
432these DLLs in a directory called "bin" one level up from GNUTLS_INCLUDE_DIR.
433
434
435=============
436Build Recipes
437=============
438
439
44032-bit Build on 64-bit Linux/Unix (including OS X)
441--------------------------------------------------
442
443Set the following environment variables before running CMake or
444'build-xorg build':
445
446 CFLAGS='-O3 -m32'
447 CXXFLAGS='-O3 -m32'
448 LDFLAGS=-m32
449
450
45164-bit Backward-Compatible Build on 64-bit OS X
452-----------------------------------------------
453
454Add
455
456 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk \
457 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.5
458
459to the CMake command line. The OS X 10.5 SDK must be installed.
460
461
46232-bit Backward-Compatible Build on 64-bit OS X
463-----------------------------------------------
464
465Set the following environment variables:
466
467 CC=gcc-4.0
468 CXX=g++-4.0
469 CFLAGS='-O3 -m32'
470 CXXFLAGS='-O3 -m32'
471 LDFLAGS=-m32
472
473and add
474
475 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk \
476 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.4
477
478to the CMake command line. The OS X 10.4 SDK must be installed.
DRC180c0162010-10-27 07:20:27 +0000479
480
48164-bit MinGW Build on Cygwin
482----------------------------
483
484 cd {build_directory}
485 CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ \
486 RC=/usr/bin/x86_64-w64-mingw32-windres \
487 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
488 -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
489 -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
490 make
491
492This produces a 64-bit build of TigerVNC that does not depend on cygwin1.dll or
493other Cygwin DLL's. The mingw64-x86_64-gcc-core and mingw64-x86_64-gcc-g++
494packages (and their dependencies) must be installed.
495
496
49732-bit MinGW Build on Cygwin
498----------------------------
499
500 cd {build_directory}
501 CC=/usr/bin/i686-w64-mingw32-gcc CXX=/usr/bin/i686-w64-mingw32-g++ \
502 RC=/usr/bin/i686-w64-mingw32-windres \
503 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
504 -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
505 -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
506 make
507
508This produces a 32-bit build of TigerVNC that does not depend on cygwin1.dll or
509other Cygwin DLL's. The mingw64-i686-gcc-core and mingw64-i686-gcc-g++
510packages (and their dependencies) must be installed.
511
512
513MinGW-w64 Build on Windows
514--------------------------
515
516This produces a 64-bit build of TigerVNC using the "native" MinGW-w64 toolchain
517(which is faster than the Cygwin version):
518
519 cd {build_directory}
520 CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
521 CXX={mingw-w64_binary_path}/x86_64-w64-mingw32-g++ \
522 RC={mingw-w64_binary_path}/x86_64-w64-mingw32-windres \
523 cmake -G "MSYS Makefiles" \
524 -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
525 -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
526 {source_directory}
527 make
528
529
530MinGW Build on Linux
531--------------------
532
533 cd {build_directory}
534 CC={mingw_binary_path}/i386-mingw32-gcc \
535 CXX={mingw_binary_path}/i386-mingw32-g++ \
536 RC={mingw_binary_path}/i386-mingw32-windres \
537 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
538 -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
539 -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
540 {source_directory}
541 make