VirtualBox

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

Last change on this file since 106798 was 106798, checked in by vboxsync, 5 months ago

Installer/win/Stub: Don't bother crossbuilding the installer stub on win.arm64, not worth the extra effort. jiraref:VBP-1253

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1# $Id: Makefile.kmk 106798 2024-10-30 23:54:21Z 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
58ifdef VBoxStub_BLD_TRG_ARCH
59 VBoxStub_LIBS += \
60 $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/delayimp.lib
61else
62 VBoxStub_LIBS += \
63 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
64endif
65
66VBoxStub_LDFLAGS = -SubSystem:Windows -DelayLoad:comctl32.dll
67VBoxStub_POST_CMDS = $(VBOX_CHECK_IMPORTS) --image $(out) ntdll.dll kernel32.dll
68ifeq ($(KBUILD_TYPE),asan)
69 VBoxStub_POST_CMDS += advapi32.dll
70endif
71VBoxStub_LNK_DEPS = $(VBOX_CHECK_IMPORTS)
72
73VBoxStub.cpp_DEFS += VBOX_SVN_REV=$(VBOX_SVN_REV)
74VBoxStub.cpp_DEPS = $(VBOX_SVN_REV_KMK)
75
76# If signing mode is enabled, then add the possibility to install the code
77# signing certificates (public key only) automatically in /silent mode.
78ifdef VBOX_SIGNING_MODE
79
80 VBoxStub_SOURCES += VBoxStubCertUtil.cpp
81 VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h
82 VBoxStub.cpp_DEPS += $(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h
83 VBoxStub.cpp_INCS += $(VBoxStub_0_OUTDIR)
84 VBoxStub.cpp_DEFS += VBOX_WITH_CODE_SIGNING
85 ifdef VBOX_WITH_VBOX_LEGACY_TS_CA
86 VBoxStub.cpp_DEFS += VBOX_WITH_VBOX_LEGACY_TS_CA
87 endif
88
89 $$(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h: | $$(dir $$@) $(VBOX_RTSIGNTOOL) $(VBOX_BIN2C) $(PATH_STAGE_SYS)/VBoxSup.sys
90 $(RM) -f -- "$@" "[email protected]" "[email protected]" "[email protected]" "[email protected]"
91
92 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --signature-index 0 --exe "$(PATH_STAGE_SYS)/VBoxSup.sys" --output "[email protected]" --der
93 $(VBOX_BIN2C) -ascii --append VBoxStubTrustedCert0 "[email protected]" $@
94 $(APPEND) "[email protected]" " { g_abVBoxStubTrustedCert0, sizeof(g_abVBoxStubTrustedCert0) }, "
95 if defined(VBOX_CERTIFICATE_SUBJECT_NAME) && defined(VBOX_CERTIFICATE_SHA2_SUBJECT_NAME) && !$(intersects win_planc,$(VBOX_WITH_CORP_CODE_SIGNING))
96 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --signature-index 1 --exe "$(PATH_STAGE_SYS)/VBoxSup.sys" --output "[email protected]" --der
97 $(VBOX_BIN2C) -ascii --append VBoxStubTrustedCert1 "[email protected]" $@
98 $(APPEND) "[email protected]" " { g_abVBoxStubTrustedCert1, sizeof(g_abVBoxStubTrustedCert1) }, "
99 endif
100 if !$(intersects win,$(VBOX_WITH_CORP_CODE_SIGNING)) && $(intersects win_planb,$(VBOX_WITH_CORP_CODE_SIGNING))
101 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --signature-index 1 --exe "$(VBOX_RTSIGNTOOL)" --output "[email protected]" --der
102 $(VBOX_BIN2C) -ascii --append VBoxStubTrustedCert2 "[email protected]" $@
103 $(APPEND) "[email protected]" " { g_abVBoxStubTrustedCert2, sizeof(g_abVBoxStubTrustedCert2) }, "
104 endif
105 $(APPEND) -n "$@" \
106 "" \
107 "struct { uint8_t const *pab; uint32_t cb; }" "g_aVBoxStubTrustedCerts[] = " \
108 "{"
109 $(SED) --append "$@" -e "" "[email protected]"
110 $(APPEND) -n "$@" \
111 "};"
112 $(RM) -f -- "[email protected]" "[email protected]" "[email protected]" "[email protected]"
113 ifdef VBOX_WITH_VBOX_LEGACY_TS_CA
114 $(RM) -f -- "[email protected]_tsca"
115 $(VBOX_RTSIGNTOOL) extract-timestamp-root --self-signed-roots-from-system --signature-index 0 --input "$(PATH_STAGE_SYS)/VBoxSup.sys" --output "[email protected]_tsca"
116 $(VBOX_BIN2C) -ascii --append VBoxLegacyWinCA "[email protected]_tsca" $@
117 $(RM) -f -- "[email protected]_tsca"
118 endif
119
120 VBoxStubPublicCert.h:: $$(VBoxStub_0_OUTDIR)/VBoxStubPublicCert.h
121
122endif
123
124# The icon location is configurable.
125VBoxStub.rc_INCS += $(VBoxStub_0_OUTDIR)
126VBoxStub.rc_DEPS += \
127 $(VBoxStub_0_OUTDIR)/VBoxStub-icon.rc \
128 $(VBoxStub_0_OUTDIR)/VBoxStub-manifest.rc
129VBoxStub_CLEAN += \
130 $(VBoxStub_0_OUTDIR)/VBoxStub-icon.rc \
131 $(VBoxStub_0_OUTDIR)/VBoxStub-manifest.rc
132
133# Icon include file.
134$$(VBoxStub_0_OUTDIR)/VBoxStub-icon.rc: $(VBOX_WINDOWS_ICON_FILE) $(MAKEFILE_CURRENT) | $$(dir $$@)
135 $(APPEND) -t $@ 'IDI_VIRTUALBOX ICON DISCARDABLE "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'
136
137# Manifest.
138VBOX_STUB_MANIFEST_FILE := $(PATH_SUB_CURRENT)/VBoxStub.manifest
139$$(VBoxStub_0_OUTDIR)/VBoxStub-manifest.rc: $(VBOX_STUB_MANIFEST_FILE) $(MAKEFILE_CURRENT) | $$(dir $$@)
140 $(APPEND) -t $@ 'APP_MANIFEST RT_MANIFEST "$(subst /,\\,$(VBOX_STUB_MANIFEST_FILE))"'
141
142# Dynamic import no. 1: MSI.DLL
143VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/MsiLazyLoad.asm
144VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/MsiLazyLoad.asm
145$$(VBoxStub_0_OUTDIR)/MsiLazyLoad.asm: $(PATH_SUB_CURRENT)/msi.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
146 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
147 $(QUIET)$(RM) -f -- "$@"
148 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library MSI.DLL --output "$@" $(filter %.def, $^)
149
150# Dynamic import no. 2: CRYPTO32.DLL
151VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/Crypt32LazyLoad.asm
152VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/Crypt32LazyLoad.asm
153$$(VBoxStub_0_OUTDIR)/Crypt32LazyLoad.asm: $(PATH_SUB_CURRENT)/crypt32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
154 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
155 $(QUIET)$(RM) -f -- "$@"
156 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library CRYPT32.DLL --output "$@" $(filter %.def, $^)
157
158# Dynamic import no. 3: WS2_32.DLL
159VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/Ws232LazyLoad.asm
160VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/Ws232LazyLoad.asm
161$$(VBoxStub_0_OUTDIR)/Ws232LazyLoad.asm: $(PATH_SUB_CURRENT)/ws2_32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
162 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
163 $(QUIET)$(RM) -f -- "$@"
164 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library WS2_32.DLL --output "$@" $(filter %.def, $^)
165
166# Dynamic import no. 4: USER32.DLL
167VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/User32LazyLoad.asm
168VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/User32LazyLoad.asm
169$$(VBoxStub_0_OUTDIR)/User32LazyLoad.asm: $(PATH_SUB_CURRENT)/user32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
170 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
171 $(QUIET)$(RM) -f -- "$@"
172 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library USER32.DLL --output "$@" $(filter %.def, $^)
173
174# Dynamic import no. 5: SHELL32.DLL
175VBoxStub_SOURCES += $(VBoxStub_0_OUTDIR)/Shell32LazyLoad.asm
176VBoxStub_CLEAN += $(VBoxStub_0_OUTDIR)/Shell32LazyLoad.asm
177$$(VBoxStub_0_OUTDIR)/Shell32LazyLoad.asm: $(PATH_SUB_CURRENT)/shell32.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
178 $(call MSG_TOOL,VBoxDef2LazyLoad,VBoxStub,$(filter %.def, $^),$@)
179 $(QUIET)$(RM) -f -- "$@"
180 $(VBOX_DEF_2_LAZY_LOAD) --target "$(VBoxStub_BLD_TRG_ARCH)" --system --library SHELL32.DLL --output "$@" $(filter %.def, $^)
181
182include $(FILE_KBUILD_SUB_FOOTER)
183
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