Add runtime resource loading and fix Docker incremental builds

- Build images.tar.gz bitmap archive for KiCad icons
- Fetch resources at runtime via HTTP instead of bundling in WASM
- Write to Emscripten virtual FS at compile-time KICAD_DATA path
- Fix rsync timestamp handling for correct make change detection
- Update kicad submodule with WASM settings manager fix

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2025-12-27 20:09:26 +01:00
commit b5d379fe70
7 changed files with 64 additions and 7 deletions

View file

@ -21,10 +21,15 @@ fi
docker compose -f docker/docker-compose.yml up -d
# Sync source code to container volume (fixes macOS Docker timestamp issues)
# This ensures timestamps are consistent within the container filesystem
# rsync -a preserves host timestamps, but make needs container timestamps to
# correctly detect changes against cached object files. We touch transferred
# files to set their mtime to container's current time.
echo "Syncing source code to container..."
docker compose -f docker/docker-compose.yml exec kicad-wasm-builder \
rsync -a --delete --exclude='build-wasm' --exclude='output' /workspace-host/ /workspace/
bash -c 'rsync -ai --delete --exclude="build-wasm" --exclude="output" /workspace-host/ /workspace/ | \
grep "^>f" | \
sed "s/^[^ ]* //" | \
while read f; do touch "/workspace/$f" 2>/dev/null; done'
# Run build command (without asyncify - handled on host due to memory requirements)
docker compose -f docker/docker-compose.yml exec kicad-wasm-builder \
@ -34,7 +39,10 @@ docker compose -f docker/docker-compose.yml exec kicad-wasm-builder \
# Note: pcbnew.wasm.debug.wasm contains DWARF debug info (generated with -gseparate-dwarf)
echo "Copying build output to ./output/..."
docker compose -f docker/docker-compose.yml exec kicad-wasm-builder \
bash -c "mkdir -p /workspace/output && cp /workspace/build-wasm/kicad-pcbnew/pcbnew/pcbnew.{js,wasm,wasm.debug.wasm,wasm.map,worker.js} /workspace/output/ 2>/dev/null || cp /workspace/build-wasm/kicad-pcbnew/pcbnew/pcbnew.{js,wasm} /workspace/output/"
bash -c "mkdir -p /workspace/output && \
cp /workspace/build-wasm/kicad-pcbnew/pcbnew/pcbnew.{js,wasm,wasm.debug.wasm,wasm.map,worker.js} /workspace/output/ 2>/dev/null || \
cp /workspace/build-wasm/kicad-pcbnew/pcbnew/pcbnew.{js,wasm} /workspace/output/; \
cp /workspace/build-wasm/kicad-pcbnew/resources/images.tar.gz /workspace/output/ 2>/dev/null || true"
# Inject dynCall shims into pcbnew.js
# This fixes "dynCall_* is not defined" errors in Emscripten 4.x

View file

@ -7,12 +7,16 @@ source /emsdk/emsdk_env.sh 2>/dev/null
# Sync source from host to workspace volume
# This fixes macOS Docker timestamp issues with bind mounts
# (autoconf sanity checks fail when timestamps appear inconsistent)
# Touch transferred files to set container timestamps for correct make detection
if [[ -d /workspace-host ]]; then
echo "Syncing source code to container volume..."
rsync -a --delete \
rsync -ai --delete \
--exclude='build-wasm' \
--exclude='output' \
/workspace-host/ /workspace/
/workspace-host/ /workspace/ | \
grep "^>f" | \
sed "s/^[^ ]* //" | \
while read f; do touch "/workspace/$f" 2>/dev/null; done
echo "Sync complete."
fi