blob: 52dcad7383b667b63357401ac46a4bafcee40986 (
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
|
#!/bin/bash
set -x -e -v
artifact=$(basename $TOOLCHAIN_ARTIFACT)
dir=${artifact%.tar.*}
patch -d $MOZ_FETCHES_DIR/wasi-sdk -p1 < $(dirname $0)/wasi-sdk.patch
cd $MOZ_FETCHES_DIR/wasi-sdk
LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project
mkdir -p build/install/wasi
# The wasi-sdk build system wants to build clang itself. We trick it into
# thinking it did, and put our own clang where it would have built its own.
ln -s $MOZ_FETCHES_DIR/clang build/llvm
touch build/llvm.BUILT
# The wasi-sdk build system wants a clang and an ar binary in
# build/install/$PREFIX/bin
ln -s $MOZ_FETCHES_DIR/clang/bin build/install/wasi/bin
ln -s llvm-ar build/install/wasi/bin/ar
# Build compiler-rt
# `BULK_MEMORY_SOURCES=` force-disables building things with -mbulk-memory,
# which wasm2c doesn't support yet.
make \
LLVM_PROJ_DIR=$LLVM_PROJ_DIR \
BULK_MEMORY_SOURCES= \
PREFIX=/wasi \
build/compiler-rt.BUILT \
-j$(nproc)
mkdir -p $dir/lib
mv build/install/wasi/lib/clang/*/lib/wasi $dir/lib
tar --zstd -cf $artifact $dir
mkdir -p $UPLOAD_DIR
mv $artifact $UPLOAD_DIR/
|