VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Stub/Makefile.kmk

Last change on this file was 108698, checked in by vboxsync, 7 weeks ago

Windows host installer stub (VBoxStub): Enabled building with splash screen support [trying to fix Win/ARM builds -- SCM fix]. bugref:10870

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.2 KB
Line 
1# $Id: Makefile.kmk 108698 2025-03-21 15:52:58Z vboxsync $
2## @file
3# Sub-Makefile for the stub installer.
4#
5
6#
7# Copyright (C) 2009-2024 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
32#
33# Special template variation.
34#
35TEMPLATE_VBoxStubTemplate := Drop the signing, we will sign it later.
36TEMPLATE_VBoxStubTemplate_EXTENDS := VBoxR3Static
37TEMPLATE_VBoxStubTemplate_POST_CMDS = $(NO_SUCH_VARIABLE)
38
39
40#
41# Installer stub program
42#
43PROGRAMS += VBoxStub
44VBoxStub_TEMPLATE := VBoxStubTemplate
45if1of ($(KBUILD_TARGET_ARCH), x86 amd64) # don't care for this on arm64
46 VBoxStub_BLD_TRG_ARCH := x86
47 VBoxStub_DEFS := IN_RT_R3 _WIN32_WINNT=0x0501
48else
49 VBoxStub_DEFS := IN_RT_R3
50endif
51
52VBoxStub_SOURCES = \
53 VBoxStub.cpp \
54 VBoxStub.rc
55
56VBoxStub_SDKS = \
57 VBoxNtDll
58
59# Enables splash screen support.
60VBOX_STUB_WITH_SPLASH = 1
61
62ifdef VBOX_STUB_WITH_SPLASH
63 VBoxStub.cpp_DEFS += VBOX_STUB_WITH_SPLASH
64 VBoxStub.rc_DEFS += VBOX_STUB_WITH_SPLASH
65 VBoxStub_CXXFLAGS += -wd5039 # pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
66 VBOX_STUB_IMPORTS += user32.dll shlwapi.dll gdi32.dll
67 # gdiplus apparently forgets to uninit COM in GdiplusShutdown(), so we have to do that ourselves via CoUninitialize().
68 # Not doing that will result in a debug assertion in experimental code in rtThreadNativeUninitComAndOle()
69 # where we check for dangling COM inits.
70 VBOX_STUB_IMPORTS += ole32.dll
71endif
72
73VBoxStub_LDFLAGS = -SubSystem:Windows
74VBoxStub_POST_CMDS = $(VBOX_CHECK_IMPORTS) --image $(out) ntdll.dll kernel32.dll $(VBOX_STUB_IMPORTS)
75ifeq ($(KBUILD_TYPE),asan)
76 VBoxStub_POST_CMDS += advapi32.dll clang_rt.asan_dynamic-i386.dll
77endif
78VBoxStub_LNK_DEPS = $(VBOX_CHECK_IMPORTS)
79
80VBoxStub.cpp_DEFS += VBOX_SVN_REV=$(VBOX_SVN_REV)
81VBoxStub.cpp_DEPS = $(VBOX_SVN_REV_KMK)
82
83# If signing mode is enabled, then add the possibility to install the code
84# signing certificates (public key only) automatically in /silent mode.
85ifdef VBOX_SIGNING_MODE
86
87 VBoxStub_SOURCES += VBoxStubCertUtil.cpp
88 VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h
89 VBoxStub.cpp_DEPS += $(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h
90 VBoxStub.cpp_INCS += $(VBoxStub_0_OUTDIR)
91 VBoxStub.cpp_DEFS += VBOX_WITH_CODE_SIGNING
92 ifdef VBOX_WITH_VBOX_LEGACY_TS_CA
93 VBoxStub.cpp_DEFS += VBOX_WITH_VBOX_LEGACY_TS_CA
94 endif
95
96 $$(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h: | $$(dir $$@) $(VBOX_RTSIGNTOOL) $(VBOX_BIN2C) $(PATH_STAGE_SYS)/VBoxSup.sys
97 $(RM) -f -- "$@" "$@.cer0" "$@.cer1" "$@.cer2" "$@.array"
98
99 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --signature-index 0 --exe "$(PATH_STAGE_SYS)/VBoxSup.sys" --output "$@.cer0" --der
100 $(VBOX_BIN2C) -ascii --append VBoxStubTrustedCert0 "$@.cer0" $@
101 $(APPEND) "$@.array" " { g_abVBoxStubTrustedCert0, sizeof(g_abVBoxStubTrustedCert0) }, "
102 if defined(VBOX_CERTIFICATE_SUBJECT_NAME) && defined(VBOX_CERTIFICATE_SHA2_SUBJECT_NAME) && !$(intersects win_planc,$(VBOX_WITH_CORP_CODE_SIGNING))
103 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --signature-index 1 --exe "$(PATH_STAGE_SYS)/VBoxSup.sys" --output "$@.cer1" --der
104 $(VBOX_BIN2C) -ascii --append VBoxStubTrustedCert1 "$@.cer1" $@
105 $(APPEND) "$@.array" " { g_abVBoxStubTrustedCert1, sizeof(g_abVBoxStubTrustedCert1) }, "
106 endif
107 if !$(intersects win,$(VBOX_WITH_CORP_CODE_SIGNING)) && $(intersects win_planb,$(VBOX_WITH_CORP_CODE_SIGNING))
108 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --signature-index 1 --exe "$(VBOX_RTSIGNTOOL)" --output "$@.cer2" --der
109 $(VBOX_BIN2C) -ascii --append VBoxStubTrustedCert2 "$@.cer2" $@
110 $(APPEND) "$@.array" " { g_abVBoxStubTrustedCert2, sizeof(g_abVBoxStubTrustedCert2) }, "
111 endif
112 $(APPEND) -n "$@" \
113 "" \
114 "struct { uint8_t const *pab; uint32_t cb; }" "g_aVBoxStubTrustedCerts[] = " \
115 "{"
116 $(SED) --append "$@" -e "" "$@.array"
117 $(APPEND) -n "$@" \
118 "};"
119 $(RM) -f -- "$@.cer0" "$@.cer1" "$@.cer2" "$@.array"
120 ifdef VBOX_WITH_VBOX_LEGACY_TS_CA
121 $(RM) -f -- "$@.cer_tsca"
122 $(VBOX_RTSIGNTOOL) extract-timestamp-root --self-signed-roots-from-system --signature-index 0 --input "$(PATH_STAGE_SYS)/VBoxSup.sys" --output "$@.cer_tsca"
123 $(VBOX_BIN2C) -ascii --append VBoxLegacyWinCA "$@.cer_tsca" $@
124 $(RM) -f -- "$@.cer_tsca"
125 endif
126
127 VBoxStubPublicCert.h:: $$(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h
128
129endif
130
131# The icon location is configurable.
132VBoxStub.rc_INCS += $(VBoxStub_0_OUTDIR)
133VBoxStub.rc_DEPS += \
134 $(VBoxStub_0_OUTDIR)/VBoxStub-icon.rc \
135 $(VBoxStub_0_OUTDIR)/VBoxStub-manifest.rc
136VBoxStub_CLEAN += \
137 $(VBoxStub_0_OUTDIR)/VBoxStub-icon.rc \
138 $(VBoxStub_0_OUTDIR)/VBoxStub-manifest.rc
139
140# Icon include file.
141$$(VBoxStub_0_OUTDIR)/VBoxStub-icon.rc: $(VBOX_WINDOWS_ICON_FILE) $(MAKEFILE_CURRENT) | $$(dir $$@)
142 $(APPEND) -t $@ 'IDI_VIRTUALBOX ICON DISCARDABLE "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'
143
144# Manifest.
145VBOX_STUB_MANIFEST_FILE := $(PATH_SUB_CURRENT)/VBoxStub.manifest
146$$(VBoxStub_0_OUTDIR)/VBoxStub-manifest.rc: $(VBOX_STUB_MANIFEST_FILE) $(MAKEFILE_CURRENT) | $$(dir $$@)
147 $(APPEND) -t $@ 'APP_MANIFEST RT_MANIFEST "$(subst /,\\,$(VBOX_STUB_MANIFEST_FILE))"'
148
149# Dynamic import no. 1: MSI.DLL
150VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/MsiLazyLoad.asm
151VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/MsiLazyLoad.asm
152$$(VBoxStub_0_OUTDIR)/MsiLazyLoad.asm: $(PATH_SUB_CURRENT)/msi.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
153 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
154 $(QUIET)$(RM) -f -- "$@"
155 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library MSI.DLL --output "$@" $(filter %.def, $^)
156
157# Dynamic import no. 2: CRYPTO32.DLL
158VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/Crypt32LazyLoad.asm
159VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/Crypt32LazyLoad.asm
160$$(VBoxStub_0_OUTDIR)/Crypt32LazyLoad.asm: $(PATH_SUB_CURRENT)/crypt32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
161 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
162 $(QUIET)$(RM) -f -- "$@"
163 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library CRYPT32.DLL --output "$@" $(filter %.def, $^)
164
165# Dynamic import no. 3: WS2_32.DLL
166VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/Ws232LazyLoad.asm
167VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/Ws232LazyLoad.asm
168$$(VBoxStub_0_OUTDIR)/Ws232LazyLoad.asm: $(PATH_SUB_CURRENT)/ws2_32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
169 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
170 $(QUIET)$(RM) -f -- "$@"
171 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library WS2_32.DLL --output "$@" $(filter %.def, $^)
172
173# Dynamic import no. 4: USER32.DLL
174VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/User32LazyLoad.asm
175VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/User32LazyLoad.asm
176$$(VBoxStub_0_OUTDIR)/User32LazyLoad.asm: $(PATH_SUB_CURRENT)/user32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
177 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
178 $(QUIET)$(RM) -f -- "$@"
179 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library USER32.DLL --output "$@" $(filter %.def, $^)
180
181# Dynamic import no. 5: SHELL32.DLL
182VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/Shell32LazyLoad.asm
183VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/Shell32LazyLoad.asm
184$$(VBoxStub_0_OUTDIR)/Shell32LazyLoad.asm: $(PATH_SUB_CURRENT)/shell32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
185 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
186 $(QUIET)$(RM) -f -- "$@"
187 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library SHELL32.DLL --output "$@" $(filter %.def, $^)
188
189# Dynamic import no. 6: COMCTL32.DLL
190VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/ComCtl32LazyLoad.asm
191VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/ComCtl32LazyLoad.asm
192$$(VBoxStub_0_OUTDIR)/ComCtl32LazyLoad.asm: $(PATH_SUB_CURRENT)/comctl32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
193 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
194 $(QUIET)$(RM) -f -- "$@"
195 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library COMCTL32.DLL --output "$@" $(filter %.def, $^)
196
197# Dynamic import no. 7: GDIPLUS.DLL
198ifdef VBOX_STUB_WITH_SPLASH
199 VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/GdiPlusLazyLoad.asm
200 VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/GdiPlusLazyLoad.asm
201 $$(VBoxStub_0_OUTDIR)/GdiPlusLazyLoad.asm: $(PATH_SUB_CURRENT)/gdiplus.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
202 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
203 $(QUIET)$(RM) -f -- "$@"
204 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library GDIPLUS.DLL --output "$@" $(filter %.def, $^)
205endif
206
207include $(FILE_KBUILD_SUB_FOOTER)
208
Note: See TracBrowser for help on using the repository browser.

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