VirtualBox

source: vbox/trunk/src/VBox/Additions/darwin/Installer/Makefile.kmk

Last change on this file was 100459, checked in by vboxsync, 11 months ago

Installer/darwin, Additions/darwin/Installer: Make sure the KEXT bundle signature is readable, even if code signing creates it as non-world readable (which before meant that pkgbuild silently left it out, because user vbox can't read such files owned by root:wheel).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.1 KB
Line 
1# $Id: Makefile.kmk 100459 2023-07-10 13:54:55Z vboxsync $
2## @file
3# Install misc stuff and create dist packages for Mac OS X Guest Additions.
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
32#
33# Globals
34#
35VBOX_ADD_PATH_DI_SRC := $(PATH_SUB_CURRENT)
36VBOX_ADD_DI_OUT_DIR := $(PATH_TARGET)/additions/Installer
37BLDDIRS += $(VBOX_ADD_DI_OUT_DIR)
38
39ifdef VBOX_WITH_COMBINED_PACKAGE
40 ifeq ($(KBUILD_TARGET_ARCH),x86)
41 VBOX_PATH_DIST_32 = $(VBOX_PATH_DIST)/additions
42 VBOX_PATH_DIST_64 = $(PATH_OUT_BASE)/darwin.amd64/$(KBUILD_TYPE)/dist/additions
43 else
44 VBOX_PATH_DIST_64 = $(VBOX_PATH_DIST)/additions
45 VBOX_PATH_DIST_32 = $(PATH_OUT_BASE)/darwin.x86/$(KBUILD_TYPE)/dist
46 endif
47 VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST_32)/$1 $(VBOX_PATH_DIST_64)/$2
48 VBOX_DI_FN_DEP_32 = $(VBOX_PATH_DIST_32)/$1
49 VBOX_DI_FN_DEP_64 = $(VBOX_PATH_DIST_64)/$1
50 VBOX_DI_LIPO = lipo
51else
52 VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST)/additions/$1
53 ifeq ($(KBUILD_TARGET_ARCH),x86)
54 VBOX_DI_FN_DEP_32 = $(VBOX_PATH_DIST)/additions/$1
55 VBOX_DI_FN_DEP_64 =
56 else
57 VBOX_DI_FN_DEP_64 = $(VBOX_PATH_DIST)/additions/$1
58 VBOX_DI_FN_DEP_32 =
59 endif
60endif
61
62# Unset this to speed up things during makefile hacking.
63VBOX_DARWIN_INST_DEP_ON_MAKEFILE := $(MAKEFILE_CURRENT)
64
65# The location of the pkgbuild program.
66ifndef VBOX_PKGBUILD
67 VBOX_PKGBUILD := pkgbuild
68endif
69
70# The location of the productbuild program.
71ifndef VBOX_PRODUCTBUILD
72 VBOX_PRODUCTBUILD := productbuild
73endif
74
75# Where we do the packing (override this in LocalConfig.kmk if building on smbfs).
76ifndef VBOX_PATH_PACK_TMP
77 VBOX_PATH_PACK_TMP := $(VBOX_ADD_DI_OUT_DIR)
78endif
79
80
81#
82# The packing.
83#
84PACKING += \
85 $(PATH_STAGE)/$(INST_ADDITIONS)VBoxGuestAdditions.pkg \
86 $(PATH_STAGE)/$(INST_ADDITIONS)VBoxDarwinAdditionsUninstall.tool
87
88#OTHER_CLEAN = TODO
89
90
91include $(FILE_KBUILD_SUB_FOOTER)
92
93
94#
95# We're running commands as root here, take some care and assertion
96# a sane environment.
97#
98ifeq ($(strip $(VBOX_PATH_DIST)),)
99 $(error VBOX_PATH_DIST=$(VBOX_PATH_DIST))
100endif
101ifeq ($(strip $(VBOX_PATH_DIST)),/)
102 $(error VBOX_PATH_DIST=$(VBOX_PATH_DIST))
103endif
104ifeq ($(strip $(VBOX_PATH_PACK_TMP)),)
105 $(error VBOX_PATH_PACK_TMP=$(VBOX_PATH_PACK_TMP))
106endif
107ifeq ($(strip $(VBOX_PATH_PACK_TMP)),/)
108 $(error VBOX_PATH_PACK_TMP=$(VBOX_PATH_PACK_TMP))
109endif
110
111#
112# The packing targets.
113#
114$(PATH_STAGE)/$(INST_ADDITIONS)VBoxGuestAdditions.pkg: $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditions.pkg
115 $(MKDIR) -p "$(@D)"
116 $(INSTALL) -m 0644 -- "$<" "$@"
117
118$(PATH_STAGE)/$(INST_ADDITIONS)VBoxDarwinAdditionsUninstall.tool: $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool
119 $(MKDIR) -p "$(@D)"
120 $(INSTALL) -m 0755 -- "$<" "$@"
121
122
123#
124# The meta-package.
125#
126$(VBOX_PATH_PACK_TMP)/VBoxGuestAdditions.pkg: \
127 $(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsKEXTs.pkg \
128 $(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsToolsAndServices.pkg \
129 $$(wildcard $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/* \
130 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/*.lproj/*) \
131 $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), $(VBOX_BRAND_$(f)_VIRTUALBOX_WELCOME_RTF)) \
132 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Welcome.rtf \
133 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Conclusion.rtf \
134 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/distribution-$(KBUILD_TARGET_ARCH).dist \
135 $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
136 $(call MSG_TOOL,productbuild,,,$@)
137 @# Cleanup any previously failed attempts.
138 sudo rm -Rf \
139 $@ \
140 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.root \
141 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.desc \
142 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res
143 @# Correct directory permissions are important.
144 $(MKDIR) -p \
145 $(@D) \
146 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.desc \
147 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res \
148 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj
149
150 @# Do keyword replacement in the package info and description files.
151 $(SED) \
152 -e 's+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g' \
153 -e 's+@VBOX_VERSION_MAJOR@+$(VBOX_VERSION_MAJOR)+g' \
154 -e 's+@VBOX_VERSION_MINOR@+$(VBOX_VERSION_MINOR)+g' \
155 -e 's+@VBOX_VERSION_BUILD@+$(VBOX_VERSION_BUILD)+g' \
156 -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
157 -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
158 -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
159 --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj/Welcome.rtf \
160 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Welcome.rtf
161 @# Copy the resources.
162 $(INSTALL) -m 0644 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Conclusion.rtf $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj/Conclusion.rtf
163
164 $(SED) \
165 -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
166 -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
167 -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
168 --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj/Localizable.strings \
169 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Localizable.strings
170 $(INSTALL) -m 0644 $(VBOX_BRAND_DARWIN_INSTALLER_BG) $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/background.tif
171
172 $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
173 $(MKDIR) -p \
174 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj$(NLTAB) \
175 $(SED) \
176 -e 's+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g' \
177 -e 's+@VBOX_VERSION_MAJOR@+$(VBOX_VERSION_MAJOR)+g' \
178 -e 's+@VBOX_VERSION_MINOR@+$(VBOX_VERSION_MINOR)+g' \
179 -e 's+@VBOX_VERSION_BUILD@+$(VBOX_VERSION_BUILD)+g' \
180 --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Welcome.rtf \
181 $(VBOX_BRAND_$(f)_VIRTUALBOX_WELCOME_RTF)$(NLTAB) \
182 $(INSTALL) -m 0644 $(VBOX_BRAND_$(f)_VIRTUALBOX_CONCLUSION_RTF) $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Conclusion.rtf$(NLTAB) \
183 $(SED) \
184 -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
185 -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
186 -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
187 --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Localizable.strings \
188 $(VBOX_BRAND_$(f)_VIRTUALBOX_LOCALIZABLE_STRINGS)$(NLTAB) \
189 )
190
191 @# Build the package.
192 $(VBOX_PRODUCTBUILD) \
193 --distribution $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/distribution-$(KBUILD_TARGET_ARCH).dist \
194 --package-path $(VBOX_PATH_PACK_TMP)/Packages \
195 --resources $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res \
196 --identifier org.VirtualBox.mpkg.GuestAdditions \
197 --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
198 $(if-expr defined(VBOX_MACOSX_INSTALLER_SIGN) && $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) == "",--sign "$(VBOX_MACOSX_INSTALLER_SIGN)",) \
199 $@
200ifdef VBOX_SIGNING_MODE
201 if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
202 @# Sign the created pkg.
203 $(call VBOX_SIGN_PKG_FN,$@,org.VirtualBox.mpkg.GuestAdditions)
204 if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
205 @# Notarize the signed pkg (includes stapling).
206 $(call VBOX_NOTARIZE_FILE_FN,$@,org.virtualbox.VBoxGuestAdditions.$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD).$(VBOX_SVN_REV))
207 endif
208 endif
209endif
210
211 @# Cleanup.
212 sudo rm -Rf \
213 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.root \
214 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.desc \
215 $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res
216
217VBoxDarwinAdditions.pkg:: $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.pkg
218
219#
220# The VirtualBox Kernel extensions.
221#
222VBOX_ADD_DI_KEXTS_UNIVERSAL = VBoxGuest
223VBOX_ADD_DI_KEXTS = $(VBOX_ADD_DI_KEXTS_UNIVERSAL)
224
225$(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsKEXTs.pkg: \
226 $(foreach kext,$(VBOX_ADD_DI_KEXTS_UNIVERSAL), $(call VBOX_DI_FN_DEP_BOTH,$(kext).kext/Contents/MacOS/$(kext))) \
227 $(foreach kext,$(VBOX_ADD_DI_KEXTS), $(VBOX_PATH_DIST)/additions/$(kext).kext/Contents/Info.plist) \
228 $$(wildcard $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/* \
229 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/*.lproj/*) \
230 $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
231 $(VBOX_BRAND_$(f)_VBOXKEXTS_DESCRIPTION_PLIST) \
232 $(VBOX_BRAND_$(f)_VBOXKEXTS_README_HTML) \
233 $(VBOX_BRAND_$(f)_VBOXKEXTS_INSTALLATIONCHECK_STRINGS)) \
234 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/postflight \
235 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist \
236 $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
237 $(call MSG_TOOL,pkgbuild,,,$@)
238 @# Cleanup any previously failed attempts.
239 sudo rm -Rf \
240 $@ \
241 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root \
242 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc \
243 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res
244 @# Correct directory permissions are important.
245 $(MKDIR) -p \
246 $(@D) \
247 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc \
248 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res \
249 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res/English.lproj
250 $(MKDIR) -p -m 1775 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library
251 $(MKDIR) -p -m 0755 \
252 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions \
253 $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
254 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext \
255 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents \
256 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/MacOS )
257 @# Copy the common files (Info.plist).
258 $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
259 $(NLTAB)$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/additions/$(kext).kext/Contents/Info.plist $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/)
260 @# Copy the binaries and invoking lipo.
261ifdef VBOX_WITH_COMBINED_PACKAGE
262 $(foreach kext,$(VBOX_ADD_DI_KEXTS_UNIVERSAL), \
263 $(NLTAB)$(VBOX_DI_LIPO) -create \
264 $(VBOX_PATH_DIST_32)/additions/$(kext).kext/Contents/MacOS/$(kext) \
265 $(VBOX_PATH_DIST_64)/additions/$(kext).kext/Contents/MacOS/$(kext) \
266 -output $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/MacOS/$(kext))
267else
268 $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
269 $(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/additions/$(kext).kext/Contents/MacOS/$(kext) $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/MacOS/)
270endif
271 @# Sign the kext bundles.
272ifdef VBOX_SIGNING_MODE
273 $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
274 $(NLTAB)$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext,) \
275 $(NLTAB)chmod a+r $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/_CodeSignature/* )
276endif
277 @# Set the correct owners.
278 sudo chown root:admin $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library
279 sudo chown -R root:wheel $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions
280
281 # Copy package internal files
282 $(INSTALL) $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc/PkgBuildComponent.plist
283
284 # Copy installer scripts
285 $(INSTALL) -m 0755 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/postflight $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res
286
287 @# Build the package.
288 $(VBOX_PKGBUILD) \
289 --root $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/ \
290 --component-plist $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc/PkgBuildComponent.plist \
291 --script $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res \
292 --identifier org.virtualbox.pkg.additions.kexts \
293 --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
294 --install-location /Library/Extensions/ \
295 --ownership preserve \
296 $(if-expr defined(VBOX_MACOSX_INSTALLER_SIGN) && $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) == "",--sign "$(VBOX_MACOSX_INSTALLER_SIGN)",) \
297 $@
298ifdef VBOX_SIGNING_MODE
299 if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
300 @# Sign the created pkg.
301 $(call VBOX_SIGN_PKG_FN,$@,org.virtualbox.pkg.vboxguestadditionskexts)
302 endif
303endif
304 @# Cleanup
305 sudo rm -Rf \
306 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root \
307 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc \
308 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res
309
310#
311# The VirtualBox Guest Additions Tools & Services.
312#
313
314VBOX_GA_PKG = VBoxGuestAdditionsToolsAndServices.pkg
315VBOX_DI_VB_GA_BINARIES = VBoxClient VBoxControl VBoxService
316$(VBOX_PATH_PACK_TMP)/Packages/$(VBOX_GA_PKG): \
317 $(foreach f, $(VBOX_DI_VB_GA_BINARIES) \
318 ,$(call VBOX_DI_FN_DEP_BOTH,$(f)) ) \
319 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist \
320 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist \
321 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper \
322 $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool \
323 $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
324 $(call MSG_TOOL,pkgbuild,,,$@)
325 @# Cleanup any previously failed attempts.
326 sudo rm -Rf \
327 $@ \
328 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root \
329 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).desc \
330 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res
331 @# Correct directory permissions are important.
332 $(MKDIR) -p \
333 $(@D) \
334 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).desc \
335 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res \
336 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res/English.lproj
337
338 @# Create directory structure within a package w/ proper permittions
339 $(MKDIR) -p -m 0775 \
340 "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions" \
341 "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchAgents" \
342 "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchDaemons"
343
344 @# Install binaries
345ifdef VBOX_WITH_COMBINED_PACKAGE
346 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
347 ,$(VBOX_DI_LIPO) -create \
348 $(VBOX_PATH_DIST_32)/additions/$(binary) \
349 $(VBOX_PATH_DIST_64)/additions/$(binary) \
350 -output "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)"$(NLTAB))
351 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES), \
352 $(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST_32)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-x86" \
353 $(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST_64)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-amd64" )
354else
355 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
356 ,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)"$(NLTAB))
357 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
358 ,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-$(KBUILD_TARGET_ARCH)"$(NLTAB))
359endif
360 # Add Uninstall.tool
361 $(INSTALL) -m 0755 $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/"
362ifdef VBOX_SIGNING_MODE
363 $(call VBOX_SIGN_FILE_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/Uninstall.tool,org.virtualbox.app.guestadditions.uninstaller)
364endif
365
366 @# Install launchd stuff
367 $(INSTALL) -m 0755 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper \
368 "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/"
369 $(INSTALL) -m 644 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist \
370 "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchAgents/"
371 $(INSTALL) -m 644 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist \
372 "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchDaemons/"
373
374 @# Sign the binaries.
375ifdef VBOX_SIGNING_MODE
376 ifdef VBOX_WITH_COMBINED_PACKAGE
377 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
378 ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary),org.virtualbox.app.guestadditions.$(notdir $(binary))) )
379 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
380 ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-x86,org.virtualbox.app.guestadditions.$(notdir $(binary))-x86) )
381 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
382 ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-amd64,org.virtualbox.app.guestadditions.$(notdir $(binary))-amd64) )
383 else
384 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
385 ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary),org.virtualbox.app.guestadditions.$(notdir $(binary))) )
386 $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
387 ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-$(KBUILD_TARGET_ARCH),org.virtualbox.app.guestadditions.$(notdir $(binary))-$(KBUILD_TARGET_ARCH)) )
388 endif
389endif
390
391 @# Correct ownership
392 sudo chown -R root:wheel "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/"
393
394 @# Build the package.
395 $(VBOX_PKGBUILD) \
396 --root "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/" \
397 --script $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res \
398 --identifier org.virtualbox.pkg.additions.tools-and-services \
399 --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
400 --install-location "/Library/" \
401 --ownership preserve \
402 $(if-expr defined(VBOX_MACOSX_INSTALLER_SIGN) && $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) == "",--sign "$(VBOX_MACOSX_INSTALLER_SIGN)",) \
403 $@
404ifdef VBOX_SIGNING_MODE
405 if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
406 @# Sign the created pkg.
407 $(call VBOX_SIGN_PKG_FN,$@,org.virtualbox.pkg.vboxguestadditions)
408 endif
409endif
410 @# Cleanup
411 sudo rm -Rf \
412 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root \
413 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).desc \
414 $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use