gbuild: implement gb_Library_get_target_for_build

I was wondering why removing instdir stuff forced a rebuild of
the cross toolset. Turned out some cross-toolset bits were wrongly
depending on host build stuff. It even had FIXME...

As a consequence, gb_CPPU_ENV was replaced by config_host.mk flags
to provide an CPPU_ENV_FOR_BUILD and also uses the correct
OS_FOR_BUILD.

Change-Id: I50e8e8dca50ab1ad3164948a585a792a52e4a39a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116359
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
This commit is contained in:
Jan-Marek Glogowski
2021-05-22 02:41:58 +02:00
parent 8196c0a0a5
commit e930174225
17 changed files with 75 additions and 39 deletions

View File

@@ -3857,19 +3857,17 @@ endif # SYSTEM_JFREEREPORT
# Executables
# FIXME: the library target should be for build too
define gb_Executable__register_bestreversemap
$(call gb_Executable_add_runtime_dependencies,bestreversemap,\
$(if $(filter $(OS),ANDROID),,$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,$(call gb_Library_get_target,sal_textenc))) \
$(if $(filter $(OS),ANDROID),,$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,$(call gb_Library_get_target_for_build,sal_textenc))) \
)
endef
# TODO depending on the whole URE might be overkill, but I do not have a
# Windows machine to debug it...
# FIXME: the library target should be for build too
define gb_Executable__register_climaker
$(call gb_Executable_add_runtime_dependencies,climaker,\
$(call gb_Library_get_target,$(gb_CPPU_ENV)_uno) \
$(call gb_Library_get_target_for_build,$(CPPU_ENV_FOR_BUILD)_uno) \
$(INSTROOT_FOR_BUILD)/$(LIBO_URE_MISC_FOLDER)/services.rdb \
$(call gb_UnoApi_get_target,udkapi) \
$(INSTROOT_FOR_BUILD)/$(LIBO_URE_ETC_FOLDER)/$(call gb_Helper_get_rcfile,uno)
@@ -3883,12 +3881,11 @@ $(call gb_Executable_add_runtime_dependencies,cppumaker,\
endef
# This is used to determine what we need for 'build' platform.
# FIXME: the library target should be for build too
define gb_Executable__register_gengal
$(call gb_Executable_add_runtime_dependencies,gengal,\
$(call gb_Library_get_target,$(gb_CPPU_ENV)_uno) \
$(if $(filter MACOSX,$(OS)),$(call gb_Library_get_target,vclplug_osx)) \
$(if $(filter WNT,$(OS)),$(call gb_Library_get_target,vclplug_win)) \
$(call gb_Library_get_target_for_build,$(CPPU_ENV_FOR_BUILD)_uno) \
$(if $(filter MACOSX,$(OS_FOR_BUILD)),$(call gb_Library_get_target_for_build,vclplug_osx)) \
$(if $(filter WNT,$(OS_FOR_BUILD)),$(call gb_Library_get_target_for_build,vclplug_win)) \
$(if $(filter host,$(gb_Side)),$(call gb_Package_get_target,postprocess_images)) \
$(call gb_Package_get_target_for_build,postprocess_registry) \
$(INSTROOT_FOR_BUILD)/$(LIBO_URE_ETC_FOLDER)/$(call gb_Helper_get_rcfile,uno) \
@@ -3929,10 +3926,9 @@ endef
# FIXME ure/services.rdb needs cleanup
# The dependencies on ure/services.rdb and udkapi.rdb are implicitly required
# due to the settings for URE_SERVICES and URE_TYPES in cppuhelper/source/unorc:
# FIXME: the library target should be for build too
define gb_Executable__register_saxparser
$(call gb_Executable_add_runtime_dependencies,saxparser,\
$(call gb_Library_get_target,$(gb_CPPU_ENV)_uno) \
$(call gb_Library_get_target_for_build,$(CPPU_ENV_FOR_BUILD)_uno) \
$(call gb_Package_get_target_for_build,instsetoo_native_setup_ure) \
$(call gb_Rdb_get_target_for_build,saxparser) \
$(INSTROOT_FOR_BUILD)/$(LIBO_URE_MISC_FOLDER_FOR_BUILD)/services.rdb \
@@ -3943,10 +3939,9 @@ endef
# NOTE: the dependencies on ure/services.rdb and udkapi.rdb are implicitly
# required due to the settings for URE_SERVICES and URE_TYPES in
# cppuhelper/source/unorc
# FIXME: the library target should be for build too
define gb_Executable__register_uno
$(call gb_Executable_add_runtime_dependencies,uno,\
$(call gb_Library_get_target,$(gb_CPPU_ENV)_uno) \
$(call gb_Library_get_target_for_build,$(CPPU_ENV_FOR_BUILD)_uno) \
$(INSTROOT_FOR_BUILD)/$(LIBO_URE_MISC_FOLDER)/services.rdb \
$(call gb_UnoApi_get_target,udkapi) \
)

View File

@@ -40,8 +40,6 @@ endif
gb_Executable_FILENAMES := $(patsubst soffice_exe:soffice_exe%,soffice_exe:soffice.exe,$(gb_Executable_FILENAMES))
gb_Executable_FILENAMES := $(patsubst soffice_com:soffice_com%,soffice_com:soffice.com,$(gb_Executable_FILENAMES))
gb_Executable_FILENAMES_FOR_BUILD := $(subst $(gb_Executable_EXT),$(gb_Executable_EXT_for_build),$(gb_Executable_FILENAMES))
# fixes for .jnilibs on macOS that are not also needed as .dylibs:
ifeq ($(OS),MACOSX)
gb_Library_FILENAMES := \
@@ -100,4 +98,7 @@ gb_Library_FILENAMES += $(foreach lib,$(gb_Library_LIBLIBFILENAMES),$(lib):lib$(
endif # ifeq ($(OS),WNT)
gb_Executable_FILENAMES_FOR_BUILD := $(subst $(gb_Executable_EXT),$(gb_Executable_EXT_for_build),$(gb_Executable_FILENAMES))
gb_Library_FILENAMES_FOR_BUILD := $(subst $(gb_Library_PLAINEXT),$(gb_Library_PLAINEXT_FOR_BUILD),$(gb_Library_FILENAMES))
# vim: set noet sw=4 ts=4:

View File

@@ -7,7 +7,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,$(gb_CPPU_ENV)_uno))
$(eval $(call gb_Library_Library,$(CPPU_ENV)_uno))
ifeq ($(CPUNAME),ARM)
@@ -28,7 +28,7 @@ bridges_SELECTED_BRIDGE := gcc3_linux_aarch64
bridge_asm_objects := vtableslotcall
bridge_exception_objects := abi cpp2uno uno2cpp
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno, \
$(eval $(call gb_Library_add_exception_objects,$(CPPU_ENV)_uno, \
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/callvirtualfunction, \
$(if $(HAVE_GCC_STACK_CLASH_PROTECTION),-fno-stack-clash-protection) \
$(if $(COM_IS_CLANG),-fasynchronous-unwind-tables) \
@@ -185,25 +185,25 @@ endif
endif
$(eval $(call gb_Library_use_internal_comprehensive_api,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_use_internal_comprehensive_api,$(CPPU_ENV)_uno,\
udkapi \
))
ifeq ($(OS),MACOSX)
ifeq ($(CPUNAME),AARCH64)
$(eval $(call gb_Library_use_internal_comprehensive_api,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_use_internal_comprehensive_api,$(CPPU_ENV)_uno,\
offapi \
))
endif
endif
$(eval $(call gb_Library_set_include,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_set_include,$(CPPU_ENV)_uno,\
-I$(SRCDIR)/bridges/inc \
$$(INCLUDE) \
))
ifeq ($(HAVE_POSIX_FALLOCATE),YES)
$(eval $(call gb_Library_add_defs,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_defs,$(CPPU_ENV)_uno,\
-DHAVE_POSIX_FALLOCATE \
))
endif
@@ -235,40 +235,40 @@ bridges_NON_CALL_EXCEPTIONS_FLAGS := -fnon-call-exceptions
endif
endif
$(eval $(call gb_Library_use_libraries,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_use_libraries,$(CPPU_ENV)_uno,\
cppu \
sal \
))
$(foreach obj,$(bridge_exception_objects),\
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_exception_objects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj))) \
)
$(foreach obj,$(bridge_noncallexception_objects),\
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_exception_objects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj) \
, $(bridges_NON_CALL_EXCEPTIONS_FLAGS) )) \
)
$(foreach obj,$(bridge_noopt_objects),\
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_exception_objects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj) \
, $(gb_COMPILERNOOPTFLAGS))) \
)
$(foreach obj,$(bridge_noncallexception_noopt_objects),\
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_exception_objects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj) \
, $(gb_COMPILERNOOPTFLAGS) $(bridges_NON_CALL_EXCEPTIONS_FLAGS) )) \
)
$(foreach obj,$(bridge_cxx_objects),\
$(eval $(call gb_Library_add_cxxobjects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_cxxobjects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj))) \
)
$(foreach obj,$(bridge_asm_objects),\
$(eval $(call gb_Library_add_asmobjects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_asmobjects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj))) \
)
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_exception_objects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/shared/bridge \
bridges/source/cpp_uno/shared/component \
bridges/source/cpp_uno/shared/types \
@@ -278,13 +278,13 @@ $(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
))
ifeq ($(COM),MSC)
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_exception_objects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/msvc_shared/cpp2uno \
bridges/source/cpp_uno/msvc_shared/except \
))
endif
$(eval $(call gb_Library_add_cxxobjects,$(gb_CPPU_ENV)_uno,\
$(eval $(call gb_Library_add_cxxobjects,$(CPPU_ENV)_uno,\
bridges/source/cpp_uno/shared/cppinterfaceproxy \
, $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
))

View File

@@ -86,6 +86,8 @@ export COMPILER_PLUGINS_CXX_LINKFLAGS=@COMPILER_PLUGINS_CXX_LINKFLAGS@
export COMPILER_PLUGINS_DEBUG=@COMPILER_PLUGINS_DEBUG@
export COMPILER_PLUGINS_TOOLING_ARGS=@COMPILER_PLUGINS_TOOLING_ARGS@
export COM_IS_CLANG=@COM_IS_CLANG@
export CPPU_ENV=@CPPU_ENV@
export CPPU_ENV_FOR_BUILD=@CPPU_ENV_FOR_BUILD@
export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@
export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@
export CPUNAME=@CPUNAME@

View File

@@ -5210,6 +5210,20 @@ AC_SUBST(PLATFORMID)
AC_SUBST(WINDOWS_X64)
AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
if test "$OS" = WNT -a "$COM" = MSC; then
case "$CPUNAME" in
INTEL) CPPU_ENV=msci ;;
X86_64) CPPU_ENV=mscx ;;
AARCH64) CPPU_ENV=msca ;;
*)
AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
;;
esac
else
CPPU_ENV=gcc3
fi
AC_SUBST(CPPU_ENV)
dnl ===================================================================
dnl Test which package format to use
dnl ===================================================================
@@ -5410,6 +5424,7 @@ if test "$cross_compiling" = "yes"; then
# all these will get a _FOR_BUILD postfix
DIRECT_FOR_BUILD_SETTINGS="
CC
CPPU_ENV
CXX
ILIB
JAVA_HOME
@@ -5495,6 +5510,7 @@ if test "$cross_compiling" = "yes"; then
else
OS_FOR_BUILD="$OS"
CC_FOR_BUILD="$CC"
CPPU_ENV_FOR_BUILD="$CPPU_ENV"
CXX_FOR_BUILD="$CXX"
INSTDIR_FOR_BUILD="$INSTDIR"
INSTROOT_FOR_BUILD="$INSTROOT"
@@ -5516,6 +5532,7 @@ AC_SUBST(SDKDIRNAME_FOR_BUILD)
AC_SUBST(WORKDIR_FOR_BUILD)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CXX_FOR_BUILD)
AC_SUBST(CPPU_ENV_FOR_BUILD)
dnl ===================================================================
dnl Check for syslog header

