git: 7efc3219b149 - main - lang/zig: build for lowest common denominator CPU

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Sat, 04 Feb 2023 23:28:56 UTC
The branch main has been updated by dch:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7efc3219b1495d2e44ed68bd9edd8d84632267bd

commit 7efc3219b1495d2e44ed68bd9edd8d84632267bd
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2023-02-04 23:28:53 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2023-02-04 23:28:53 +0000

    lang/zig: build for lowest common denominator CPU
    
    Systems that don't have AVX2 or newer CPU instructions will SIGILL. This
    seems particularly cruel for a language with the moniker "Gotta Go Fast".
    
    PR:             269206
    Differential Revision: https://reviews.freebsd.org/D38284
    
    Reported by:    Yonas Yanfa
    Tested by:      Oleh Vinichenko
---
 lang/zig/Makefile                   |  3 ++-
 lang/zig/files/patch-CMakeLists.txt | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lang/zig/Makefile b/lang/zig/Makefile
index c270f4f62530..0b72faae67d6 100644
--- a/lang/zig/Makefile
+++ b/lang/zig/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	zig
 DISTVERSION=	0.10.1
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	lang
 MASTER_SITES=	https://ziglang.org/download/${DISTVERSION}/ \
 		https://ziglang.org/builds/
@@ -28,6 +28,7 @@ LIB_DEPENDS=	liblzma.so:archivers/lzma \
 
 USES=		cmake compiler:c++11-lang localbase:ldflags tar:xz
 CMAKE_ON=	THREADS_PREFER_PTHREAD_FLAG
+CMAKE_ARGS+=	-DZIG_TARGET_MCPU=baseline # ensure we run everywhere
 
 OPTIONS_DEFINE=		DOCS STATIC
 OPTIONS_DEFAULT=	DOCS
diff --git a/lang/zig/files/patch-CMakeLists.txt b/lang/zig/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..fbad7bb9df60
--- /dev/null
+++ b/lang/zig/files/patch-CMakeLists.txt
@@ -0,0 +1,10 @@
+--- CMakeLists.txt.orig	2023-01-31 09:51:54 UTC
++++ CMakeLists.txt
+@@ -1089,6 +1089,7 @@ set(ZIG_BUILD_ARGS
+     "-Dtarget=${ZIG_TARGET_TRIPLE}"
+     "-Dcpu=${ZIG_TARGET_MCPU}"
+     "-Dversion-string=${ZIG_VERSION}"
++    "--verbose"
+ )
+ 
+ add_custom_target(stage3 ALL