blob: 45f377230a741da183e99494e6f3f316e8a936ec (
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
86
87
88
89
90
91
92
93
94
95
96
|
#!/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 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
}
|