#!/usr/bin/env bash # wasmar: thin wrapper for llvm-ar to create WASM-compatible archives. # # Routes llvm-ar through the LLVM this repository pins. Resolution order for the # LLVM bin dir (see libexec/find-llvm.sh): $WASMLD_HWJS_LLVM_BIN, then # $HWJS_LLVM_BIN, then the discovered pinned build tree. No machine-specific # absolute path is baked in. set -euo pipefail HWJS_HOME="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # shellcheck source=libexec/find-llvm.sh source "$HWJS_HOME/libexec/find-llvm.sh" BIN="$(hwjs_llvm_bin "$HWJS_HOME/libexec")" \ || { echo "wasmar: FATAL: pinned LLVM not found (set WASMLD_HWJS_LLVM_BIN, or build it per toolchain/llvm-from-source.md)." >&2; exit 1; } LLVM_AR="$BIN/llvm-ar" [[ -x "$LLVM_AR" ]] || { echo "wasmar: FATAL: llvm-ar not found/executable at '$LLVM_AR'." >&2; exit 1; } exec "$LLVM_AR" "$@"