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