#!/bin/bash
[% INCLUDE 'build_common' %]

# We already packed compiler-rt alongside clang.
# Just let the build system know it's there.
touch build/compiler-rt.BUILT

make \
  LLVM_PROJ_DIR=$LLVM_HOME \
  PREFIX=/wasi \
  build/libcxx.BUILT \
  NINJA_FLAGS='-j[% c("num_procs") %]'

mv build/install/wasi/share/wasi-sysroot/* $distdir/

cd /var/tmp/dist
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'),
    }) %]
