tech-pkg archive

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

tools.Darwin.mk workaround for CLT 16.2?



There's a local diff that I've been running with in my tree (and totally forgot about) that I suspect we don't need.

It addresses a problem encountered on current macOS with a particular recent version of the Command Line Tools. To see which CLT you have installed:

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep ^version:

I'm on 16.4.x by now, and I'm guessing many/most others staying relatively current are too. Which is why I suspect we don't urgently need the patch: if we did, something like it would have been committed by now. So unlike the 15.3 Xcode and CLT troubles that arose during a previous "careful mode" (https://mail-index.netbsd.org/tech-pkg/2024/04/07/msg029104.html), this problem must have been limited to a version or perhaps narrow range that's no longer current and that nobody's going to be particularly attached to. And if that ever proves false, the patch will be here in the list archives. :-)

My current judgment is that there's no clear need that justifies committing this at all, let alone now during careful mode. If anyone feels differently, please weigh in.

- Amitai


Index: mk/tools/tools.Darwin.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/tools/tools.Darwin.mk,v
retrieving revision 1.67
diff -u -p -r1.67 tools.Darwin.mk
--- mk/tools/tools.Darwin.mk	3 Jul 2024 13:27:16 -0000	1.67
+++ mk/tools/tools.Darwin.mk	4 Jun 2025 15:42:04 -0000
@@ -18,14 +18,25 @@ TOOLS_PLATFORM.bsdtar?=		/usr/bin/bsdtar
 .endif
 # 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.
+# CLT 16.2 yacc bails out (so avoid defaulting to it in this case):
+# xcode-select: error: tool 'bison' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
 .if !defined(OSX_PATH_TO_YACC)
 OSX_PATH_TO_YACC_cmd=		${OSX_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}
+.if !defined(OSX_YACC_THAT_WORKS)
+. if ${OSX_PATH_TO_YACC} != ""
+OSX_YACC_THAT_WORKS_cmd= ${OSX_PATH_TO_YACC} </dev/null 2>&1 | grep -vq 'requires Xcode, but .* command line tools instance' && echo ${OSX_PATH_TO_YACC} || true
+OSX_YACC_THAT_WORKS=		${OSX_YACC_THAT_WORKS_cmd:sh}
+. else
+OSX_YACC_THAT_WORKS=		# empty
+. endif
+.endif
+MAKEFLAGS+=			OSX_YACC_THAT_WORKS=${OSX_YACC_THAT_WORKS:Q}
+.if ${OSX_YACC_THAT_WORKS} != ""
+TOOLS_PLATFORM.byacc?=		${OSX_YACC_THAT_WORKS}
 .endif
 .if exists(/usr/bin/bzcat)
 TOOLS_PLATFORM.bzcat?=		/usr/bin/bzcat
@@ -170,8 +181,8 @@ TOOLS_PLATFORM.wc?=		/usr/bin/wc
 TOOLS_PLATFORM.wish?=		/usr/bin/wish
 .endif
 TOOLS_PLATFORM.xargs?=		/usr/bin/xargs
-.if ${OSX_PATH_TO_YACC} != ""
-TOOLS_PLATFORM.yacc?=		${OSX_PATH_TO_YACC}
+.if ${OSX_YACC_THAT_WORKS} != ""
+TOOLS_PLATFORM.yacc?=		${OSX_YACC_THAT_WORKS}
 .else
 OSX_TOOLS_FORCE_NOOP+=		yacc
 .endif



Home | Main Index | Thread Index | Old Index