summaryrefslogtreecommitdiff
path: root/solenv/gbuild/platform/unxgcc.mk
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-05-14 15:26:39 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2021-12-01 13:06:55 +0100
commite050b09c7ef193da9da4441d9984c793e35b5a8a (patch)
tree4dd5b57161afc89adc8399a8aaca9387cf397310 /solenv/gbuild/platform/unxgcc.mk
parent47cdd3ba605324072db617c6ae2d1a647b8bdce6 (diff)
gbuild: serialize dynamic link for static builds
This is a hack, because make has no way to serialize processing of a target (just .NOTPARALLEL for the whole Makefile). It uses the lockfile tool / liblockfile 1.17. Since that polls the file, I adjusted the poll timeout to 5s max, because I found the 60s wait much too long. Guess even 1s would be ok... Since it's just a small build tool, I simply copied and patched its source, instead of creating an external project. And there is --with-system-lockfile=... to use an external binary instead. Change-Id: I16bc4579a273dcf1aac811ae4723ca325a0b9eba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126152 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'solenv/gbuild/platform/unxgcc.mk')
-rw-r--r--solenv/gbuild/platform/unxgcc.mk8
1 files changed, 7 insertions, 1 deletions
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 0cec2ecfbc0c..60e63f36cd3a 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -99,6 +99,10 @@ gb_LinkTarget__RPATHS := \
gb_LinkTarget_CFLAGS := $(gb_CFLAGS)
gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
+gb_LinkTarget__cmd_lockfile = $(if $(LOCKFILE),$(LOCKFILE),$(call gb_Executable_get_command,lockfile))
+gb_LinkTarget__Lock := $(WORKDIR)/LinkTarget/link.lock
+gb_LinkTarget__WantLock = $(if $(and $(filter-out ANDROID MACOSX iOS WNT,$(OS)),$(filter TRUE,$(DISABLE_DYNLOADING)),$(filter CppunitTest Executable,$(TARGETTYPE))),$(true))
+
# note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10
# we want to use @$(extraobjectlist) in the long run
# link with C compiler if there are no C++ files (pyuno_wrapper depends on this)
@@ -107,6 +111,7 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
# libclang_rt.ubsan_cxx-x86_64.a, and oosplash links against sal but itself only
# contains .c sources:
define gb_LinkTarget__command_dynamiclink
+$(if $(gb_LinkTarget__WantLock),$(gb_LinkTarget__cmd_lockfile) -r -1 $(gb_LinkTarget__Lock))
$(call gb_Helper_abbreviate_dirs,\
$(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \
$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
@@ -141,7 +146,8 @@ $(call gb_Helper_abbreviate_dirs,\
$(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \
) \
-o $(1) \
- $(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)))
+ $(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)) \
+ $(if $(gb_LinkTarget__WantLock),; RC=$$? ; rm -f $(gb_LinkTarget__Lock); if test $$RC -ne 0; then exit $$RC; fi))
$(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\
$(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
$(NM) $(gb_LTOPLUGINFLAGS) --dynamic --extern-only --defined-only --format=posix $(1) \