summaryrefslogtreecommitdiff
path: root/lang/wasi-compiler-rt
diff options
context:
space:
mode:
authorryoon <ryoon@pkgsrc.org>2021-12-19 14:05:53 +0000
committerryoon <ryoon@pkgsrc.org>2021-12-19 14:05:53 +0000
commit6f39e86103834354729c3c7cca44a7556e1bceb1 (patch)
tree3a0c570391334cba073124a13314905c33da98d5 /lang/wasi-compiler-rt
parent51fa548e2948b0169d57650c58c9de784360d795 (diff)
downloadpkgsrc-6f39e86103834354729c3c7cca44a7556e1bceb1.tar.gz
lang/wasi-compiler-rt: import wasi-compiler-rt-13.0.0
compiler-rt library for WebAssembly programs built on top of WASI
Diffstat (limited to 'lang/wasi-compiler-rt')
-rw-r--r--lang/wasi-compiler-rt/DESCR1
-rw-r--r--lang/wasi-compiler-rt/Makefile68
-rw-r--r--lang/wasi-compiler-rt/PLIST2
-rw-r--r--lang/wasi-compiler-rt/buildlink3.mk15
4 files changed, 86 insertions, 0 deletions
diff --git a/lang/wasi-compiler-rt/DESCR b/lang/wasi-compiler-rt/DESCR
new file mode 100644
index 00000000000..402651e971b
--- /dev/null
+++ b/lang/wasi-compiler-rt/DESCR
@@ -0,0 +1 @@
+compiler-rt library for WebAssembly programs built on top of WASI
diff --git a/lang/wasi-compiler-rt/Makefile b/lang/wasi-compiler-rt/Makefile
new file mode 100644
index 00000000000..a9b581fe73e
--- /dev/null
+++ b/lang/wasi-compiler-rt/Makefile
@@ -0,0 +1,68 @@
+# $NetBSD: Makefile,v 1.1 2021/12/19 14:05:53 ryoon Exp $
+
+.include "../../lang/llvm/version.mk"
+
+DISTNAME= compiler-rt-${LLVM_VERSION}.src
+PKGNAME= ${DISTNAME:S/.src//:S/compiler-rt-/wasi-compiler-rt-/}
+CATEGORIES= lang devel
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= https://compiler-rt.llvm.org/
+COMMENT= LLVM runtime libraries for WASI/WebAssembly
+LICENSE= apache-2.0
+
+PATCHDIR= ${.CURDIR}/../../lang/compiler-rt/patches
+DISTINFO_FILE= ${.CURDIR}/../../lang/compiler-rt/distinfo
+
+NOT_FOR_PLATFORM= NetBSD-[0-7].*-*
+
+USE_CMAKE= yes
+USE_LANGUAGES= c99 c++11
+USE_TOOLS+= ggrep
+SSP_SUPPORTED= no
+
+CONFIGURE_DIRS= ../build
+CMAKE_ARG_PATH= ${WRKSRC}/lib/builtins
+
+BUILDLINK_TRANSFORM+= rm:-I/usr/include
+BUILDLINK_TRANSFORM+= rm:-I${PREFIX}/include
+
+CMAKE_ARGS+= -DCMAKE_VERBOSE_MAKEFILE=1
+
+CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Release
+CMAKE_ARGS+= -DCMAKE_C_COMPILER=${PREFIX}/bin/clang
+CMAKE_ARGS+= -DCMAKE_CXX_COMPILER=${PREFIX}/bin/clang++
+CMAKE_ARGS+= -DCOMPILER_RT_TEST_COMPILER=${PREFIX}/bin/clang
+CMAKE_ARGS+= -DCOMPILER_RT_OS_DIR:STRING=wasi
+CMAKE_ARGS+= -DLLVM_CONFIG_PATH=${LLVM_CONFIG_PATH:Q}
+CMAKE_ARGS+= -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=wasm32-wasi
+CMAKE_ARGS+= -DCOMPILER_RT_BAREMETAL_BUILD=TRUE
+CMAKE_ARGS+= -DCMAKE_SYSROOT=${PREFIX}/wasi
+CMAKE_ARGS+= -DCOMPILER_RT_BAREMETAL_BUILD=TRUE
+CMAKE_ARGS+= -DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=TRUE
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_FPIC_FLAG:BOOL=ON
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_FPIE_FLAG:BOOL=ON
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_FNO_BUILTIN_FLAG:BOOL=ON
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_STD_C11_FLAG:BOOL=ON
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG:BOOL=ON
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_FREESTANDING_FLAG:BOOL=ON
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_XRAY_COMPILER_FLAG:BOOL=OFF
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_ATOMIC_KEYWORD:BOOL=ON
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_FLOAT16:BOOL=OFF
+CMAKE_ARGS+= -DCOMPILER_RT_HAS_ASM_LSE:BOOL=OFF
+CMAKE_ARGS+= -DCMAKE_C_COMPILER_WORKS=1 # Do not test clang compile
+CMAKE_ARGS+= -DCMAKE_CXX_COMPILER_WORKS=1 # Do not test clang++ compile
+
+CMAKE_INSTALL_PREFIX= ${PREFIX}/lib/clang/13.0.0
+
+post-extract:
+ ${MKDIR} ${WRKDIR}/build
+
+PKGSRC_COMPILER= clang
+PKG_CC= ${PREFIX}/bin/clang
+PKG_CXX= ${PREFIX}/bin/clang++
+BUILDLINK_DEPMETHOD.clang= build
+.include "../../lang/clang/buildlink3.mk"
+.include "../../lang/llvm/buildlink3.mk"
+.include "../../lang/wasi-libc/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/wasi-compiler-rt/PLIST b/lang/wasi-compiler-rt/PLIST
new file mode 100644
index 00000000000..71365dae3ba
--- /dev/null
+++ b/lang/wasi-compiler-rt/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1 2021/12/19 14:05:53 ryoon Exp $
+lib/clang/13.0.0/lib/wasi/libclang_rt.builtins-wasm32.a
diff --git a/lang/wasi-compiler-rt/buildlink3.mk b/lang/wasi-compiler-rt/buildlink3.mk
new file mode 100644
index 00000000000..c5e6ff66889
--- /dev/null
+++ b/lang/wasi-compiler-rt/buildlink3.mk
@@ -0,0 +1,15 @@
+# $NetBSD: buildlink3.mk,v 1.1 2021/12/19 14:05:53 ryoon Exp $
+
+BUILDLINK_TREE+= wasi-compiler-rt
+
+BUILDLINK_DEPMETHOD.wasi-compiler-rt?= build
+
+.if !defined(WASI_COMPILER_RT_BUILDLINK3_MK)
+WASI_COMPILER_RT_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.wasi-compiler-rt+= wasi-compiler-rt>=13.0.0
+BUILDLINK_PKGSRCDIR.wasi-compiler-rt?= ../../lang/wasi-compiler-rt
+
+.endif # WASI_COMPILER_RT_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -wasi-compiler-rt