View File

@@ -30,7 +30,7 @@ $(if $(LIBFILENAME),,$(call gb_Output_error,No LIBFILENAME set at component targ
mkdir -p $(dir $(1)) && \
$(call gb_ExternalExecutable_get_command,xsltproc) --nonet \
--stringparam uri '$(if $(filter TRUE,$(DISABLE_DYNLOADING)),,$(subst \d,$$,$(COMPONENTPREFIX)))$(LIBFILENAME)' \
--stringparam cppu_env $(gb_CPPU_ENV) -o $(1) \
--stringparam cppu_env $(CPPU_ENV) -o $(1) \
$(gb_ComponentTarget_XSLTCOMMANDFILE) $(COMPONENTSOURCE)
endef

View File

@@ -220,7 +220,7 @@ endef
define gb_CppunitTest_use_ure
$(call gb_CppunitTest_use_rdb,$(1),ure/services)
$(call gb_CppunitTest_get_target,$(1)) : URE := $(true)
$(call gb_CppunitTest_get_target,$(1)) : $(call gb_Library_get_target,$(gb_CPPU_ENV)_uno)
$(call gb_CppunitTest_get_target,$(1)) : $(call gb_Library_get_target,$(CPPU_ENV)_uno)
$(call gb_CppunitTest_get_target,$(1)) : $(call gb_Library_get_target,affine_uno)
$(call gb_CppunitTest_get_target,$(1)) : $(call gb_Library_get_target,unobootstrapprotector)
$(call gb_CppunitTest_get_target,$(1)) : $(call gb_Library_get_target,unoexceptionprotector)

View File

@@ -35,6 +35,13 @@ gb_Library_LAYER_DIRS := \
OXT:$(WORKDIR)/LinkTarget/ExtensionLibrary \
NONE:$(gb_Library_DLLDIR) \
gb_Library_LAYER_DIRS_FOR_BUILD := \
URELIB:$(INSTROOT_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER_FOR_BUILD) \
OOO:$(INSTROOT_FOR_BUILD)/$(LIBO_LIB_FOLDER_FOR_BUILD) \
SHLXTHDL:$(INSTROOT_FOR_BUILD)/$(LIBO_LIB_FOLDER_FOR_BUILD)/shlxthdl \
OXT:$(WORKDIR_FOR_BUILD)/LinkTarget/ExtensionLibrary \
NONE:$(gb_Library_DLLDIR_FOR_BUILD) \
# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
.PHONY : $(WORKDIR)/Clean/Library/%
$(WORKDIR)/Clean/Library/% :
@@ -43,7 +50,9 @@ $(WORKDIR)/Clean/Library/% :
$(AUXTARGETS))
gb_Library__get_dir_for_layer = $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_LAYER_DIRS)))
gb_Library__get_dir_for_layer_for_build = $(patsubst $(1):%,%,$(filter $(1):%,$(call gb_Library_LAYER_DIRS_FOR_BUILD)))
gb_Library_get_instdir = $(call gb_Library__get_dir_for_layer,$(call gb_Library_get_layer,$(1)))
gb_Library_get_instdir_for_build = $(call gb_Library__get_dir_for_layer_for_build,$(call gb_Library_get_layer,$(1)))
gb_Library_get_ilib_target = $(if $(filter $(1),$(gb_Library_RTVERLIBS) $(gb_Library_UNOVERLIBS)),$(call gb_Library_get_sdk_link_dir)/$(call gb_Library_get_ilibfilename,$(1)),$(gb_Library_DLLDIR)/$(call gb_Library_get_ilibfilename,$(1)))
@@ -161,6 +170,7 @@ gb_Library__COMPONENTPREFIXES := \
gb_Library_get_runtime_filename = $(call gb_Library_get_filename,$(1))
gb_Library_get_runtime_filename_for_build = $(call gb_Library_get_filename_for_build,$(1))
# forward the call to the gb_LinkTarget implementation
# (note: because the function name is in $(1), the other args are shifted by 1)

