summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-12-21 04:36:55 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2021-12-24 02:17:37 +0100
commitecc50f56b3282ec3b0364101d860f22fe8da9042 (patch)
tree651f9c25b66db13f1e3ade7a03031f6128fbacaa /solenv
parentaf4c5d3ea1ec5d140b9477feea2cb9487977a6c4 (diff)
gbuild: set library dependency for static builds
For DISABLE_DYNLOADING builds, all libraries become real and not export-only dependencies. And all real linking targets need a dependency on all static libraries. Change-Id: I8433a0225d428951739f7afa3068a61dce9e61eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127236 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/LinkTarget.mk26
-rw-r--r--solenv/gbuild/TargetLocations.mk4
2 files changed, 26 insertions, 4 deletions
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 57b9a40d7560..12c4dec988fa 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -1197,6 +1197,11 @@ define gb_PrintDeps_info
$(info LibraryDep: $(1) links against $(2))
endef
+# returns $(true), if the target class really calls a linker.
+# call gb_LinkTarget_does_real_link,linktarget
+gb_LinkTarget_does_real_link = $(if $(filter Executable CppunitTest $(if $(DISABLE_DYNLOADING),,Library), \
+ $(call gb_LinkTarget__get_workdir_linktargetclass,$(1))),$(true))
+
# avoid problem when a module is built partially but other modules that define
# needed libraries is not yet built: prevent invocation of pattern rule
# for library with invalid parameters by depending on the header target
@@ -1218,12 +1223,21 @@ endif
$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(3)
+ifeq (,$(DISABLE_DYNLOADING))
# depend on the exports of the library, not on the library itself
-# for faster incremental builds when the ABI is unchanged
-ifeq ($(DISABLE_DYNLOADING),)
+# for faster incremental builds when the ABI is unchanged.
+# export files are created from the library, so this also ensures the library exists.
$(call gb_LinkTarget_get_target,$(1)) : \
$(foreach lib,$(3),$(call gb_Library_get_exports_target,$(lib)))
+
+else # DISABLE_DYNLOADING
+# depend on the now-static libraries themself, but only if the target actually links to it
+ifneq (,$(call gb_LinkTarget_does_real_link,$(1)))
+$(foreach lib,$(3),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \
+ $(eval $(call gb_LinkTarget_get_target,$(1)) : $(call gb_Library_get_target,$(lib))) \
+))
endif
+endif # DISABLE_DYNLOADING
$(call gb_LinkTarget_get_headers_target,$(1)) : \
$(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))
@@ -1311,8 +1325,12 @@ $(if $(call gb_LinkTarget__is_merged,$(1)),\
$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,merged)) : \
LINKED_STATIC_LIBS += $$(if $$(filter-out StaticLibrary,$$(TARGETTYPE)),$(2)))
-ifeq ($(DISABLE_DYNLOADING),)
-$(call gb_LinkTarget_get_target,$(1)) : $(foreach lib,$(2),$(call gb_StaticLibrary_get_target,$(lib)))
+# depend on the static libraries, but only if the target actually links to it
+ifneq (,$(call gb_LinkTarget_does_real_link,$(1)))
+# make has a size limit for the prerequisites string, which will be exceeded for some larger static links,
+# like soffice.bin, but there seems to be no limit for makefile lines...
+$(foreach lib,$(2), \
+ $$(eval $(call gb_LinkTarget_get_target,$(1)): $(call gb_StaticLibrary_get_target,$(lib))))
endif
$(call gb_LinkTarget_get_headers_target,$(1)) : \
$(foreach lib,$(2),$(call gb_StaticLibrary_get_headers_target,$(lib)))
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 24e1210b2563..d2bbfe0cdfb2 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -114,7 +114,11 @@ gb_JunitTest_get_classsetname = JunitTest/$(1)
gb_JunitTest_get_target = $(WORKDIR)/JunitTest/$(1)/done
gb_JunitTest_get_userdir = $(WORKDIR)/JunitTest/$(1)/user
gb_PythonTest_get_target = $(WORKDIR)/PythonTest/$(1)/done
+# linktarget = class/object<>some_optional_target, like Library/libswlo.so<>/.../instdir/program/libswlo.so
+# while the target is optional, the workdir functions will always work correctly
gb_LinkTarget__get_workdir_linktargetname = $(firstword $(subst <>, ,$(1)))
+gb_LinkTarget__get_workdir_linktargetclass = $(firstword $(subst /, ,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))))
+gb_LinkTarget__get_workdir_linktargetobject = $(lastword $(subst /, ,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))))
gb_LinkTarget_get_headers_target = \
$(WORKDIR)/Headers/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))
gb_LinkTarget_get_objects_list = \