tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

build-sysroot-wasi.sh (1550B)


      1 #!/bin/bash
      2 set -x -e -v
      3 
      4 artifact=$(basename $TOOLCHAIN_ARTIFACT)
      5 sysroot=${artifact%.tar.*}
      6 
      7 # Make the wasi compiler-rt available to clang.
      8 env UPLOAD_DIR= $GECKO_PATH/taskcluster/scripts/misc/repack-clang.sh
      9 
     10 if [ -n "$1" ]; then
     11  patch -d $MOZ_FETCHES_DIR/wasi-sdk -p1 < $(dirname $0)/$1
     12 fi
     13 
     14 cd $MOZ_FETCHES_DIR/wasi-sdk
     15 LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project
     16 
     17 mkdir -p build/install/wasi
     18 # The wasi-sdk build system wants to build clang itself. We trick it into
     19 # thinking it did, and put our own clang where it would have built its own.
     20 ln -s $MOZ_FETCHES_DIR/clang build/llvm
     21 touch build/llvm.BUILT
     22 
     23 # The wasi-sdk build system wants a clang and an ar binary in
     24 # build/install/$PREFIX/bin
     25 ln -s $MOZ_FETCHES_DIR/clang/bin build/install/wasi/bin
     26 ln -s llvm-ar build/install/wasi/bin/ar
     27 
     28 # Build wasi-libc, libc++ and libc++abi.
     29 do_make() {
     30  make \
     31    LLVM_PROJ_DIR=$LLVM_PROJ_DIR \
     32    PREFIX=$(grep -q BUILD_PREFIX Makefile || echo $PWD/build/install)/wasi \
     33    -j$(nproc) \
     34    $1
     35 }
     36 
     37 do_make build/wasi-libc.BUILT
     38 
     39 # The wasi-sdk build system has a dependency on compiler-rt for libcxxabi,
     40 # but that's not actually necessary. Pretend it's already built.
     41 # Because compiler-rt has a dependency on wasi-libc, we can only do this
     42 # after wasi-libc is built.
     43 touch build/compiler-rt.BUILT
     44 
     45 do_make build/libcxx.BUILT
     46 if grep -q build/libcxxabi.BUILT Makefile; then
     47    do_make build/libcxxabi.BUILT
     48 fi
     49 
     50 mv build/install/wasi/share/wasi-sysroot $sysroot
     51 tar --zstd -cf $artifact $sysroot
     52 mkdir -p $UPLOAD_DIR
     53 mv $artifact $UPLOAD_DIR/