View File

@@ -342,6 +342,10 @@ define gb_Library_get_filename
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_FILENAMES)))
endef
define gb_Library_get_filename_for_build
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_FILENAMES_FOR_BUILD)))
endef
define gb_Executable_get_filename
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Executable_FILENAMES)))
endef
@@ -393,6 +397,13 @@ endef
define gb_Library_get_target
$(call gb_Library_get_instdir,$(1))/$(call gb_Library_get_runtime_filename,$(1))
endef
ifneq ($(CROSS_COMPILING),)
define gb_Library_get_target_for_build
$(call gb_Library_get_instdir_for_build,$(1))/$(call gb_Library_get_runtime_filename_for_build,$(1))
endef
else
gb_Library_get_target_for_build = $(gb_Library_get_target)
endif # CROSS_COMPILING
# this returns a tuple of both the linktargetname, and the target file
define gb_Library_get_linktarget
$(call gb_Library__get_workdir_linktargetname,$(1))<>$(call gb_Library_get_target,$(1))
@@ -438,6 +449,7 @@ gb_Library_WORKDIR_FOR_BUILD = $(WORKDIR_FOR_BUILD)/LinkTarget/Library
gb_Executable_BINDIR = $(WORKDIR)/LinkTarget/Executable
gb_Executable_BINDIR_FOR_BUILD = $(WORKDIR_FOR_BUILD)/LinkTarget/Executable
gb_Library_DLLDIR = $(WORKDIR)/LinkTarget/Library
gb_Library_DLLDIR_FOR_BUILD = $(WORKDIR_FOR_BUILD)/LinkTarget/Library
gb_CppunitTest_DLLDIR = $(WORKDIR)/LinkTarget/CppunitTest
# static variables declared here because they are used globally

