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 Zstd for WebAssembly
|
|
|
|
|
# Zstd is used for compression in KiCad project files
|
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
|
|
ZSTD_DIR="${DEPS_ROOT}/zstd-${ZSTD_VERSION}"
|
|
|
|
|
ZSTD_BUILD="${BUILD_ROOT}/deps/zstd"
|
|
|
|
|
ZSTD_STAMP="${BUILD_ROOT}/stamps/zstd.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 Zstd build..."
|
|
|
|
|
rm -rf "${ZSTD_BUILD}" "${ZSTD_STAMP}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check if already built
|
|
|
|
|
if check_stamp "${ZSTD_STAMP}"; then
|
|
|
|
|
log_info "Zstd already built, skipping..."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Download if needed
|
|
|
|
|
if [ ! -d "${ZSTD_DIR}" ]; then
|
|
|
|
|
log_info "Downloading Zstd ${ZSTD_VERSION}..."
|
|
|
|
|
mkdir -p "${DEPS_ROOT}"
|
|
|
|
|
cd "${DEPS_ROOT}"
|
|
|
|
|
|
|
|
|
|
ZSTD_URL="https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz"
|
|
|
|
|
download_file "${ZSTD_URL}" "zstd-${ZSTD_VERSION}.tar.gz"
|
|
|
|
|
tar -xzf "zstd-${ZSTD_VERSION}.tar.gz"
|
|
|
|
|
rm "zstd-${ZSTD_VERSION}.tar.gz"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
log_info "Building Zstd ${ZSTD_VERSION} for WASM..."
|
|
|
|
|
|
|
|
|
|
mkdir -p "${ZSTD_BUILD}"
|
|
|
|
|
cd "${ZSTD_BUILD}"
|
|
|
|
|
|
|
|
|
|
# Zstd uses CMake in build/cmake directory
|
|
|
|
|
emcmake cmake "${ZSTD_DIR}/build/cmake" \
|
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 \
|
|
|
|
|
-DZSTD_BUILD_PROGRAMS=OFF \
|
|
|
|
|
-DZSTD_BUILD_TESTS=OFF \
|
|
|
|
|
-DZSTD_BUILD_SHARED=OFF \
|
|
|
|
|
-DZSTD_BUILD_STATIC=ON \
|
|
|
|
|
-DZSTD_MULTITHREAD_SUPPORT=ON \
|
2025-12-13 11:29:45 +01:00
|
|
|
-DCMAKE_C_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory" \
|
|
|
|
|
-DCMAKE_CXX_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory"
|
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
|
|
|
|
|
|
|
|
emmake make -j${JOBS}
|
|
|
|
|
emmake make install
|
|
|
|
|
|
|
|
|
|
create_stamp "${ZSTD_STAMP}"
|
|
|
|
|
log_info "Zstd build complete!"
|