author Hubert Boma Manilla <hmanilla@mozilla.com>
Sun, 27 Nov 2022 16:18:37 +0000
changeset 643736 f49e8eca9e344e5d8b9a5e67ff5859ba3afc3a4d
parent 641022 e3175cbf4c6e2d9582c189cc228da934c38deff5
permissions -rwxr-xr-x
Bug 1787198 - [devtools] Change caching of original and generated source text content r=ochameau Differential Revision: https://phabricator.services.mozilla.com/D160564

set -x -e -v

artifact=$(basename $TOOLCHAIN_ARTIFACT)

patch -d $MOZ_FETCHES_DIR/wasi-sdk -p1 < $(dirname $0)/wasi-sdk.patch

cd $MOZ_FETCHES_DIR/wasi-sdk

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 has a dependency on compiler-rt for libcxxabi,
# but that's not actually necessary. Pretend it's already built
touch build/compiler-rt.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.
# `BULK_MEMORY_SOURCES=` force-disables building things with -mbulk-memory,
# which wasm2c doesn't support yet.
make \
  PREFIX=/wasi \
  build/wasi-libc.BUILT \
  build/libcxx.BUILT \

mv build/install/wasi/share/wasi-sysroot $sysroot
tar --zstd -cf $artifact $sysroot
mkdir -p $UPLOAD_DIR
mv $artifact $UPLOAD_DIR/