View File

@@ -17,7 +17,6 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
gb_CPPU_ENV := msca
gb_CPUDEFS := -D_ARM64_=1
include $(GBUILDDIR)/platform/com_MSC_defs.mk

View File

@@ -17,7 +17,6 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
gb_CPPU_ENV := msci
gb_CPUDEFS := -D_X86_=1
include $(GBUILDDIR)/platform/com_MSC_defs.mk

View File

@@ -17,7 +17,6 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
gb_CPPU_ENV := mscx
gb_CPUDEFS := -D_AMD64_=1
include $(GBUILDDIR)/platform/com_MSC_defs.mk

View File

@@ -41,14 +41,12 @@ ifeq ($(strip $(gb_COMPILEROPTFLAGS)),)
gb_COMPILEROPTFLAGS := -O2
endif
gb_CPPU_ENV := gcc3
gb_AFLAGS := $(AFLAGS)
gb_COMPILERDEFS := \
-DBOOST_ERROR_CODE_HEADER_ONLY \
-DBOOST_SYSTEM_NO_DEPRECATED \
-DCPPU_ENV=$(gb_CPPU_ENV) \
-DCPPU_ENV=$(CPPU_ENV) \
$(if $(filter EMSCRIPTEN,$(OS)),-U_FORTIFY_SOURCE) \
gb_CFLAGS_COMMON := \

