Skip to content

Commit 9d8d6f2

Browse files
committed
tools: as flex invokes GNU m4, make flex imply gm4.
Before this change, on macOS at least with the current troubled Command Line Tools, package builds that declare "flex" or "flex:*" but not "gm4" in USE_TOOLS will fail, because invocations of flex exit nonzero. /usr/bin/flex tries to exec /usr/bin/gm4, the problems with which are documented in tools.Darwin.mk. With this change, by letting pkgsrc control which gm4 gets found, flex works as before and these packages build as well as they did before. NFCI on other platforms. Tested on netbsd-10 and Ubuntu 23. Some packages I tested with: gobject-introspection, MesaLib, netpbm, gstreamer1.
1 parent c952609 commit 9d8d6f2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎mk/tools/replace.mk‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: replace.mk,v 1.301 2024/03/22 18:59:04 schmonz Exp $
1+
# $NetBSD: replace.mk,v 1.302 2024/03/26 16:27:13 schmonz Exp $
22
#
33
# Copyright (c) 2005 The NetBSD Foundation, Inc.
44
# All rights reserved.
@@ -78,6 +78,13 @@
7878
USE_TOOLS+= bison-yacc
7979
.endif
8080

81+
# flex needs gm4
82+
.if !empty(USE_TOOLS:Mflex) || !empty(USE_TOOLS:Mflex\:*)
83+
# flex:run is used in a few packages, none of which actually build
84+
# binaries that exec flex. No other flex:* modifiers are being used.
85+
USE_TOOLS+= gm4
86+
.endif
87+
8188
######################################################################
8289

8390
# Create _USE_TOOLS, a sanitized version of USE_TOOLS that removes the

0 commit comments

Comments
 (0)