# $Id: Config.kmk 104031 2024-03-24 18:52:47Z vboxsync $ ## @file # XPCOM kBuild Configuration file. # # # Copyright (C) 2006-2023 Oracle and/or its affiliates. # # This file is part of VirtualBox base platform packages, as # available from https://www.virtualbox.org. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, in version 3 of the # License. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # SPDX-License-Identifier: GPL-3.0-only # # Include the top-level configure file. ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED include $(PATH_ROOT)/Config.kmk endif # # Globals. # VBOX_PATH_XPCOM_SRC := $(PATH_ROOT)/src/libs/xpcom18a4 # # Template for building the XPCOM libraries (shared). # TEMPLATE_XPComDll = XPCOM libraries (shared) TEMPLATE_XPComDll_EXTENDS = VBoxR3DllNonPedantic ## @todo correct inheritance here to make it use all the VBoxR3DllNonPedantic settings instead of overriding all of them. TEMPLATE_XPComDll_ASTOOL = $(TEMPLATE_VBoxR3DllNonPedantic_TOOL) TEMPLATE_XPComDll_ASFLAGS = $(NO_SUCH_VARIABLE) TEMPLATE_XPComDll_ASFLAGS.x86 = -m32 TEMPLATE_XPComDll_ASFLAGS.amd64 = -m64 TEMPLATE_XPComDll_ASDEFS = $(NO_SUCH_VARIABLE) TEMPLATE_XPComDll_CXXFLAGS = -g -pipe -ansi -Wall -Wno-unused -Wno-non-virtual-dtor \ $(VBOX_GCC_Wno-invalid-offsetof) -Wno-sign-compare -Wno-unused -Wno-ctor-dtor-privacy \ $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \ $(VBOX_GCC_Wno-delete-non-virtual-dtor) $(VBOX_GCC_Wno-multistatement-macros) $(VBOX_GCC_fdiagnostics-show-option) \ $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) #if !defined(VBOX_GCC_Wno-delete-non-virtual-dtor) && defined(VBOX_GCC_Wno-non-virtual-dtor) ifndef VBOX_GCC_Wno-delete-non-virtual-dtor ifdef VBOX_GCC_Wno-non-virtual-dtor TEMPLATE_XPComDll_CXXFLAGS += $(VBOX_GCC_Wno-non-virtual-dtor) endif endif TEMPLATE_XPComDll_CXXFLAGS.x86 = -m32 TEMPLATE_XPComDll_CXXFLAGS.amd64 = -m64 TEMPLATE_XPComDll_CXXFLAGS.darwin = -fpascal-strings -fshort-wchar -fno-common -fno-rtti $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) TEMPLATE_XPComDll_CXXFLAGS.freebsd = -pthread TEMPLATE_XPComDll_CXXFLAGS.linux = -pthread TEMPLATE_XPComDll_CXXFLAGS.solaris = -fno-omit-frame-pointer # for now anyway. TEMPLATE_XPComDll_CFLAGS = -g -pipe -Wall -Wno-unused -Wno-parentheses -Wno-uninitialized $(VBOX_GCC_fvisibility-hidden) \ $(VBOX_GCC_Wno-multistatement-macros) $(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) TEMPLATE_XPComDll_CFLAGS.x86 = -m32 TEMPLATE_XPComDll_CFLAGS.amd64 = -m64 TEMPLATE_XPComDll_CFLAGS.freebsd = -pthread TEMPLATE_XPComDll_CFLAGS.linux = -pthread -ansi TEMPLATE_XPComDll_CFLAGS.solaris = -fno-omit-frame-pointer # for now anyway. TEMPLATE_XPComDll_DEFS = \ MOZILLA_CLIENT=1 \ NDEBUG=1 \ _IMPL_NS_COM \ IN_RING3 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING TEMPLATE_XPComDll_DEFS += \ XPCOM_DLL_BASE="$(basename $(notdir $(LIB_XPCOM)))" \ MOZ_DLL_SUFFIX="$(suffix $(LIB_XPCOM))" else TEMPLATE_XPComDll_DEFS += \ XPCOM_DLL_BASE=\"$(basename $(notdir $(LIB_XPCOM)))\" \ MOZ_DLL_SUFFIX=\"$(suffix $(LIB_XPCOM))\" endif ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP TEMPLATE_XPComDll_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP endif TEMPLATE_XPComDll_DEFS.x86 = i386=1 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING TEMPLATE_XPComDll_DEFS.amd64 = HAVE_VA_LIST_AS_ARRAY HAVE_VA_COPY VA_COPY(a,b)=__builtin_va_copy(a,b) else TEMPLATE_XPComDll_DEFS.amd64 = HAVE_VA_LIST_AS_ARRAY HAVE_VA_COPY VA_COPY\(a\,b\)=__builtin_va_copy\(a\,b\) endif ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING TEMPLATE_XPComDll_DEFS.arm64 = HAVE_VA_LIST_AS_ARRAY HAVE_VA_COPY VA_COPY(a,b)=__builtin_va_copy(a,b) else TEMPLATE_XPComDll_DEFS.arm64 = HAVE_VA_LIST_AS_ARRAY HAVE_VA_COPY VA_COPY\(a\,b\)=__builtin_va_copy\(a\,b\) endif ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING TEMPLATE_XPComDll_DEFS.darwin = XP_UNIX=1 XP_MACOSX=1 TARGET_CARBON=1 HAVE_VISIBILITY_ATTRIBUTE=1 $(TEMPLATE_VBoxR3DllNonPedantic_DEFS.darwin) else TEMPLATE_XPComDll_DEFS.darwin = XP_UNIX=1 XP_MACOSX=1 TARGET_CARBON=1 HAVE_VISIBILITY_ATTRIBUTE=1 $(TEMPLATE_VBoxR3DllNonPedantic_DEFS.darwin) endif ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING TEMPLATE_XPComDll_DEFS.freebsd = XP_UNIX=1 HAVE_VISIBILITY_ATTRIBUTE=1 else TEMPLATE_XPComDll_DEFS.freebsd = XP_UNIX=1 HAVE_VISIBILITY_ATTRIBUTE=1 endif ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING TEMPLATE_XPComDll_DEFS.linux = XP_UNIX=1 _GNU_SOURCE HAVE_VISIBILITY_ATTRIBUTE=1 else TEMPLATE_XPComDll_DEFS.linux = XP_UNIX=1 _GNU_SOURCE HAVE_VISIBILITY_ATTRIBUTE=1 endif ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING TEMPLATE_XPComDll_DEFS.solaris = XP_UNIX=1 HAVE_LIBDL=1 HAVE_SENDFILEV=1 _REENTRANT else TEMPLATE_XPComDll_DEFS.solaris = XP_UNIX=1 HAVE_LIBDL=1 HAVE_SENDFILEV=1 _REENTRANT endif TEMPLATE_XPComDll_LDFLAGS = $(TEMPLATE_VBoxR3DllNonPedantic_LDFLAGS) ifdef VBOX_WITH_RUNPATH TEMPLATE_XPComDll_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' else ifdef VBOX_WITH_RELATIVE_RUNPATH TEMPLATE_XPComDll_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)' endif TEMPLATE_XPComDll_LDFLAGS.x86 = -m32 TEMPLATE_XPComDll_LDFLAGS.amd64 = -m64 TEMPLATE_XPComDll_LDFLAGS.darwin = $(TEMPLATE_VBoxR3DllNonPedantic_LDFLAGS.darwin) \ -fshort-wchar -fno-rtti -fno-exceptions -fpascal-strings \ -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \ -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \ -framework CoreServices \ -framework CoreFoundation \ -framework Foundation \ -framework AppKit \ -framework Carbon ## @todo why is -fno-exceptions here. ifn1of ($(KBUILD_TARGET), os2 win) TEMPLATE_XPComDll_CXXFLAGS += -fPIC TEMPLATE_XPComDll_CFLAGS += -fPIC TEMPLATE_XPComDll_LDFLAGS += -fPIC TEMPLATE_XPComDll_DEFS += MOZ_PRESERVE_PIC endif TEMPLATE_XPComDll_INCS = $(VBOX_PATH_XPCOM_SRC)/xpcom/build \ $(VBOX_PATH_XPCOM_SRC)/xpcom/ds \ $(VBOX_PATH_XPCOM_SRC)/xpcom/io \ $(VBOX_PATH_XPCOM_SRC)/xpcom/base \ $(VBOX_PATH_XPCOM_SRC)/xpcom/components \ $(VBOX_PATH_XPCOM_SRC)/xpcom/threads \ $(VBOX_PATH_XPCOM_SRC)/xpcom/proxy/src \ $(VBOX_PATH_XPCOM_SRC)/xpcom/reflect/xptcall/src \ $(VBOX_PATH_XPCOM_SRC)/ipc/ipcd/client/src \ $(VBOX_PATH_XPCOM_SRC)/ipc/ipcd/shared/src \ $(VBOX_PATH_SDK)/bindings/xpcom/include \ $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \ $(VBOX_PATH_SDK)/bindings/xpcom/include/string \ $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \ $(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd \ . TEMPLATE_XPComDll_DEFS.darwin += VBOX_WITH_NEWER_OSX_SDK TEMPLATE_XPComDll_INCS.darwin = \ $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/ \ $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/ \ $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/Headers/ TEMPLATE_XPComDll_ORDERDEPS = $(foreach hdrinst, $(filter %-HEADERS, $(INSTALLS)), $($(hdrinst)_1_TARGET)) \ $(PATH_TARGET)/VBox-xpcom-idl-timestamp # When using IPRT in NSRP or/and using IPRT for logging, link with IPRT. TEMPLATE_XPComDll_LIBS += $(LIB_RUNTIME) # # Same as XPCOM except using YASM/NASM instead of the gnu/unix assembler. # TEMPLATE_XPComDllYasm := XPCOM w/ yasm TEMPLATE_XPComDllYasm_EXTENDS := XPComDll TEMPLATE_XPComDllYasm_ASTOOL = $(TEMPLATE_VBoxR3DllNonPedantic_ASTOOL) TEMPLATE_XPComDllYasm_ASFLAGS = $(TEMPLATE_VBoxR3DllNonPedantic_ASFLAGS) TEMPLATE_XPComDllYasm_ASFLAGS.x86 = $(TEMPLATE_VBoxR3DllNonPedantic_ASFLAGS.x86) TEMPLATE_XPComDllYasm_ASFLAGS.amd64 = $(TEMPLATE_VBoxR3DllNonPedantic_ASFLAGS.amd64) TEMPLATE_XPComDllYasm_ASDEFS = $(TEMPLATE_VBoxR3DllNonPedantic_DEFS) # # Template for building the XPCOM executables. # Used as a base template by XPComTstExe and XPComIpcExe. # TEMPLATE_XPComExe := XPCOM executable files TEMPLATE_XPComExe_EXTENDS := XPComDll ## @todo undo -fPIC. TEMPLATE_XPComExe_INCS = ipc/ipcd/shared/src \ $(VBOX_PATH_SDK)/bindings/xpcom/include \ $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \ $(VBOX_PATH_SDK)/bindings/xpcom/include/string \ $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \ $(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd \ . TEMPLATE_XPComExe_LIBS = \ $(VBox-xpcom-ipcshared_1_TARGET) \ $(VBoxXPCOM_1_TARGET) \ $(TEMPLATE_XPComDll_LIBS) TEMPLATE_XPComExe_LIBS.freebsd = $(LIB_PTHREAD) TEMPLATE_XPComExe_LIBS.linux = dl $(LIB_PTHREAD) TEMPLATE_XPComExe_LDFLAGS.darwin = -bind_at_load $(filter-out -current_version -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD),$(TEMPLATE_XPComDll_LDFLAGS.darwin)) # # Template for building the XPCOM testcase executables # TEMPLATE_XPComTstExe = XPCOM executable files (testcases) TEMPLATE_XPComTstExe_EXTENDS = XPComExe TEMPLATE_XPComTstExe_CXXFLAGS = $(TEMPLATE_XPComExe_CXXFLAGS) -Wno-format TEMPLATE_XPComTstExe_CFLAGS = $(TEMPLATE_XPComExe_CFLAGS) -Wno-format TEMPLATE_XPComTstExe_INST = $(INST_TESTCASE) ifdef VBOX_WITH_RUNPATH TEMPLATE_XPComTstExe_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_XPComExe_LDFLAGS) else ifdef VBOX_WITH_RELATIVE_RUNPATH TEMPLATE_XPComTstExe_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_XPComExe_LDFLAGS) endif if "$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE) TEMPLATE_XPComTstExe_POST_CMDS = endif # # Template for building XPCOM executables for running at build time. # # It extends the BLDPROG template in config.kmk but overrides CFLAGS # and CXXFLAGS completely at the moment. # TEMPLATE_XPComBldProg = XPCOM Build programs executables TEMPLATE_XPComBldProg_EXTENDS = VBoxAdvBldProg TEMPLATE_XPComBldProg_DEFS.$(KBUILD_HOST) = $(TEMPLATE_VBoxAdvBldProg_DEFS.$(KBUILD_HOST)) $(TEMPLATE_XPComExe_DEFS.$(KBUILD_HOST)) TEMPLATE_XPComBldProg_DEFS.x86 = $(TEMPLATE_VBoxAdvBldProg_DEFS.x86) $(TEMPLATE_XPComExe_DEFS.x86) TEMPLATE_XPComBldProg_DEFS.amd64 = $(TEMPLATE_VBoxAdvBldProg_DEFS.amd64) $(TEMPLATE_XPComExe_DEFS.amd64) TEMPLATE_XPComBldProg_DEFS.arm64 = $(TEMPLATE_VBoxAdvBldProg_DEFS.arm64) $(TEMPLATE_XPComExe_DEFS.arm64) TEMPLATE_XPComBldProg_INCS = \ $(VBOX_PATH_SDK)/bindings/xpcom/include \ $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \ $(VBOX_PATH_SDK)/bindings/xpcom/include/string \ $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \ $(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd TEMPLATE_XPComBldProg_CFLAGS = $(filter-out $(VBOX_GCC_PEDANTIC_C), $(TEMPLATE_VBoxAdvBldProg_CFLAGS)) \ $(VBOX_GCC_Wno-int-to-pointer-cast) $(VBOX_GCC_Wno-pointer-to-int-cast) $(VBOX_GCC_NON_PEDANTIC_C) TEMPLATE_XPComBldProg_CXXFLAGS.darwin = $(TEMPLATE_VBoxAdvBldProg_CXXFLAGS.darwin) -fpascal-strings -fshort-wchar -fno-common -fno-rtti TEMPLATE_XPComBldProg_CXXFLAGS.solaris = $(TEMPLATE_VBoxAdvBldProg_CXXFLAGS.solaris) -fno-omit-frame-pointer # for now anyway. TEMPLATE_XPComBldProg_LDFLAGS.darwin = $(TEMPLATE_VBoxAdvBldProg_LDFLAGS.darwin) -fpascal-strings -fshort-wchar -fno-rtti -fno-exceptions TEMPLATE_XPComBldProg_ORDERDEPS = $(foreach hdrinst, $(filter %-HEADERS, $(INSTALLS)), $($(hdrinst)_1_TARGET)) TEMPLATE_XPComBldProg_LIBS.darwin = \ iconv # # Creates a x86 target for an XPCOM target if so desired. # The target is specified as the first argument: $(evalcall VBOX_XPCOM_X86,target). # ifdef VBOX_WITH_32_ON_64_MAIN_API define VBOX_XPCOM_X86 $(1)-x86_TEMPLATE := $(strip $($(1)_TEMPLATE))-x86 $(1)-x86_EXTENDS := $(1) endef else define VBOX_XPCOM_X86 endef endif # Corresponding 32-bit template(s). TEMPLATE_XPComDll-x86 = 32-bit XPCOM libraries (shared) TEMPLATE_XPComDll-x86_EXTENDS = XPComDll TEMPLATE_XPComDll-x86_BLD_TRG_ARCH = x86 TEMPLATE_XPComDll-x86_DEFS = $(TEMPLATE_XPComDll_DEFS) VBOX_IN_32_ON_64_MAIN_API TEMPLATE_XPComDll-x86_LIBS = $(subst $(LIB_RUNTIME),$(VBOX_LIB_RUNTIME_X86),$(TEMPLATE_XPComDll_LIBS)) TEMPLATE_XPComDllYasm-x86 = 32-bit XPCOM libraries (shared) with YASM as assembler. TEMPLATE_XPComDllYasm-x86_EXTENDS = XPComDllYasm TEMPLATE_XPComDllYasm-x86_BLD_TRG_ARCH = x86 TEMPLATE_XPComDllYasm-x86_DEFS = $(TEMPLATE_XPComDllYasm_DEFS) VBOX_IN_32_ON_64_MAIN_API TEMPLATE_XPComDllYasm-x86_LIBS = $(subst $(LIB_RUNTIME),$(VBOX_LIB_RUNTIME_X86),$(TEMPLATE_XPComDllYasm_LIBS)) # # The list of XPCOM's IDL files. # This is used by the java bindings as well as the XPCOM build. # XPCOM_IDLFILES = \ xpcom/base/nsIDebug.idl \ xpcom/base/nsIInterfaceRequestor.idl \ xpcom/base/nsIProgrammingLanguage.idl \ xpcom/base/nsISupports.idl \ xpcom/base/nsITraceRefcnt.idl \ xpcom/base/nsIWeakReference.idl \ xpcom/base/nsIErrorService.idl \ xpcom/base/nsIException.idl \ xpcom/base/nsIExceptionService.idl \ xpcom/base/nsrootidl.idl \ xpcom/components/nsIClassInfo.idl \ xpcom/components/nsIComponentRegistrar.idl \ xpcom/components/nsIFactory.idl \ xpcom/components/nsIModule.idl \ xpcom/components/nsIServiceManager.idl \ xpcom/components/nsIComponentManager.idl \ xpcom/components/nsICategoryManager.idl \ xpcom/components/nsIComponentLoader.idl \ xpcom/components/nsINativeComponentLoader.idl \ xpcom/components/nsIComponentManagerObsolete.idl \ xpcom/components/nsIComponentLoaderManager.idl \ xpcom/ds/nsISupportsArray.idl \ xpcom/ds/nsICollection.idl \ xpcom/ds/nsISerializable.idl \ xpcom/ds/nsIEnumerator.idl \ xpcom/ds/nsISimpleEnumerator.idl \ xpcom/ds/nsIObserverService.idl \ xpcom/ds/nsIObserver.idl \ xpcom/ds/nsIAtom.idl \ xpcom/ds/nsIAtomService.idl \ xpcom/ds/nsIProperties.idl \ xpcom/ds/nsIStringEnumerator.idl \ xpcom/ds/nsISupportsPrimitives.idl \ xpcom/ds/nsISupportsIterators.idl \ xpcom/ds/nsIVariant.idl \ xpcom/ds/nsIArray.idl \ xpcom/ds/nsIHashable.idl \ xpcom/io/nsIDirectoryService.idl \ xpcom/io/nsIDirectoryEnumerator.idl \ xpcom/io/nsIFile.idl \ xpcom/io/nsILocalFile.idl \ xpcom/io/nsILocalFileMac.idl \ xpcom/io/nsIInputStream.idl \ xpcom/io/nsIObjectInputStream.idl \ xpcom/io/nsIBinaryInputStream.idl \ xpcom/io/nsIObjectOutputStream.idl \ xpcom/io/nsIBinaryOutputStream.idl \ xpcom/io/nsIOutputStream.idl \ xpcom/proxy/public/nsIProxyObjectManager.idl \ xpcom/threads/nsIEventQueueService.idl \ xpcom/threads/nsIEventQueue.idl \ xpcom/threads/nsIEventTarget.idl \ xpcom/threads/nsIRunnable.idl \ xpcom/reflect/xptinfo/public/nsIInterfaceInfo.idl \ xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl \ xpcom/reflect/xptinfo/public/nsIXPTLoader.idl \ ipc/ipcd/client/public/ipcIService.idl \ ipc/ipcd/client/public/ipcIMessageObserver.idl \ ipc/ipcd/client/public/ipcIClientObserver.idl \ ipc/ipcd/client/public/ipcIDConnectService.idl # # The include path for the XPCOM IDL files above. # XPIDL_INCS = \ -I $(VBOX_PATH_XPCOM_SRC)/xpcom/base/ \ -I $(VBOX_PATH_XPCOM_SRC)/xpcom/ds/ \ -I $(VBOX_PATH_XPCOM_SRC)/xpcom/components/ \ -I $(VBOX_PATH_XPCOM_SRC)/xpcom/io/ \ -I $(VBOX_PATH_XPCOM_SRC)/xpcom/threads/ \ -I $(VBOX_PATH_XPCOM_SRC)/xpcom/reflect/xptinfo/public/