openbsd-ports/lang/wasi-sdk/Makefile.inc
landry 22898d821f import lang/wasi-sdk, the sdk part of https://wasi.dev/
built on top of llvm sources (but without any of our patches), it
builds/bundles compiler-rt, libcxx and libcxxabi for the 'wasm32-wasi'
target to provide the wasi sysroot required to enable wasm sandboxing in
firefox.

with some inspiration from freebsd/pkgsrc/archlinux.

ok sthen@
2022-05-23 14:18:41 +00:00

30 lines
941 B
Makefile

ONLY_FOR_ARCHS = ${LLVM_ARCHS}
LLVM_V = 13.0.0
CATEGORIES = lang
MASTER_SITES = https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_V}/
EXTRACT_SUFX = .tar.xz
COMPILER = ports-clang
MODULES = devel/cmake
WASI_SYSROOT = ${LOCALBASE}/share/wasi-sysroot
# https://github.com/WebAssembly/wasi-sdk/issues/52
CFLAGS += -fno-exceptions
CXXFLAGS += -fno-exceptions
WRKDIST = ${WRKDIR}/${DISTNAME}/${BUILDSUBDIR}
DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX}
# wasi-libcxx build needs libcxxabi source for c++abi.h only ?
.if ${PKGNAME:Mwasi-libcxx*}
DISTFILES += libcxx-${LLVM_V}.src${EXTRACT_SUFX} \
libcxxabi-${LLVM_V}.src${EXTRACT_SUFX}
post-extract:
mv ${WRKDIR}/libcxx-${LLVM_V}.src ${WRKDIR}/${DISTNAME}/libcxx
mv ${WRKDIR}/libcxxabi-${LLVM_V}.src ${WRKDIR}/${DISTNAME}/libcxxabi
.else
DISTFILES += compiler-rt-${LLVM_V}.src${EXTRACT_SUFX}
.endif
post-build:
${LOCALBASE}/bin/llvm-ranlib ${WRKBUILD}/lib/${LIBPATH}