Fix Asyncify and improve build process
Build system improvements: - Add wasm-opt stub for Docker build to bypass asyncify in container - Add apply-asyncify.sh script for host-side asyncify transformation - Update build-pcbnew.sh to install wasm-opt stub and add EXPORTED_RUNTIME_METHODS - Add --with-zlib=sys to wxWidgets configure for proper zlib linking - Improve update-baseline-screenshots.sh to only copy new/significantly changed files wxWidgets submodule update: - Fix EM_JS to EM_ASYNC_JS for proper Asyncify registration Test updates: - Add new baseline screenshots for bitmapbuttons, dnd, gridrenderers, printpreview, specialized tests - Add kicad-pcbnew initial screenshot - Fix wxgrid-controls.png and wxgrid-dedicated-page.png (were showing errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b70f098ae2
commit
6771e7de74
44 changed files with 167 additions and 32 deletions
60
scripts/common/apply-asyncify.sh
Executable file
60
scripts/common/apply-asyncify.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
# Apply asyncify transformation to KiCad WASM
|
||||
#
|
||||
# Usage: ./scripts/common/apply-asyncify.sh <input.wasm> <output.wasm>
|
||||
#
|
||||
# This script is called by docker/build.sh but can also be run standalone
|
||||
# for debugging asyncify issues.
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
||||
|
||||
# Get wasm-opt path
|
||||
WASM_OPT=$("${SCRIPT_DIR}/get-wasm-opt.sh")
|
||||
|
||||
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 asyncify transformation..."
|
||||
echo " Input: ${INPUT_WASM}"
|
||||
echo " Output: ${OUTPUT_WASM}"
|
||||
echo " Tool: ${WASM_OPT}"
|
||||
|
||||
# Asyncify import patterns (functions that trigger async suspension)
|
||||
# - env.invoke_* : Exception handling trampolines
|
||||
# - env.__asyncjs__* : EM_ASYNC_JS functions (like startModal())
|
||||
ASYNCIFY_IMPORTS="env.invoke_*,env.__asyncjs__*"
|
||||
|
||||
# Functions to exclude from asyncify instrumentation
|
||||
# These are large functions that inflate beyond V8's 7.65MB function limit
|
||||
# The names must match exactly as they appear in the WASM (C++ mangled names)
|
||||
ASYNCIFY_REMOVE=$(cat << 'REMOVELIST'
|
||||
COLOR_SETTINGS::COLOR_SETTINGS(wxString const&, bool)
|
||||
BuildBitmapInfo(std::__2::unordered_map<BITMAPS, std::__2::vector<BITMAP_INFO, std::__2::allocator<BITMAP_INFO>>, std::__2::hash<BITMAPS>, std::__2::equal_to<BITMAPS>, std::__2::allocator<std::__2::pair<BITMAPS const, std::__2::vector<BITMAP_INFO, std::__2::allocator<BITMAP_INFO>>>>>&)
|
||||
match
|
||||
REMOVELIST
|
||||
)
|
||||
|
||||
# Convert newlines to commas for the removelist
|
||||
ASYNCIFY_REMOVE_ARG=$(echo "${ASYNCIFY_REMOVE}" | tr '\n' ',' | sed 's/,$//')
|
||||
|
||||
echo ""
|
||||
echo "Running wasm-opt --asyncify..."
|
||||
echo "This may take several minutes and use significant RAM..."
|
||||
|
||||
"${WASM_OPT}" --asyncify \
|
||||
"--pass-arg=asyncify-imports@${ASYNCIFY_IMPORTS}" \
|
||||
"--pass-arg=asyncify-removelist@${ASYNCIFY_REMOVE_ARG}" \
|
||||
--pass-arg=asyncify-propagate-addlist \
|
||||
"${INPUT_WASM}" -o "${OUTPUT_WASM}"
|
||||
|
||||
echo ""
|
||||
echo "Asyncify complete: ${OUTPUT_WASM}"
|
||||
ls -lh "${OUTPUT_WASM}"
|
||||
Loading…
Reference in a new issue