summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/build-sysroot-wasi.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
commit9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /taskcluster/scripts/misc/build-sysroot-wasi.sh
parentInitial commit. (diff)
downloadthunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.tar.xz
thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/scripts/misc/build-sysroot-wasi.sh')
-rwxr-xr-xtaskcluster/scripts/misc/build-sysroot-wasi.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/taskcluster/scripts/misc/build-sysroot-wasi.sh b/taskcluster/scripts/misc/build-sysroot-wasi.sh
new file mode 100755
index 0000000000..2c6ef551ce
--- /dev/null
+++ b/taskcluster/scripts/misc/build-sysroot-wasi.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+set -x -e -v
+
+artifact=$(basename $TOOLCHAIN_ARTIFACT)
+sysroot=${artifact%.tar.*}
+
+# Make the wasi compiler-rt available to clang.
+env UPLOAD_DIR= $GECKO_PATH/taskcluster/scripts/misc/repack-clang.sh
+
+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 wasi-libc, libc++ and libc++abi.
+do_make() {
+ make \
+ LLVM_PROJ_DIR=$LLVM_PROJ_DIR \
+ PREFIX=/wasi \
+ -j$(nproc) \
+ $1
+}
+
+do_make build/wasi-libc.BUILT
+
+# The wasi-sdk build system has a dependency on compiler-rt for libcxxabi,
+# but that's not actually necessary. Pretend it's already built.
+# Because compiler-rt has a dependency on wasi-libc, we can only do this
+# after wasi-libc is built.
+touch build/compiler-rt.BUILT
+
+do_make build/libcxx.BUILT
+
+mv build/install/wasi/share/wasi-sysroot $sysroot
+tar --zstd -cf $artifact $sysroot
+mkdir -p $UPLOAD_DIR
+mv $artifact $UPLOAD_DIR/