-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·21 lines (20 loc) · 1.01 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
git clone https://github.com/llvm/llvm-project
rm -r llvm-project/build
CXXFLAGS="-Dwait4=__syscall_wait4" \
LDFLAGS="-sEXPORTED_RUNTIME_METHODS=FS,callMain -sINVOKE_RUN=0 -sEXPORT_ES6 -sMODULARIZE -sALLOW_MEMORY_GROWTH -sINITIAL_MEMORY=512MB -sSTACK_SIZE=64MB -sGLOBAL_BASE=64MB --embed-file $(pwd)/wasi-sysroot@wasi-sysroot" \
emcmake cmake -S llvm-project/llvm -B llvm-project/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_HOST_TRIPLE=wasm32-unknown-wasi \
-DCMAKE_SYSTEM_NAME=wasm32-unknown-wasi \
-DLLVM_TARGETS_TO_BUILD=WebAssembly \
-DLLVM_ENABLE_THREADS=OFF \
-DLLVM_CCACHE_BUILD=ON \
-DLLVM_CCACHE_DIR=/tmp/ccache
ninja -C llvm-project/build -- clang lld
rm src/lib/clang.mjs src/lib/clang.wasm src/lib/lld.mjs src/lib/lld.wasm
cp llvm-project/build/bin/clang.js src/lib/clang.mjs
cp llvm-project/build/bin/clang.wasm src/lib/clang.wasm
cp llvm-project/build/bin/lld.js src/lib/lld.mjs
cp llvm-project/build/bin/lld.wasm src/lib/lld.wasm
# /build/lib/clang/18/include