- Add autoreconf step for bundled PCRE in wxWidgets build script (fixes automake version mismatch between 1.16.1 and 1.16.5) - Fix apply-finalize.sh to use get-wasm-opt.sh for consistent tool paths (tools moved to build-wasm/tools/ in previous commit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
1.2 KiB
Shell
Executable file
41 lines
1.2 KiB
Shell
Executable file
#!/bin/bash
|
|
# Apply wasm-emscripten-finalize transformation on host
|
|
# Uses the same Binaryen v121 as wasm-opt to ensure version consistency
|
|
#
|
|
# Usage: ./scripts/common/apply-finalize.sh <input.wasm> <output.wasm>
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|
|
|
# Get wasm-opt path (this downloads Binaryen if needed)
|
|
WASM_OPT=$("${SCRIPT_DIR}/get-wasm-opt.sh")
|
|
BINARYEN_BIN=$(dirname "${WASM_OPT}")
|
|
FINALIZE="${BINARYEN_BIN}/wasm-emscripten-finalize"
|
|
|
|
INPUT_WASM="${1:-output/pcbnew.wasm}"
|
|
OUTPUT_WASM="${2:-${INPUT_WASM}}"
|
|
|
|
if [ ! -f "${INPUT_WASM}" ]; then
|
|
echo "ERROR: Input file not found: ${INPUT_WASM}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Applying wasm-emscripten-finalize..."
|
|
echo " Input: ${INPUT_WASM}"
|
|
echo " Output: ${OUTPUT_WASM}"
|
|
echo " Tool: ${FINALIZE}"
|
|
|
|
# Run finalize with the same flags Emscripten would use
|
|
# NOTE: --dwarf removed because debug info is in separate .debug.wasm file
|
|
"${FINALIZE}" \
|
|
-g \
|
|
--bigint \
|
|
--no-legalize-javascript-ffi \
|
|
--detect-features \
|
|
"${INPUT_WASM}" \
|
|
-o "${OUTPUT_WASM}"
|
|
|
|
echo "Finalize complete: ${OUTPUT_WASM}"
|
|
ls -lh "${OUTPUT_WASM}"
|