blob: 0cb830bf5d32b0920dba07dd6d7f11cd1e594bf2 [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
Pierre Ossman56610fb2015-01-27 16:28:15 +010012-- FLTK 1.3.3 or later
Peter Åstrand956a6362012-08-09 07:33:08 +000013
DRC69854b42011-05-13 09:31:24 +000014-- If building TLS support:
Pierre Ossmanec3dfe62014-10-17 10:36:58 +020015 * GnuTLS
Brian P. Hinz34d2b4d2014-11-14 00:25:12 -050016 * See "Building TLS Support" below.
DRC69854b42011-05-13 09:31:24 +000017
DRCce355e32011-06-24 04:58:01 +000018-- If building native language support (NLS):
19 * Gnu gettext 0.14.4 or later
20 * See "Building Native Language Support" below.
21
Pierre Ossman3e4281b2014-10-17 10:40:07 +020022-- libjpeg-turbo
23 * "Normal" libjpegv6 is also supported, although it is not
24 recommended as it is much slower.
DRC667df922011-06-23 10:11:22 +000025
26
27=========================
28Build Requirements (Unix)
29=========================
30
31-- Non-Mac platforms:
32 * X11 development kit
33
Pierre Ossman6330d142015-01-27 16:46:06 +010034-- If building Xvnc/libvnc.so:
35 * Xorg server source code, 1.7 or never
36 * All build requirements Xorg imposes (see its documentation)
DRC2c0ea902010-04-16 07:33:41 +000037
DRC667df922011-06-23 10:11:22 +000038============================
39Build Requirements (Windows)
40============================
DRC180c0162010-10-27 07:20:27 +000041
DRCccc09692011-11-08 06:57:58 +000042-- MinGW or MinGW-w64
DRC180c0162010-10-27 07:20:27 +000043
DRC180c0162010-10-27 07:20:27 +000044-- Inno Setup (needed to build the TigerVNC installer)
45 Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php.
46 You also need the Inno Setup Preprocessor, which is available in the
47 Inno Setup QuickStart Pack.
48
49 Add the directory containing iscc.exe (for instance,
50 C:\Program Files\Inno Setup 5) to the system or user PATH environment
51 variable prior to building TigerVNC.
52
DRC667df922011-06-23 10:11:22 +000053
DRC15b6e052011-10-06 01:20:52 +000054=========================
55Build Requirements (Java)
56=========================
57
58-- Sun/Oracle JDK v5 or later or OpenJDK
59
60-- See "Building Java Support" below.
61
62
DRC180c0162010-10-27 07:20:27 +000063==================
64Out-of-Tree Builds
65==================
66
67Binary objects, libraries, and executables are generated in the same directory
68from which cmake was executed (the "binary directory"), and this directory need
69not necessarily be the same as the TigerVNC source directory. You can create
70multiple independent binary directories, in which different versions of
71TigerVNC can be built from the same source tree using different compilers or
72settings. In the sections below, {build_directory} refers to the binary
73directory, whereas {source_directory} refers to the TigerVNC source directory.
74For in-tree builds, these directories are the same.
75
76
77=================
78Building TigerVNC
79=================
80
81
DRC62f3a662011-08-24 00:03:31 +000082Building the TigerVNC Viewer on Unix/Mac Systems
83------------------------------------------------
DRC667df922011-06-23 10:11:22 +000084
85The following procedure will build the TigerVNC Viewer on Linux and Unix
86systems. On 64-bit systems, this will build a 64-bit version of TigerVNC. See
87"Build Recipes" for specific build instructions for building a 32-bit version
88of TigerVNC on 64-bit systems.
89
90 cd {build_directory}
DRC240a5ff2011-07-06 07:28:30 +000091 cmake -G "Unix Makefiles" [additional CMake flags] {source_directory}
DRC667df922011-06-23 10:11:22 +000092 make
93
DRC62f3a662011-08-24 00:03:31 +000094
95Building the TigerVNC Server on Modern Unix/Linux Systems
96---------------------------------------------------------
97
DRC667df922011-06-23 10:11:22 +000098Building the TigerVNC Server (Xvnc) is a bit trickier. On newer systems
99containing Xorg 7.4 or later (such as Fedora), Xvnc is typically built to use
100the X11 shared libraries provided with the system. The procedure for this is
DRC62f3a662011-08-24 00:03:31 +0000101system-specific, since it requires specifying such things as font directories,
102but the general outline is as follows (this procedure assumes that the viewer
103has already been built, per above.)
104
105 > cd {build_directory}
106
107 If performing an out-of-tree build:
108 > mkdir unix
109 > cp -R {source_directory}/unix/xserver unix/
110
111 > cp -R {xorg_source}/* unix/xserver/
112 (NOTE: {xorg_source} is the directory containing the Xorg source for the
113 machine on which you are building TigerVNC. The most recent versions of
114 Red Hat/CentOS/Fedora, for instance, provide an RPM called
115 "xorg-x11-server-source", which installs the Xorg source under
116 /usr/share/xorg-x11-server-source.)
117
118 > cd unix/xserver/
119 > patch -p1 < {source_directory}/unix/xserver{version}.patch
120 (where {version} matches the X server version you are building, such as
121 "17" for version 1.7.x.)
122 > autoreconf -fiv
123
Peter Åstrand01b24332011-10-31 08:14:40 +0000124 > ./configure --with-pic --without-dtrace --disable-static --disable-dri \
DRC62f3a662011-08-24 00:03:31 +0000125 --disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \
126 --disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \
127 --disable-config-dbus --disable-config-hal --disable-config-udev \
128 --disable-dri2 --enable-install-libxf86config --enable-glx \
129 --with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \
130 --with-fontdir=/usr/share/X11/fonts \
131 --with-xkb-path=/usr/share/X11/xkb \
132 --with-xkb-output=/var/lib/xkb \
DRC0bb7e132011-08-24 00:26:54 +0000133 --with-xkb-bin-directory=/usr/bin \
DRC62f3a662011-08-24 00:03:31 +0000134 --with-serverconfig-path=/usr/lib[64]/xorg \
135 --with-dri-driver-path=/usr/lib[64]/dri \
136 {additional configure options}
137 (NOTE: This is merely an example that works with Red Hat Enterprise/CentOS
138 6 and recent Fedora releases. You should customize it for your particular
139 system. In particular, it will be necessary to customize the font, XKB,
140 and DRI directories.)
141
142 > make TIGERVNC_SRCDIR={source_directory}
143
144
145Building the TigerVNC Server on Legacy Unix/Linux Systems
146---------------------------------------------------------
DRC667df922011-06-23 10:11:22 +0000147
148Those using systems with older versions of Xorg must build a "legacy-friendly"
149version of the TigerVNC Server. This is accomplished by downloading and
150building the more recent Xorg modules in a local directory and then building
151Xvnc such that it links against the local build of these libraries, not the X11
152libraries installed on the system. The "build-xorg" script in the TigerVNC
Pierre Ossman04d288c2015-01-27 16:50:59 +0100153source distribution (located under contrib/xorg/) automates this process.
DRC667df922011-06-23 10:11:22 +0000154
155The following procedure will build both the TigerVNC Viewer and a
156"legacy-friendly" version of the TigerVNC Server:
157
158 cd {build_directory}
Pierre Ossman04d288c2015-01-27 16:50:59 +0100159 sh {source_directory}/contrib/xorg/build-xorg init
160 sh {source_directory}/contrib/xorg/build-xorg build [additional CMake flags]
DRC667df922011-06-23 10:11:22 +0000161
162build-xorg generates a version of Xvnc that has no external dependencies on the
163X11 shared libraries or any other distribution-specific shared libraries. This
164version of Xvnc should be transportable across multiple O/S distributions.
165build-xorg should work on Red Hat Enterprise 4, its contemporaries, and later
166systems. It probably will not work on older systems. It has not been tested
167on non-Linux systems (yet).
168
169build-xorg can also be used to rebuild just the TigerVNC Server and Viewer,
170once the X11 modules and other dependencies have been built for the first time.
171This is convenient for testing changes that just apply to the TigerVNC source
172code. To accomplish this, run:
173
Pierre Ossman04d288c2015-01-27 16:50:59 +0100174 sh {source_directory}/contrib/xorg/build-xorg rebuild [additional make flags]
DRC667df922011-06-23 10:11:22 +0000175
176For instance,
177
Pierre Ossman04d288c2015-01-27 16:50:59 +0100178 sh {source_directory}/contrib/xorg/build-xorg rebuild clean
DRC667df922011-06-23 10:11:22 +0000179
180will clean both the Xvnc and vncviewer builds without destroying any of the
181build configuration or module dependencies.
182
183
DRCe4e604f2011-10-01 17:54:36 +0000184Building the Windows TigerVNC Viewer with MinGW
185-----------------------------------------------
DRC180c0162010-10-27 07:20:27 +0000186
DRCccc09692011-11-08 06:57:58 +0000187If building the Windows version of TigerVNC on a Windows build system, use
188the following procedure.
189
DRC180c0162010-10-27 07:20:27 +0000190 cd {build_directory}
DRC240a5ff2011-07-06 07:28:30 +0000191 cmake -G "MSYS Makefiles" [additional CMake flags] {source_directory}
DRC180c0162010-10-27 07:20:27 +0000192 make
193
DRCccc09692011-11-08 06:57:58 +0000194If cross-compiling on a Unix/Linux system, then see the "Build Recipes" section
195below.
DRC180c0162010-10-27 07:20:27 +0000196
197
198Debug Build
199-----------
200
DRCccc09692011-11-08 06:57:58 +0000201Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line.
DRC180c0162010-10-27 07:20:27 +0000202
203
Pierre Ossmanf95272d2014-10-17 13:59:35 +0200204Portable (semi-static) Build
205----------------------------
DRC8290dd62011-02-10 22:54:36 +0000206
Pierre Ossmanf95272d2014-10-17 13:59:35 +0200207TigerVNC can under favourble circumstances be built in a way that allows
208the resulting binaries to run on any system without having to also install
209all the dynamic libraries it depends on. Enable this mode by adding:
DRC8290dd62011-02-10 22:54:36 +0000210
DRCe4e604f2011-10-01 17:54:36 +0000211 -DBUILD_STATIC=1
DRC8290dd62011-02-10 22:54:36 +0000212
Adam Tkacf586b842011-04-27 11:20:18 +0000213to the CMake command line.
DRC8290dd62011-02-10 22:54:36 +0000214
Pierre Ossmanf95272d2014-10-17 13:59:35 +0200215Note that the method used to achieve this is very fragile and it may be
216necessary to tweak cmake/StaticBuild.cmake to make things work on your
217specific system.
218
DRC8290dd62011-02-10 22:54:36 +0000219
DRC15b6e052011-10-06 01:20:52 +0000220=====================
221Building Java Support
222=====================
223
224TigerVNC includes a Java version of the TigerVNC Viewer, which can be used on
225any platform that has a Java Runtime Environment (JRE) installed. The Java
226viewer works similarly to the native viewer, but with lower performance.
227
228To build the Java TigerVNC Viewer, add
229
230 -DBUILD_JAVA=1
231
232to the CMake or build-xorg command line. The build system will attempt to find
233an installed Java Development Kit (JDK) and determine the appropriate paths for
234the Java compiler (javac) and the JAR creation utility (jar). You can override
235these paths by setting the Java_JAVAC_EXECUTABLE and Java_JAR_EXECUTABLE CMake
236variables. You can also override the default flags that are passed to javac
237by setting the JAVACFLAGS CMake variable. The build system will look for
238keytool and jarsigner in the same directory as Java_JAR_EXECUTABLE. These
239tools are needed to sign the JAR file, which is necessary to enable certain
240functionality (such as clipboard transfers) when the Java viewer is used as an
241applet.
242
243If the Java viewer is built along with the Windows TigerVNC Server (WinVNC),
244then the build system will embed the Java viewer into WinVNC4.exe so that it
245will automatically be served up using WinVNC's built-in HTTP server.
246Similarly, if the Java viewer is built along with the Unix TigerVNC Server
247(Xvnc), then the build system will include the Java viewer in the server
248tarball.
249
Brian Hinzf88b3ad2013-12-02 02:53:10 +0000250By default, a self-signed certificate will be generated and used to sign the
251jar file. By specifying the following command line arguments to the CMake
252command line, an alternate certificate may be used for signing.
253
254 -DJAVA_KEYSTORE=${keystore_location_or_url}
255 -DJAVA_KEYSTORE_TYPE=${keystore_type} (Default: "jks")
256 -DJAVA_KEY_ALIAS=${keytore_key_alias}
257 -DJAVA_STOREPASS=${keystore_password}
258 -DJAVA_KEYPASS=${keystore_entry_password}
259 -DJAVA_TSA_URL=${url_of_timestamping_authority}
260
261The values of the JAVA_STOREPASS and JAVA_KEYPASS arguments may optionally be
262read from file or environment variables by prefixing the value with ":env "
263or ":file " (see the jarsigner documentation for more info):
264
265 export StorePass=tigervnc
266 export KeyPass=tigervnc
267 cmake \
268 ...
269 -DJAVA_STOREPASS=":env StorePass"
270 -DJAVA_KEYPASS=":env KeyPass"
271
DRC15b6e052011-10-06 01:20:52 +0000272
DRC240a5ff2011-07-06 07:28:30 +0000273======================================
Brian P. Hinz34d2b4d2014-11-14 00:25:12 -0500274Building TLS Support
275======================================
276
277TLS requires GnuTLS, which is supplied with most Linux distributions and
278with MinGW for Windows and can be built from source on OS X and other
279Unix variants. However, GnuTLS versions > 2.12.x && < 3.3.x should be
280avoided because of potential incompatibilities during initial handshaking.
281
282You can override the GNUTLS_LIBRARY and GNUTLS_INCLUDE_DIR CMake variables
283to specify the locations of libgnutls and any dependencies. For instance,
284adding
285
286 -DGNUTLS_INCLUDE_DIR=/usr/local/include \
Brian P. Hinz94433e82014-11-18 07:39:35 -0500287 -DGNUTLS_LIBRARY=/usr/local/lib/libgnutls.a
Brian P. Hinz34d2b4d2014-11-14 00:25:12 -0500288
289to the CMake command line would link TigerVNC against a static version of
290libgnutls located under /usr/local.
291
292
293======================================
DRCce355e32011-06-24 04:58:01 +0000294Building Native Language Support (NLS)
295======================================
296
DRCccc09692011-11-08 06:57:58 +0000297NLS requires gettext, which is supplied with most Linux distributions and
298with MinGW for Windows and which can easily be built from source on OS X and
299other Unix variants.
DRCce355e32011-06-24 04:58:01 +0000300
301You can override the ICONV_LIBRARIES and LIBINTL_LIBRARY CMake variables to
302specify the locations of libiconv and libintl, respectively. For instance,
303adding
304
305 -DLIBINTL_LIBRARY=/opt/gettext/lib/libintl.a
306
307to the CMake command line would link TigerVNC against a static version of
308libintl located under /opt/gettext. Adding
309
310 -DICONV_INCLUDE_DIR=/mingw/include \
311 -DICONV_LIBRARIES=/mingw/lib/libiconv.a \
312 -DGETTEXT_INCLUDE_DIR=/mingw/include \
313 -DLIBINTL_LIBRARY=/mingw/lib/libintl.a
314
315to the CMake command line would link TigerVNC against the static versions of
316libiconv and libintl included in the MinGW Developer Toolkit.
317
318
DRC180c0162010-10-27 07:20:27 +0000319===================
320Installing TigerVNC
321===================
322
323You can use the build system to install TigerVNC into a directory of your
DRC667df922011-06-23 10:11:22 +0000324choosing. To do this, add:
DRC180c0162010-10-27 07:20:27 +0000325
326 -DCMAKE_INSTALL_PREFIX={install_directory}
327
DRCccc09692011-11-08 06:57:58 +0000328to the CMake command line. Then, you can run 'make install' to build and
329install it.
DRC180c0162010-10-27 07:20:27 +0000330
331If you don't specify CMAKE_INSTALL_PREFIX, then the default is
DRC667df922011-06-23 10:11:22 +0000332c:\Program Files\TigerVNC on Windows and /usr/local on Unix.
DRC180c0162010-10-27 07:20:27 +0000333
334
DRC667df922011-06-23 10:11:22 +0000335=========================
336Creating Release Packages
337=========================
338
339The following commands can be used to create various types of release packages:
340
341
342Unix
343----
344
DRC667df922011-06-23 10:11:22 +0000345make tarball
346
347 Create a binary tarball containing the TigerVNC Viewer
348
349make servertarball
350
351 Create a binary tarball containing both the TigerVNC Server and Viewer
352
353make dmg
354
DRCaab38302011-06-25 20:24:02 +0000355 Create Macintosh disk image file that contains an application bundle of the
356 TigerVNC Viewer
DRC667df922011-06-23 10:11:22 +0000357
DRCaab38302011-06-25 20:24:02 +0000358make udmg
DRC667df922011-06-23 10:11:22 +0000359
360 On 64-bit OS X systems, this creates a version of the Macintosh package and
361 disk image which contains universal i386/x86-64 binaries. You should first
362 configure a 32-bit out-of-tree build of TigerVNC, then configure a 64-bit
363 out-of-tree build, then run 'make udmg' from the 64-bit build directory. The
364 build system will look for the 32-bit build under {source_directory}/osxx86
DRCaab38302011-06-25 20:24:02 +0000365 by default, but you can override this by setting the OSX_X86_BUILD CMake
366 variable to the directory containing your configured 32-bit build. Either
367 the 64-bit or 32-bit build can be configured to be backward compatible by
368 using the instructions in the "Build Recipes" section.
DRC667df922011-06-23 10:11:22 +0000369
370
371Windows
372-------
373
DRCccc09692011-11-08 06:57:58 +0000374make installer
DRC667df922011-06-23 10:11:22 +0000375
DRCccc09692011-11-08 06:57:58 +0000376 Create a Windows installer using Inno Setup. The installer package
377 (TigerVNC[64].exe) will be located under {build_directory}.
DRC667df922011-06-23 10:11:22 +0000378
379
380=============
381Build Recipes
382=============
383
384
38532-bit Build on 64-bit Linux/Unix (including OS X)
386--------------------------------------------------
387
DRCdc4f3542011-08-24 00:30:49 +0000388Set the following environment variables before building TigerVNC.
DRC667df922011-06-23 10:11:22 +0000389
390 CFLAGS='-O3 -m32'
391 CXXFLAGS='-O3 -m32'
392 LDFLAGS=-m32
393
DRCdc4f3542011-08-24 00:30:49 +0000394If you are building the TigerVNC Server on a modern Unix/Linux system, then
395you will also need to pass the appropriate --host argument when configuring the
396X server source (for instance, --host=i686-pc-linux-gnu).
397
DRC667df922011-06-23 10:11:22 +0000398
39964-bit Backward-Compatible Build on 64-bit OS X
400-----------------------------------------------
401
402Add
403
404 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk \
405 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.5
406
407to the CMake command line. The OS X 10.5 SDK must be installed.
408
409
41032-bit Backward-Compatible Build on 64-bit OS X
411-----------------------------------------------
412
413Set the following environment variables:
414
415 CC=gcc-4.0
416 CXX=g++-4.0
417 CFLAGS='-O3 -m32'
418 CXXFLAGS='-O3 -m32'
419 LDFLAGS=-m32
420
421and add
422
423 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk \
424 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.4
425
426to the CMake command line. The OS X 10.4 SDK must be installed.
DRC180c0162010-10-27 07:20:27 +0000427
428
42964-bit MinGW Build on Cygwin
430----------------------------
431
432 cd {build_directory}
433 CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ \
434 RC=/usr/bin/x86_64-w64-mingw32-windres \
435 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
436 -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
437 -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
438 make
439
440This produces a 64-bit build of TigerVNC that does not depend on cygwin1.dll or
441other Cygwin DLL's. The mingw64-x86_64-gcc-core and mingw64-x86_64-gcc-g++
442packages (and their dependencies) must be installed.
443
444
44532-bit MinGW Build on Cygwin
446----------------------------
447
448 cd {build_directory}
449 CC=/usr/bin/i686-w64-mingw32-gcc CXX=/usr/bin/i686-w64-mingw32-g++ \
450 RC=/usr/bin/i686-w64-mingw32-windres \
451 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
452 -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
453 -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
454 make
455
456This produces a 32-bit build of TigerVNC that does not depend on cygwin1.dll or
457other Cygwin DLL's. The mingw64-i686-gcc-core and mingw64-i686-gcc-g++
458packages (and their dependencies) must be installed.
459
460
461MinGW-w64 Build on Windows
462--------------------------
463
464This produces a 64-bit build of TigerVNC using the "native" MinGW-w64 toolchain
465(which is faster than the Cygwin version):
466
467 cd {build_directory}
468 CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
469 CXX={mingw-w64_binary_path}/x86_64-w64-mingw32-g++ \
470 RC={mingw-w64_binary_path}/x86_64-w64-mingw32-windres \
471 cmake -G "MSYS Makefiles" \
472 -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
473 -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
474 {source_directory}
475 make
476
477
478MinGW Build on Linux
479--------------------
480
481 cd {build_directory}
482 CC={mingw_binary_path}/i386-mingw32-gcc \
483 CXX={mingw_binary_path}/i386-mingw32-g++ \
484 RC={mingw_binary_path}/i386-mingw32-windres \
485 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
486 -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
487 -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
488 {source_directory}
489 make
Brian Hinz1ff04d12013-11-28 16:26:08 +0000490
491
492===============================
493Distribution-Specific Packaging
494===============================
495
496
497RPM Packages for RHEL / CentOS
498------------------------------
499
500The RPM spec files and patches used to create the nightly builds
501and releases can be found in the "contrib/rpm/el{5,6}" directories
502of the TigerVNC subversion trunk. All external source tarballs
503must be fetched manually and placed into the 'SOURCES' directory
504under the rpmbuild root. Additonally, the following macros need
505to be defined:
506
507 EL6:
508 %debug_package %{nil}
509
510 EL5:
511 %dist .el5
512 %_smp_mflags -j3
513 %debug_package %{nil}
514 %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
515
516
517Debian packages for Ubuntu 12.04LTS
518-----------------------------------
519The debian folder used to create the nightly builds and releases
520can be found in the "contrib/deb/ubuntu-precise" directory of the
521TigerVNC subversion trunk.