Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation
Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
# Build HarfBuzz for WebAssembly
|
|
|
|
|
# HarfBuzz is used for text shaping in KiCad
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
source "${SCRIPT_DIR}/../common/env.sh"
|
|
|
|
|
source "${SCRIPT_DIR}/../common/versions.sh"
|
|
|
|
|
source "${SCRIPT_DIR}/../common/functions.sh"
|
|
|
|
|
|
|
|
|
|
# HarfBuzz requires FreeType
|
|
|
|
|
"${SCRIPT_DIR}/build-freetype.sh"
|
|
|
|
|
|
|
|
|
|
HARFBUZZ_DIR="${DEPS_ROOT}/harfbuzz-${HARFBUZZ_VERSION}"
|
|
|
|
|
HARFBUZZ_BUILD="${BUILD_ROOT}/deps/harfbuzz"
|
|
|
|
|
HARFBUZZ_STAMP="${BUILD_ROOT}/stamps/harfbuzz.stamp"
|
|
|
|
|
|
|
|
|
|
# Parse arguments
|
|
|
|
|
CLEAN=0
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
|
case $arg in
|
|
|
|
|
--clean)
|
|
|
|
|
CLEAN=1
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ $CLEAN -eq 1 ]; then
|
|
|
|
|
log_info "Cleaning HarfBuzz build..."
|
|
|
|
|
rm -rf "${HARFBUZZ_BUILD}" "${HARFBUZZ_STAMP}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check if already built
|
|
|
|
|
if check_stamp "${HARFBUZZ_STAMP}"; then
|
|
|
|
|
log_info "HarfBuzz already built, skipping..."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Download if needed
|
|
|
|
|
if [ ! -d "${HARFBUZZ_DIR}" ]; then
|
|
|
|
|
log_info "Downloading HarfBuzz ${HARFBUZZ_VERSION}..."
|
|
|
|
|
mkdir -p "${DEPS_ROOT}"
|
|
|
|
|
cd "${DEPS_ROOT}"
|
|
|
|
|
|
|
|
|
|
HARFBUZZ_URL="https://github.com/harfbuzz/harfbuzz/releases/download/${HARFBUZZ_VERSION}/harfbuzz-${HARFBUZZ_VERSION}.tar.xz"
|
|
|
|
|
download_file "${HARFBUZZ_URL}" "harfbuzz-${HARFBUZZ_VERSION}.tar.xz"
|
|
|
|
|
tar -xJf "harfbuzz-${HARFBUZZ_VERSION}.tar.xz"
|
|
|
|
|
rm "harfbuzz-${HARFBUZZ_VERSION}.tar.xz"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
log_info "Building HarfBuzz ${HARFBUZZ_VERSION} for WASM..."
|
|
|
|
|
|
|
|
|
|
mkdir -p "${HARFBUZZ_BUILD}"
|
|
|
|
|
cd "${HARFBUZZ_BUILD}"
|
|
|
|
|
|
|
|
|
|
# HarfBuzz uses meson, but also has CMake support
|
|
|
|
|
emcmake cmake "${HARFBUZZ_DIR}" \
|
2025-12-12 14:51:38 +01:00
|
|
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
|
Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation
Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00
|
|
|
-DCMAKE_INSTALL_PREFIX="${SYSROOT}" \
|
|
|
|
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
2025-12-13 11:29:45 +01:00
|
|
|
-DCMAKE_C_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory" \
|
jspi: migration phases 0-7 — build knob, scheduler shim, test successor suite
Toolchain: emsdk 6.0.6 (versions.sh; cache-hash keys on it). Build knob
PCBJAM_ASYNC_BACKEND=jspi|asyncify: build-kicad-target.sh links editors with
-sJSPI + -sJSPI_EXPORTS=@scripts/common/jspi-exports.txt + --pre-js
jspi-scheduler.js (no DYNCALLS, no post-link asyncify pipeline); wx build
stamps the backend and forces clean on flip or unknown provenance;
docker/build.sh passes the knob, seeds the emscripten ports cache from the
volume every launch, jspi postprocess = patch-env-shim only.
scripts/common/shims/jspi-scheduler.js: the JSPI successor scheduler —
token-wait registry, resume turnstile (one armed resume between engine
re-entries, SP swaps only at microtask boundaries), green-region spill
stacks (16-aligned tops), S1 embind mutator FIFO lane + parker wraps, S6
shutdown, libctx integration hooks (suspend/end/quarantine + g_current
arm/clear), SuspendError attributor, lost-wake + stuck-window watchdogs,
__wxWaitDump observability.
Embind: PARKER registrations get emscripten::async() under PCBJAM_JSPI
(wasm/bindings/pcbjam_async_policy.h). nanosleep yields route via the shim.
Tests: tests/asyncify -> tests/jspi successor suite (jspi-stack red/green
shadow-stack battery, jspi-coroutine MiniCoro harness, suspend-races
semantic scenarios + __wxWaitDump books coherence); projects jspi-firefox/
jspi-chrome (asyncify-webkit retired — no JSPI in WebKit); unconditional
Firefox JSPI pref; guard-beacons -> wait-beacons (+wxScheduler/libctxJspi
families); Makefile.wasm links test apps against JSPI with the shim as a
tracked link prerequisite.
Web: WasmTool setRo await + __wxWaitDump forensics, open-flow contained
promise, scheduler-shim.test.ts retargeted (8 green).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NDeBaKKhQztd8KiVtHuyXr
2026-08-13 07:06:24 +02:00
|
|
|
-DCMAKE_CXX_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory -DHB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR" \
|
Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation
Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00
|
|
|
-DHB_HAVE_FREETYPE=ON \
|
|
|
|
|
-DHB_HAVE_GLIB=OFF \
|
|
|
|
|
-DHB_HAVE_ICU=OFF \
|
|
|
|
|
-DHB_HAVE_GOBJECT=OFF \
|
|
|
|
|
-DHB_HAVE_CAIRO=OFF \
|
|
|
|
|
-DHB_BUILD_UTILS=OFF \
|
|
|
|
|
-DHB_BUILD_SUBSET=OFF \
|
|
|
|
|
-DBUILD_SHARED_LIBS=OFF \
|
|
|
|
|
-DCMAKE_PREFIX_PATH="${SYSROOT}" \
|
|
|
|
|
-DFREETYPE_LIBRARY="${SYSROOT}/lib/libfreetype.a" \
|
|
|
|
|
-DFREETYPE_INCLUDE_DIRS="${SYSROOT}/include/freetype2"
|
|
|
|
|
|
|
|
|
|
emmake make -j${JOBS}
|
|
|
|
|
emmake make install
|
|
|
|
|
|
|
|
|
|
create_stamp "${HARFBUZZ_STAMP}"
|
|
|
|
|
log_info "HarfBuzz build complete!"
|