From af06999f2027f311ac68c51e8e63b445d4b2bca5 Mon Sep 17 00:00:00 2001 From: TC Date: Sat, 10 Oct 2026 00:32:03 +0200 Subject: [PATCH] build.sh: stop RUSTFLAGS from dropping the wasm32 target's rustflags RUSTFLAGS as an env var replaces .cargo/config.toml's target rustflags instead of adding to it, so the leak-check remap flag was silently dropping +simd128 from both wasm builds since build.sh was added. Pass the remap flag through cargo's --config instead, which merges with the config file's rustflags array. wasm-pack 0.14's extra-args parser mishandles "--features -- " (the -- separator and everything after it get swallowed into --features's value list), so the --config has to go right after --features with no -- separator. --- scripts/build.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 4b91578..ecac07d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,13 +21,24 @@ HF_PROD_BASE="https://huggingface.co/idle-intelligence/personaplex-24L-q4_k-webg REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$REPO_ROOT" +# RUSTFLAGS as an env var REPLACES .cargo/config.toml's target rustflags +# instead of adding to it, silently dropping +simd128. --config merges with +# the config file's rustflags array, so the remap flag goes in through that +# instead. +REMAP_CONFIG="target.wasm32-unknown-unknown.rustflags=[\"--remap-path-prefix=$HOME=/home\"]" + echo "==> Building sts-wasm (wasm feature) for ENGINE_BUILD=$ENGINE_BUILD" -RUSTFLAGS="--remap-path-prefix=$HOME=/home" \ - wasm-pack build crates/sts-wasm --target web --release --no-default-features --features wasm +# No "--" before --config: wasm-pack 0.14's extra-args parser mishandles the +# "--features -- " combination (the "--" and everything after +# it get swallowed into --features's value list), so --config never reaches +# cargo. Passing --config straight after --features works and still reaches +# cargo build as an extra option. +wasm-pack build crates/sts-wasm --target web --release --no-default-features --features wasm \ + --config "$REMAP_CONFIG" echo "==> Building mimi-wasm" -RUSTFLAGS="--remap-path-prefix=$HOME=/home" \ - wasm-pack build crates/mimi-wasm --target web --release +wasm-pack build crates/mimi-wasm --target web --release \ + --config "$REMAP_CONFIG" # --- Local-path / user-name leak check on built wasm outputs --- for WASM in crates/sts-wasm/pkg/sts_wasm_bg.wasm crates/mimi-wasm/pkg/mimi_wasm_bg.wasm; do