summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/build-compiler-rt-wasi.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /taskcluster/scripts/misc/build-compiler-rt-wasi.sh
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/scripts/misc/build-compiler-rt-wasi.sh')
-rwxr-xr-xtaskcluster/scripts/misc/build-compiler-rt-wasi.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/build-compiler-rt-wasi.sh b/taskcluster/scripts/misc/build-compiler-rt-wasi.sh
new file mode 100755
index 0000000000..3f176d15d0
--- /dev/null
+++ b/taskcluster/scripts/misc/build-compiler-rt-wasi.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+set -x -e -v
+
+artifact=$(basename $TOOLCHAIN_ARTIFACT)
+dir=${artifact%.tar.*}
+
+if [ -n "$1" ]; then
+ patch -d $MOZ_FETCHES_DIR/wasi-sdk -p1 < $(dirname $0)/$1
+fi
+
+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
+make \
+ LLVM_PROJ_DIR=$LLVM_PROJ_DIR \
+ PREFIX=$(grep -q BUILD_PREFIX Makefile || echo $PWD/build/install)/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/