summaryrefslogtreecommitdiff
path: root/skip/wasi-libcxx.xibuild
diff options
context:
space:
mode:
Diffstat (limited to 'skip/wasi-libcxx.xibuild')
-rw-r--r--skip/wasi-libcxx.xibuild98
1 files changed, 98 insertions, 0 deletions
diff --git a/skip/wasi-libcxx.xibuild b/skip/wasi-libcxx.xibuild
new file mode 100644
index 0000000..1425877
--- /dev/null
+++ b/skip/wasi-libcxx.xibuild
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+NAME="wasi-libcxx"
+DESC="WASI LLVM C++ standard library"
+
+MAKEDEPS="cmake "
+DEPS="musl "
+
+PKG_VER=13.0.1
+wasi_sdk_ver=14
+
+SOURCE="https://github.com/WebAssembly/wasi-sdk/archive/refs/tags/wasi-sdk-$wasi_sdk_ver.tar.gz"
+ADDITIONAL="
+https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/libcxx-$PKG_VER.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/libcxxabi-$PKG_VER.src.tar.xz
+https://github.com/llvm/llvm-project/releases/download/llvmorg-$PKG_VER/llvm-$PKG_VER.src.tar.xz
+"
+
+builddir="$BUILD_ROOT/wasi-libcxx"
+
+prepare () {
+ mkdir -p $builddir/
+
+ for s in libcxx libcxxabi llvm; do
+ tar xf $s-$PKG_VER.src.tar.xz
+ mv $s-$PKG_VER.src $builddir/$s
+ done
+
+ mv wasi-sdk.cmake "$builddir"
+ mv cmake "$builddir"
+}
+
+build () {
+ export CC="clang"
+ export CXX="clang++"
+ export CFLAGS="$CFLAGS -fno-exceptions --sysroot=/usr/share/wasi-sysroot"
+ export CXXFLAGS="$CXXFLAGS -fno-exceptions --sysroot=/usr/share/wasi-sysroot"
+
+ cd $builddir
+ cmake -B build-libcxx -G Ninja \
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
+ -DCMAKE_MODULE_PATH="$builddir"/cmake \
+ -DCMAKE_TOOLCHAIN_FILE="$builddir"/wasi-sdk.cmake \
+ -DCMAKE_C_COMPILER_WORKS=ON \
+ -DCMAKE_CXX_COMPILER_WORKS=ON \
+ -DCMAKE_STAGING_PREFIX=/usr/share/wasi-sysroot \
+ -DLIBCXX_INCLUDE_TESTS=ON \
+ -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
+ -DLIBCXX_ENABLE_SHARED=OFF \
+ -DLIBCXX_ENABLE_THREADS=OFF \
+ -DLIBCXX_HAS_PTHREAD_API=OFF \
+ -DLIBCXX_HAS_EXTERNAL_THREAD_API=OFF \
+ -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY=OFF \
+ -DLIBCXX_HAS_WIN32_THREAD_API=OFF \
+ -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
+ -DLIBCXX_ENABLE_FILESYSTEM=OFF \
+ -DLIBCXX_CXX_ABI=libcxxabi \
+ -DLIBCXX_CXX_ABI_INCLUDE_PATHS=libcxxabi/include \
+ -DLIBCXX_HAS_MUSL_LIBC=ON \
+ -DLIBCXX_ABI_VERSION=2 \
+ -DWASI_SDK_PREFIX=/usr \
+ -DLIBCXX_LIBDIR_SUFFIX=/wasm32-wasi \
+ libcxx
+
+ cmake -B build-libcxxabi -G Ninja \
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
+ -DCMAKE_MODULE_PATH="$builddir"/cmake \
+ -DCMAKE_TOOLCHAIN_FILE="$builddir"/wasi-sdk.cmake \
+ -DCMAKE_C_COMPILER_WORKS=ON \
+ -DCMAKE_CXX_COMPILER_WORKS=ON \
+ -DCMAKE_STAGING_PREFIX=/usr/share/wasi-sysroot \
+ -DLIBCXXABI_INCLUDE_TESTS=ON \
+ -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
+ -DLIBCXXABI_ENABLE_SHARED=OFF \
+ -DLIBCXXABI_ENABLE_THREADS=OFF \
+ -DLIBCXXABI_HAS_PTHREAD_API=OFF \
+ -DLIBCXXABI_HAS_EXTERNAL_THREAD_API=OFF \
+ -DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY=OFF \
+ -DLIBCXXABI_HAS_WIN32_THREAD_API=OFF \
+ -DLIBCXXABI_SILENT_TERMINATE:BOOL=ON \
+ -DLIBCXXABI_ENABLE_PIC=OFF \
+ -DUNIX=ON \
+ -DCXX_SUPPORTS_CXX11=ON \
+ -DLIBCXXABI_LIBCXX_PATH=libcxx \
+ -DLIBCXXABI_LIBCXX_INCLUDES="$builddir"/build-libcxx/include/c++/v1 \
+ -DWASI_SDK_PREFIX=/usr \
+ -DLIBCXXABI_LIBDIR_SUFFIX=/wasm32-wasi \
+ libcxxabi
+
+ cmake --build build-libcxx
+ cmake --build build-libcxxabi
+
+}
+
+package () {
+ DESTDIR="$PKG_DEST" cmake --install build-libcxx
+ DESTDIR="$PKG_DEST" cmake --install build-libcxxabi
+}