Remove unused legacy build scripts and directories

Clean up obsolete files that are not part of the current build workflows:

Deleted:
- cmake/ - Old native build CMake modules
- core/ - Old core extraction from Nov 2024
- stubs/ - Old stubs for native build
- scripts/build.sh - Old native build script
- scripts/build-core-wasm.sh - Old core library build
- scripts/build-wxbase-wasm.sh - Old CMake-based wxBase
- scripts/build-kicad-wasm.sh - Old standalone kicad build
- scripts/build-wxwidgets-wasm-clean.sh - Patch testing script
- scripts/generate-wxwidgets-patches.sh - Patch generation
- scripts/prepare.sh - Old patch apply script
- scripts/update-kicad.sh - Old kicad update script
- CMakeLists.txt - Old native build root
- wxWidgets-wasm-reference submodule - Unused reference clone

Both workflows verified working after cleanup:
1. KiCad: docker/build.sh → tests/scripts/setup-kicad-wasm.sh → npm test
2. wxWidgets: scripts/build-wxuniversal-wasm.sh → scripts/build-wasm-test.sh → npm test

🤖 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 11:07:54 +01:00
commit a88652279b
41 changed files with 0 additions and 4691 deletions

View file

@ -1,53 +0,0 @@
#!/bin/bash
# Build KiCad core library for WebAssembly
# This builds kimath, sexpr, and core utilities with wxBase
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BUILD_DIR="$PROJECT_ROOT/build-wasm/core"
CORE_SOURCE="$PROJECT_ROOT/core"
echo "=== Building KiCad Core for WASM ==="
echo "Project root: $PROJECT_ROOT"
echo "Build dir: $BUILD_DIR"
echo "Core source: $CORE_SOURCE"
# Verify core source exists
if [ ! -f "$CORE_SOURCE/CMakeLists.txt" ]; then
echo "ERROR: Core source not found at $CORE_SOURCE"
exit 1
fi
# Verify wxBase was built
if [ ! -f "$PROJECT_ROOT/build-wasm/wxwidgets/lib/libwx_baseu-3.2-Emscripten.a" ]; then
echo "ERROR: wxBase not built. Run scripts/build-wxbase-wasm.sh first"
exit 1
fi
# Clean if requested (must be before mkdir to properly reset CMake cache)
if [ "$1" = "--clean" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure with emcmake
echo ""
echo "=== Configuring ==="
emcmake cmake "$CORE_SOURCE" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=OFF
# Build
echo ""
echo "=== Building ==="
emmake make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
echo ""
echo "=== Build complete ==="
ls -lh "$BUILD_DIR"/*.a 2>/dev/null || echo "Libraries built in $BUILD_DIR"

View file

@ -1,222 +0,0 @@
#!/bin/bash
# Master build script for KiCad PCBnew WASM
# Usage: ./build-kicad-wasm.sh [OPTIONS]
#
# Options:
# --clean Full clean rebuild
# --deps-only Only build dependencies
# --skip-deps Skip dependency builds
# --with-occ Enable OpenCASCADE (3D/STEP support)
# --with-ngspice Enable ngspice (simulation)
# --with-pthread Enable pthreads (multi-threading)
# --release Release build (optimized, no debug symbols)
# --debug Debug build with symbols (default)
# -j N Parallel jobs (default: nproc)
# --help Show this help
set -e
# Source common environment
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/common/env.sh"
# Default options
DEPS_ONLY=0
SKIP_DEPS=0
WITH_OCC=0
WITH_NGSPICE=0
WITH_PTHREAD=0
# Show help
show_help() {
head -20 "$0" | tail -18 | sed 's/^# //' | sed 's/^#//'
exit 0
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--help|-h)
show_help
;;
--clean)
CLEAN_BUILD=1
shift
;;
--deps-only)
DEPS_ONLY=1
shift
;;
--skip-deps)
SKIP_DEPS=1
shift
;;
--with-occ)
WITH_OCC=1
shift
;;
--with-ngspice)
WITH_NGSPICE=1
shift
;;
--with-pthread)
WITH_PTHREAD=1
shift
;;
--debug)
DEBUG_BUILD=1
shift
;;
--release)
DEBUG_BUILD=0
shift
;;
-j)
PARALLEL_JOBS="$2"
shift 2
;;
-j*)
PARALLEL_JOBS="${1#-j}"
shift
;;
*)
log_error "Unknown option: $1"
show_help
;;
esac
done
# Set defaults if not set
CLEAN_BUILD=${CLEAN_BUILD:-0}
DEBUG_BUILD=${DEBUG_BUILD:-1} # Debug mode by default (use --release for optimized builds)
PARALLEL_JOBS=${PARALLEL_JOBS:-$(get_nproc)}
# Export for sub-scripts
export CLEAN_BUILD DEBUG_BUILD PARALLEL_JOBS WITH_OCC WITH_NGSPICE WITH_PTHREAD
# Print configuration
echo "========================================"
echo "KiCad WASM Build"
echo "========================================"
echo " Clean build: $CLEAN_BUILD"
echo " Debug build: $DEBUG_BUILD"
echo " Deps only: $DEPS_ONLY"
echo " Skip deps: $SKIP_DEPS"
echo " With OCC: $WITH_OCC"
echo " With ngspice: $WITH_NGSPICE"
echo " With pthreads: $WITH_PTHREAD"
echo " Parallel jobs: $PARALLEL_JOBS"
echo "========================================"
# Verify prerequisites
setup_error_trap
verify_emscripten
verify_submodules "$PROJECT_ROOT"
# Clean if requested
if [ "$CLEAN_BUILD" = "1" ]; then
log_step "Cleaning previous builds..."
rm -rf "$STAMPS_DIR"/*
rm -rf "$DEPS_ROOT"/*
rm -rf "$BUILD_ROOT/kicad"
fi
# Build dependencies
if [ "$SKIP_DEPS" != "1" ]; then
log_step "Building dependencies..."
# Tier 1: Header-only (just verify they exist)
log_info "Tier 1: Header-only libraries (no build needed)"
# Tier 2: Simple C/C++ libraries from thirdparty
log_info "Tier 2: Simple libraries"
# These are built as part of KiCad's CMake, no separate build needed
# Tier 3: Emscripten ports
log_info "Tier 3: Emscripten ports (zlib, freetype via -sUSE_*)"
# These are linked via emscripten flags, no separate build
# Build Zstd
if [ -f "$SCRIPT_DIR/build-deps/build-zstd-wasm.sh" ]; then
build_if_needed "zstd" "$SCRIPT_DIR/build-deps/build-zstd-wasm.sh" "$CLEAN_BUILD"
else
log_warn "Zstd build script not found, skipping"
fi
# Build HarfBuzz
if [ -f "$SCRIPT_DIR/build-deps/build-harfbuzz-wasm.sh" ]; then
build_if_needed "harfbuzz" "$SCRIPT_DIR/build-deps/build-harfbuzz-wasm.sh" "$CLEAN_BUILD"
else
log_warn "HarfBuzz build script not found, skipping"
fi
# Build Pixman
if [ -f "$SCRIPT_DIR/build-deps/build-pixman-wasm.sh" ]; then
build_if_needed "pixman" "$SCRIPT_DIR/build-deps/build-pixman-wasm.sh" "$CLEAN_BUILD"
else
log_warn "Pixman build script not found, skipping"
fi
# Build Cairo
if [ -f "$SCRIPT_DIR/build-deps/build-cairo-wasm.sh" ]; then
build_if_needed "cairo" "$SCRIPT_DIR/build-deps/build-cairo-wasm.sh" "$CLEAN_BUILD"
else
log_warn "Cairo build script not found, skipping"
fi
# Tier 4: Complex dependencies
if [ "$WITH_OCC" = "1" ]; then
log_info "Tier 4: Building OpenCASCADE..."
if [ -f "$SCRIPT_DIR/build-deps/build-opencascade-wasm.sh" ]; then
build_if_needed "opencascade" "$SCRIPT_DIR/build-deps/build-opencascade-wasm.sh" "$CLEAN_BUILD"
else
log_warn "OpenCASCADE build script not found"
fi
fi
if [ "$WITH_NGSPICE" = "1" ]; then
log_info "Tier 4: Building ngspice..."
if [ -f "$SCRIPT_DIR/build-deps/build-ngspice-wasm.sh" ]; then
build_if_needed "ngspice" "$SCRIPT_DIR/build-deps/build-ngspice-wasm.sh" "$CLEAN_BUILD"
else
log_warn "ngspice build script not found"
fi
fi
# Verify wxWidgets is built
if [ ! -f "$WX_BUILD/wx-config" ]; then
log_step "Building wxWidgets..."
"$SCRIPT_DIR/build-wxuniversal-wasm.sh"
else
log_info "wxWidgets already built"
fi
log_info "Dependencies complete"
fi
if [ "$DEPS_ONLY" = "1" ]; then
log_info "Dependency build complete (--deps-only specified)"
exit 0
fi
# Build KiCad compatibility layer
log_step "Building WASM compatibility layer..."
if [ -f "$SCRIPT_DIR/build-wasm-compat.sh" ]; then
"$SCRIPT_DIR/build-wasm-compat.sh"
else
log_warn "WASM compatibility layer script not found, skipping"
fi
# Build KiCad PCBnew
log_step "Building KiCad PCBnew..."
if [ -f "$SCRIPT_DIR/build-pcbnew-wasm.sh" ]; then
"$SCRIPT_DIR/build-pcbnew-wasm.sh"
else
log_error "PCBnew build script not found: $SCRIPT_DIR/build-pcbnew-wasm.sh"
exit 1
fi
log_info "========================================"
log_info "Build complete!"
log_info "Output: $BUILD_ROOT/kicad/pcbnew/"
log_info "========================================"

View file

@ -1,67 +0,0 @@
#!/bin/bash
# Build wxBase (non-GUI wxWidgets) for WebAssembly
# This builds only the base utilities needed by KiCad core (wxString, wxFile, etc.)
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets"
WX_SOURCE="$PROJECT_ROOT/wxwidgets"
echo "=== Building wxBase for WASM ==="
echo "Project root: $PROJECT_ROOT"
echo "Build dir: $BUILD_DIR"
echo "wxWidgets source: $WX_SOURCE"
# Verify we're in the right place
if [ ! -f "$WX_SOURCE/CMakeLists.txt" ]; then
echo "ERROR: wxWidgets source not found at $WX_SOURCE"
echo "Make sure the wxwidgets submodule is initialized"
exit 1
fi
# Clean if requested (must be before mkdir to properly reset CMake cache)
if [ "$1" = "--clean" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure with emcmake
# Disable all GUI and most optional features - we only need wxBase utilities
# Note: zlib/expat "builtin" versions use POSIX file descriptors not available in WASM,
# so we disable them. We'll use Emscripten's ports if compression is needed.
emcmake cmake "$WX_SOURCE" \
-DwxUSE_GUI=OFF \
-DwxBUILD_SHARED=OFF \
-DwxBUILD_SAMPLES=OFF \
-DwxBUILD_TESTS=OFF \
-DwxBUILD_DEMOS=OFF \
-DwxBUILD_BENCHMARKS=OFF \
-DwxUSE_REGEX=builtin \
-DwxUSE_ZLIB=OFF \
-DwxUSE_EXPAT=OFF \
-DwxUSE_LIBJPEG=OFF \
-DwxUSE_LIBPNG=OFF \
-DwxUSE_LIBTIFF=OFF \
-DwxUSE_WEBREQUEST=OFF \
-DwxUSE_SECRETSTORE=OFF \
-DwxUSE_LIBSDL=OFF \
-DwxUSE_LIBMSPACK=OFF \
-DwxUSE_FSWATCHER=OFF \
-DwxUSE_XLOCALE=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
# Build
echo ""
echo "=== Building ==="
emmake make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
echo ""
echo "=== Build complete ==="
ls -lh "$BUILD_DIR"/lib/*.a 2>/dev/null || echo "Libraries built in $BUILD_DIR"

View file

@ -1,178 +0,0 @@
#!/bin/bash
# Build wxWidgets for WASM from a clean clone + patches
# This tests that our patches can reproduce the build
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
PATCHES_DIR="$PROJECT_ROOT/patches/wxwidgets-wasm"
CLONE_DIR="$PROJECT_ROOT/wxwidgets-clean"
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-clean"
REFERENCE_BUILD="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
# Configuration - fork URL and commit
WX_REPO="git@github.com:VV-EE/wxWidgets.git"
WX_COMMIT="5ff25322553c1870cf20a2e1ba6f20ed50d9fe9a"
# Parse arguments
CLEAN=false
SKIP_BUILD=false
while [[ $# -gt 0 ]]; do
case $1 in
--clean) CLEAN=true; shift ;;
--skip-build) SKIP_BUILD=true; shift ;;
--help)
echo "Usage: $0 [OPTIONS]"
echo " --clean Force fresh clone (remove existing)"
echo " --skip-build Only clone and patch, skip building"
exit 0
;;
*) echo "Unknown option: $1"; exit 1 ;;
esac
done
echo "=== wxWidgets WASM Clean Build ==="
echo "Repository: $WX_REPO"
echo "Commit: $WX_COMMIT"
echo "Clone dir: $CLONE_DIR"
echo "Build dir: $BUILD_DIR"
echo ""
# Verify patch exists
if [ ! -f "$PATCHES_DIR/wxwidgets-wasm.patch" ]; then
echo "ERROR: Patch not found: $PATCHES_DIR/wxwidgets-wasm.patch"
echo "Run ./scripts/generate-wxwidgets-patches.sh first"
exit 1
fi
# Verify checksums
echo "=== Verifying patch checksums ==="
cd "$PATCHES_DIR"
if ! shasum -a 256 -c checksums.sha256; then
echo "ERROR: Patch checksum verification failed"
exit 1
fi
echo "Checksums OK"
echo ""
# Step 1: Clone repository
echo "=== Step 1: Clone repository ==="
if [ "$CLEAN" = true ] || [ ! -d "$CLONE_DIR/.git" ]; then
rm -rf "$CLONE_DIR"
echo "Cloning $WX_REPO..."
git clone "$WX_REPO" "$CLONE_DIR"
cd "$CLONE_DIR"
git checkout "$WX_COMMIT"
else
echo "Using existing clone at $CLONE_DIR"
cd "$CLONE_DIR"
git fetch origin
git checkout "$WX_COMMIT"
git reset --hard "$WX_COMMIT"
fi
echo ""
# Step 2: Initialize submodules
echo "=== Step 2: Initialize submodules ==="
git submodule update --init --recursive
echo ""
# Step 3: Apply the unified patch
echo "=== Step 3: Apply unified patch ==="
echo "Applying wxwidgets-wasm.patch..."
patch -p1 < "$PATCHES_DIR/wxwidgets-wasm.patch"
echo ""
if [ "$SKIP_BUILD" = true ]; then
echo "=== Skipping build (--skip-build) ==="
echo "Clone and patch complete. Source ready at: $CLONE_DIR"
exit 0
fi
# Step 4: Configure and build
echo "=== Step 4: Configure ==="
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
export CFLAGS="-DZ_HAVE_UNISTD_H=1"
export CXXFLAGS="-DZ_HAVE_UNISTD_H=1"
emconfigure "$CLONE_DIR/configure" \
--host=emscripten \
--enable-universal \
--disable-shared \
--with-opengl \
--disable-exceptions \
--disable-richtext \
--without-libtiff \
--disable-xlocale \
--with-cxx=17 \
--enable-utf8
echo ""
echo "=== Step 5: Build ==="
emmake make -j$(sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo 4)
echo ""
echo "=== Step 6: Verify and compare ==="
# List built libraries
echo "Built libraries:"
ls -lh "$BUILD_DIR/lib/"*.a 2>/dev/null || echo "No libraries found"
# Compare with reference build if it exists
if [ -d "$REFERENCE_BUILD/lib" ]; then
echo ""
echo "=== Comparison with reference build ==="
printf "%-50s %12s %12s %10s\n" "Library" "Reference" "Clean" "Match"
printf "%-50s %12s %12s %10s\n" "-------" "---------" "-----" "-----"
MISMATCH=0
for lib in "$BUILD_DIR/lib/"*.a; do
basename=$(basename "$lib")
ref_lib="$REFERENCE_BUILD/lib/$basename"
if [ -f "$ref_lib" ]; then
# Get sizes (macOS stat syntax)
new_size=$(stat -f%z "$lib" 2>/dev/null || stat -c%s "$lib")
ref_size=$(stat -f%z "$ref_lib" 2>/dev/null || stat -c%s "$ref_lib")
if [ "$new_size" -eq "$ref_size" ]; then
match="YES"
else
match="NO (diff: $((new_size - ref_size)))"
MISMATCH=1
fi
printf "%-50s %12d %12d %10s\n" "$basename" "$ref_size" "$new_size" "$match"
else
printf "%-50s %12s %12d %10s\n" "$basename" "(missing)" "$new_size" "NEW"
fi
done
# Check for libraries in reference but not in clean build
for lib in "$REFERENCE_BUILD/lib/"*.a; do
basename=$(basename "$lib")
if [ ! -f "$BUILD_DIR/lib/$basename" ]; then
ref_size=$(stat -f%z "$lib" 2>/dev/null || stat -c%s "$lib")
printf "%-50s %12d %12s %10s\n" "$basename" "$ref_size" "(missing)" "MISSING"
MISMATCH=1
fi
done
echo ""
if [ "$MISMATCH" -eq 0 ]; then
echo "SUCCESS: All libraries match!"
else
echo "WARNING: Some libraries differ (this may be expected due to build timestamps)"
fi
else
echo ""
echo "No reference build found at $REFERENCE_BUILD"
echo "Run ./scripts/build-wxuniversal-wasm.sh first to create a reference"
fi
echo ""
echo "=== Build complete ==="
echo "Libraries in: $BUILD_DIR/lib/"

View file

@ -1,162 +0,0 @@
#!/bin/bash
#
# KiCad Wasm Port - Build Script
#
# This script builds KiCad with optional dependencies disabled.
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
KICAD_DIR="$PROJECT_ROOT/kicad"
BUILD_DIR="$PROJECT_ROOT/build"
CMAKE_MODULE_PATH="$PROJECT_ROOT/cmake"
STUBS_DIR="$PROJECT_ROOT/stubs/include"
# Default options
USE_CURL="${KICAD_USE_CURL:-OFF}"
USE_GIT="${KICAD_USE_GIT:-OFF}"
USE_OCC="${KICAD_USE_OCC:-OFF}"
USE_NGSPICE="${KICAD_USE_NGSPICE:-OFF}"
BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}"
PARALLEL_JOBS="${PARALLEL_JOBS:-$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)}"
show_help() {
echo "KiCad Wasm Port - Build Script"
echo ""
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " --with-curl Enable CURL (network features)"
echo " --with-git Enable libgit2 (git integration)"
echo " --with-occ Enable OpenCASCADE (STEP/3D)"
echo " --with-ngspice Enable ngspice (SPICE simulation)"
echo " --debug Build in Debug mode"
echo " --clean Clean build directory first"
echo " -j N Number of parallel jobs (default: $PARALLEL_JOBS)"
echo " --configure-only Only run cmake, don't build"
echo " -h, --help Show this help"
echo ""
echo "Environment variables:"
echo " KICAD_USE_CURL=ON|OFF (default: OFF)"
echo " KICAD_USE_GIT=ON|OFF (default: OFF)"
echo " KICAD_USE_OCC=ON|OFF (default: OFF)"
echo " KICAD_USE_NGSPICE=ON|OFF (default: OFF)"
echo " CMAKE_BUILD_TYPE=Release|Debug"
echo ""
}
CLEAN_BUILD=0
CONFIGURE_ONLY=0
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--with-curl)
USE_CURL=ON
shift
;;
--with-git)
USE_GIT=ON
shift
;;
--with-occ)
USE_OCC=ON
shift
;;
--with-ngspice)
USE_NGSPICE=ON
shift
;;
--debug)
BUILD_TYPE=Debug
shift
;;
--clean)
CLEAN_BUILD=1
shift
;;
-j)
PARALLEL_JOBS="$2"
shift 2
;;
--configure-only)
CONFIGURE_ONLY=1
shift
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
echo "=== KiCad Wasm Port - Build ==="
echo ""
echo "Configuration:"
echo " Build type: $BUILD_TYPE"
echo " CURL: $USE_CURL"
echo " Git: $USE_GIT"
echo " OpenCASCADE: $USE_OCC"
echo " ngspice: $USE_NGSPICE"
echo " Parallel jobs: $PARALLEL_JOBS"
echo ""
# Check if kicad exists
if [ ! -f "$KICAD_DIR/CMakeLists.txt" ]; then
echo "Error: KiCad source not found at $KICAD_DIR"
echo "Run: git submodule update --init --recursive"
exit 1
fi
# Clean if requested
if [ $CLEAN_BUILD -eq 1 ] && [ -d "$BUILD_DIR" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Additional include paths for stubs
EXTRA_INCLUDES=""
if [ "$USE_CURL" = "OFF" ] || [ "$USE_GIT" = "OFF" ]; then
EXTRA_INCLUDES="-DCMAKE_CXX_FLAGS=-I$STUBS_DIR"
fi
# Configure
echo "Running CMake..."
cmake "$KICAD_DIR" \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_MODULE_PATH="$CMAKE_MODULE_PATH" \
-DKICAD_USE_CURL="$USE_CURL" \
-DKICAD_USE_GIT="$USE_GIT" \
-DKICAD_USE_OCC="$USE_OCC" \
-DKICAD_USE_NGSPICE="$USE_NGSPICE" \
-DKICAD_SCRIPTING_WXPYTHON=OFF \
-DKICAD_BUILD_QA_TESTS=OFF \
-DKICAD_BUILD_I18N=OFF \
$EXTRA_INCLUDES
if [ $CONFIGURE_ONLY -eq 1 ]; then
echo ""
echo "Configuration complete. Run 'make -j$PARALLEL_JOBS' in $BUILD_DIR to build."
exit 0
fi
# Build
echo ""
echo "Building..."
cmake --build . --parallel "$PARALLEL_JOBS"
echo ""
echo "=== Build Complete ==="
echo ""
echo "Binaries are in: $BUILD_DIR"

View file

@ -1,163 +0,0 @@
#!/bin/bash
# Generate a single unified patch from current wxwidgets state
# This captures ALL modifications including submodule config.sub changes
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
WX_SOURCE="$PROJECT_ROOT/wxwidgets"
PATCHES_DIR="$PROJECT_ROOT/patches/wxwidgets-wasm"
PATCH_FILE="$PATCHES_DIR/wxwidgets-wasm.patch"
echo "=== Generating wxWidgets WASM Unified Patch ==="
echo "Source: $WX_SOURCE"
echo "Output: $PATCH_FILE"
# Verify wxwidgets exists (check for .git as file or directory - submodules use a file)
if [ ! -e "$WX_SOURCE/.git" ]; then
echo "ERROR: wxwidgets is not a git repository"
exit 1
fi
# Create output directory
mkdir -p "$PATCHES_DIR"
cd "$WX_SOURCE"
# Capture current commit SHA (the base we're patching from)
CURRENT_COMMIT=$(git rev-parse HEAD)
echo ""
echo "Base commit: $CURRENT_COMMIT"
# Start with empty patch file
> "$PATCH_FILE"
echo ""
echo "=== Part 1: Main wxWidgets changes ==="
# Mark all untracked files as "intent to add" (allows git diff to see them)
git add -N .
# Generate main diff (excluding submodule directory pointers, but including everything else)
git diff HEAD -- . \
':!3rdparty/catch' \
':!3rdparty/nanosvg' \
':!3rdparty/pcre' \
':!src/expat' \
':!src/jpeg' \
':!src/png' \
':!src/tiff' \
':!src/zlib' \
>> "$PATCH_FILE"
# Undo the intent-to-add
git reset HEAD --quiet
MAIN_LINES=$(wc -l < "$PATCH_FILE")
echo "Added main changes ($MAIN_LINES lines so far)"
echo ""
echo "=== Part 2: Submodule config.sub changes ==="
# Process each submodule config.sub
add_submodule_config_sub() {
local submodule="$1"
local config_sub_path="$2"
local full_path="$WX_SOURCE/$config_sub_path"
if [ -d "$WX_SOURCE/$submodule" ] && [ -f "$full_path" ]; then
cd "$WX_SOURCE/$submodule"
# Get the relative path within the submodule
local rel_config_sub="${config_sub_path#$submodule/}"
# Check if config.sub is modified in this submodule
if ! git diff --quiet HEAD -- "$rel_config_sub" 2>/dev/null; then
echo " Adding $config_sub_path"
# Generate diff with paths rewritten to be relative to main repo
git diff HEAD -- "$rel_config_sub" | sed "s|a/$rel_config_sub|a/$config_sub_path|g; s|b/$rel_config_sub|b/$config_sub_path|g" >> "$PATCH_FILE"
else
echo " Skipping $config_sub_path (no changes)"
fi
else
echo " Skipping $submodule (not found)"
fi
}
add_submodule_config_sub "3rdparty/pcre" "3rdparty/pcre/config.sub"
add_submodule_config_sub "src/expat" "src/expat/expat/conftools/config.sub"
add_submodule_config_sub "src/jpeg" "src/jpeg/config.sub"
add_submodule_config_sub "src/png" "src/png/config.sub"
add_submodule_config_sub "src/tiff" "src/tiff/config/config.sub"
cd "$WX_SOURCE"
TOTAL_LINES=$(wc -l < "$PATCH_FILE")
echo ""
echo "Total patch: $TOTAL_LINES lines"
echo ""
echo "=== Generating checksums ==="
cd "$PATCHES_DIR"
shasum -a 256 *.patch > checksums.sha256
echo "Created checksums.sha256"
echo ""
echo "=== Generating README ==="
cat > README.md << EOF
# wxWidgets WASM Port Patch
Single unified patch that transforms wxWidgets into a WASM-capable build.
## Base Version
- Repository: git@github.com:VV-EE/wxWidgets.git
- Commit: $CURRENT_COMMIT
- Generated: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
## Patch Contents
This single patch includes:
- Main wxWidgets modifications (config.sub, configure.in, headers, sources)
- New WASM platform: src/wasm/, include/wx/wasm/
- New build files: build/wasm/
- WASM theme renderer: src/univ/themes/wasm.cpp
- Submodule config.sub updates for emscripten/wasm32 support:
- 3rdparty/pcre/config.sub
- src/expat/expat/conftools/config.sub
- src/jpeg/config.sub
- src/png/config.sub
- src/tiff/config/config.sub
## Apply Instructions
\`\`\`bash
# Clone wxWidgets fork at the base commit
git clone git@github.com:VV-EE/wxWidgets.git wxwidgets-clean
cd wxwidgets-clean
git checkout $CURRENT_COMMIT
git submodule update --init --recursive
# Apply the unified patch
patch -p1 < /path/to/patches/wxwidgets-wasm/wxwidgets-wasm.patch
# Build
mkdir build && cd build
emconfigure ../configure --host=emscripten --enable-universal ...
emmake make
\`\`\`
## Verification
\`\`\`bash
shasum -a 256 -c checksums.sha256
\`\`\`
EOF
echo "Created README.md"
echo ""
echo "=== Summary ==="
ls -lh "$PATCHES_DIR"
echo ""
echo "Unified patch generated successfully!"

View file

@ -1,120 +0,0 @@
#!/bin/bash
#
# KiCad Wasm Port - Prepare Script
#
# This script applies patches to the KiCad source code to enable
# building with optional dependencies disabled.
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
KICAD_DIR="$PROJECT_ROOT/kicad"
PATCHES_DIR="$PROJECT_ROOT/patches"
echo "=== KiCad Wasm Port - Prepare ==="
echo "Project root: $PROJECT_ROOT"
echo "KiCad source: $KICAD_DIR"
echo ""
# Check if kicad submodule is initialized
if [ ! -f "$KICAD_DIR/CMakeLists.txt" ]; then
echo "Error: KiCad submodule not initialized."
echo "Run: git submodule update --init --recursive"
exit 1
fi
# Check if patches directory exists
if [ ! -d "$PATCHES_DIR" ]; then
echo "Error: Patches directory not found: $PATCHES_DIR"
exit 1
fi
# Function to check if a patch is already applied
patch_already_applied() {
local patch_file="$1"
# Try to reverse-apply the patch (dry run)
# If it succeeds, the patch is already applied
cd "$KICAD_DIR"
if git apply --reverse --check "$patch_file" 2>/dev/null; then
return 0
else
return 1
fi
}
# Function to apply a patch
apply_patch() {
local patch_file="$1"
local patch_name="$(basename "$patch_file")"
echo "Checking patch: $patch_name"
if patch_already_applied "$patch_file"; then
echo " -> Already applied, skipping"
return 0
fi
echo " -> Applying..."
cd "$KICAD_DIR"
# Try to apply the patch
if git apply --check "$patch_file" 2>/dev/null; then
git apply "$patch_file"
echo " -> Success"
else
echo " -> Warning: Patch may not apply cleanly, trying with -3 (three-way merge)"
if git apply -3 "$patch_file" 2>/dev/null; then
echo " -> Success with three-way merge"
else
echo " -> Error: Patch failed to apply"
echo " You may need to manually resolve conflicts or update the patch"
return 1
fi
fi
}
# Apply all patches in order
echo "Applying patches..."
echo ""
patch_count=0
patch_failed=0
for patch_file in "$PATCHES_DIR"/*.patch; do
if [ -f "$patch_file" ]; then
if apply_patch "$patch_file"; then
((patch_count++))
else
((patch_failed++))
fi
echo ""
fi
done
echo "=== Summary ==="
echo "Patches applied: $patch_count"
echo "Patches failed: $patch_failed"
if [ $patch_failed -gt 0 ]; then
echo ""
echo "Some patches failed to apply. Please check the errors above."
exit 1
fi
echo ""
echo "=== Next Steps ==="
echo ""
echo "Build with optional dependencies disabled:"
echo ""
echo " mkdir build && cd build"
echo " cmake ../kicad \\"
echo " -DKICAD_USE_CURL=OFF \\"
echo " -DKICAD_USE_GIT=OFF \\"
echo " -DKICAD_USE_OCC=OFF \\"
echo " -DKICAD_USE_NGSPICE=OFF \\"
echo " -DCMAKE_PREFIX_PATH=\"\$(pwd)/../stubs/include\""
echo " make -j\$(nproc)"
echo ""
echo "Done!"

View file

@ -1,137 +0,0 @@
#!/bin/bash
#
# KiCad Wasm Port - Update KiCad Submodule
#
# This script updates the KiCad submodule to a new version and
# helps regenerate patches if needed.
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
KICAD_DIR="$PROJECT_ROOT/kicad"
PATCHES_DIR="$PROJECT_ROOT/patches"
echo "=== KiCad Wasm Port - Update KiCad ==="
echo ""
# Check if kicad submodule exists
if [ ! -d "$KICAD_DIR/.git" ] && [ ! -f "$KICAD_DIR/.git" ]; then
echo "Error: KiCad submodule not initialized."
echo "Run: git submodule update --init --recursive"
exit 1
fi
# Parse arguments
TARGET_REF="${1:-}"
FORCE_UPDATE=0
if [ "$1" = "--force" ] || [ "$2" = "--force" ]; then
FORCE_UPDATE=1
fi
show_usage() {
echo "Usage: $0 [<ref>] [--force]"
echo ""
echo "Arguments:"
echo " <ref> Git reference (branch, tag, or commit) to update to"
echo " Examples: 8.0, master, v8.0.0, abc1234"
echo " --force Force update even if patches need manual intervention"
echo ""
echo "If no ref is provided, shows current KiCad version."
}
# Show current version
show_current_version() {
cd "$KICAD_DIR"
echo "Current KiCad version:"
echo " Branch: $(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo 'detached')"
echo " Commit: $(git rev-parse --short HEAD)"
echo " Date: $(git log -1 --format=%ci)"
# Check if there are local modifications
if ! git diff --quiet; then
echo ""
echo "Warning: There are uncommitted changes in the KiCad directory"
git status --short
fi
}
# Revert patches before update
revert_patches() {
echo "Reverting existing patches..."
cd "$KICAD_DIR"
for patch_file in "$PATCHES_DIR"/*.patch; do
if [ -f "$patch_file" ]; then
patch_name="$(basename "$patch_file")"
# Try to reverse the patch
if git apply --reverse --check "$patch_file" 2>/dev/null; then
echo " Reverting: $patch_name"
git apply --reverse "$patch_file"
else
echo " Skipping (not applied): $patch_name"
fi
fi
done
}
# Update submodule
update_submodule() {
local ref="$1"
echo ""
echo "Updating KiCad to: $ref"
cd "$KICAD_DIR"
# Fetch latest
echo "Fetching from origin..."
git fetch origin
# Checkout the target ref
echo "Checking out $ref..."
git checkout "$ref"
# If it's a branch, pull latest
if git rev-parse --verify "origin/$ref" >/dev/null 2>&1; then
echo "Pulling latest from origin/$ref..."
git pull origin "$ref"
fi
echo ""
show_current_version
}
# Main logic
if [ -z "$TARGET_REF" ] || [ "$TARGET_REF" = "--force" ]; then
show_current_version
echo ""
show_usage
exit 0
fi
echo "Preparing to update KiCad..."
echo ""
# Show current version
show_current_version
echo ""
# Revert patches first
revert_patches
echo ""
# Update submodule
update_submodule "$TARGET_REF"
echo ""
# Re-apply patches
echo "Re-applying patches..."
"$SCRIPT_DIR/prepare.sh"
echo ""
echo "=== Update Complete ==="
echo ""
echo "Don't forget to test the build:"
echo " cd build && cmake --build . --clean-first"