#!/bin/bash # Build every WASM artifact downstream projects need, from a clean checkout. # Produces the four static libraries that (e.g.) concept-collection/matmul-bench # links against: # # install/lib/libflame.a single-threaded libflame # install/lib/libflame-mt.a libflame compiled with -pthread # install/lib/libblis-st.a single-threaded BLIS (BLAS backend) # blis/lib/generic/libblis.a BLIS compiled with pthreads # # Each variant is built in a freshly re-cloned tree (rm -rf before each build): # the single- and multi-threaded objects differ only by compile flags, and # libflame's make does not rebuild objects when just config.mk changes, so a # clean tree is the only reliable way to get correct -pthread archives. # # This is slow (libflame is built twice, BLIS twice). Downstream CI should # cache the outputs keyed on this repo's commit SHA. # # Requires: emsdk (expected at ~/emsdk, or already on PATH), git, a C toolchain. set -euo pipefail cd "$(dirname "$0")" if ! command -v emcc >/dev/null 2>&1; then source ~/emsdk/emsdk_env.sh fi echo "==> [1/4] libflame (single-threaded)" rm -rf libflame ./build-wasm.sh echo "==> [2/4] libflame (pthreads)" rm -rf libflame PTHREAD=1 ./build-wasm.sh echo "==> [3/4] BLIS (single-threaded)" rm -rf blis ./build-blis-wasm.sh mkdir -p install/lib cp blis/lib/generic/libblis.a install/lib/libblis-st.a echo "==> [4/4] BLIS (pthreads)" rm -rf blis THREADING=pthreads ./build-blis-wasm.sh echo echo "Done. Artifacts:" ls -la install/lib/libflame.a install/lib/libflame-mt.a \ install/lib/libblis-st.a blis/lib/generic/libblis.a