From ed1aa172f8807ee479e4f529df49d19c13a8bc86 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Sat, 8 Jan 2022 06:47:02 +0100 Subject: [PATCH] Unify condition names and fix "else" paths Drop Build prefix and settle on Lib and Exe prefixes. Also add a note about the "else" part of the condition and fix offenders. While at it, define COND_LIB_SAL_TEXTENC to be used by sal to prevent diverting coditions in build and cxx code. Change-Id: I944587ca1ccbe46b765d1a631a7214c8126fe951 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128136 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- Repository.mk | 10 +++++----- RepositoryExternal.mk | 4 ++-- desktop/Module_desktop.mk | 6 +++--- desktop/Package_scripts.mk | 2 +- idlc/Executable_idlc.mk | 2 +- registry/Module_registry.mk | 2 +- sal/Library_sal.mk | 3 ++- sal/Module_sal.mk | 2 +- sal/textenc/textenc.cxx | 2 +- solenv/Module_solenv.mk | 2 +- solenv/gbuild/Conditions.mk | 19 ++++++++++++------- solenv/gbuild/extensions/pre_BuildTools.mk | 2 +- solenv/gbuild/platform/unxgcc.mk | 2 +- 13 files changed, 32 insertions(+), 26 deletions(-) diff --git a/Repository.mk b/Repository.mk index 2732439165e1..6e3834a24259 100644 --- a/Repository.mk +++ b/Repository.mk @@ -44,7 +44,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \ $(if $(filter iOS,$(OS)),LibreOffice) \ lngconvex \ localize \ - $(call gb_CondBuildLockfile,lockfile) \ + $(call gb_CondExeLockfile,lockfile) \ makedepend \ mbsdiff \ osl_process_child \ @@ -147,7 +147,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \ $(call gb_Helper_optional,FUZZERS,dbffuzzer) \ $(if $(filter-out ANDROID HAIKU iOS MACOSX WNT,$(OS)),oosplash) \ soffice_bin \ - $(call gb_CondBuildUnopkg, \ + $(call gb_CondExeUnopkg, \ unopkg_bin \ $(if $(filter WNT,$(OS)), \ unopkg \ @@ -235,7 +235,7 @@ endif $(eval $(call gb_Helper_register_executables_for_install,UREBIN,ure,\ $(if $(and $(ENABLE_JAVA),$(filter-out HAIKU MACOSX WNT,$(OS)),$(filter DESKTOP,$(BUILD_TYPE))),javaldx) \ - $(call gb_CondBuildRegistryTools, \ + $(call gb_CondExeRegistryTools, \ regmerge \ regview \ ) \ @@ -603,7 +603,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PRIVATELIBS_URE,ure, \ )) $(eval $(call gb_Helper_register_plugins_for_install,PRIVATELIBS_URE,ure, \ - $(call gb_CondSalTextEncodingLibrary,sal_textenc) \ + $(call gb_CondLibSalTextenc,sal_textenc) \ )) $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ @@ -638,7 +638,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ $(call gb_Helper_optional,XMLHELP,ucpchelp1) \ ucphier1 \ ucppkg1 \ - $(call gb_CondBuildUnopkg,unopkgapp) \ + $(call gb_CondExeUnopkg,unopkgapp) \ xmlsecurity \ xsec_xmlsec \ xstor \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index cf9b2aa13dc4..e391bc5ff7c1 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -3772,7 +3772,7 @@ endif # SYSTEM_JFREEREPORT define gb_Executable__register_bestreversemap $(call gb_Executable_add_runtime_dependencies,bestreversemap,\ - $(call gb_CondSalTextEncodingLibrary,$(call gb_Library_get_target_for_build,sal_textenc)) \ + $(call gb_CondLibSalTextenc,$(call gb_Library_get_target_for_build,sal_textenc)) \ ) endef @@ -3789,7 +3789,7 @@ endef define gb_Executable__register_cppumaker $(call gb_Executable_add_runtime_dependencies,cppumaker,\ - $(call gb_CondSalTextEncodingLibrary,$(call gb_Library_get_target,sal_textenc)) \ + $(call gb_CondLibSalTextenc,$(call gb_Library_get_target,sal_textenc)) \ ) endef diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk index 67ba27fbe2f0..15b2ad358d64 100644 --- a/desktop/Module_desktop.mk +++ b/desktop/Module_desktop.mk @@ -33,11 +33,11 @@ $(eval $(call gb_Module_add_l10n_targets,desktop,\ ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,desktop,\ Executable_soffice_bin \ - $(call gb_CondBuildUnopkg,Executable_unopkg_bin) \ + $(call gb_CondExeUnopkg,Executable_unopkg_bin) \ $(if $(ENABLE_BREAKPAD),Executable_minidump_upload) \ Library_migrationoo2 \ Library_migrationoo3 \ - $(call gb_CondBuildUnopkg,Library_unopkgapp) \ + $(call gb_CondExeUnopkg,Library_unopkgapp) \ Package_scripts \ $(if $(ENABLE_PAGEIN), \ Pagein_calc \ @@ -79,7 +79,7 @@ $(eval $(call gb_Module_add_targets,desktop,\ Executable_sweb \ Executable_swriter \ Executable_unoinfo \ - $(call gb_CondBuildUnopkg, \ + $(call gb_CondExeUnopkg, \ Executable_unopkg \ Executable_unopkg_com \ ) \ diff --git a/desktop/Package_scripts.mk b/desktop/Package_scripts.mk index 0c9b1c3ec648..248665595ee6 100644 --- a/desktop/Package_scripts.mk +++ b/desktop/Package_scripts.mk @@ -12,7 +12,7 @@ $(eval $(call gb_Package_Package,desktop_scripts_install,$(SRCDIR)/desktop/scrip ifeq (,$(filter MACOSX WNT,$(OS))) $(eval $(call gb_Package_add_file,desktop_scripts_install,$(LIBO_BIN_FOLDER)/gdbtrace,gdbtrace)) -ifneq (,$(call gb_CondBuildUnopkg,$(true))) +ifneq (,$(call gb_CondExeUnopkg,$(true))) $(eval $(call gb_Package_add_file,desktop_scripts_install,$(LIBO_BIN_FOLDER)/unopkg,unopkg.sh)) endif diff --git a/idlc/Executable_idlc.mk b/idlc/Executable_idlc.mk index f2f79dcb8911..8af0c40f111a 100644 --- a/idlc/Executable_idlc.mk +++ b/idlc/Executable_idlc.mk @@ -75,7 +75,7 @@ $(eval $(call gb_Executable_add_exception_objects,idlc,\ # to something other than listed in Impl_getTextEncodingData, because osl_getThreadTextEncoding() # returns Windows ACP, calling FullTextEncodingData ctor which loads the not-yet-built library $(call gb_Executable_add_runtime_dependencies,idlc, \ - $(call gb_Library_get_target,sal_textenc) \ + $(call gb_CondLibSalTextenc,$(call gb_Library_get_target,sal_textenc)) \ ) # vim:set noet sw=4 ts=4: diff --git a/registry/Module_registry.mk b/registry/Module_registry.mk index e5969171e005..40f7230bbb73 100644 --- a/registry/Module_registry.mk +++ b/registry/Module_registry.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Module_Module,registry)) $(eval $(call gb_Module_add_targets,registry,\ Library_reg \ - $(call gb_CondBuildRegistryTools, \ + $(call gb_CondExeRegistryTools, \ Executable_regmerge \ Executable_regview \ StaticLibrary_registry_helper \ diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index 30af237cd546..d8d409195a39 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk @@ -33,6 +33,7 @@ $(eval $(call gb_Library_add_defs,sal,\ -DRTL_OS="\"$(RTL_OS)\"" \ -DRTL_ARCH="\"$(RTL_ARCH)\"" \ -DSRCDIR="\"$(SRCDIR)\"" \ + $(call gb_CondLibSalTextenc,-DCOND_LIB_SAL_TEXTENC) \ )) $(eval $(call gb_Library_use_libraries,sal,\ @@ -132,7 +133,7 @@ $(eval $(call gb_Library_add_cxxflags,sal,\ )) endif -ifeq (,$(call gb_CondSalTextEncodingLibrary,$(true))) +ifeq (,$(call gb_CondLibSalTextenc,$(true))) $(eval $(call gb_Library_add_exception_objects,sal,\ sal/textenc/context \ sal/textenc/convertbig5hkscs \ diff --git a/sal/Module_sal.mk b/sal/Module_sal.mk index 19bf547ad572..e0448a5085bf 100644 --- a/sal/Module_sal.mk +++ b/sal/Module_sal.mk @@ -14,7 +14,7 @@ $(eval $(call gb_Module_add_targets,sal,\ $(if $(filter $(OS),ANDROID), \ Library_lo-bootstrap) \ Library_sal \ - $(call gb_CondSalTextEncodingLibrary,Library_sal_textenc) \ + $(call gb_CondLibSalTextenc,Library_sal_textenc) \ )) ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) diff --git a/sal/textenc/textenc.cxx b/sal/textenc/textenc.cxx index 6b9247566de0..5765637fddac 100644 --- a/sal/textenc/textenc.cxx +++ b/sal/textenc/textenc.cxx @@ -351,7 +351,7 @@ ImplTextEncodingData const aImplJavaUtf8TextEncodingData namespace { -#if defined DISABLE_DYNLOADING || defined ANDROID +#ifndef COND_LIB_SAL_TEXTENC extern "C" ImplTextEncodingData const * sal_getFullTextEncodingData( rtl_TextEncoding); // from tables.cxx in sal_textenc library diff --git a/solenv/Module_solenv.mk b/solenv/Module_solenv.mk index 1c2793c104bf..a26775f71083 100644 --- a/solenv/Module_solenv.mk +++ b/solenv/Module_solenv.mk @@ -16,7 +16,7 @@ $(eval $(call gb_Module_add_targets_for_build,solenv,\ ifeq (,$(LOCKFILE)) $(eval $(call gb_Module_add_targets_for_build,solenv,\ - $(call gb_CondBuildLockfile,Executable_lockfile) \ + $(call gb_CondExeLockfile,Executable_lockfile) \ )) endif diff --git a/solenv/gbuild/Conditions.mk b/solenv/gbuild/Conditions.mk index f405ab86308b..0a7b88969557 100644 --- a/solenv/gbuild/Conditions.mk +++ b/solenv/gbuild/Conditions.mk @@ -7,15 +7,16 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -define gb_CondBuildUnopkg -$(if $(and $(filter DESKTOP,$(BUILD_TYPE)),$(if $(DISABLE_DYNLOADING),,$(true))),$(1),$(2)) -endef +# IMPORTANT NOTE: make sure, the "else" part works as expected. This normally +# means, that the condition ends with "$(1),$(2))" or the reverse. It should +# just end in two (!) braces, otherwise you may need to use either the $(1) +# or the $(2) multiple times. -define gb_CondBuildLockfile +define gb_CondExeLockfile $(if $(and $(filter-out ANDROID MACOSX iOS WNT,$(OS))),$(1),$(2)) endef -define gb_CondBuildRegistryTools +define gb_CondExeRegistryTools $(if $(or $(DISABLE_DYNLOADING),$(ENABLE_MACOSX_SANDBOX)),$(2),$(1)) endef @@ -27,8 +28,12 @@ define gb_CondExeUno $(if $(and $(filter DESKTOP,$(BUILD_TYPE)),$(if $(DISABLE_DYNLOADING),,$(true))),$(1),$(2)) endef -define gb_CondSalTextEncodingLibrary -$(if $(filter ANDROID,$(OS)),,$(if $(DISABLE_DYNLOADING),$(2),$(1))) +define gb_CondExeUnopkg +$(if $(and $(filter DESKTOP,$(BUILD_TYPE)),$(if $(DISABLE_DYNLOADING),,$(true))),$(1),$(2)) +endef + +define gb_CondLibSalTextenc +$(if $(or $(filter ANDROID,$(OS)),$(DISABLE_DYNLOADING)),$(2),$(1)) endef # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/extensions/pre_BuildTools.mk b/solenv/gbuild/extensions/pre_BuildTools.mk index e7602c2d7089..0a83545cf748 100644 --- a/solenv/gbuild/extensions/pre_BuildTools.mk +++ b/solenv/gbuild/extensions/pre_BuildTools.mk @@ -24,7 +24,7 @@ gb_BUILD_TOOLS_executables = \ helpex \ idxdict \ javamaker \ - $(call gb_CondBuildLockfile,lockfile) \ + $(call gb_CondExeLockfile,lockfile) \ makedepend \ propex \ saxparser \ diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 3a7aba87a760..684ab7695f77 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -105,7 +105,7 @@ gb_LinkTarget__Lock := $(WORKDIR)/LinkTarget/link.lock # No newline or space before endef! define gb_LinkTarget__WantLock $(if $(strip $(and \ - $(call gb_CondBuildLockfile,$(true)), \ + $(call gb_CondExeLockfile,$(true)), \ $(filter-out Executable/lockfile,$(1)), \ $(if $(filter FUZZERS,$(BUILD_TYPE)),,$(DISABLE_DYNLOADING)), \ $(filter CppunitTest Executable,$(TARGETTYPE)) \