fix(wasm): Fix asyncify rewind with asyncify-aware dynCall shims
Emscripten 4.x removed dynCall_* WASM exports, breaking asyncify
rewind through indirect calls (modal dialogs, event handlers).
Generate JS shims that track Asyncify.exportCallStack and register
in wasmExports so doRewind can find them.
Also fixes empty callback functions ((() => {})) generated by
Emscripten 4.x + pthreads for HTML5 events, pthread entry,
sighandler, async timer, and main loop callbacks.
Build pipeline improvements:
- Stub wasm-opt/finalize in Docker (RAM limits), run on host
- Add setup-emsdk.sh for reproducible Emscripten setup
- Simplify env.sh and version management
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
51b158f6b1
commit
b46b4b69f1
13 changed files with 150 additions and 65 deletions
|
|
@ -36,47 +36,18 @@ export WX_BUILD="$BUILD_ROOT/wxwidgets-universal"
|
|||
# Emscripten settings
|
||||
export EMSDK_QUIET=1
|
||||
|
||||
# Homebrew Emscripten configuration
|
||||
# The em++ script uses EMSDK_PYTHON (not PYTHON env var) for the Python interpreter
|
||||
# and finds clang via PATH - Emscripten bundles its own LLVM with WebAssembly support
|
||||
if [[ -d "/opt/homebrew/Cellar/emscripten" ]]; then
|
||||
_EM_VERSION=$(ls /opt/homebrew/Cellar/emscripten/ | sort -V | tail -1)
|
||||
_EM_LLVM_BIN="/opt/homebrew/Cellar/emscripten/$_EM_VERSION/libexec/llvm/bin"
|
||||
if [[ -d "$_EM_LLVM_BIN" ]]; then
|
||||
# Add bundled LLVM to PATH so Emscripten finds its clang (not /usr/bin/clang)
|
||||
export PATH="$_EM_LLVM_BIN:$PATH"
|
||||
fi
|
||||
elif [[ -d "/usr/local/Cellar/emscripten" ]]; then
|
||||
_EM_VERSION=$(ls /usr/local/Cellar/emscripten/ | sort -V | tail -1)
|
||||
_EM_LLVM_BIN="/usr/local/Cellar/emscripten/$_EM_VERSION/libexec/llvm/bin"
|
||||
if [[ -d "$_EM_LLVM_BIN" ]]; then
|
||||
export PATH="$_EM_LLVM_BIN:$PATH"
|
||||
fi
|
||||
# Local emsdk: auto-install if missing, then source its environment
|
||||
# The emsdk bundles its own Python, Node, and LLVM — no Homebrew needed
|
||||
_EMSDK_DIR="$_KICAD_WASM_PROJECT_ROOT/tools/emsdk"
|
||||
_EMSDK_ENV="$_EMSDK_DIR/emsdk_env.sh"
|
||||
|
||||
if [ ! -f "$_EMSDK_ENV" ]; then
|
||||
echo "Emscripten SDK not found. Installing..."
|
||||
"$_KICAD_WASM_SCRIPTS_DIR/setup-emsdk.sh"
|
||||
fi
|
||||
|
||||
# Emscripten 4.0.22+ requires Python 3.10+ (uses match statement and type union syntax)
|
||||
# The em++ shell script checks EMSDK_PYTHON first, then falls back to `which python3`
|
||||
# Set EMSDK_PYTHON to Homebrew's Python to ensure correct version is used
|
||||
if [[ -d "/opt/homebrew/opt/python@3.14/bin" ]]; then
|
||||
export EMSDK_PYTHON="/opt/homebrew/opt/python@3.14/bin/python3.14"
|
||||
elif [[ -d "/opt/homebrew/opt/python@3.13/bin" ]]; then
|
||||
export EMSDK_PYTHON="/opt/homebrew/opt/python@3.13/bin/python3.13"
|
||||
elif [[ -d "/opt/homebrew/opt/python@3.12/bin" ]]; then
|
||||
export EMSDK_PYTHON="/opt/homebrew/opt/python@3.12/bin/python3.12"
|
||||
elif [[ -d "/opt/homebrew/opt/python@3.11/bin" ]]; then
|
||||
export EMSDK_PYTHON="/opt/homebrew/opt/python@3.11/bin/python3.11"
|
||||
elif [[ -d "/opt/homebrew/opt/python@3.10/bin" ]]; then
|
||||
export EMSDK_PYTHON="/opt/homebrew/opt/python@3.10/bin/python3.10"
|
||||
elif [[ -d "/usr/local/opt/python@3.14/bin" ]]; then
|
||||
export EMSDK_PYTHON="/usr/local/opt/python@3.14/bin/python3.14"
|
||||
elif [[ -d "/usr/local/opt/python@3.13/bin" ]]; then
|
||||
export EMSDK_PYTHON="/usr/local/opt/python@3.13/bin/python3.13"
|
||||
elif [[ -d "/usr/local/opt/python@3.12/bin" ]]; then
|
||||
export EMSDK_PYTHON="/usr/local/opt/python@3.12/bin/python3.12"
|
||||
elif [[ -d "/usr/local/opt/python@3.11/bin" ]]; then
|
||||
export EMSDK_PYTHON="/usr/local/opt/python@3.11/bin/python3.11"
|
||||
elif [[ -d "/usr/local/opt/python@3.10/bin" ]]; then
|
||||
export EMSDK_PYTHON="/usr/local/opt/python@3.10/bin/python3.10"
|
||||
if [ -f "$_EMSDK_ENV" ]; then
|
||||
source "$_EMSDK_ENV" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Common compiler flags
|
||||
|
|
|
|||
Loading…
Reference in a new issue