1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00
freebsd-ports/lang/zig/Makefile
Adriaan de Groot bdc2b54bd1 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
2022-09-17 12:56:01 +02:00

58 lines
1.6 KiB
Makefile

PORTNAME= zig
DISTVERSION= 0.9.1
PORTREVISION= 2
CATEGORIES= lang
MASTER_SITES= https://ziglang.org/download/${DISTVERSION}/ \
https://ziglang.org/builds/
# fetch prebuilt platform-independent docs
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} zig-freebsd-x86_64-${DISTVERSION}${EXTRACT_SUFX}
MAINTAINER= dch@FreeBSD.org
COMMENT= Language designed for robustness, optimality, and maintainability
WWW= https://ziglang.org/
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
ONLY_FOR_ARCHS= aarch64 amd64
ONLY_FOR_ARCHS_REASON= not yet supported
BUILD_DEPENDS= llvm${_LLVM_VER}>=0:devel/llvm${_LLVM_VER} icu>=71:devel/icu
CONFLICTS= zig-devel
USES= cmake compiler:c++11-lang localbase:ldflags tar:xz
OPTIONS_DEFINE= STATIC DOCS
OPTIONS_DEFAULT= STATIC DOCS
STATIC_DESC= sets ZIG_STATIC to avoid 800MiB LLVM runtime dependency
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
post-configure-STATIC-on:
@${REINPLACE_CMD} 's/-Wl,-Bdynamic//' ${BUILD_WRKSRC}/build.ninja
post-install-DOCS-on:
${MKDIR} ${STAGEDIR}${DOCSDIR}/std
.for f in langref.html std/data.js std/main.js std/index.html
${INSTALL_MAN} ${WRKDIR}/zig-freebsd-x86_64-${DISTVERSION}/doc/${f} \
${STAGEDIR}${DOCSDIR}/${f}
.endfor
do-test:
mkdir ${WRKDIR}/cache
(cd ${WRKSRC} && ${_ZIG_BIN} build test-behavior \
--cache-dir ${WRKDIR}/cache \
--global-cache-dir ${WRKDIR}/cache \
--zig-lib-dir ${WRKSRC}/lib)
.include <bsd.port.mk>