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

@ -10,6 +10,7 @@ source "$(dirname "$0")/common/env.sh"
# ./build-wasm-test.sh # Incremental build (default)
# ./build-wasm-test.sh --clean # Clean build from scratch
# ./build-wasm-test.sh --debug # Build with debug symbols
# ./build-wasm-test.sh --dom # Build against the DOM port into tests/apps-dom
# ./build-wasm-test.sh menu # Build only the menu test
# ./build-wasm-test.sh --debug menu # Build menu test with debug symbols
@ -17,6 +18,7 @@ set -e
DEBUG_BUILD=0
CLEAN_BUILD=0
DOM_BUILD=0
TARGET=""
# Parse arguments
@ -25,6 +27,8 @@ for arg in "$@"; do
DEBUG_BUILD=1
elif [ "$arg" = "--clean" ]; then
CLEAN_BUILD=1
elif [ "$arg" = "--dom" ]; then
DOM_BUILD=1
elif [ "$arg" != "" ]; then
TARGET="$arg"
fi
@ -32,9 +36,26 @@ done
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
TESTS_DIR="$PROJECT_ROOT/tests"
WASM_APP_DIR="$TESTS_DIR/apps"
if [ "$DOM_BUILD" = "1" ]; then
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-dom"
# DOM apps build in a mirrored source tree so canvas and DOM bundles
# coexist; relative ../../ paths in Makefile.wasm resolve identically.
WASM_APP_DIR="$TESTS_DIR/apps-dom"
echo "Mirroring test app sources into apps-dom..."
rsync -a --delete \
--exclude '*.o' --exclude '*.d' \
--exclude '*_test.html' --exclude '*_test.js' --exclude '*_test.wasm' \
--exclude '*_repro.html' --exclude '*_repro.js' --exclude '*_repro.wasm' \
--exclude '*.wasm.map' \
"$TESTS_DIR/apps/" "$WASM_APP_DIR/"
MAKE_PORT_ARGS="PORT=dom"
else
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
WASM_APP_DIR="$TESTS_DIR/apps"
MAKE_PORT_ARGS=""
fi
STANDALONE_DIR="$WASM_APP_DIR/standalone"
echo "=== Building wxWidgets WASM Test Applications ==="
@ -93,9 +114,9 @@ fi
# Build (pass DEBUG flag if requested)
if [ "$DEBUG_BUILD" = "1" ]; then
make -f Makefile.wasm DEBUG=1 "$MAKE_TARGET"
make -f Makefile.wasm DEBUG=1 $MAKE_PORT_ARGS "$MAKE_TARGET"
else
make -f Makefile.wasm "$MAKE_TARGET"
make -f Makefile.wasm $MAKE_PORT_ARGS "$MAKE_TARGET"
fi
echo ""

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"

View file

@ -7,8 +7,26 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BASELINE_DIR="$PROJECT_ROOT/tests/baseline-screenshots"
TEST_RESULTS_DIR="$PROJECT_ROOT/tests/test-results"
# --port dom compares the DOM-port artifacts (WX_PORT=dom test runs) against
# their own baseline set; canvas paths are the default and stay unchanged.
PORT=""
ARGS=()
while [ $# -gt 0 ]; do
case "$1" in
--port) PORT="$2"; shift 2 ;;
*) ARGS+=("$1"); shift ;;
esac
done
set -- "${ARGS[@]+"${ARGS[@]}"}"
if [ "$PORT" = "dom" ]; then
BASELINE_DIR="$PROJECT_ROOT/tests/baseline-screenshots-dom"
TEST_RESULTS_DIR="$PROJECT_ROOT/tests/test-results/dom"
else
BASELINE_DIR="$PROJECT_ROOT/tests/baseline-screenshots"
TEST_RESULTS_DIR="$PROJECT_ROOT/tests/test-results"
fi
# Check if directories exist
if [ ! -d "$BASELINE_DIR" ]; then

View file

@ -5,19 +5,34 @@
# - Screenshots with SIGNIFICANT differences (>5% size change) when --all flag used
#
# Usage:
# ./update-baseline-screenshots.sh # Only copy NEW screenshots
# ./update-baseline-screenshots.sh --all # Copy new + significantly different
# ./update-baseline-screenshots.sh # Only copy NEW screenshots
# ./update-baseline-screenshots.sh --all # Copy new + significantly different
# ./update-baseline-screenshots.sh --port dom # Same, for the DOM-port baseline set
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TESTS_DIR="$SCRIPT_DIR/../tests"
SOURCE_DIR="$TESTS_DIR/test-results"
DEST_DIR="$TESTS_DIR/baseline-screenshots"
COPY_ALL=0
PORT=""
THRESHOLD=5 # Percent threshold for "significant" difference
if [ "$1" = "--all" ]; then
COPY_ALL=1
while [ $# -gt 0 ]; do
case "$1" in
--all) COPY_ALL=1; shift ;;
--port) PORT="$2"; shift 2 ;;
*) shift ;;
esac
done
if [ "$PORT" = "dom" ]; then
SOURCE_DIR="$TESTS_DIR/test-results/dom"
DEST_DIR="$TESTS_DIR/baseline-screenshots-dom"
else
SOURCE_DIR="$TESTS_DIR/test-results"
DEST_DIR="$TESTS_DIR/baseline-screenshots"
fi
if [ $COPY_ALL -eq 1 ]; then
echo "Mode: Copy NEW + SIGNIFICANTLY DIFFERENT screenshots"
else
echo "Mode: Copy NEW screenshots only (use --all to include significant changes)"