View File

@@ -310,6 +310,7 @@ gb_Library_get_rpath :=
gb_Library_SYSPRE := i
gb_Library_PLAINEXT := .lib
gb_Library_PLAINEXT_FOR_BUILD := .lib
gb_Library_LAYER := \
$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \

View File

@@ -56,7 +56,7 @@ gb_COMPILERDEFS := \
-D_SCL_SECURE_NO_WARNINGS \
-D_MT \
-D_DLL \
-DCPPU_ENV=$(gb_CPPU_ENV) \
-DCPPU_ENV=$(CPPU_ENV) \
ifeq ($(CPUNAME),INTEL)
gb_COMPILERDEFS += \

View File

@@ -177,6 +177,7 @@ gb_Library_UDK_MAJORVER := 3
gb_Library_SYSPRE := lib
gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_
gb_Library_PLAINEXT := .dylib
gb_Library_PLAINEXT_FOR_BUILD := .dylib
gb_Library_DLLEXT := .dylib
gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT)

View File

@@ -188,6 +188,7 @@ gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_
ifeq ($(DISABLE_DYNLOADING),TRUE)
gb_Library_PLAINEXT := .a
gb_Library_PLAINEXT_FOR_BUILD := .so
gb_Library_DLLEXT := .a
else
@@ -195,6 +196,7 @@ else
gb_Library_TARGETTYPEFLAGS := -shared -Wl,-z,noexecstack
gb_Library_UDK_MAJORVER := 3
gb_Library_PLAINEXT := .so
gb_Library_PLAINEXT_FOR_BUILD := .so
gb_Library_DLLEXT := .so
endif