diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-08-31 04:10:05 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-08-31 04:10:05 +0100 |
commit | 025c71a90f259ca9319b4caa92495e43acf489b0 (patch) | |
tree | 63ba67fc666bfe4fdc21e49e319562fa7d545590 /dev-util/netsurf-buildsystem/files/netsurf-buildsystem-1.9-parallel-pre-post-targets.patch | |
parent | 5685192438444645b599ae1b567d1b73103fba7f (diff) |
gentoo auto-resync : 31:08:2023 - 04:10:05
Diffstat (limited to 'dev-util/netsurf-buildsystem/files/netsurf-buildsystem-1.9-parallel-pre-post-targets.patch')
-rw-r--r-- | dev-util/netsurf-buildsystem/files/netsurf-buildsystem-1.9-parallel-pre-post-targets.patch | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/dev-util/netsurf-buildsystem/files/netsurf-buildsystem-1.9-parallel-pre-post-targets.patch b/dev-util/netsurf-buildsystem/files/netsurf-buildsystem-1.9-parallel-pre-post-targets.patch new file mode 100644 index 000000000000..8ae044887356 --- /dev/null +++ b/dev-util/netsurf-buildsystem/files/netsurf-buildsystem-1.9-parallel-pre-post-targets.patch @@ -0,0 +1,72 @@ +https://listmaster.pepperfish.net/hyperkitty/list/netsurf-dev@netsurf-browser.org/thread/NUOLUXAZS2GYBJ3Q5GCTGSYLKOX3MCME/ + +From 1a6171aa8fd69b20f5c7d2be31ab00539adae959 Mon Sep 17 00:00:00 2001 +From: Michael Orlitzky <michael@orlitzky.com> +Date: Mon, 14 Aug 2023 12:43:54 -0400 +Subject: [PATCH] makefiles/Makefile.top: dependencies for PRE_ and + POST_TARGETS + +The PRE_TARGETS and POST_TARGETS are supposed to be built before and +after $(OBJECTS), respectively -- at least according to the comments +in Makefile.top: + + # List of targets to run before building $(OBJECT) + PRE_TARGETS := + # List of targets to run after building $(OBJECT) + POST_TARGETS := + +The default target however builds them at the same time as $(OUTPUT), + + # Default target + all: $(PRE_TARGETS) $(OUTPUT) $(POST_TARGETS) + +where $(OUTPUT) basically just builds $(OBJECTS): + + $(OUTPUT): $(BUILDDIR)/stamp $(OBJECTS) + ... + +As a result, there is a race condition when $(OBJECTS) truly requires +$(PRE_TARGETS), because they may be built at the same time. The same +problem arises the other way around with $(POST_TARGETS). As a +demonstration, one can try to build the libsvgtiny shared library +directly (note: the details are platform-dependent), + + $ BD=build-x86_64-pc-linux-gnu-x86_64-pc-linux-gnu-release-lib-shared + $ make COMPONENT_TYPE=lib-shared "${BD}/libsvgtiny.so.0.1.7" + COMPILE: src/svgtiny.c + ... + src/svgtiny.c:24:10: fatal error: autogenerated_colors.c: No such file or directory + 24 | #include "autogenerated_colors.c" + | ^~~~~~~~~~~~~~~~~~~~~~~~ + compilation terminated. + +This is because $(PRE_TARGETS) is not satisfied. In practice, this +condition seems hard to hit unintentionally, but it can happen if you +are building in parallel and extemely unlucky. A user discovered it in +Gentoo bug 711200. + +The fix simply adds the stated dependencies on $(OBJECTS) and +$(POST_TARGETS) to guarantee the correct order. +--- + makefiles/Makefile.top | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top +index caac166..dafdfaa 100644 +--- a/makefiles/Makefile.top ++++ b/makefiles/Makefile.top +@@ -176,6 +176,11 @@ OBJECTS := $(addprefix $(BUILDDIR)/,$(filter %.o, \ + $(subst /,_,$(subst .cmhg,.o,$(SOURCES))) \ + $(subst /,_,$(subst .s,.o,$(SOURCES))))) + ++# Ensure that PRE_TARGETS are built before OBJECTS, and POST_TARGETS ++# after them. ++$(OBJECTS): $(PRE_TARGETS) ++$(POST_TARGETS): $(OBJECTS) ++ + bin_for_test = $(addprefix $(BUILDDIR)/,$(firstword $(subst :, ,$(ITEM)))) + TEST_BINARIES := $(foreach ITEM,$(TEST_ITEMS),$(bin_for_test)) + +-- +2.41.0 + |