tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Yacc Shaving, or, Latest macOS CLT Laccs Something



On 7 Mar 2024, at 21:33, Amitai Schleier wrote:

So we'll have to defend against m4 that's not really there, too.

With the updated patch below, Command Line Tools only (no Xcode), and no definitions of TOOLS_PLATFORM.yacc or TOOLS_PLATFORM.m4 in mk.conf, the output of

    $ make show-vars VARNAMES="TOOLS_PLATFORM.yacc TOOLS_PLATFORM.m4"

changes from:

    /usr/bin/yacc
    /usr/bin/m4

(which, in CLT 15.3.0.0.1.1708646388, don't work) to empty values, so that these two tools get fulfilled some other way.

Help please, Xcode users: when you have no definitions of TOOLS_PLATFORM.yacc or TOOLS_PLATFORM.m4 in mk.conf, does the output of

    $ make show-vars VARNAMES="TOOLS_PLATFORM.yacc TOOLS_PLATFORM.m4"

remain unchanged by the following patch?

Thanks,

- Amitai

Index: mk/tools/tools.Darwin.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/tools/tools.Darwin.mk,v
retrieving revision 1.63
diff -u -p -r1.63 tools.Darwin.mk
--- mk/tools/tools.Darwin.mk	17 May 2023 19:32:57 -0000	1.63
+++ mk/tools/tools.Darwin.mk	9 Mar 2024 01:46:21 -0000
@@ -14,7 +14,17 @@ TOOLS_PLATFORM.bash?=		/bin/bash
 .if exists(/usr/bin/bsdtar)
 TOOLS_PLATFORM.bsdtar?=		/usr/bin/bsdtar
 .endif
-TOOLS_PLATFORM.byacc?=		/usr/bin/yacc
+# CLT 15.3.0.0.1.1708646388 does not provide yacc. Check whether the
+# /usr/bin/yacc xcode-select stub's target exists before defaulting to it.
+.if !defined(OSX_PATH_TO_YACC)
+OSX_PATH_TO_YACC_cmd=		/usr/bin/xcrun --find yacc 2>/dev/null | \
+				sed -e 's|^/Library/Developer/CommandLineTools||'
+OSX_PATH_TO_YACC=		${OSX_PATH_TO_YACC_cmd:sh}
+.endif
+MAKEFLAGS+=			OSX_PATH_TO_YACC=${OSX_PATH_TO_YACC:Q}
+.if ${OSX_PATH_TO_YACC} != ""
+TOOLS_PLATFORM.byacc?=		${OSX_PATH_TO_YACC}
+.endif
 .if exists(/usr/bin/bzcat)
 TOOLS_PLATFORM.bzcat?=		/usr/bin/bzcat
 .endif
@@ -88,7 +98,17 @@ TOOLS_PLATFORM.ksh?=		/bin/ksh
 TOOLS_PLATFORM.lex?=		/usr/bin/lex
 TOOLS_PLATFORM.ln?=		/bin/ln
 TOOLS_PLATFORM.ls?=		/bin/ls
-TOOLS_PLATFORM.m4?=		/usr/bin/m4
+# CLT 15.3.0.0.1.1708646388 does not provide m4. Check whether the
+# /usr/bin/m4 xcode-select stub's target exists before defaulting to it.
+.if !defined(OSX_PATH_TO_M4)
+OSX_PATH_TO_M4_cmd=		/usr/bin/xcrun --find m4 2>/dev/null | \
+				sed -e 's|^/Library/Developer/CommandLineTools||'
+OSX_PATH_TO_M4=			${OSX_PATH_TO_M4_cmd:sh}
+.endif
+MAKEFLAGS+=			OSX_PATH_TO_M4=${OSX_PATH_TO_M4:Q}
+.if ${OSX_PATH_TO_M4} != ""
+TOOLS_PLATFORM.m4?=		${OSX_PATH_TO_M4}
+.endif
 TOOLS_PLATFORM.mail?=		/usr/bin/mail
 .if exists(/usr/bin/makeinfo)
 TOOLS_PLATFORM.makeinfo?=	/usr/bin/makeinfo
@@ -142,4 +162,6 @@ TOOLS_PLATFORM.wc?=		/usr/bin/wc
 TOOLS_PLATFORM.wish?=		/usr/bin/wish
 .endif
 TOOLS_PLATFORM.xargs?=		/usr/bin/xargs
-TOOLS_PLATFORM.yacc?=		/usr/bin/yacc
+.if ${OSX_PATH_TO_YACC} != ""
+TOOLS_PLATFORM.yacc?=           ${OSX_PATH_TO_YACC}
+.endif


Home | Main Index | Thread Index | Old Index