summaryrefslogtreecommitdiff
path: root/lang/zig-devel/Makefile
blob: 8a1e810907e13178d2709e3d0109a969966282b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
PORTNAME=	zig
DISTVERSION=	0.9.1
CATEGORIES=	lang
MASTER_SITES=	https://ziglang.org/download/${DISTVERSION}/ \
		https://ziglang.org/builds/
PKGNAMESUFFIX=	-devel
# 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

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}

CONFLICTS=	zig

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=		-llzma -lm -lmd -lxml2 -lz

_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>