Fix wxWidgets build for portable zlib and window sizing
Build script changes: - Use embuilder to build zlib port (works in Docker and on host) - Use em-config CACHE for portable sysroot path - Fix symlink creation to avoid "same file" errors on re-runs wxWidgets submodule update: - Fix toplevel window sizing to return 1280x720 instead of 20x20 - Handle default size like GTK/MSW ports before passing to base class 🤖 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
8453f9681e
commit
4a9c23bbcb
2 changed files with 19 additions and 4 deletions
|
|
@ -67,6 +67,15 @@ cd "$BUILD_DIR"
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Configuring ==="
|
echo "=== Configuring ==="
|
||||||
|
|
||||||
|
# Ensure Emscripten's zlib port is built (works in Docker and on host)
|
||||||
|
# This populates the cache sysroot with zlib.h and libz.a
|
||||||
|
echo "Building Emscripten zlib port..."
|
||||||
|
embuilder build zlib
|
||||||
|
|
||||||
|
# Get Emscripten cache sysroot path (portable across environments)
|
||||||
|
EM_CACHE_SYSROOT="$(em-config CACHE)/sysroot"
|
||||||
|
echo "Emscripten cache sysroot: $EM_CACHE_SYSROOT"
|
||||||
|
|
||||||
# Set flags for Emscripten compatibility
|
# Set flags for Emscripten compatibility
|
||||||
# Z_HAVE_UNISTD_H ensures zlib includes <unistd.h> for read/write/lseek
|
# Z_HAVE_UNISTD_H ensures zlib includes <unistd.h> for read/write/lseek
|
||||||
# Include pcre2 headers from the build directory (generated during configure)
|
# Include pcre2 headers from the build directory (generated during configure)
|
||||||
|
|
@ -83,8 +92,10 @@ else
|
||||||
echo "Building wxWidgets in RELEASE mode"
|
echo "Building wxWidgets in RELEASE mode"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export CFLAGS="-DZ_HAVE_UNISTD_H=1 ${WX_DEBUG_FLAGS} -fexceptions -pthread -matomics -mbulk-memory"
|
# Include emscripten cache sysroot for zlib headers
|
||||||
export CXXFLAGS="-DZ_HAVE_UNISTD_H=1 -I$PCRE2_INCLUDE ${WX_DEBUG_FLAGS} -fexceptions -pthread -matomics -mbulk-memory"
|
export CFLAGS="-DZ_HAVE_UNISTD_H=1 -I$EM_CACHE_SYSROOT/include ${WX_DEBUG_FLAGS} -fexceptions -pthread -matomics -mbulk-memory"
|
||||||
|
export CXXFLAGS="-DZ_HAVE_UNISTD_H=1 -I$EM_CACHE_SYSROOT/include -I$PCRE2_INCLUDE ${WX_DEBUG_FLAGS} -fexceptions -pthread -matomics -mbulk-memory"
|
||||||
|
export LDFLAGS="-L$EM_CACHE_SYSROOT/lib/wasm32-emscripten"
|
||||||
|
|
||||||
emconfigure "$WX_SOURCE/configure" \
|
emconfigure "$WX_SOURCE/configure" \
|
||||||
--host=emscripten \
|
--host=emscripten \
|
||||||
|
|
@ -117,8 +128,10 @@ echo ""
|
||||||
echo "=== Creating library symlinks ==="
|
echo "=== Creating library symlinks ==="
|
||||||
cd "$BUILD_DIR/lib"
|
cd "$BUILD_DIR/lib"
|
||||||
for lib in *-emscripten.a; do
|
for lib in *-emscripten.a; do
|
||||||
if [ -f "$lib" ]; then
|
# Skip symlinks - only process real files (stub symlinks are handled below)
|
||||||
|
if [ -f "$lib" ] && [ ! -L "$lib" ]; then
|
||||||
newname="${lib/-emscripten/}"
|
newname="${lib/-emscripten/}"
|
||||||
|
rm -f "$newname" # Remove existing symlink/file to avoid conflicts
|
||||||
ln -sf "$lib" "$newname"
|
ln -sf "$lib" "$newname"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -127,6 +140,8 @@ done
|
||||||
# KiCad doesn't use these directly
|
# KiCad doesn't use these directly
|
||||||
echo "Creating stub libraries..."
|
echo "Creating stub libraries..."
|
||||||
for stub in richtext webview; do
|
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"
|
emar rcs "libwx_wasmunivu_${stub}-3.2.a"
|
||||||
ln -sf "libwx_wasmunivu_${stub}-3.2.a" "libwx_wasmunivu_${stub}-3.2-emscripten.a"
|
ln -sf "libwx_wasmunivu_${stub}-3.2.a" "libwx_wasmunivu_${stub}-3.2-emscripten.a"
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 08794a9f579d5fcdc08085e18f25f108446f46f0
|
Subproject commit 981fb9a05569077eaf503ff38db8cf079c7d1a19
|
||||||
Loading…
Reference in a new issue