1 | # $Id: Makefile.kmk 99689 2023-05-09 08:28:38Z 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 |
|
---|
28 | SUB_DEPTH = ../../../../..
|
---|
29 | include $(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.
|
---|
33 | VBOX_WITH_DISTRO_XRAND_XINERAMA =
|
---|
34 |
|
---|
35 | # We want to lazy load as much stuff as possible. See #10427.
|
---|
36 | VBOX_WITH_VBOXCLIENT_LAZY_LOAD := 1
|
---|
37 |
|
---|
38 | # We don't yet have a seamless mode compilation flag, so define it here unconditionally.
|
---|
39 | VBOX_WITH_SEAMLESS := 1
|
---|
40 |
|
---|
41 | #
|
---|
42 | # VBoxClient - clipboard and seamless.
|
---|
43 | #
|
---|
44 | PROGRAMS += 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 | #
|
---|
49 | PROGRAMS.linux += VBoxDRMClient
|
---|
50 |
|
---|
51 | # Common Guest / Host sources.
|
---|
52 | VBOX_GH_SOURCES := \
|
---|
53 | $(PATH_ROOT)/src/VBox/GuestHost/DisplayServerType.cpp
|
---|
54 |
|
---|
55 | VBoxClient_TEMPLATE = VBoxGuestR3Exe
|
---|
56 | VBoxClient_DEFS += VBOX_X11_CLIPBOARD VBOX_WITH_HGCM
|
---|
57 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
58 | VBoxClient_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
|
---|
59 | else
|
---|
60 | VBoxClient_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
|
---|
61 | endif
|
---|
62 | ifdef VBOX_WITH_DBUS
|
---|
63 | VBoxClient_DEFS += VBOX_WITH_DBUS
|
---|
64 | endif
|
---|
65 |
|
---|
66 | VBoxClient_DEFS.linux += _GNU_SOURCE
|
---|
67 | VBoxClient_INCS = $(VBOX_GRAPHICS_INCS)
|
---|
68 | VBoxClient_INCS += ../x11include/panoramiXproto-1.1
|
---|
69 | VBoxClient_INCS += ../x11include/libXrandr-1.5.2
|
---|
70 | VBoxClient_INCS += ../x11include/randrproto-1.5.0
|
---|
71 | VBoxClient_SOURCES = \
|
---|
72 | main.cpp \
|
---|
73 | logging.cpp
|
---|
74 | VBoxClient_SOURCES += $(VBOX_GH_SOURCES)
|
---|
75 |
|
---|
76 | VBoxDRMClient_TEMPLATE = VBoxGuestR3Exe
|
---|
77 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
78 | VBoxDRMClient_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
|
---|
79 | else
|
---|
80 | VBoxDRMClient_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
|
---|
81 | endif
|
---|
82 | VBoxDRMClient_SOURCES = \
|
---|
83 | display-drm.cpp \
|
---|
84 | display-ipc.cpp \
|
---|
85 | logging.cpp
|
---|
86 | VBoxDRMClient_SOURCES += $(VBOX_GH_SOURCES)
|
---|
87 |
|
---|
88 | VBoxClient_SOURCES.linux = \
|
---|
89 | chk_stubs.c
|
---|
90 | VBoxClient_LIBPATH = \
|
---|
91 | $(VBOX_LIBPATH32_X11)
|
---|
92 | VBoxClient_LIBS.freebsd = \
|
---|
93 | iconv
|
---|
94 | VBoxClient_LIBS.linux = \
|
---|
95 | dl
|
---|
96 | VBoxClient_LIBS.netbsd = \
|
---|
97 | crypt
|
---|
98 | VBoxClient_LIBS.solaris = \
|
---|
99 | dl
|
---|
100 | ifndef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
|
---|
101 | VBoxClient_LIBS = \
|
---|
102 | X11 Xt Xext Xmu
|
---|
103 | endif
|
---|
104 | ifdef VBOX_WITH_DISTRO_XRAND_XINERAMA
|
---|
105 | VBoxClient_DEFS += WITH_DISTRO_XRAND_XINERAMA
|
---|
106 | ifndef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
|
---|
107 | VBoxClient_LIBS += Xrandr
|
---|
108 | endif
|
---|
109 | endif
|
---|
110 |
|
---|
111 | # XXX: -L comes from the template, but not rpath
|
---|
112 | VBoxClient_LDFLAGS.netbsd = \
|
---|
113 | -Wl,-rpath /usr/X11R7/lib
|
---|
114 |
|
---|
115 | ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
116 | ifdef VBOX_DND_WITH_XTEST
|
---|
117 | VBoxClient_DEFS += VBOX_DND_WITH_XTEST
|
---|
118 | VBoxClient_LIBS += \
|
---|
119 | Xtst
|
---|
120 | endif
|
---|
121 | endif
|
---|
122 |
|
---|
123 | # This forces the memcpy references in the static libraries to go to
|
---|
124 | # __wrap_memcpy, which we can wrap around memcpy@GLIBC_2.2.5. I do not know
|
---|
125 | # how else to do that without recompiling or implementing our own memcpy.
|
---|
126 | ifeq ($(KBUILD_TARGET),linux)
|
---|
127 | VBoxClient_LDFLAGS.amd64 += \
|
---|
128 | -Wl,--wrap=memcpy
|
---|
129 | endif
|
---|
130 |
|
---|
131 | ifdef VBOX_WITH_GUEST_PROPS
|
---|
132 | VBoxClient_DEFS += VBOX_WITH_GUEST_PROPS
|
---|
133 | VBoxClient_SOURCES += \
|
---|
134 | hostversion.cpp
|
---|
135 | VBoxDRMClient_DEFS += VBOX_WITH_GUEST_PROPS
|
---|
136 | endif
|
---|
137 |
|
---|
138 | ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
139 | VBoxClient_DEFS += \
|
---|
140 | VBOX_WITH_DRAG_AND_DROP \
|
---|
141 | $(if $(VBOX_WITH_DRAG_AND_DROP_GH),VBOX_WITH_DRAG_AND_DROP_GH,)
|
---|
142 | VBoxClient_SOURCES += \
|
---|
143 | draganddrop.cpp \
|
---|
144 | draganddrop-x11.cpp
|
---|
145 | VBoxClient_LIBS += \
|
---|
146 | $(VBOX_LIB_VBGL_R3) \
|
---|
147 | $(PATH_STAGE_LIB)/additions/VBoxDnDGuestR3Lib$(VBOX_SUFF_LIB)
|
---|
148 | endif
|
---|
149 |
|
---|
150 | ifdef VBOX_WITH_SEAMLESS
|
---|
151 | VBoxClient_DEFS += VBOX_WITH_SEAMLESS
|
---|
152 | VBoxClient_SOURCES += \
|
---|
153 | seamless.cpp \
|
---|
154 | seamless-x11.cpp
|
---|
155 | endif
|
---|
156 |
|
---|
157 | ifdef VBOX_WITH_VMSVGA
|
---|
158 | VBoxClient_DEFS += VBOX_WITH_VMSVGA
|
---|
159 | VBoxClient_SOURCES += \
|
---|
160 | display.cpp \
|
---|
161 | display-svga-x11.cpp \
|
---|
162 | display-svga-xf86cvt.cpp
|
---|
163 | VBoxClient_SOURCES.linux += \
|
---|
164 | display-svga-session.cpp \
|
---|
165 | display-ipc.cpp \
|
---|
166 | display-helper-gnome3.cpp \
|
---|
167 | display-helper-generic.cpp
|
---|
168 |
|
---|
169 | ### include $(PATH_SUB_CURRENT)/helpers/Makefile.kmk
|
---|
170 | endif
|
---|
171 |
|
---|
172 | ifdef VBOX_WITH_SHARED_CLIPBOARD
|
---|
173 | VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD
|
---|
174 | VBoxClient_SOURCES += \
|
---|
175 | $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp \
|
---|
176 | $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp \
|
---|
177 | clipboard.cpp \
|
---|
178 | clipboard-x11.cpp
|
---|
179 | ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
|
---|
180 | VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS VBOX_WITH_SHARED_CLIPBOARD_GUEST
|
---|
181 | VBoxClient_SOURCES += \
|
---|
182 | $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp \
|
---|
183 | $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardPath.cpp
|
---|
184 | ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS_HTTP
|
---|
185 | VBoxClient_DEFS += VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS_HTTP
|
---|
186 | VBoxClient_SOURCES += \
|
---|
187 | $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-http.cpp
|
---|
188 | endif
|
---|
189 | endif
|
---|
190 | endif
|
---|
191 |
|
---|
192 | ifdef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
|
---|
193 | VBoxClient_DEFS += VBOX_WITH_VBOXCLIENT_LAZY_LOAD
|
---|
194 | # Dynamic import no. 1: libX11.so.6
|
---|
195 | VBoxClient_SOURCES += \
|
---|
196 | $(VBoxClient_0_OUTDIR)/libX11LazyLoad.asm
|
---|
197 | VBoxClient_CLEAN += $(VBoxClient_0_OUTDIR)/libX11LazyLoad.asm
|
---|
198 | $$(VBoxClient_0_OUTDIR)/libX11LazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libX11.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
|
---|
199 | $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
|
---|
200 | $(QUIET)$(RM) -f -- "$@"
|
---|
201 | $(VBOX_DEF_2_LAZY_LOAD) --system --library libX11.so.6 --output "$@" $(filter %.def, $^)
|
---|
202 |
|
---|
203 | # Dynamic import no. 2: libXt.so.6
|
---|
204 | VBoxClient_SOURCES += \
|
---|
205 | $(VBoxClient_0_OUTDIR)/libXtLazyLoad.asm
|
---|
206 | VBoxClient_CLEAN += $(VBoxClient_0_OUTDIR)/libXtLazyLoad.asm
|
---|
207 | $$(VBoxClient_0_OUTDIR)/libXtLazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libXt.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
|
---|
208 | $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
|
---|
209 | $(QUIET)$(RM) -f -- "$@"
|
---|
210 | $(VBOX_DEF_2_LAZY_LOAD) --system --library libXt.so.6 --output "$@" $(filter %.def, $^)
|
---|
211 |
|
---|
212 | # Dynamic import no. 3: libXmu.so.6
|
---|
213 | VBoxClient_SOURCES += \
|
---|
214 | $(VBoxClient_0_OUTDIR)/libXmuLazyLoad.asm
|
---|
215 | VBoxClient_CLEAN += $(VBoxClient_0_OUTDIR)/libXmuLazyLoad.asm
|
---|
216 | $$(VBoxClient_0_OUTDIR)/libXmuLazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libXmu.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
|
---|
217 | $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
|
---|
218 | $(QUIET)$(RM) -f -- "$@"
|
---|
219 | $(VBOX_DEF_2_LAZY_LOAD) --system --library libXmu.so.6 --output "$@" $(filter %.def, $^)
|
---|
220 |
|
---|
221 | # Dynamic import no. 4: libXrandr.so.2
|
---|
222 | VBoxClient_SOURCES += \
|
---|
223 | $(VBoxClient_0_OUTDIR)/libXrandrLazyLoad.asm
|
---|
224 | VBoxClient_CLEAN += $(VBoxClient_0_OUTDIR)/libXrandrLazyLoad.asm
|
---|
225 | $$(VBoxClient_0_OUTDIR)/libXrandrLazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libXrandr.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
|
---|
226 | $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
|
---|
227 | $(QUIET)$(RM) -f -- "$@"
|
---|
228 | $(VBOX_DEF_2_LAZY_LOAD) --system --library libXrandr.so.2 --output "$@" $(filter %.def, $^)
|
---|
229 | endif
|
---|
230 |
|
---|
231 | if defined(VBOX_WITH_TESTCASES) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_SDK)
|
---|
232 | if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
|
---|
233 |
|
---|
234 | # Set this in LocalConfig.kmk if you are working on the X11 clipboard service
|
---|
235 | # to automatically run the unit test at build time.
|
---|
236 | # OTHERS += $(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto.run
|
---|
237 |
|
---|
238 | PROGRAMS += tstSeamlessX11-auto
|
---|
239 | tstSeamlessX11-auto_TEMPLATE = VBoxR3TstExe
|
---|
240 | tstSeamlessX11-auto_SOURCES = \
|
---|
241 | testcase/tstSeamlessX11-auto.cpp \
|
---|
242 | seamless-x11.cpp
|
---|
243 | tstSeamlessX11-auto_DEFS = TESTCASE
|
---|
244 | tstSeamlessX11-auto_LIBS = \
|
---|
245 | $(LIB_RUNTIME)
|
---|
246 |
|
---|
247 | TESTING += $(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto
|
---|
248 | $$(tstSeamlessX11-auto_0_OUTDIR)/tstSeamlessX11-auto.run: \
|
---|
249 | $$(tstSeamlessX11-auto_1_STAGE_TARGET)
|
---|
250 | export VBOX_LOG_DEST=nofile; $(tstSeamlessX11-auto_1_STAGE_TARGET) quiet
|
---|
251 | $(QUIET)$(APPEND) -t "$@" "done"
|
---|
252 |
|
---|
253 | #
|
---|
254 | # Additional testcase designed to be run manually, which initiates and starts the Linux
|
---|
255 | # guest client part of the seamless additions in the host, faking seamless events from
|
---|
256 | # the host and writing information about guest events to standard output.
|
---|
257 | #
|
---|
258 | PROGRAMS += tstSeamlessX11
|
---|
259 | tstSeamlessX11_TEMPLATE = VBoxR3TstExe
|
---|
260 | tstSeamlessX11_SOURCES = \
|
---|
261 | testcase/tstSeamlessX11.cpp \
|
---|
262 | seamless.cpp \
|
---|
263 | seamless-x11.cpp
|
---|
264 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
265 | tstSeamlessX11_DEFS += VBOX_BUILD_TARGET="$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)"
|
---|
266 | else
|
---|
267 | tstSeamlessX11_DEFS += VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
|
---|
268 | endif
|
---|
269 | tstSeamlessX11_LIBPATH = \
|
---|
270 | $(VBOX_LIBPATH_X11)
|
---|
271 | tstSeamlessX11_LIBS = \
|
---|
272 | $(LIB_RUNTIME) \
|
---|
273 | Xext \
|
---|
274 | Xmu \
|
---|
275 | X11
|
---|
276 | endif
|
---|
277 | endif
|
---|
278 |
|
---|
279 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|