commit:     5f14870405eb92a33d12a55c38fa67ffe93b9a86
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  9 22:45:06 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb  9 22:52:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f148704

sys-devel/reflex: fix parallel build

Closes: https://bugs.gentoo.org/883611
Thanks-to: Arsen Arsenović <arsen <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/reflex-20230206-parallel-build.patch     | 54 ++++++++++++++++++++++
 sys-devel/reflex/reflex-20230206.ebuild            |  7 ++-
 2 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/sys-devel/reflex/files/reflex-20230206-parallel-build.patch 
b/sys-devel/reflex/files/reflex-20230206-parallel-build.patch
new file mode 100644
index 000000000000..ecfadc14639f
--- /dev/null
+++ b/sys-devel/reflex/files/reflex-20230206-parallel-build.patch
@@ -0,0 +1,54 @@
+From 16cc516dfbb6dac01fcd0bfcb717a681b132c0b4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <[email protected]>
+Date: Thu, 9 Feb 2023 20:34:48 +0100
+Subject: [PATCH] Remove .bootstrap and scan.c target race
+
+If the parallelism of a make invocation is great enough to generate both
+.bootstrap and scan.c simultaneously, there's a great chance that the
+rule in .bootstrap will be overruled by the (possibly failing)
+redirection in the scan.c, resulting in an empty scan.c and a failing
+build.  Instead, we can use an empty scan.c as an (inaccurate) proxy for
+the boostrap.
+
+Bug: https://bugs.gentoo.org/883611
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -126,14 +126,9 @@ PERF_REPORT     = -p
+ 
+ all: $(FLEX)
+ 
+-$(FLEX): .bootstrap $(OBJECTS) $(FLEXLIB)
++$(FLEX): $(OBJECTS) $(FLEXLIB)
+       @ECHO_LD@$(CC) $(CFLAGS) -o $(FLEX) $(LDFLAGS) $(OBJECTS) $(FLEXLIB) 
$(LIBS)
+ 
+-.bootstrap: initscan.c
+-      @rm -f scan.c
+-      cp $(srcdir)/initscan.c scan.c
+-      touch .bootstrap
+-
+ parse.c: parse.y
+       $(YACC) -d $(srcdir)/parse.y
+       @sed '/extern char.*malloc/d' <y.tab.c >parse.tmp
+@@ -145,6 +140,7 @@ parse.h: parse.c
+ 
+ scan.c: scan.l
+       $(SHELL) $(srcdir)/mkscan.sh $(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) 
$(srcdir)/scan.l >scan.c
++      grep . $@ || cp initscan.c scan.c
+ 
+ scan$o: scan.c parse.h flexdef.h config.h
+ yylex$o: yylex.c parse.h flexdef.h config.h
+@@ -259,8 +255,8 @@ clean :: mostlyclean
+               $(FLEXLIB) config.log config.cache
+ 
+ distclean :: clean
+-      rm -f .bootstrap $(FLEX) scan.c tags TAGS Makefile man2html.tmp \
+-              config.status config.h stamp-h config.log config.cache
++      rm -f $(FLEX) scan.c tags TAGS Makefile man2html.tmp config.status \
++              config.h stamp-h config.log config.cache
+ 
+ maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+-- 
+2.39.1
+
+

diff --git a/sys-devel/reflex/reflex-20230206.ebuild 
b/sys-devel/reflex/reflex-20230206.ebuild
index 9510513ed2ba..730f0aa25747 100644
--- a/sys-devel/reflex/reflex-20230206.ebuild
+++ b/sys-devel/reflex/reflex-20230206.ebuild
@@ -17,10 +17,9 @@ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~ppc 
~ppc64 ~riscv ~s390 ~
 
 BDEPEND="verify-sig? ( sec-keys/openpgp-keys-thomasdickey )"
 
-src_compile() {
-       # bug #883611
-       emake -j1
-}
+PATCHES=(
+       "${FILESDIR}"/reflex-20230206-parallel-build.patch
+)
 
 src_install() {
        default

Reply via email to