feat(wasm-dom): dual-mode build scaffold — native DOM port builds, links and boots alongside canvas

Build/test plumbing for the second wxWidgets mode: --dom on
build-wxuniversal-wasm.sh (build-wasm/wxwidgets-dom, no universal,
--disable-tooltips, libwx_wasmu_* stubs) and build-wasm-test.sh
(mirrors sources into tests/apps-dom, PORT=dom). Build script now
reconfigures when Makefile.in or autoconf_inc.m4 regenerate (bakefile
chain). Harness: WX_PORT=dom serves apps-dom, namespaces screenshots
into test-results/dom and logs into logs/wxwidgets/dom; compare/update
screenshot scripts take --port dom with baseline-screenshots-dom.
New port-agnostic boot.spec.ts (green on both ports).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-06-10 17:17:57 +02:00
commit 249010a582
10 changed files with 205 additions and 29 deletions

View file

@ -22,14 +22,41 @@ source "$(dirname "$0")/common/stages.sh"
# Usage:
# ./build-wxuniversal-wasm.sh # Incremental build (default)
# ./build-wxuniversal-wasm.sh --clean # Clean build from scratch
# ./build-wxuniversal-wasm.sh --dom # Build the DOM port (native widgets,
# # no wxUniversal) into build-wasm/wxwidgets-dom
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
WX_SOURCE="$PROJECT_ROOT/wxwidgets"
# Parse arguments: --clean and/or --dom, in any order
CLEAN_BUILD=0
DOM_BUILD=0
for arg in "$@"; do
case "$arg" in
--clean) CLEAN_BUILD=1 ;;
--dom) DOM_BUILD=1 ;;
*) echo "Unknown argument: $arg"; exit 1 ;;
esac
done
if [ "$DOM_BUILD" = "1" ]; then
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-dom"
# Native (non-universal) widget set: controls are real DOM elements.
UNIVERSAL_FLAG=""
# Tooltips will be DOM title attributes (dom-phase-5); no wxToolTip yet.
# (Universal mode auto-disables them; native mode must do it explicitly.)
PORT_EXTRA_FLAGS="--disable-tooltips"
WXLIB_PREFIX="libwx_wasmu"
else
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
UNIVERSAL_FLAG="--enable-universal"
PORT_EXTRA_FLAGS=""
WXLIB_PREFIX="libwx_wasmunivu"
fi
# Use our config.sub wrapper for autoconf projects
# CONFIG_SHELL is critical: nested configures (pcre, etc.) do SHELL=${CONFIG_SHELL-/bin/sh}
# Without CONFIG_SHELL, nested configures would reset SHELL to /bin/sh and bypass our wrapper
@ -54,14 +81,17 @@ if [ ! -f "$WX_SOURCE/configure.in" ]; then
exit 1
fi
# Regenerate configure if configure.in is newer
if [ "$WX_SOURCE/configure.in" -nt "$WX_SOURCE/configure" ]; then
echo "configure.in is newer than configure, regenerating..."
# Regenerate configure if configure.in or autoconf_inc.m4 is newer.
# (configure.in sincludes autoconf_inc.m4, which bakefile regenerates from
# build/bakefiles/files.bkl — new build conditions live there.)
if [ "$WX_SOURCE/configure.in" -nt "$WX_SOURCE/configure" ] || \
[ "$WX_SOURCE/autoconf_inc.m4" -nt "$WX_SOURCE/configure" ]; then
echo "configure inputs changed, regenerating configure..."
(cd "$WX_SOURCE" && autoconf)
fi
# Incremental build by default, use --clean for full rebuild
if [ "$1" = "--clean" ]; then
if [ "$CLEAN_BUILD" = "1" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
@ -84,6 +114,11 @@ elif [ "$WX_SOURCE/configure.in" -nt "$BUILD_DIR/Makefile" ]; then
elif [ "$WX_SOURCE/configure" -nt "$BUILD_DIR/Makefile" ]; then
echo "configure script changed, will reconfigure..."
NEEDS_CONFIGURE=1
elif [ "$WX_SOURCE/Makefile.in" -nt "$BUILD_DIR/Makefile" ]; then
# Makefile.in is regenerated from build/bakefiles/files.bkl (see header);
# the build Makefile must be re-derived or new source files are ignored.
echo "Makefile.in changed since last configure, will reconfigure..."
NEEDS_CONFIGURE=1
else
echo "Already configured, skipping configure (use clean build to reconfigure)"
fi
@ -145,7 +180,8 @@ if [ $NEEDS_CONFIGURE -eq 1 ]; then
emconfigure "$WX_SOURCE/configure" \
--host=emscripten \
--without-subdirs \
--enable-universal \
${UNIVERSAL_FLAG} \
${PORT_EXTRA_FLAGS} \
--disable-shared \
--with-opengl \
--enable-exceptions \
@ -188,9 +224,9 @@ done
echo "Creating stub libraries..."
for stub in richtext webview; do
# Remove any existing symlinks first to avoid "same file" errors
rm -f "libwx_wasmunivu_${stub}-3.2.a" "libwx_wasmunivu_${stub}-3.2-emscripten.a"
emar rcs "libwx_wasmunivu_${stub}-3.2.a"
ln -sf "libwx_wasmunivu_${stub}-3.2.a" "libwx_wasmunivu_${stub}-3.2-emscripten.a"
rm -f "${WXLIB_PREFIX}_${stub}-3.2.a" "${WXLIB_PREFIX}_${stub}-3.2-emscripten.a"
emar rcs "${WXLIB_PREFIX}_${stub}-3.2.a"
ln -sf "${WXLIB_PREFIX}_${stub}-3.2.a" "${WXLIB_PREFIX}_${stub}-3.2-emscripten.a"
done
cd "$BUILD_DIR"