summaryrefslogtreecommitdiff
path: root/devel/wasi-libcxx/Makefile
blob: 0ff40ad0b469d8e55b65641cc2461b0cf73802c8 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

PORTNAME=	libcxx
DISTVERSION=	11.0.0
CATEGORIES=	devel lang
MASTER_SITES=	https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION}/
PKGNAMEPREFIX=	wasi-
DISTNAME=	llvm-project-${DISTVERSION}

MAINTAINER=	greg@unrelenting.technology
COMMENT=	C++ standard library for WebAssembly System Interface

LICENSE=	LLVM2
LICENSE_NAME=	Apache License 2.0 with LLVM Exceptions
LICENSE_FILE=	${WRKSRC}/LICENSE.TXT
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

BUILD_DEPENDS=	${WASI_SYSROOT}/include/stdarg.h:devel/wasi-libc \
		clang${LLVM_SUFFIX}:devel/llvm${LLVM_SUFFIX}

USES=		cmake tar:xz
NO_ARCH=	yes

SSP_UNSAFE=	yes
CC=		${LOCALBASE}/bin/clang${LLVM_SUFFIX}
CXX=		${LOCALBASE}/bin/clang++${LLVM_SUFFIX}
LLVM_RELEASE=	${DISTVERSION:C/rc.*//}
LLVM_SUFFIX=	${LLVM_RELEASE:C/\.[0-9]\.[0-9]$//}
LLVM_PREFIX=	${PREFIX}/llvm${LLVM_SUFFIX}
WASI_SYSROOT=	${LOCALBASE}/share/wasi-sysroot
WRKSRC=		${WRKDIR}/${DISTNAME}/libcxx

CMAKE_INSTALL_PREFIX=	${PREFIX}/share/wasi-sysroot
CMAKE_ARGS=	-DCMAKE_C_COMPILER_WORKS=1 \
		-DCMAKE_CXX_COMPILER_WORKS=1 \
		-DCXX_SUPPORTS_CXX11=ON \
		-DLLVM_COMPILER_CHECKED=ON \
		-DUNIX:BOOL=ON \
		-DCMAKE_SYSROOT=${WASI_SYSROOT} \
		-DLLVM_CONFIG_PATH=${LOCALBASE}/bin/llvm-config${LLVM_SUFFIX} \
		-DLIBCXX_LIBDIR_SUFFIX=/wasm32-wasi \
		-DLIBCXX_INCLUDE_BENCHMARKS:BOOL=FALSE \
		-DLIBCXX_INCLUDE_TESTS:BOOL=FALSE \
		-DLIBCXX_TARGET_TRIPLE=wasm32-wasi \
		-DLIBCXX_ENABLE_THREADS:BOOL=OFF \
		-DLIBCXX_HAS_PTHREAD_API:BOOL=OFF \
		-DLIBCXX_HAS_EXTERNAL_THREAD_API:BOOL=OFF \
		-DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \
		-DLIBCXX_HAS_WIN32_THREAD_API:BOOL=OFF \
		-DLIBCXX_ENABLE_SHARED:BOOL=OFF \
		-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY:BOOL=OFF \
		-DLIBCXX_ENABLE_EXCEPTIONS:BOOL=OFF \
		-DLIBCXX_ENABLE_FILESYSTEM:BOOL=OFF \
		-DLIBCXX_CXX_ABI=libcxxabi \
		-DLIBCXX_HAS_MUSL_LIBC:BOOL=ON \
		-DLIBCXX_ABI_VERSION=2 \
		-DLIBCXXABI_LIBDIR_SUFFIX=/wasm32-wasi \
		-DLIBCXXABI_TARGET_TRIPLE=wasm32-wasi \
		-DLIBCXXABI_ENABLE_EXCEPTIONS:BOOL=OFF \
		-DLIBCXXABI_ENABLE_SHARED:BOOL=OFF \
		-DLIBCXXABI_SILENT_TERMINATE:BOOL=ON \
		-DLIBCXXABI_ENABLE_THREADS:BOOL=OFF \
		-DLIBCXXABI_HAS_PTHREAD_API:BOOL=OFF \
		-DLIBCXXABI_HAS_EXTERNAL_THREAD_API:BOOL=OFF \
		-DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \
		-DLIBCXXABI_HAS_WIN32_THREAD_API:BOOL=OFF \
		-DLIBCXXABI_LIBCXX_INCLUDES=${CONFIGURE_WRKSRC}/include/c++/v1

post-extract:
	@${MKDIR} ${WRKDIR}/.build_cxxabi

post-configure:
	@cd ${WRKDIR}/.build_cxxabi  && \
		${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${WRKDIR}/${DISTNAME}/libcxxabi

post-build:
	@${LOCALBASE}/bin/llvm-ranlib${LLVM_SUFFIX} ${CONFIGURE_WRKSRC}/lib/wasm32-wasi/*.a
	@cd ${WRKDIR}/.build_cxxabi && \
		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET}
	@${LOCALBASE}/bin/llvm-ranlib${LLVM_SUFFIX} ${WRKDIR}/.build_cxxabi/lib/wasm32-wasi/*.a

post-install:
	@cd ${WRKDIR}/.build_cxxabi && \
		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${INSTALL_TARGET}

.include <bsd.port.mk>