summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/turbovnc-custom-paths.patch
blob: 563009c9271b8db747db211b075bbbdc35db2f7d (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
From c58cdb2b7fe72685f97dee5872336f32a40fa04a Mon Sep 17 00:00:00 2001
From: DRC <information@virtualgl.org>
Date: Tue, 23 Aug 2022 12:02:12 -0500
Subject: [PATCH] Improve support for distribution-specific builds

- Rename the DRI_DRIVER_PATH and SERVER_MISC_CONFIG_PATH CMake variables
  to XORG_DRI_DRIVER_PATH and XORG_REGISTRY_PATH, respectively.

- Introduce a new CMake variable (XORG_FONT_PATH) that allows the X.org
  font path to be set statically for a particular build.

- Remove the unused RGB_DB macro definition.  (That macro hasn't been
  used since TurboVNC 1.2.x.)

- Introduce a new CMake variable (TVNC_STATIC_XORG_PATHS) that forces
  Xvnc and vncserver to honor the paths set using the
  XKB_BASE_DIRECTORY, XKB_BIN_DIRECTORY, XORG_DRI_DRIVER_PATH,
  XORG_FONT_PATH, and XORG_REGISTRY_PATH CMake variables rather than
  trying to determine the appropriate values of those paths at run time.
  If enabled, this option disables the TurboVNC-specific -dridir,
  -registrydir, and -xkbcompdir Xvnc command-line arguments.
---
 BUILDING.md                                   | 25 +++++++++++++++++++
 unix/CMakeLists.txt                           |  9 +++++++
 unix/Xvnc/programs/Xserver/dix/CMakeLists.txt | 20 +++++++++------
 unix/Xvnc/programs/Xserver/dix/registry.c     |  2 +-
 unix/Xvnc/programs/Xserver/glx/CMakeLists.txt | 12 ++++-----
 unix/Xvnc/programs/Xserver/glx/glxdricommon.c |  2 +-
 unix/Xvnc/programs/Xserver/hw/vnc/init.c      | 10 +++++++-
 unix/Xvnc/programs/Xserver/xkb/xkbInit.c      |  2 +-
 unix/vncserver.in                             | 13 +++++++---
 9 files changed, 73 insertions(+), 22 deletions(-)

diff --git a/BUILDING.md b/BUILDING.md
index 99f190b2c..b11665f95 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -181,6 +181,31 @@ directly with libssl and libcrypto by adding `-DTVNC_DLOPENSSL=0` to the CMake
 command line.
 
 
+### Distribution-Specific Build
+
+By default, the build system builds TurboVNC binaries that can run on multiple
+O/S distributions.  This involves building some of the X.org dependencies,
+which are included in the TurboVNC source tree, and statically linking TurboVNC
+with those and other dependencies.  Distribution-specific dynamically-linked
+TurboVNC binaries can instead be built by changing the values of the following
+CMake variables:
+
+- `TJPEG_INCLUDE_DIR`
+- `TJPEG_LIBRARY`
+- `TVNC_DLOPENSSL`
+- `TVNC_STATIC_XORG_PATHS`
+- `TVNC_SYSTEMLIBS`
+- `TVNC_SYSTEMX11`
+- `XKB_BASE_DIRECTORY`
+- `XKB_BIN_DIRECTORY`
+- `XORG_DRI_DRIVER_PATH`
+- `XORG_FONT_PATH`
+- `XORG_REGISTRY_PATH`
+
+Use `ccmake` or `cmake-gui`, as described below, to view documentation for
+those variables.
+
+
 Build Recipes
 -------------
 
diff --git a/unix/CMakeLists.txt b/unix/CMakeLists.txt
index 1db927c94..6ef830a8b 100644
--- a/unix/CMakeLists.txt
+++ b/unix/CMakeLists.txt
@@ -74,6 +74,15 @@ option(TVNC_SYSTEMLIBS
 boolean_number(TVNC_SYSTEMLIBS)
 report_option(TVNC_SYSTEMLIBS "System zlib/bzip2/FreeType")
 
+option(TVNC_STATIC_XORG_PATHS
+	"Force vncserver and Xvnc to use the XKB base directory, XKB binary directory, X.org DRI driver path, X.org font path, and X.org registry path specified in the XKB_BASE_DIRECTORY, XKB_BIN_DIRECTORY, XORG_DRI_DRIVER_PATH, XORG_FONT_PATH, and XORG_REGISTRY_PATH CMake variables rather than detecting the appropriate paths at run time"
+	OFF)
+boolean_number(TVNC_STATIC_XORG_PATHS)
+report_option(TVNC_STATIC_XORG_PATHS "Static X.org paths")
+if(TVNC_STATIC_XORG_PATHS)
+	add_definitions(-DTURBOVNC_STATIC_XORG_PATHS)
+endif()
+
 if(NOT TVNC_SYSTEMLIBS)
 	add_subdirectory(${CMAKE_SOURCE_DIR}/common ${CMAKE_BINARY_DIR}/common)
 endif()
diff --git a/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt b/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt
index 784fc48d2..19a7b28c4 100644
--- a/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt
+++ b/unix/Xvnc/programs/Xserver/dix/CMakeLists.txt
@@ -1,18 +1,22 @@
 include_directories(../Xi ../composite ../damageext ../mi ../miext/sync
 	../randr ../render ../xfixes)
 
-add_definitions(-DRGB_DB=\"/usr/share/X11/rgb\"
-	-DCOMPILEDDEFAULTFONTPATH=\"/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,/usr/share/X11/fonts/100dpi/\")
+set(DEFAULT_XORG_FONT_PATH
+	"/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,/usr/share/X11/fonts/100dpi/")
+set(XORG_FONT_PATH ${DEFAULT_XORG_FONT_PATH} CACHE STRING
+	"X.org font path (default: ${DEFAULT_XORG_FONT_PATH})")
+message(STATUS "XORG_FONT_PATH = ${XORG_FONT_PATH}")
+add_definitions(-DCOMPILEDDEFAULTFONTPATH=\"${XORG_FONT_PATH}\")
 
 if(BITS EQUAL 64)
-	set(DEFAULT_SERVER_MISC_CONFIG_PATH "/usr/lib64/xorg")
+	set(DEFAULT_XORG_REGISTRY_PATH "/usr/lib64/xorg")
 else()
-	set(DEFAULT_SERVER_MISC_CONFIG_PATH "/usr/lib/xorg")
+	set(DEFAULT_XORG_REGISTRY_PATH "/usr/lib/xorg")
 endif()
-set(SERVER_MISC_CONFIG_PATH ${DEFAULT_SERVER_MISC_CONFIG_PATH} CACHE PATH
-	"Path to miscellaneous server config files (default: ${DEFAULT_SERVER_MISC_CONFIG_PATH})")
-message(STATUS "SERVER_MISC_CONFIG_PATH = ${SERVER_MISC_CONFIG_PATH}")
-add_definitions(-DSERVER_MISC_CONFIG_PATH=\"${SERVER_MISC_CONFIG_PATH}\")
+set(XORG_REGISTRY_PATH ${DEFAULT_XORG_REGISTRY_PATH} CACHE PATH
+	"X.org registry path, which contains protocol.txt (default: ${DEFAULT_XORG_REGISTRY_PATH})")
+message(STATUS "XORG_REGISTRY_PATH = ${XORG_REGISTRY_PATH}")
+add_definitions(-DSERVER_MISC_CONFIG_PATH=\"${XORG_REGISTRY_PATH}\")
 
 disable_compiler_warnings()
 
diff --git a/unix/Xvnc/programs/Xserver/dix/registry.c b/unix/Xvnc/programs/Xserver/dix/registry.c
index de4bf8eaf..3e8039250 100644
--- a/unix/Xvnc/programs/Xserver/dix/registry.c
+++ b/unix/Xvnc/programs/Xserver/dix/registry.c
@@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #ifdef X_REGISTRY_REQUEST
 #define CORE "X11"
-#ifdef TURBOVNC
+#if defined(TURBOVNC) && !defined(TURBOVNC_STATIC_XORG_PATHS)
 char registry_path[PATH_MAX] = SERVER_MISC_CONFIG_PATH "/protocol.txt";
 #define FILENAME registry_path
 #else
diff --git a/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt b/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt
index 45f4b9635..ff8b84f6c 100644
--- a/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt
+++ b/unix/Xvnc/programs/Xserver/glx/CMakeLists.txt
@@ -10,14 +10,14 @@ if(HAVE_BACKTRACE)
 endif()
 
 if(BITS EQUAL 64)
-	set(DEFAULT_DRI_DRIVER_PATH "/usr/lib64/dri")
+	set(DEFAULT_XORG_DRI_DRIVER_PATH "/usr/lib64/dri")
 else()
-	set(DEFAULT_DRI_DRIVER_PATH "/usr/lib/dri")
+	set(DEFAULT_XORG_DRI_DRIVER_PATH "/usr/lib/dri")
 endif()
-set(DRI_DRIVER_PATH ${DEFAULT_DRI_DRIVER_PATH} CACHE PATH
-	"Path to DRI drivers (default: ${DEFAULT_DRI_DRIVER_PATH})")
-message(STATUS "DRI_DRIVER_PATH = ${DRI_DRIVER_PATH}")
-add_definitions(-DDRI_DRIVER_PATH=\"${DRI_DRIVER_PATH}\")
+set(XORG_DRI_DRIVER_PATH ${DEFAULT_XORG_DRI_DRIVER_PATH} CACHE PATH
+	"X.org DRI driver path, which contains swrast_dri.so (default: ${DEFAULT_XORG_DRI_DRIVER_PATH})")
+message(STATUS "XORG_DRI_DRIVER_PATH = ${XORG_DRI_DRIVER_PATH}")
+add_definitions(-DDRI_DRIVER_PATH=\"${XORG_DRI_DRIVER_PATH}\")
 
 disable_compiler_warnings()
 
diff --git a/unix/Xvnc/programs/Xserver/glx/glxdricommon.c b/unix/Xvnc/programs/Xserver/glx/glxdricommon.c
index be9352b5e..a16e1bcf9 100644
--- a/unix/Xvnc/programs/Xserver/glx/glxdricommon.c
+++ b/unix/Xvnc/programs/Xserver/glx/glxdricommon.c
@@ -258,7 +258,7 @@ glxConvertConfigs(const __DRIcoreExtension * core,
     return head.next;
 }
 
-#ifdef TURBOVNC
+#if defined(TURBOVNC) && !defined(TURBOVNC_STATIC_XORG_PATH)
 char *dri_driver_path = DRI_DRIVER_PATH;
 #else
 static const char dri_driver_path[] = DRI_DRIVER_PATH;
diff --git a/unix/Xvnc/programs/Xserver/hw/vnc/init.c b/unix/Xvnc/programs/Xserver/hw/vnc/init.c
index 81fbfe8b5..c8ba83772 100644
--- a/unix/Xvnc/programs/Xserver/hw/vnc/init.c
+++ b/unix/Xvnc/programs/Xserver/hw/vnc/init.c
@@ -103,7 +103,7 @@ from the X Consortium.
 #ifdef GLXEXT
 extern char *dri_driver_path;
 #endif
-#ifdef X_REGISTRY_REQUEST
+#if defined(X_REGISTRY_REQUEST) && !defined(TURBOVNC_STATIC_XORG_PATHS)
 extern char registry_path[PATH_MAX];
 #endif
 
@@ -437,6 +437,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
     return 2;
   }
 
+#ifndef TURBOVNC_STATIC_XORG_PATHS
   if (strcasecmp(argv[i], "-dridir") == 0) {
 #ifdef GLXEXT
     REQUIRE_ARG();
@@ -444,6 +445,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
 #endif
     return 2;
   }
+#endif
 
   if (strcasecmp(argv[i], "-geometry") == 0) {
     /* -geometry WxH or W0xH0+X0+Y0[,W1xH1+X1+Y1,...] */
@@ -644,6 +646,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
 
   /***** TurboVNC miscellaneous options *****/
 
+#ifndef TURBOVNC_STATIC_XORG_PATHS
   if (strcasecmp(argv[i], "-registrydir") == 0) {
 #ifdef X_REGISTRY_REQUEST
     REQUIRE_ARG();
@@ -651,6 +654,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
 #endif
     return 2;
   }
+#endif
 
   if (strcasecmp(argv[i], "-verbose") == 0) {
     LogSetParameter(XLOG_VERBOSITY, X_DEBUG);
@@ -1672,7 +1676,9 @@ void ddxUseMsg(void)
   ErrorF("\nTurboVNC display options\n");
   ErrorF("========================\n");
   ErrorF("-depth D               set framebuffer depth\n");
+#ifndef TURBOVNC_STATIC_XORG_PATHS
   ErrorF("-dridir dir            specify directory containing the swrast Mesa driver\n");
+#endif
   ErrorF("-geometry WxH          set framebuffer width & height (single-screen)\n");
   ErrorF("-geometry W0xH0+X0+Y0[,W1xH1+X1+Y1,...,WnxHn+Xn+Yn]\n");
   ErrorF("                       set multi-screen geometry (see man page)\n");
@@ -1730,7 +1736,9 @@ void ddxUseMsg(void)
 
   ErrorF("\nTurboVNC miscellaneous options\n");
   ErrorF("==============================\n");
+#ifndef TURBOVNC_STATIC_XORG_PATHS
   ErrorF("-registrydir dir       specify directory containing protocol.txt\n");
+#endif
   ErrorF("-verbose               print all X.org errors, warnings, and messages\n");
   ErrorF("-version               report Xvnc version on stderr\n\n");
 }
diff --git a/unix/Xvnc/programs/Xserver/xkb/xkbInit.c b/unix/Xvnc/programs/Xserver/xkb/xkbInit.c
index b63549f3d..ddd5ef7f2 100644
--- a/unix/Xvnc/programs/Xserver/xkb/xkbInit.c
+++ b/unix/Xvnc/programs/Xserver/xkb/xkbInit.c
@@ -767,7 +767,7 @@ XkbProcessArguments(int argc, char *argv[], int i)
             return -1;
         }
     }
-#ifdef TURBOVNC
+#if defined(TURBOVNC) && !defined(TURBOVNC_XORG_STATIC_PATHS)
     else if (strncmp(argv[i], "-xkbcompdir", 11) == 0) {
         if (++i < argc) {
 #if !defined(WIN32) && !defined(__CYGWIN__)
diff --git a/unix/vncserver.in b/unix/vncserver.in
index 4ed8ef668..300ccbf88 100644
--- a/unix/vncserver.in
+++ b/unix/vncserver.in
@@ -38,6 +38,7 @@ if ($slashndx >= 0) {
 
 $xauth = "xauth";
 $buildWebServer = @TVNC_BUILDWEBSERVER@;
+$staticXorgPaths = @TVNC_STATIC_XORG_PATHS@;
 
 &SanityCheck();
 
@@ -98,6 +99,8 @@ unless ($xauthorityFile) {
 chop($host = `uname -n`);
 chop($os = `uname`);
 
+if (!$staticXorgPaths) {
+
 if (-d "/etc/X11/fontpath.d") {
   $fontPath = "catalogue:/etc/X11/fontpath.d";
 }
@@ -195,6 +198,8 @@ foreach $_registrydir (@registrydirs) {
   }
 }
 
+} # !$staticXorgPaths
+
 # Check command line options
 
 &ParseOptions("-geometry", 1, "-depth", 1, "-pixelformat", 1, "-name", 1,
@@ -447,11 +452,11 @@ $cmd .= " -rfbport $vncPort";
 $cmd .= " -fp $fontPath" if ($fontPath);
 $cmd .= " -alr ".$autoLosslessRefresh if ($autoLosslessRefresh > 0.0);
 $cmd .= " -deferupdate $deferUpdate";
-$cmd .= " -xkbdir $xkbdir" if ($xkbdir);
-$cmd .= " -xkbcompdir $xkbcompdir" if ($xkbcompdir);
+$cmd .= " -xkbdir $xkbdir" if ($xkbdir && !$staticXorgPaths);
+$cmd .= " -xkbcompdir $xkbcompdir" if ($xkbcompdir && !$staticXorgPaths);
 $cmd .= " -pamsession" if ($pamSession);
-$cmd .= " -dridir $dridir" if ($dridir);
-$cmd .= " -registrydir $registrydir" if ($registrydir);
+$cmd .= " -dridir $dridir" if ($dridir && !$staticXorgPaths);
+$cmd .= " -registrydir $registrydir" if ($registrydir && !$staticXorgPaths);
 $cmd .= " -nomt" if (!$multiThread);
 $cmd .= " -nthreads $numThreads" if ($numThreads);
 $cmd .= " $serverArgs" if ($serverArgs);