VirtualBox

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

Last change on this file since 101721 was 100585, checked in by vboxsync, 20 months ago

Additions/VBoxClient: Altering the .def files is not necessary, as VBoxDef2LazyLoad ignores the LIBRARY directive and uses the --library parameter for it instead. bugref:10427

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.5 KB
Line 
1# $Id: Makefile.kmk 100585 2023-07-14 14:43:03Z 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
51# Common Guest / Host sources.
52VBOX_GH_SOURCES := \
53 $(PATH_ROOT)/src/VBox/GuestHost/DisplayServerType.cpp
54
55VBoxClient_TEMPLATE = VBoxGuestR3Exe
56VBoxClient_DEFS += VBOX_X11_CLIPBOARD VBOX_WITH_HGCM
57ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
58 VBoxClient_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
59else
60 VBoxClient_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
61endif
62ifdef VBOX_WITH_DBUS
63 VBoxClient_DEFS += VBOX_WITH_DBUS
64endif
65
66VBoxClient_DEFS.linux += _GNU_SOURCE
67VBoxClient_INCS = $(VBOX_GRAPHICS_INCS)
68VBoxClient_INCS += ../x11include/panoramiXproto-1.1
69VBoxClient_INCS += ../x11include/libXrandr-1.5.2
70VBoxClient_INCS += ../x11include/randrproto-1.5.0
71VBoxClient_SOURCES = \
72 main.cpp \
73 logging.cpp
74
75ifdef VBOX_WITH_WAYLAND_ADDITIONS
76 VBoxClient_DEFS += VBOX_WITH_WAYLAND_ADDITIONS
77 VBoxClient_SOURCES += \
78 wayland-helper-dcp.cpp \
79 wayland-helper-gtk.cpp \
80 wayland.cpp
81endif
82
83VBoxClient_SOURCES += $(VBOX_GH_SOURCES)
84
85VBoxDRMClient_TEMPLATE = VBoxGuestR3Exe
86ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
87 VBoxDRMClient_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
88else
89 VBoxDRMClient_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
90endif
91VBoxDRMClient_SOURCES = \
92 display-drm.cpp \
93 display-ipc.cpp \
94 logging.cpp
95VBoxDRMClient_SOURCES += $(VBOX_GH_SOURCES)
96
97VBoxClient_SOURCES.linux = \
98 chk_stubs.c
99VBoxClient_LIBPATH = \
100 $(VBOX_LIBPATH32_X11)
101VBoxClient_LIBS.freebsd = \
102 iconv
103VBoxClient_LIBS.linux = \
104 dl
105VBoxClient_LIBS.netbsd = \
106 crypt
107VBoxClient_LIBS.solaris = \
108 dl
109ifndef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
110 VBoxClient_LIBS = \
111 X11 Xt Xext Xmu
112endif
113ifdef VBOX_WITH_DISTRO_XRAND_XINERAMA
114 VBoxClient_DEFS += WITH_DISTRO_XRAND_XINERAMA
115 ifndef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
116 VBoxClient_LIBS += Xrandr
117 endif
118endif
119
120# XXX: -L comes from the template, but not rpath
121VBoxClient_LDFLAGS.netbsd = \
122 -Wl,-rpath /usr/X11R7/lib
123
124ifdef VBOX_WITH_DRAG_AND_DROP
125 ifdef VBOX_DND_WITH_XTEST
126 VBoxClient_DEFS += VBOX_DND_WITH_XTEST
127 VBoxClient_LIBS += \
128 Xtst
129 endif
130endif
131
132# This forces the memcpy references in the static libraries to go to
133# __wrap_memcpy, which we can wrap around memcpy@GLIBC_2.2.5. I do not know
134# how else to do that without recompiling or implementing our own memcpy.
135ifeq ($(KBUILD_TARGET),linux)
136 VBoxClient_LDFLAGS.amd64 += \
137 -Wl,--wrap=memcpy
138endif
139
140ifdef VBOX_WITH_GUEST_PROPS
141 VBoxClient_DEFS += VBOX_WITH_GUEST_PROPS
142 VBoxClient_SOURCES += \
143 hostversion.cpp
144 VBoxDRMClient_DEFS += VBOX_WITH_GUEST_PROPS
145endif
146
147ifdef VBOX_WITH_DRAG_AND_DROP
148 VBoxClient_DEFS += \
149 VBOX_WITH_DRAG_AND_DROP \
150 $(if $(VBOX_WITH_DRAG_AND_DROP_GH),VBOX_WITH_DRAG_AND_DROP_GH,)
151 VBoxClient_SOURCES += \
152 draganddrop.cpp \
153 draganddrop-x11.cpp
154 VBoxClient_LIBS += \
155 $(VBOX_LIB_VBGL_R3) \
156 $(PATH_STAGE_LIB)/additions/VBoxDnDGuestR3Lib$(VBOX_SUFF_LIB)
157endif
158
159ifdef VBOX_WITH_SEAMLESS
160 VBoxClient_DEFS += VBOX_WITH_SEAMLESS
161 VBoxClient_SOURCES += \
162 seamless.cpp \
163 seamless-x11.cpp
164endif
165
166ifdef VBOX_WITH_VMSVGA
167 VBoxClient_DEFS += VBOX_WITH_VMSVGA
168 VBoxClient_SOURCES += \
169 display.cpp \
170 display-svga-x11.cpp \
171 display-svga-xf86cvt.cpp
172 VBoxClient_SOURCES.linux += \
173 display-svga-session.cpp \
174 display-ipc.cpp \
175 display-helper-gnome3.cpp \
176 display-helper-generic.cpp
177
178 ### include $(PATH_SUB_CURRENT)/helpers/Makefile.kmk
179endif
180
181ifdef VBOX_WITH_SHARED_CLIPBOARD
182 VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD
183 VBoxClient_SOURCES += \
184 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp \
185 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp \
186 clipboard.cpp \
187 clipboard-x11.cpp
188 ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
189 VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS VBOX_WITH_SHARED_CLIPBOARD_GUEST
190 VBoxClient_SOURCES += \
191 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp \
192 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardPath.cpp
193 ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS_HTTP
194 VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS_HTTP
195 VBoxClient_SOURCES += \
196 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-http.cpp
197 endif
198 endif
199endif
200
201ifdef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
202 # Macro for generating the lazy loading assembly stub loader for a specific .def file.
203 #
204 # @param 1 Absolute path of the .def file to use as a template.
205 # @param 2 The library name w/o suffix (e.g. "libFoo").
206 # @param 3 The library version, to be appended to the library .so name (e.g. "6.42" -> "libFoo.so.6.42").
207 define def_libToLazyLoad
208 VBoxClient_SOURCES += \
209 $$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm
210 VBoxClient_CLEAN += \
211 $$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm
212 $$$$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm: $$(PATH_ROOT)/src/VBox/GuestHost/$(2).def $(VBOX_DEF_2_LAZY_LOAD) | $$$$(dir $$@)
213 $$(call MSG_TOOL,VBoxDef2LazyLoad,$$(PATH_ROOT)/src/VBox/GuestHost/$(2).def,$$@)
214 $$(eval VBOX_VBOXCLIENT_LIB_TO_LAZYLOAD_SUFF=$$$$(if $(3),$(SUFF_DLL).$(3),$(SUFF_DLL)))
215 $$(QUIET)$$(RM) -f -- "$$@"
216 $$(VBOX_DEF_2_LAZY_LOAD) --system --library $(2)$$(VBOX_VBOXCLIENT_LIB_TO_LAZYLOAD_SUFF) --output "$$@" $$(PATH_ROOT)/src/VBox/GuestHost/$(2).def
217 endef # VBOXCLIENT_LAZYLOAD_GEN_ASM_FN
218
219 VBoxClient_DEFS += VBOX_WITH_VBOXCLIENT_LAZY_LOAD
220
221 # Define library versions to use, depending on the OS we build for.
222 # Note: Solaris does *not* have any of those libs with a version suffix, so simply keep those empty (= unset) then.
223 if1of ($(KBUILD_TARGET), linux)
224 VBOX_VBOXCLIENT_LIBX11_VER = 6
225 VBOX_VBOXCLIENT_LIBXT_VER = 6
226 VBOX_VBOXCLIENT_LIBXMU_VER = 6
227 VBOX_VBOXCLIENT_LIBXRANDR_VER = 2
228 endif
229 ## Dynamic import no. 1: libX11.so
230 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libX11.def,libX11,$(VBOX_VBOXCLIENT_LIBX11_VER))
231 ## Dynamic import no. 2: libXt.so
232 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXt.def,libXt,$(VBOX_VBOXCLIENT_LIBXT_VER))
233 ## Dynamic import no. 3: libXmu.so
234 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXmu.def,libXmu,$(VBOX_VBOXCLIENT_LIBXMU_VER))
235 ## Dynamic import no. 4: libXrandr.so
236 $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXrandr.def,libXrandr,$(VBOX_VBOXCLIENT_LIBXRANDR_VER))
237endif
238
239if defined(VBOX_WITH_TESTCASES) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_SDK)
240 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
241
242 # Set this in LocalConfig.kmk if you are working on the X11 clipboard service
243 # to automatically run the unit test at build time.
244 # OTHERS += $(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto.run
245
246 PROGRAMS += tstSeamlessX11-auto
247 tstSeamlessX11-auto_TEMPLATE = VBoxR3TstExe
248 tstSeamlessX11-auto_SOURCES = \
249 testcase/tstSeamlessX11-auto.cpp \
250 seamless-x11.cpp
251 tstSeamlessX11-auto_DEFS = TESTCASE
252 tstSeamlessX11-auto_LIBS = \
253 $(LIB_RUNTIME)
254
255 TESTING += $(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto
256 $$(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto.run: \
257 $$(tstSeamlessX11-auto_1_STAGE_TARGET)
258 export VBOX_LOG_DEST=nofile; $(tstSeamlessX11-auto_1_STAGE_TARGET) quiet
259 $(QUIET)$(APPEND) -t "$@" "done"
260
261 #
262 # Additional testcase designed to be run manually, which initiates and starts the Linux
263 # guest client part of the seamless additions in the host, faking seamless events from
264 # the host and writing information about guest events to standard output.
265 #
266 PROGRAMS += tstSeamlessX11
267 tstSeamlessX11_TEMPLATE = VBoxR3TstExe
268 tstSeamlessX11_SOURCES = \
269 testcase/tstSeamlessX11.cpp \
270 seamless.cpp \
271 seamless-x11.cpp
272 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
273 tstSeamlessX11_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
274 else
275 tstSeamlessX11_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
276 endif
277 tstSeamlessX11_LIBPATH = \
278 $(VBOX_LIBPATH_X11)
279 tstSeamlessX11_LIBS = \
280 $(LIB_RUNTIME) \
281 Xext \
282 Xmu \
283 X11
284 endif
285endif
286
287include $(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