git: bdc2b54bd1d9 - main - lang/zig, lang/zig-devel: fix for CMake 3.24

From: Adriaan de Groot <adridg_at_FreeBSD.org>
Date: Sat, 17 Sep 2022 10:57:57 UTC
The branch main has been updated by adridg:

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

commit bdc2b54bd1d909666e6970e6464b892eea67aa3b
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2022-09-16 22:37:06 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2022-09-17 10:56:01 +0000

    lang/zig, lang/zig-devel: fix for CMake 3.24
    
    Add the THREADS_PREFER_PTHREAD_FLAG explicitly for zig builds;
    these are the only two ports that need that, otherwise it would
    be a candidate for adding to our platform CMake flags.
    
    Without the flag, CMake 3.24 changes how pthreads are searched,
    and it ends up leaving out the -pthread flag from the compile.
    For zig, this causes the bootstrap compiler to crash immediately
    (it does not even reach main), which kills the build. Prior to
    CMake 3.24, this flag already existed, but the order in which
    pthreads were searched was different, and we ended up using the
    -pthread flag anyway.
    
    The PR is for the CMake update. This was the last blocker for it.
    
    PR:             265652
---
 lang/zig-devel/Makefile | 3 +++
 lang/zig/Makefile       | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lang/zig-devel/Makefile b/lang/zig-devel/Makefile
index 61264aff72f6..f1ab152699f9 100644
--- a/lang/zig-devel/Makefile
+++ b/lang/zig-devel/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	zig
 DISTVERSION=	0.9.1
+PORTREVISION=	1
 CATEGORIES=	lang
 MASTER_SITES=	https://ziglang.org/download/${DISTVERSION}/ \
 		https://ziglang.org/builds/
@@ -32,6 +33,8 @@ STATIC_RUN_DEPENDS_OFF=	llvm${_LLVM_VER}>=0:devel/llvm${_LLVM_VER}
 STATIC_CMAKE_BOOL=	CMAKE_SKIP_INSTALL_RPATH ZIG_STATIC
 STATIC_LDFLAGS=		-llzma -lm -lmd -lxml2 -lz
 
+CMAKE_ON=	THREADS_PREFER_PTHREAD_FLAG
+
 _LLVM_VER=	13
 _ZIG_BIN=	${STAGEDIR}${PREFIX}/bin/zig
 
diff --git a/lang/zig/Makefile b/lang/zig/Makefile
index d23b5b56c8d9..860013d5bff9 100644
--- a/lang/zig/Makefile
+++ b/lang/zig/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	zig
-PORTREVISION=	1
 DISTVERSION=	0.9.1
+PORTREVISION=	2
 CATEGORIES=	lang
 MASTER_SITES=	https://ziglang.org/download/${DISTVERSION}/ \
 		https://ziglang.org/builds/
@@ -32,6 +32,8 @@ STATIC_RUN_DEPENDS_OFF=	llvm${_LLVM_VER}>=0:devel/llvm${_LLVM_VER}
 STATIC_CMAKE_BOOL=	CMAKE_SKIP_INSTALL_RPATH ZIG_STATIC
 STATIC_LDFLAGS=		-licudata -licuuc -llzma -lm -lmd -lxml2 -lz
 
+CMAKE_ON=	THREADS_PREFER_PTHREAD_FLAG
+
 _LLVM_VER=	13
 _ZIG_BIN=	${STAGEDIR}${PREFIX}/bin/zig