Module Name:    src
Committed By:   lukem
Date:           Fri May 19 10:42:34 UTC 2023

Modified Files:
        src/external/gpl3/gcc.old/usr.bin/host-libcpp: Makefile
        src/external/gpl3/gcc/usr.bin/host-libcpp: Makefile
        src/tools: Makefile.gnuhost

Log Message:
Fix passing -j NNN to gmake

Use a more restrictive pattern to extract -j NNN from MAKEFLAGS
into GMAKE_J_ARGS, to avoid false positives when the source directory
has "-j" in the path (e.g "amd64-job-000012" or "src-j9999").
Previously this could pass either -"-j" or "-j BIGNUM" to gmake
and result in "vfork: Resource temporarily unavailable" failures.

PR misc/54456


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
    src/external/gpl3/gcc.old/usr.bin/host-libcpp/Makefile
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
cvs rdiff -u -r1.55 -r1.56 src/tools/Makefile.gnuhost

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc.old/usr.bin/host-libcpp/Makefile
diff -u src/external/gpl3/gcc.old/usr.bin/host-libcpp/Makefile:1.6 src/external/gpl3/gcc.old/usr.bin/host-libcpp/Makefile:1.7
--- src/external/gpl3/gcc.old/usr.bin/host-libcpp/Makefile:1.6	Mon Feb 20 02:12:35 2023
+++ src/external/gpl3/gcc.old/usr.bin/host-libcpp/Makefile	Fri May 19 10:42:34 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2023/02/20 02:12:35 mrg Exp $
+#	$NetBSD: Makefile,v 1.7 2023/05/19 10:42:34 lukem Exp $
 
 BUILD_ENV= \
 		AR=${HOST_AR:Q} \
@@ -19,7 +19,7 @@ BUILD_ENV= \
 		RANLIB=${HOST_RANLIB:Q} \
 		YACC=${YACC:Q}
 
-GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
+GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/(^|.* )(-j ?[0-9][0-9]*).*/\2/W}
 BUILD_COMMAND=	/usr/bin/env -i ${BUILD_ENV} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e
 
 libcpp/libcpp.a:

Index: src/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
diff -u src/external/gpl3/gcc/usr.bin/host-libcpp/Makefile:1.5 src/external/gpl3/gcc/usr.bin/host-libcpp/Makefile:1.6
--- src/external/gpl3/gcc/usr.bin/host-libcpp/Makefile:1.5	Wed Jun 24 05:06:08 2020
+++ src/external/gpl3/gcc/usr.bin/host-libcpp/Makefile	Fri May 19 10:42:34 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2020/06/24 05:06:08 rin Exp $
+#	$NetBSD: Makefile,v 1.6 2023/05/19 10:42:34 lukem Exp $
 
 BUILD_ENV= \
 		AR=${HOST_AR:Q} \
@@ -19,7 +19,7 @@ BUILD_ENV= \
 		RANLIB=${HOST_RANLIB:Q} \
 		YACC=${YACC:Q}
 
-GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
+GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/(^|.* )(-j ?[0-9][0-9]*).*/\2/W}
 BUILD_COMMAND=	/usr/bin/env -i ${BUILD_ENV} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e
 
 libcpp/libcpp.a:

Index: src/tools/Makefile.gnuhost
diff -u src/tools/Makefile.gnuhost:1.55 src/tools/Makefile.gnuhost:1.56
--- src/tools/Makefile.gnuhost:1.55	Mon May 15 21:24:56 2023
+++ src/tools/Makefile.gnuhost	Fri May 19 10:42:34 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.gnuhost,v 1.55 2023/05/15 21:24:56 lukem Exp $
+#	$NetBSD: Makefile.gnuhost,v 1.56 2023/05/19 10:42:34 lukem Exp $
 #
 # Rules used when building a GNU host package.  Expects MODULE to be set.
 #
@@ -100,7 +100,7 @@ BUILD_COMMAND=	${BUILD_ENV} ${MAKE} ${MA
 # gmake version of this puts MAKE_ARGS in the environment to be sure that
 # sub-gmake's get them, otherwise tools/gcc tries to build libgcc and
 # fails.  it also uses "env -i" to entirely clear out MAKEFLAGS.
-GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
+GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/(^|.* )(-j ?[0-9][0-9]*).*/\2/W}
 BUILD_COMMAND=	/usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS:N-*} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e ${MAKE_ARGS}
 
 .endif

Reply via email to