VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/Makefile.kmk@ 102032

Last change on this file since 102032 was 102032, checked in by vboxsync, 13 months ago

Additions: X11/Wayland: Fix build when shared clipboard support is disabled, bugref:10194.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.2 KB
Line 
1# $Id: Makefile.kmk 102032 2023-11-09 12:59:11Z vboxsync $
2## @file
3# Sub-Makefile for the VirtualBox Guest Addition X11 Client.
4#
5
6#
7# Copyright (C) 2006-2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28SUB_DEPTH = ../../../../..
29include $(KBUILD_PATH)/subheader.kmk
30
31# Use header files from our tree for randr and xinerama. and don't link but rather dlopen libXrand
32# This is mostly because the GA build boxes can have a very old xrandr lib, so instead of linking we dlopen.
33VBOX_WITH_DISTRO_XRAND_XINERAMA =
34
35# We want to lazy load as much stuff as possible. See #10427.
36VBOX_WITH_VBOXCLIENT_LAZY_LOAD := 1
37
38# We don't yet have a seamless mode compilation flag, so define it here unconditionally.
39VBOX_WITH_SEAMLESS := 1
40
41#
42# VBoxClient - clipboard and seamless.
43#
44PROGRAMS += VBoxClient
45#
46# Please make sure that you grep the source tree and modify all occurences accordingly
47# if you rename the following program name.
48#
49PROGRAMS.linux += VBoxDRMClient
50
51ifdef VBOX_WITH_WAYLAND_ADDITIONS
52 PROGRAMS.linux += vboxwl
53endif
54
55# Common Guest / Host sources.
56VBOX_GH_SOURCES := \
57 $(PATH_ROOT)/src/VBox/GuestHost/DisplayServerType.cpp
58
59VBoxClient_TEMPLATE = VBoxGuestR3Exe
60VBoxClient_DEFS += VBOX_X11_CLIPBOARD VBOX_WITH_HGCM
61ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
62 VBoxClient_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
63else
64 VBoxClient_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
65endif
66ifdef VBOX_WITH_DBUS
67 VBoxClient_DEFS += VBOX_WITH_DBUS
68endif
69
70VBoxClient_DEFS.linux += _GNU_SOURCE
71VBoxClient_INCS = $(VBOX_GRAPHICS_INCS)
72VBoxClient_INCS += ../x11include/panoramiXproto-1.1
73VBoxClient_INCS += ../x11include/libXrandr-1.5.2
74VBoxClient_INCS += ../x11include/randrproto-1.5.0
75VBoxClient_SOURCES = \
76 main.cpp \
77 logging.cpp
78
79
80VBoxClient_SOURCES += $(VBOX_GH_SOURCES)
81
82VBoxDRMClient_TEMPLATE = VBoxGuestR3Exe
83ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
84 VBoxDRMClient_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
85else
86 VBoxDRMClient_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
87endif
88VBoxDRMClient_SOURCES = \
89 display-drm.cpp \
90 display-ipc.cpp \
91 logging.cpp
92VBoxDRMClient_SOURCES += $(VBOX_GH_SOURCES)
93
94VBoxClient_SOURCES.linux = \
95 chk_stubs.c
96VBoxClient_LIBPATH = \
97 $(VBOX_LIBPATH32_X11)
98VBoxClient_LIBS.freebsd = \
99 iconv
100VBoxClient_LIBS.linux = \
101 dl
102VBoxClient_LIBS.netbsd = \
103 crypt
104VBoxClient_LIBS.solaris = \
105 dl
106ifndef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
107 VBoxClient_LIBS = \
108 X11 Xt Xext Xmu
109endif
110ifdef VBOX_WITH_DISTRO_XRAND_XINERAMA
111 VBoxClient_DEFS += WITH_DISTRO_XRAND_XINERAMA
112 ifndef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
113 VBoxClient_LIBS += Xrandr
114 endif
115endif
116
117# XXX: -L comes from the template, but not rpath
118VBoxClient_LDFLAGS.netbsd = \
119 -Wl,-rpath /usr/X11R7/lib
120
121ifdef VBOX_WITH_DRAG_AND_DROP
122 ifdef VBOX_DND_WITH_XTEST
123 VBoxClient_DEFS += VBOX_DND_WITH_XTEST
124 VBoxClient_LIBS += \
125 Xtst
126 endif
127endif
128
129# This forces the memcpy references in the static libraries to go to
130# __wrap_memcpy, which we can wrap around memcpy@GLIBC_2.2.5. I do not know
131# how else to do that without recompiling or implementing our own memcpy.
132ifeq ($(KBUILD_TARGET),linux)
133 VBoxClient_LDFLAGS.amd64 += \
134 -Wl,--wrap=memcpy
135endif
136
137ifdef VBOX_WITH_GUEST_PROPS
138 VBoxClient_DEFS += VBOX_WITH_GUEST_PROPS
139 VBoxClient_SOURCES += \
140 hostversion.cpp
141 VBoxDRMClient_DEFS += VBOX_WITH_GUEST_PROPS
142endif
143
144ifdef VBOX_WITH_DRAG_AND_DROP
145 VBoxClient_DEFS += \
146 VBOX_WITH_DRAG_AND_DROP \
147 $(if $(VBOX_WITH_DRAG_AND_DROP_GH),VBOX_WITH_DRAG_AND_DROP_GH,)
148 VBoxClient_SOURCES += \
149 draganddrop.cpp \
150 draganddrop-x11.cpp
151 VBoxClient_LIBS += \
152 $(VBOX_LIB_VBGL_R3) \
153 $(PATH_STAGE_LIB)/additions/VBoxDnDGuestR3Lib$(VBOX_SUFF_LIB)
154endif
155
156ifdef VBOX_WITH_SEAMLESS
157 VBoxClient_DEFS += VBOX_WITH_SEAMLESS
158 VBoxClient_SOURCES += \
159 seamless.cpp \
160 seamless-x11.cpp
161endif
162
163ifdef VBOX_WITH_VMSVGA
164 VBoxClient_DEFS += VBOX_WITH_VMSVGA
165 VBoxClient_SOURCES += \
166 display.cpp \
167 display-svga-x11.cpp \
168 display-svga-xf86cvt.cpp
169 VBoxClient_SOURCES.linux += \
170 display-svga-session.cpp \
171 display-ipc.cpp \
172 display-helper-gnome3.cpp \
173 display-helper-generic.cpp
174
175 ### include $(PATH_SUB_CURRENT)/helpers/Makefile.kmk
176endif
177
178ifdef VBOX_WITH_SHARED_CLIPBOARD
179 VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD
180 VBoxClient_SOURCES += \
181 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp \
182 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp \
183 clipboard.cpp \
184 clipboard-common.cpp \
185 clipboard-x11.cpp
186 ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
187 VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS VBOX_WITH_SHARED_CLIPBOARD_GUEST
188 VBoxClient_SOURCES += \
189 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp \
190 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardPath.cpp \
191 $(PATH_ROOT)/src/VBox/GuestHost/common/mime-type-converter.cpp
192 ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS_HTTP
193 VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS_HTTP
194 VBoxClient_SOURCES += \
195 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-http.cpp
196 endif
197 endif
198 ifdef VBOX_WITH_WAYLAND_ADDITIONS
199 VBoxClient_DEFS += VBOX_WITH_WAYLAND_ADDITIONS
200 VBoxClient_INCS += ../wlInclude/
201 VBoxClient_SOURCES += \
202 wayland-helper-dcp.cpp \
203 wayland-helper-gtk.cpp \
204 wayland-helper.cpp \
205 wayland.cpp \
206 wayland-helper-ipc.cpp \
207 ../wlInclude/wayland-protocol.c \
208 ../wlInclude/wlr-data-control-unstable-v1.c
209 endif
210endif
211
212ifdef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
213 # Macro for generating the lazy loading assembly stub loader for a specific .def file.
214 #
215 # @param 1 Absolute path of the .def file to use as a template.
216 # @param 2 The library name w/o suffix (e.g. "libFoo").
217 # @param 3 The library version, to be appended to the library .so name (e.g. "6.42" -> "libFoo.so.6.42").
218 define def_libToLazyLoad
219 VBoxClient_SOURCES += \
220 $$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm
221 VBoxClient_CLEAN += \
222 $$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm
223 $$$$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm: $$(PATH_ROOT)/src/VBox/GuestHost/$(2).def $(VBOX_DEF_2_LAZY_LOAD) | $$$$(dir $$@)
224 $$(call MSG_TOOL,VBoxDef2LazyLoad,$$(PATH_ROOT)/src/VBox/GuestHost/$(2).def,$$@)
225 $$(eval VBOX_VBOXCLIENT_LIB_TO_LAZYLOAD_SUFF=$$$$(if $(3),$(SUFF_DLL).$(3),$(SUFF_DLL)))
226 $$(QUIET)$$(RM) -f -- "$$@"
227 $$(VBOX_DEF_2_LAZY_LOAD) --system --library $(2)$$(VBOX_VBOXCLIENT_LIB_TO_LAZYLOAD_SUFF) --output "$$@" $$(PATH_ROOT)/src/VBox/GuestHost/$(2).def
228 endef # VBOXCLIENT_LAZYLOAD_GEN_ASM_FN
229
230 VBoxClient_DEFS += VBOX_WITH_VBOXCLIENT_LAZY_LOAD
231
232 # Define library versions to use, depending on the OS we build for.
233 # Note: Solaris does *not* have any of those libs with a version suffix, so simply keep those empty (= unset) then.
234 if1of ($(KBUILD_TARGET), linux)
235 VBOX_VBOXCLIENT_LIBX11_VER = 6
236 VBOX_VBOXCLIENT_LIBXT_VER = 6
237 VBOX_VBOXCLIENT_LIBXMU_VER = 6
238 VBOX_VBOXCLIENT_LIBXRANDR_VER = 2
239 VBOX_VBOXCLIENT_LIBWAYLANDCLIENT_VER = 0
240 endif
241 ## Dynamic import no. 1: libX11.so
242 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libX11.def,libX11,$(VBOX_VBOXCLIENT_LIBX11_VER))
243 ## Dynamic import no. 2: libXt.so
244 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXt.def,libXt,$(VBOX_VBOXCLIENT_LIBXT_VER))
245 ## Dynamic import no. 3: libXmu.so
246 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXmu.def,libXmu,$(VBOX_VBOXCLIENT_LIBXMU_VER))
247 ## Dynamic import no. 4: libXrandr.so
248 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXrandr.def,libXrandr,$(VBOX_VBOXCLIENT_LIBXRANDR_VER))
249 ## Dynamic import no. 5: libwayland-client.so
250 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libwayland-client.def,libwayland-client,$(VBOX_VBOXCLIENT_LIBWAYLANDCLIENT_VER))
251endif
252
253ifdef VBOX_WITH_WAYLAND_ADDITIONS
254 define def_libToLazyLoad2
255 vboxwl_SOURCES += \
256 $$(vboxwl_0_OUTDIR)/$(2)LazyLoad.asm
257 vboxwl_CLEAN += \
258 $$(vboxwl_0_OUTDIR)/$(2)LazyLoad.asm
259 $$$$(vboxwl_0_OUTDIR)/$(2)LazyLoad.asm: $$(PATH_ROOT)/src/VBox/GuestHost/$(2).def $(VBOX_DEF_2_LAZY_LOAD) | $$$$(dir $$@)
260 $$(call MSG_TOOL,VBoxDef2LazyLoad,$$(PATH_ROOT)/src/VBox/GuestHost/$(2).def,$$@)
261 $$(eval VBOX_VBOXWL_LIB_TO_LAZYLOAD_SUFF=$$$$(if $(3),$(SUFF_DLL).$(3),$(SUFF_DLL)))
262 $$(QUIET)$$(RM) -f -- "$$@"
263 $$(VBOX_DEF_2_LAZY_LOAD) --system --library $(2)$$(VBOX_VBOXWL_LIB_TO_LAZYLOAD_SUFF) --output "$$@" $$(PATH_ROOT)/src/VBox/GuestHost/$(2).def
264 endef
265
266 vboxwl_TEMPLATE = VBoxGuestR3Exe
267 vboxwl_DEFS += VBOX_WITH_SHARED_CLIPBOARD
268 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
269 vboxwl_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
270 else
271 vboxwl_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
272 endif
273 vboxwl_SOURCES = \
274 vboxwl.cpp \
275 logging.cpp \
276 clipboard-common.cpp \
277 wayland-helper-ipc.cpp \
278 wayland-helper.cpp \
279 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp \
280 $(PATH_ROOT)/src/VBox/GuestHost/common/mime-type-converter.cpp
281 vboxwl_SOURCES += $(VBOX_GH_SOURCES)
282
283 VBOX_VBOXWL_LIBWAYLANDCLIENT_VER = 0
284 VBOX_VBOXWL_LIBGTK3_VER = 0
285 VBOX_VBOXWL_LIBGIO20_VER = 0
286 VBOX_VBOXWL_LIBGOBJECT20_VER = 0
287 VBOX_VBOXWL_LIBGLIB20_VER = 0
288
289 ## Dynamic import no. 5: libwayland-client.so
290 $(evalcall2 def_libToLazyLoad2,$(PATH_ROOT)/src/VBox/GuestHost/libwayland-client.def,libwayland-client,$(VBOX_VBOXWL_LIBWAYLANDCLIENT_VER))
291 ## Dynamic import no. 6: libgtk-3.so
292 $(evalcall2 def_libToLazyLoad2,$(PATH_ROOT)/src/VBox/GuestHost/libgtk-3.def,libgtk-3,$(VBOX_VBOXWL_LIBGTK3_VER))
293 ## Dynamic import no. 7: libgio-2.0.so
294 $(evalcall2 def_libToLazyLoad2,$(PATH_ROOT)/src/VBox/GuestHost/libgio-2.0.def,libgio-2.0,$(VBOX_VBOXWL_LIBGIO20_VER))
295 ## Dynamic import no. 8: libgobject-2.0.so
296 $(evalcall2 def_libToLazyLoad2,$(PATH_ROOT)/src/VBox/GuestHost/libgobject-2.0.def,libgobject-2.0,$(VBOX_VBOXWL_LIBGOBJECT20_VER))
297 ## Dynamic import no. 9: libglib-2.0.so
298 $(evalcall2 def_libToLazyLoad2,$(PATH_ROOT)/src/VBox/GuestHost/libglib-2.0.def,libglib-2.0,$(VBOX_VBOXWL_LIBGLIB20_VER))
299endif
300
301if defined(VBOX_WITH_TESTCASES) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_SDK)
302 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
303
304 # Set this in LocalConfig.kmk if you are working on the X11 clipboard service
305 # to automatically run the unit test at build time.
306 # OTHERS += $(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto.run
307
308 PROGRAMS += tstSeamlessX11-auto
309 tstSeamlessX11-auto_TEMPLATE = VBoxR3TstExe
310 tstSeamlessX11-auto_SOURCES = \
311 testcase/tstSeamlessX11-auto.cpp \
312 seamless-x11.cpp
313 tstSeamlessX11-auto_DEFS = TESTCASE
314 tstSeamlessX11-auto_LIBS = \
315 $(LIB_RUNTIME)
316
317 TESTING += $(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto
318 $$(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto.run: \
319 $$(tstSeamlessX11-auto_1_STAGE_TARGET)
320 export VBOX_LOG_DEST=nofile; $(tstSeamlessX11-auto_1_STAGE_TARGET) quiet
321 $(QUIET)$(APPEND) -t "$@" "done"
322
323 #
324 # Additional testcase designed to be run manually, which initiates and starts the Linux
325 # guest client part of the seamless additions in the host, faking seamless events from
326 # the host and writing information about guest events to standard output.
327 #
328 PROGRAMS += tstSeamlessX11
329 tstSeamlessX11_TEMPLATE = VBoxR3TstExe
330 tstSeamlessX11_SOURCES = \
331 testcase/tstSeamlessX11.cpp \
332 seamless.cpp \
333 seamless-x11.cpp
334 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
335 tstSeamlessX11_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
336 else
337 tstSeamlessX11_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
338 endif
339 tstSeamlessX11_LIBPATH = \
340 $(VBOX_LIBPATH_X11)
341 tstSeamlessX11_LIBS = \
342 $(LIB_RUNTIME) \
343 Xext \
344 Xmu \
345 X11
346 endif
347endif
348
349include $(FILE_KBUILD_SUB_FOOTER)
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette