# $Id: Makefile.kmk 72047 2018-04-27 00:07:20Z vboxsync $
## @file
# Makefile for the Windows installer.
#
#
# Copyright (C) 2006-2017 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk
ifneq ($(KBUILD_HOST),win)
$(error "The Windows installer can only be built on Windows!")
endif
#
# Include Sub-Makefiles.
#
include $(PATH_SUB_CURRENT)/InstallHelper/Makefile.kmk
ifeq ($(KBUILD_TARGET_ARCH),x86)
include $(PATH_SUB_CURRENT)/Stub/Makefile.kmk
include $(PATH_SUB_CURRENT)/StubBld/Makefile.kmk
endif
include $(PATH_SUB_CURRENT)/Resources/Makefile.kmk
ifdef VBOX_WITH_MSI_HACK
include $(PATH_SUB_CURRENT)/MsiHack/Makefile.kmk
endif
#
# Globals.
#
# Tip: Use VBOX_CAB_COMPRESSION_LEVEL=none on the kmk command line when working
# on the installer.
#
VBOX_WIN_INST_MAKEFILE_DEP := $(MAKEFILE_CURRENT)
VBOX_CAB_COMPRESSION_LEVEL := high
VBOX_PATH_WIN_INST_SRC := $(PATH_SUB_CURRENT)
VBOX_WIN_INST_OUT_DIR := $(PATH_TARGET)/Installer/win
VBOX_WIN_INST_REPACK_DIR := $(PATH_OUT)/repack
# Note: en_US *must* come first for the dependency file generation.
ifndef VBOX_INSTALLER_LANGUAGES
VBOX_INSTALLER_LANGUAGES = en_US de_DE fr_FR it_IT zh_TW
VBOX_INSTALLER_LANGUAGES += $(VBOX_INSTALLER_ADD_LANGUAGES)
endif
#
# List of merge modules to use.
#
VBOX_INSTALLER_MERGE_MODULES = App USB NetAdp NetFlt NetAdp6 NetLwf Python
ifeq ($(KBUILD_TARGET_ARCH),amd64)
VBOX_INSTALLER_MERGE_MODULES += COM32On64
endif
# We only ship the merge modules in locale en_US for the moment.
ifdef VBOX_WITH_MSM_INSTALL
VBOX_INSTALLER_LANGUAGES := en_US
VBOX_INSTALLER_MERGE_LANGUAGES = $(VBOX_INSTALLER_LANGUAGES)
endif
#
# Language IDs.
#
VBOX_BRAND_en_US_LANG_ID ?= 1033
VBOX_BRAND_de_DE_LANG_ID ?= 1031
VBOX_BRAND_fr_FR_LANG_ID ?= 1036
VBOX_BRAND_it_IT_LANG_ID ?= 1040
VBOX_BRAND_zh_TW_LANG_ID ?= 1028
# Standard language names (in the native language), to be extended as we go.
# VBOX_BRAND_$(lang)_LANG_NAME must be defined for each language which occurs
# in either VBOX_LICENSE_ADD_LANGUAGES or VBOX_MANUAL_ADD_LANGUAGES.
VBOX_BRAND_fr_FR_LANG_NAME := Français
#
# We don't have the license text in another language than English yet,
# so just define the branding targets to use the English one for now.
# The installer generation assumes that there is a translation for each
# of VBOX_INSTALLER_LANGUAGES.
#
$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
$(eval VBOX_BRAND_$(lang)_LICENSE_RTF := $(VBOX_BRAND_LICENSE_RTF)))
#
# Set the codepage for all languages to 1252, covers most cases.
#
$(foreach lang,$(sort $(VBOX_INSTALLER_LANGUAGES) $(VBOX_LICENSE_ADD_LANGUAGES) $(VBOX_MANUAL_ADD_LANGUAGES)), \
$(eval VBOX_BRAND_$(lang)_LANGUAGE_CODEPAGE := 1252))
# Exceptions:
VBOX_BRAND_zh_TW_LANGUAGE_CODEPAGE := 950
#
# If we want to build a combined package, we separate all common stuff
# (that is all 100% identical content between 32-/64-bit builds)
# into an own .cab file to save space. This .cab file then gets included
# and used by the 32-/64-bit installers.
#
ifdef VBOX_WITH_COMBINED_PACKAGE
VBOX_INSTALLER_COMMON_DISKID := 2
else
VBOX_INSTALLER_COMMON_DISKID := 1
endif
## @todo VBOX_ prefixes!
PACKAGE_BASE := VirtualBox-$(VBOX_VERSION_STRING)
PACKAGE_NAME_LANG := $(PACKAGE_BASE)-r$(VBOX_SVN_REV)
PACKAGE_NAME_FINAL := $(PATH_STAGE_BIN)/$(PACKAGE_NAME_LANG).msi
ifdef VBOX_WITH_COMBINED_PACKAGE
PATH_MULTIARCH_TEMP := $(PATH_OUT_BASE)/win.x86/$(KBUILD_TYPE)/obj/Installer
PATH_MULTIARCH_GUEST_ADDITIONS_ISO := $(PATH_OUT_BASE)/win.amd64/$(KBUILD_TYPE)/bin/additions
PACKAGE_NAME_MULTIARCH := $(PACKAGE_NAME_LANG)-MultiArch
PACKAGE_NAME_MULTIARCH.x86 := $(PACKAGE_NAME_MULTIARCH)_x86.msi
PACKAGE_NAME_MULTIARCH.amd64 := $(PACKAGE_NAME_MULTIARCH)_amd64.msi
PACKAGE_NAME_FINAL := $(PATH_MULTIARCH_TEMP)/$(PACKAGE_NAME_MULTIARCH.$(KBUILD_TARGET_ARCH))
PACKAGE_NAME_MULTIARCH_FINAL := $(PACKAGE_NAME_MULTIARCH).exe
# Always take the common.cab from the amd64 build, as it
# might contain certain files for x86 compatibility such
# as our 32-on-64-bit COM stuff.
PACKAGE_NAME_MULTIARCH_COMMONCAB := $(PATH_OUT_BASE)/win.amd64/$(KBUILD_TYPE)/obj/Installer/win/common.cab
BLDDIRS += $(PATH_MULTIARCH_TEMP)
PACKING += $(PACKAGE_NAME_FINAL)
ifeq ($(KBUILD_TARGET_ARCH),x86)
PACKING += $(PATH_STAGE_BIN)/$(PACKAGE_NAME_MULTIARCH_FINAL)
endif
else
PACKING += $(PACKAGE_NAME_FINAL)
endif
BLDDIRS += \
$(VBOX_WIN_INST_OUT_DIR) \
$(VBOX_WIN_INST_REPACK_DIR)/ \
$(foreach lang,$(VBOX_INSTALLER_LANGUAGES),$(VBOX_WIN_INST_OUT_DIR)/$(lang)/) \
$(VBOX_WIN_INST_OUT_DIR)/NLS/
OTHER_CLEAN += \
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj \
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wix \
$(VBOX_WIN_INST_REPACK_DIR)/VirtualBox.wix \
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep \
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi \
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_ProxyStub.wxi \
$(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
$(VBOX_WIN_INST_OUT_DIR)/VBoxUnattendedTemplateComponent.wxi \
$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
$(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/$(lang).mst \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/$(PACKAGE_NAME_LANG)_$(lang).wixpdb \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/$(PACKAGE_NAME_LANG)_$(lang).msi \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/VirtualBox_$(lang).wix \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/VirtualBox_$(lang).wixobj \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/VirtualBox_$(lang).wixobj.dep )\
$(VBOX_WIN_INST_REPACK_DIR)/VirtualBox_$(lang).wix \
$(VBOX_WIN_INST_OUT_DIR)/DirComponentsAndFiles_DTrace.wxi \
$(VBOX_WIN_INST_OUT_DIR)/Files_Main.wxi \
$(VBOX_WIN_INST_OUT_DIR)/Files_Doc.wxi \
$(VBOX_WIN_INST_OUT_DIR)/Files_License.wxi \
$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi \
$(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_LANG).msi \
$(VBOX_WIN_INST_REPACK_DIR)/3-multilingual-$(PACKAGE_NAME_LANG).cmd
ifdef VBOX_WITH_COMBINED_PACKAGE
ifeq ($(KBUILD_TARGET_ARCH),x86)
OTHER_CLEAN += \
$(PATH_STAGE_BIN)/$(PACKAGE_NAME_MULTIARCH_FINAL) \
$(VBOX_WIN_INST_REPACK_DIR)/4-multiarch-$(@F).cmd \
$(PATH_MULTIARCH_TEMP)/$(PACKAGE_NAME_MULTIARCH.x86)
endif
ifndef VBOX_WITH_MSM_INSTALL
OTHER_CLEAN += \
$(VBOX_WIN_INST_OUT_DIR)/common.cab
endif
else
OTHER_CLEAN += \
$(PACKAGE_NAME_FINAL)
endif
ifdef VBOX_WITH_MSM_INSTALL
OTHER_CLEAN += \
$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
$(foreach lang,$(VBOX_INSTALLER_MERGE_LANGUAGES), \
$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep \
$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm \
$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj \
$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixpdb \
$(VBOX_WIN_INST_REPACK_DIR)/VBoxMerge$(module)_$(lang).wix))
endif
#
# Suppress/skip the following ICE (Internal Consistency Evaluators):
# - ICE64: Checks that new directories in the user profile are removed correctly in roaming scenarios.
# -> We don't want to remove system folders (like "Microsoft/Internet Explorer/Quick Launch").
# - ICE69: Checks if file references are within the same component.
# -> We reference to files within different components, but these components are installed using
# the same feature, so that's fine.
#
VBOX_MSI_ICE_IGNORE := \
-ice:64 \
-ice:69
#
# Create intermediate XML file for languages (needed for .MSI linking).
#
# Note: The double escaping of $(dir $@) in the prereq/dep list is because we first have
# to escape the expansion of the $(eval ) argument and then the definition of the
# rule. The statement is finally expanded during second dependency expansion, which
# takes place after all makefiles has been loaded and with the @ variable defined.
#
define def_vbox_lang_xml
$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl: $(VBOX_PATH_WIN_INST_SRC)/NLS/$(lang).wxl | $$$$(dir $$$$@)
$$(call MSG_GENERATE,,$$@,$$<)
$(QUIET)$(INSTALL) -m 0644 $$< $$@
endef
$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
$(eval $(def_vbox_lang_xml)))
#
# Create intermediate XML file for licenses (needed for .MSI linking).
# These files are created from the original .RTF files in the /docs directory.
#
# Note: The redirect command below will open $$@ as stdout in append+text mode
# and then exec cat, thus appending the license file to the result file.
#
# Note: The license_file variable has to be created before def_vbox_license_xml
# is expanded by the 2nd eval because we rely on the that expansion
# replacing all $(license_file) (and $(lang)) references before evaluation.
#
# Note: The REDIRECT + ECHO_EXT is because WiX gets upset if there a newline
# between the tag and the RTF license text.
#
define def_vbox_license_xml
$(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl: $(license_file) $(VBOX_WIN_INST_MAKEFILE_DEP) | $$$$(dir $$$$@)
$$(call MSG_GENERATE,,$$@,$$<)
$(APPEND) -t $$@ ''
$(APPEND) $$@ ''
$(REDIRECT) -a+to $$@ -- $(ECHO_EXT) -n ''
$(REDIRECT) -a+to $$@ -- $(SED) -e "s|<|\<|g" -e "s|>|\>|g" $(license_file)
$(APPEND) $$@ ''
$(APPEND) $$@ '$(license_file)'
$(APPEND) $$@ 'License_$(lang).rtf'
$(APPEND) $$@ 'L_$(lang).rtf'
$(APPEND) $$@ ''
endef
$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
$(eval local license_file := $(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF)) \
$(eval $(def_vbox_license_xml)))
#
# Create one intermediate WXI (Windows Installer Include) file for all installers (needed for .MSI compiling).
# This file includes all language-specific files (PDFs, CHMs, ...) to install.
#
# Note: When using the -n switch, append will append a new line after each
# argument. The -t switch makes it truncate the file.
#
$(VBOX_WIN_INST_OUT_DIR)/Files_Main.wxi: $(VBOX_WIN_INST_MAKEFILE_DEP) | $$(dir $$@)
$(call MSG_GENERATE,,$@,$<)
$(APPEND) -t $@ ''
$(APPEND) $@ ''
ifdef VBOX_WITH_DOCS_PACKING
$(APPEND) $@ ' '
$(APPEND) -n $@ $(foreach lang,$(VBOX_MANUAL_ADD_LANGUAGES), \
' ')
endif
$(APPEND) $@ ''
$(VBOX_WIN_INST_OUT_DIR)/Files_Doc.wxi: $(VBOX_WIN_INST_MAKEFILE_DEP) | $$(dir $$@)
$(call MSG_GENERATE,,$@,$<)
$(APPEND) -t $@ ''
$(APPEND) $@ ''
ifdef VBOX_WITH_DOCS_PACKING
$(APPEND) $@ ' '
$(APPEND) $@ ' '
$(APPEND) -n $@ $(foreach lang,$(VBOX_MANUAL_ADD_LANGUAGES), \
' ' \
' ')
endif
$(APPEND) $@ ''
$(VBOX_WIN_INST_OUT_DIR)/Files_License.wxi: $(VBOX_WIN_INST_MAKEFILE_DEP) | $$(dir $$@)
$(call MSG_GENERATE,,$@,$<)
$(APPEND) -t $@ ''
$(APPEND) $@ ''
$(APPEND) $@ ' ' \
' '
$(APPEND) -n $@ $(foreach lang,$(VBOX_LICENSE_ADD_LANGUAGES), \
' ' \
' ')
$(APPEND) $@ ''
$(VBOX_WIN_INST_OUT_DIR)/DirComponentsAndFiles_DTrace.wxi: $(VBOX_WIN_INST_MAKEFILE_DEP) $(PATH_SUB_CURRENT)/../Config.kmk | $$(dir $$@)
$(call MSG_GENERATE,,$@,$<)
$(QUIET)$(APPEND) -nt "$@" \
'' \
''
ifdef VBOX_WITH_DTRACE
$(QUIET)$(APPEND) -n "$@" \
'' \
' ' \
' ' \
' ' \
$(foreach file, $(VBOXINST_DTRACE_LIB_ARCH_FILES) \
, ' ' ) \
' ' \
' ' \
' ' \
$(if $(VBOXINST_DTRACE_TESTCASE_ARCH_FILES), \
' ' \
' ' \
' ' \
$(foreach file, $(VBOXINST_DTRACE_TESTCASE_ARCH_FILES) \
, ' ' ) \
' ' \
' ' \
' ') \
$(if $(VBOXINST_DTRACE_SCRIPTS_FILES), \
' ' \
' ' \
$(foreach file, $(VBOXINST_DTRACE_SCRIPTS_FILES) \
, ' ' ) \
' ' \
' ') \
''
endif
$(QUIET)$(APPEND) "$@" ''
$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi: $(VBOX_WIN_INST_MAKEFILE_DEP) | $$(dir $$@)
$(call MSG_GENERATE,,$@,$<)
$(APPEND) -t $@ ''
$(APPEND) $@ ''
#
# Documentation (PDF/CHM)
#
ifdef VBOX_WITH_DOCS_PACKING
$(APPEND) $@ ' '
$(APPEND) -n $@ $(foreach lang,$(VBOX_MANUAL_ADD_LANGUAGES), \
' ')
endif
$(APPEND) $@ ' '
$(APPEND) -n $@ $(foreach lang,$(VBOX_MANUAL_ADD_LANGUAGES), \
' ')
#
# License(s) (RTF)
#
$(APPEND) $@ ' '
$(APPEND) -n $@ $(foreach lang,$(VBOX_LICENSE_ADD_LANGUAGES), \
' ')
$(APPEND) $@ ''
#
# .MSI linking of the main installer (en_US).
#
# Note: This will clean up any previous .msi and .wixpdb files to prevent dep
# build boxes from filling up with old files.
#
define def_vbox_link_msi
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/$(PACKAGE_NAME_LANG)_$(lang).msi \
$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE) && !defined(VBOX_WITH_MSM_INSTALL), + $(VBOX_WIN_INST_OUT_DIR)/common.cab,): \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/VirtualBox_$(lang).wixobj \
$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
$(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
$(PATH_STAGE_BIN)/VBoxInstallHelper.dll \
$(VBOX_SVN_REV_KMK) \
$(VBOX_WIN_INST_MAKEFILE_DEP) \
$(if-expr defined(VBOX_WITH_MSI_HACK),$(MsiHack_0_OUTDIR)/MsiHack.dll,) \
$(if-expr defined(VBOX_WITH_MSI_HACK),$(MsiHack_0_OUTDIR)/MsiHackExtension.dll,) \
| $$$$(dir $$$$@)
$$(call MSG_L1,Linking installer $$@)
$(QUIET)$(RM) -f $$(wildcard $$(subst r$$(VBOX_SVN_REV),r*,\
$$@ \
$$(basename $$@).wixpdb \
$$(VBOX_WIN_INST_REPACK_DIR)/2-link-$$(PACKAGE_NAME_LANG).cmd ))
kmk_time $(VBOX_PATH_WIX)/light.exe -v -nologo \
-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
$(if-expr defined(VBOX_WITH_MSI_HACK),-ext $(MsiHack_0_OUTDIR)/MsiHackExtension.dll,) \
$(VBOX_MSI_ICE_IGNORE) \
-out $$@ \
$$< \
$(VBOX_PATH_WIX)/difxapp_$(if-expr "$(KBUILD_TARGET_ARCH)" == "x86",x86,x64).wixlib
if defined(VBOX_WITH_COMBINED_PACKAGE) && !defined(VBOX_WITH_MSM_INSTALL)
$(MV) -f -- $$(@D)/common.cab $$(@D)/../common.cab
endif
ifeq ($(lang),en_US)
$(CP) -f -- "$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl" "$(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl" \
"$(VBOX_WIN_INST_REPACK_DIR)/files-VirtualBox_$(lang)/"
$(APPEND) -tn "$$(VBOX_WIN_INST_REPACK_DIR)/2-link-$$(PACKAGE_NAME_LANG).cmd" \
'if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_DEVTOOLS is not set & exit /b1)' \
$(subst $(KBUILD_DEVTOOLS),%KBUILD_DEVTOOLS%,\
'$(VBOX_PATH_WIX)/light.exe -v -nologo ^' \
' -loc files-VirtualBox_$(lang)/Language_$(lang).wxl ^' \
' -loc files-VirtualBox_$(lang)/License_$(lang).wxl ^' \
' -ext $(VBOX_PATH_WIX)/WixUIExtension.dll ^' \
' -ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll ^' \
$(if-expr defined(VBOX_WITH_MSI_HACK),'-ext $(MsiHack_0_OUTDIR)/MsiHackExtension.dll ^',) \
' $(VBOX_MSI_ICE_IGNORE) ^' \
' -out $$(@F) ^' \
' $$(> "$$@.dep"
$(QUIET)$(VBOX_XSLTPROC) $(VBOX_PATH_WIN_INST_SRC)/dep2.xsl "$$@" | sort | $(SED) '$!N; /^\(.*\)\n\1$$$$/!P; D' >> "$$@.dep"
$(QUIET)$(APPEND) -n '$$@.dep' '' ''
ifeq ($(lang),en_US)
$(QUIET)$(APPEND) -n '$$@.dep' 'define VBOX_REPACK_FILES_VirtualBox_$(lang)'
$(QUIET)$(CAT_EXT) "$(VBOX_WIN_INST_REPACK_DIR)/VirtualBox_$(lang).files" >> '$$@.dep'
$(QUIET)$(APPEND) -n '$$@.dep' '' 'endef'
endif
$(eval BLDDIRS += $(VBOX_WIN_INST_REPACK_DIR)/files-VirtualBox_$(lang)/)
$(eval OTHER_CLEAN += $(VBOX_REPACK_FILES_VirtualBox_$(lang)) $(VBOX_WIN_INST_REPACK_DIR)/VirtualBox_$(lang).files $(VBOX_WIN_INST_OUT_DIR)/$(lang)/VirtualBox_$(lang).wixobj.dep)
endef
$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
$(eval $(def_vbox_compile_wixobj)))
#
# MSM (merge module) compile.
#
define def_vbox_compile_msm
includedep $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj
$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj \
+ $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wix \
$(if-expr "$(lang)" != "en_US",, \
+ $(VBOX_WIN_INST_REPACK_DIR)/VBoxMerge$(module)_$(lang).wix): \
$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxs \
$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxi \
$(PATH_SUB_CURRENT)/VBoxMerge$(module)CA.wxi \
$(PATH_SUB_CURRENT)/VBoxMerge$(module)Seq.wxi \
$(PATH_SUB_CURRENT)/UserInterface.wxi \
$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi \
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
$(VBOX_WIN_INST_OUT_DIR)/VBoxUnattendedTemplateComponent.wxi \
$(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
$(VBOX_MSI_DEPENDENCIES) \
$(VBOX_VERSION_STAMP) \
| $$$$(dir $$$$@) $(VBOX_WIN_INST_REPACK_DIR)/
$(QUIET)$(RM) -f -- "$@" "$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wix" "$(VBOX_WIN_INST_REPACK_DIR)/VBoxMerge$(module)_$(lang).wix"
$(REDIRECT) \
-E 'PATH_OUT=$(subst /,\,$(PATH_OUT))' \
-E 'PATH_TARGET=$(subst /,\,$(VBOX_WIN_INST_OUT_DIR))' \
-E 'PATH_ROOT=$(subst /,\,$(PATH_ROOT))' \
-E 'PATH_MULTIARCH_GUEST_ADDITIONS_ISO=$(subst /,\,$(PATH_MULTIARCH_GUEST_ADDITIONS_ISO))' \
-E 'VBOX_PATH_WIN_INST_SRC=$(subst /,\,$(VBOX_PATH_WIN_INST_SRC))' \
-E 'VBOX_BRAND_WIN_INST_DLGJPG=$(subst /,\,$(VBOX_BRAND_WIN_INST_DLGJPG))' \
-E 'VBOX_ADD_LANGUAGES=$(VBOX_INSTALLER_ADD_LANGUAGES)' \
-E 'VBOX_BRAND_LICENSE_RTF=$(subst /,\,$(VBOX_BRAND_LICENSE_RTF))' \
$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
-E 'VBOX_BRAND_$(lang)_LICENSE_RTF=$(subst /,\,$(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF))') \
-E 'VBOX_BUILD_NR_FOR_INST=$(VBOX_VERSION_BUILD)' \
-E 'VBOX_VENDOR=$(VBOX_VENDOR)' \
-E 'VBOX_VENDOR_SHORT=$(VBOX_VENDOR_SHORT)' \
-E 'VBOX_PRODUCT=$(VBOX_PRODUCT)' \
-E 'VBOX_C_YEAR=$(VBOX_C_YEAR)' \
-E 'VBOX_VERSION_STRING=$(VBOX_VERSION_STRING)' \
-E 'VBOX_VERSION_STRING_RAW=$(VBOX_VERSION_STRING_RAW)' \
-E 'VBOX_VERSION_MAJOR_INST=$(VBOX_VERSION_MAJOR)' \
-E 'VBOX_VERSION_MINOR_INST=$(VBOX_VERSION_MINOR)' \
-E 'VBOX_SIGNING_MODE=$(strip $(if $(VBOX_SIGNING_MODE),$(VBOX_SIGNING_MODE),none))' \
-E 'VBOX_CAB_COMPRESSION_LEVEL=$(VBOX_CAB_COMPRESSION_LEVEL)' \
-E 'VBOX_CAB_COMPRESSION_LEVEL_COMMON=$(VBOX_CAB_COMPRESSION_LEVEL)' \
-E 'VBOX_GUI_USE_QGL=$(if $(VBOX_GUI_USE_QGL),yes,no)' \
-E 'VBOX_MIDL_PROXY_CLSID=$(VBOX_MIDL_PROXY_CLSID)' \
-E 'VBOX_WINDOWS_ICON_FILE=$(subst /,\,$(VBOX_WINDOWS_ICON_FILE))' \
-E 'VBOX_QT_INFIX=$(VBOX_QT_INFIX)' \
-E 'VBOX_WITH_32_ON_64_MAIN_API=$(if $(VBOX_WITH_32_ON_64_MAIN_API),yes,no)' \
-E 'VBOX_WITH_ADDITIONS_PACKING=$(if $(VBOX_WITH_ADDITIONS_PACKING),yes,no)' \
-E 'VBOX_WITH_COMBINED_PACKAGE=$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE),yes,no)' \
-E 'VBOX_WITH_CROGL=$(if $(VBOX_WITH_CROGL),yes,no)' \
-E 'VBOX_WITH_DEBUGGER_GUI=$(if-expr defined(VBOX_WITH_DEBUGGER_GUI) && defined(VBOX_WITH_QTGUI),yes,no)' \
-E 'VBOX_WITH_DOCS_PACKING=$(if $(VBOX_WITH_DOCS_PACKING),yes,no)' \
-E 'VBOX_WITH_DRAG_AND_DROP=$(if $(VBOX_WITH_DRAG_AND_DROP),yes,no)' \
-E 'VBOX_WITH_DTRACE=$(if $(VBOX_WITH_DTRACE),yes,no)' \
-E 'VBOX_WITH_EFIFW_PACKING=$(if $(VBOX_WITH_EFIFW_PACKING),yes,no)' \
-E 'VBOX_WITH_EXTPACK=$(if $(VBOX_WITH_EXTPACK),yes,no)' \
-E 'VBOX_WITH_GUEST_CONTROL=$(if $(VBOX_WITH_GUEST_CONTROL),yes,no)' \
-E 'VBOX_WITH_GUEST_PROPS=$(if $(VBOX_WITH_GUEST_PROPS),yes,no)' \
-E 'VBOX_WITH_HARDENING=$(if $(VBOX_WITH_HARDENING),yes,no)' \
-E 'VBOX_WITH_LICENSE_DISPLAY=$(if $(VBOX_WITH_LICENSE_DISPLAY),yes,no)' \
-E 'VBOX_WITH_MIDL_PROXY_STUB=$(if $(VBOX_WITH_MIDL_PROXY_STUB),yes,no)' \
-E 'VBOX_WITH_MSM_INSTALL=$(if-expr defined(VBOX_WITH_MSM_INSTALL),yes,no)' \
-E 'VBOX_WITH_NETFLT=$(if $(VBOX_WITH_NETFLT),yes,no)' \
-E 'VBOX_WITH_PYTHON=$(if $(VBOX_WITH_PYTHON),yes,no)' \
-E 'VBOX_WITH_QTGUI=$(if $(VBOX_WITH_QTGUI),yes,no)' \
-E 'VBOX_WITH_SECURELABEL=$(if $(VBOX_WITH_SECURELABEL),yes,no)' \
-E 'VBOX_WITH_SERIALNUMBER_INSTALL=$(if $(VBOX_WITH_SERIALNUMBER_INSTALL),yes,no)' \
-E 'VBOX_WITH_VIDEOHWACCEL=$(if $(VBOX_WITH_VIDEOHWACCEL),yes,no)' \
-E 'VBOX_WITH_VRDP=$(if-expr defined(VBOX_WITH_VRDP) && !defined(VBOX_WITH_EXTPACK_PUEL),yes,no)' \
-E 'VBOX_WITH_WEBSERVICES=$(if $(VBOX_WITH_WEBSERVICES),yes,no)' \
-E 'VBOX_WITH_SDS=$(if $(VBOX_WITH_SDS),yes,no)' \
-E 'VBOX_WITH_UNATTENDED=$(if $(VBOX_WITH_UNATTENDED),yes,no)' \
-E 'BUILD_TYPE=$(KBUILD_TYPE)' \
-E 'BUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH)' \
-E 'VBOX_VCC_TOOL_STEM=$(VBOX_VCC_TOOL_STEM)' \
-- \
$(VBOX_PATH_WIX)/candle.exe $(filter-out $(VBOX_VERSION_STAMP),$$<) \
-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
-p$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wix
$(VBOX_PATH_WIX)/candle.exe $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wix \
-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
-out $$@
ifeq ($(lang),en_US)
$(SED) -e 's,$(subst /,\\,$(PATH_OUT))\\bin,..\\bin,g' \
-e 's,$(subst /,\\,$(PATH_ROOT))\\doc\\,files-VirtualBox_$(lang)\\,g' \
-e 's,$(subst /,\\,$(VBOX_PATH_WIN_INST_SRC))\\Binary\\,files-VirtualBox_$(lang)\\,g' \
-e 's,$(subst /,\\,$(dir $(VBOX_WINDOWS_ICON_FILE))),files-VirtualBox_$(lang)\\,g' \
--output "$(VBOX_WIN_INST_REPACK_DIR)/VBoxMerge$(module)_$(lang).wix" \
"$(VBOX_WIN_INST_OUT_DIR)/$(lang)/VBoxMerge$(module)_$(lang).wix"
$(SED) -n \
-e '/<\?ln /d' \
-e '/$(subst /,\\,$(PATH_ROOT))/p' \
-e '/$(subst /,\\,$(PATH_ROOT))/q2' \
"$(VBOX_WIN_INST_REPACK_DIR)/VBoxMerge$(module)_$(lang).wix"
$(SED) -n \
-e '/<\?ln /d' \
-e 's/\\/\//g' \
-e 's,^.*"\($(PATH_ROOT)/doc/[^"]*\)".*$$(DOLLAR),\1,p' \
-e 's,^.*"\($(VBOX_PATH_WIN_INST_SRC)/Binary/[^"]*\)".*$$(DOLLAR),\1,p' \
-e 's,^.*"\($(dir $(VBOX_WINDOWS_ICON_FILE))[^"]*\)".*$$(DOLLAR),\1,p' \
--output "$(VBOX_WIN_INST_REPACK_DIR)/VBoxMerge$(module)_$(lang).files" \
"$(VBOX_WIN_INST_OUT_DIR)/$(lang)/VBoxMerge$(module)_$(lang).wix"
$(MKDIR) -p -- "$(VBOX_WIN_INST_REPACK_DIR)/files-VBoxMerge$(module)_$(lang)/"
set -xe && for file in `$(CAT_EXT) "$(VBOX_WIN_INST_REPACK_DIR)/VBoxMerge$(module)_$(lang).files"`; \
do $(CP_EXT) -f -- "$$(DOLLAR){file}" "$(VBOX_WIN_INST_REPACK_DIR)/files-VBoxMerge$(module)_$(lang)/"; done
## @todo repack script
endif
# Generate wxi dependencies based on the sourceLineNumber references in the output.
$(QUIET)$(APPEND) -t '$$@.dep' '$$@: \'
$(QUIET)$(VBOX_XSLTPROC) $(VBOX_PATH_WIN_INST_SRC)/dep.xsl "$$@" >> "$$@.dep"
$(QUIET)$(VBOX_XSLTPROC) $(VBOX_PATH_WIN_INST_SRC)/dep2.xsl "$$@" | sort | $(SED) '$!N; /^\(.*\)\n\1$$$$/!P; D' >> "$$@.dep"
$(QUIET)$(APPEND) -n '$$@.dep' '' ''
$(eval OTHER_CLEAN += $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj)
endef
$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
$(foreach lang,$(VBOX_INSTALLER_MERGE_LANGUAGES), \
$(eval $(def_vbox_compile_msm))))
#
# VirtualBox Type Library definition.
#
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi: \
$(PATH_SUB_CURRENT)/$(if-expr defined(VBOX_WITH_MIDL_PROXY_STUB),VirtualBox_TypeLibWithInterfaces.xsl,VirtualBox_TypeLib.xsl) \
$(VBOX_XIDL_FILE) \
$(MAKEFILE) \
| $$(dir $$@)
$(VBOX_XSLTPROC) \
$(if-expr defined(VBOX_WITH_MIDL_PROXY_STUB),--stringparam "a_sProxyStubClsid" "$(VBOX_MIDL_PROXY_CLSID)",) \
$(if-expr defined(VBOX_WITH_SDS),--stringparam "a_sWithSDS" "yes",) \
-o $@ $< $(VBOX_XIDL_FILE)
$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi: \
$(PATH_SUB_CURRENT)/$(if-expr defined(VBOX_WITH_MIDL_PROXY_STUB),VirtualBox_TypeLibWithInterfaces.xsl,VirtualBox_TypeLib.xsl) \
$(VBOX_XIDL_FILE) \
| $$(dir $$@)
$(VBOX_XSLTPROC) --stringparam "a_sTarget" "VBoxClient-x86" \
$(if-expr defined(VBOX_WITH_MIDL_PROXY_STUB),--stringparam "a_sProxyStubClsid" "$(VBOX_MIDL_PROXY_CLSID)",) \
$(if-expr defined(VBOX_WITH_SDS),--stringparam "a_sWithSDS" "yes",) \
-o $@ $< $(VBOX_XIDL_FILE)
#
# Construct the list of GUI translations.
# ('-t' -- truncate file; '-n' -- new line between arguments)
#
include $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk
$(call KB_FN_AUTO_CMD_DEPS,$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi)
$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi: $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk | $$(dir $$@)
$(APPEND) -t $@ ''
$(APPEND) $@ ''
$(APPEND) -n $@ $(foreach lang,$(VBOX_APPROVED_GUI_LANGUAGES), \
' ' \
' ')
$(APPEND) $@ ''
#
# Edit the version stored in the registry.
#
$(call KB_FN_AUTO_CMD_DEPS,$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi)
$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi: $(PATH_SUB_CURRENT)/VBoxKey.wxi $(VBOX_VERSION_STAMP) | $$(dir $$@)
$(SED) -e 's/%VER%/$(VBOX_VERSION_STRING_RAW)/' \
-e 's/%VER_EXT%/$(VBOX_VERSION_STRING)/' \
--output $@ $<
#
# Generate the list of unattended template script files.
#
$(call KB_FN_AUTO_CMD_DEPS,$(VBOX_WIN_INST_OUT_DIR)/VBoxUnattendedTemplateComponent.wxi)
$(VBOX_WIN_INST_OUT_DIR)/VBoxUnattendedTemplateComponent.wxi: | $$(dir $$@)
$(APPEND) -t -n $@ \
'' \
''
ifdef VBOX_UNATTENDED_TEMPLATES
$(APPEND) -n $@ \
' ' \
' ' \
$(foreach file,$(VBOX_UNATTENDED_TEMPLATES), \
' ') \
' ' \
' '
endif
$(APPEND) $@ ''
#
# Build the multi-language version of the .MSI installer (final installer).
#
# This is done by creating binary .MST diffs of all the language-specific installers
# against the en_US one, and then merging the diffs into the en_US one using tools
# from the MS Installer SDK.
#
define def_vbox_create_mst
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/$(lang).mst \
+ $(VBOX_WIN_INST_REPACK_DIR)/$(lang).mst: \
$(VBOX_WIN_INST_OUT_DIR)/en_US/$(PACKAGE_NAME_LANG)_en_US.msi \
$(VBOX_WIN_INST_OUT_DIR)/$(lang)/VirtualBox_$(lang).wixobj \
$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
$(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
$(PATH_STAGE_BIN)/VBoxInstallHelper.dll \
$(VBOX_SVN_REV_KMK) \
$(VBOX_WIN_INST_MAKEFILE_DEP) \
$(if-expr defined(VBOX_WITH_MSI_HACK),$(MsiHack_0_OUTDIR)/MsiHack.dll,) \
$(if-expr defined(VBOX_WITH_MSI_HACK),$(MsiHack_0_OUTDIR)/MsiHackExtension.dll,) \
| $$$$(dir $$$$@) $(VBOX_WIN_INST_REPACK_DIR)/
$(call MSG_L1,Creating language diff for $(lang))
kmk_time $(VBOX_PATH_WIX)/light.exe -v -nologo \
-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
$(if-expr defined(VBOX_WITH_MSI_HACK),-ext $(MsiHack_0_OUTDIR)/MsiHackExtension.dll,) \
$(VBOX_MSI_ICE_IGNORE) \
-out $$(@D)/$(PACKAGE_NAME_LANG)_$(lang).msi \
$$(@D)/VirtualBox_$(lang).wixobj \
$(VBOX_PATH_WIX)/difxapp_$(if-expr "$(KBUILD_TARGET_ARCH)" == "x86",x86,x64).wixlib
$(REDIRECT) -C $$(@D) -- $(VBOX_PATH_MSITRAN) -g $$< $(PACKAGE_NAME_LANG)_$(lang).msi $(lang).mst
$(CP) -f -- "$(VBOX_WIN_INST_OUT_DIR)/$(lang)/$(lang).mst" "$(VBOX_WIN_INST_REPACK_DIR)/$(lang).mst"
$(RM) -f -- $$(@D)/$(PACKAGE_NAME_LANG)_$(lang).msi \
$$(@D)/$(PACKAGE_NAME_LANG)_$(lang).wixpdb \
$$(@D)/common.cab
endef
$(foreach lang,$(filter-out en_US, $(VBOX_INSTALLER_LANGUAGES)), \
$(eval local lang_id := $(VBOX_BRAND_$(lang)_LANG_ID)) \
$(eval $(def_vbox_create_mst)))
# Create WISUMINFO argument.
VBOX_INS_PROD_ARCH.amd64 = x64
VBOX_INS_PROD_ARCH.x86 = Intel
VBOX_INS_PROD_ARCH := $(VBOX_INS_PROD_ARCH.$(KBUILD_TARGET_ARCH))
$(if $(VBOX_INS_PROD_ARCH),,$(error VBOX_INS_PROD_ARCH is empty!))
VBOX_INS_PROD_LANG := 7="$(VBOX_INS_PROD_ARCH);1033
$(foreach lang, $(filter-out en_US,$(VBOX_INSTALLER_LANGUAGES))\
, $(eval VBOX_INS_PROD_LANG := $(VBOX_INS_PROD_LANG)$(COMMA)$(VBOX_BRAND_$(lang)_LANG_ID)))
VBOX_INS_PROD_LANG := $(VBOX_INS_PROD_LANG)"
# The multilingual installer rule.
$(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_LANG).msi \
+ $(VBOX_WIN_INST_REPACK_DIR)/3-multilingual-$(PACKAGE_NAME_LANG).cmd: \
$(VBOX_WIN_INST_OUT_DIR)/en_US/$(PACKAGE_NAME_LANG)_en_US.msi \
$(foreach lang,$(filter-out en_US,$(VBOX_INSTALLER_LANGUAGES)),$(VBOX_WIN_INST_OUT_DIR)/$(lang)/$(lang).mst)
$(call MSG_L1,Creating final multilingual MSI)
$(QUIET)$(RM) -f -- \
$(wildcard $(@D)/$(PACKAGE_BASE)-r*.msi $(VBOX_WIN_INST_REPACK_DIR)/3-multilingual-$(PACKAGE_BASE)-r*.cmd )
$(CP) -f -- "$<" "$@"
$(foreach lang,$(filter-out en_US,$(VBOX_INSTALLER_LANGUAGES)), \
$(NLTAB)$(REDIRECT) -C $(@D)/$(lang) -- $(VBOX_PATH_MSIDB) -d $@ -r $(lang).mst \
$(NLTAB)$(REDIRECT) -C $(@D)/$(lang) -- cscript.exe /nologo $(VBOX_PATH_WISUBSTG) $@ $(lang).mst $(VBOX_BRAND_$(lang)_LANG_ID) )
$(REDIRECT) -C $(@D) -- cscript.exe /nologo $(VBOX_PATH_WISUBSTG) $(@F)
$(REDIRECT) -C $(@D) -- cscript.exe /nologo $(VBOX_PATH_WISUMINFO) $@ $(VBOX_INS_PROD_LANG)
$(call VBOX_SIGN_FILE_FN,$@,$(VBOX_PRODUCT) $(VBOX_VERSION_STRING)r$(VBOX_SVN_REV) ($(KBUILD_TARGET_ARCH)),,,disable-dual-signing)
# Create repack script for this step.
$(APPEND) -nt "$(VBOX_WIN_INST_REPACK_DIR)/3-multilingual-$(PACKAGE_NAME_LANG).cmd" \
'if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_DEVTOOLS is not set & exit /b1)' \
'if ".%KBUILD_BIN_PATH%" == "." (echo KBUILD_BIN_PATH is not set & exit /b1)' \
'copy /y "$(