2026-04-01 06:53:56 +07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Build both libqemu-xtensa.dll and libqemu-riscv32.dll with slirp (WiFi)
|
|
|
|
|
# and copy them to backend/app/services/.
|
|
|
|
|
#
|
|
|
|
|
# Run from MSYS2 MINGW64 shell:
|
|
|
|
|
# cd /e/Hardware/wokwi_clon
|
|
|
|
|
# bash build_qemu_all.sh
|
|
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
|
refactor: rename wokwi-libs/ → third-party/
The directory grew well beyond Wokwi-only contents: it now hosts
lcgamboa's QEMU fork (qemu-lcgamboa), Espressif's esp32-camera, the
ngspice WASM build, fritzing-parts, picowi, an alternative QEMU
(qemu-esp32), the 100_Days_100_IoT_Projects examples repo, and
Wokwi's own avr8js/rp2040js/wokwi-elements/wokwi-features/wokwi-boards.
"wokwi-libs" was misleading — half the contents have nothing to do
with Wokwi. "third-party/" is the standard convention for vendored
external dependencies.
Mechanical changes:
Path rename:
wokwi-libs/ → third-party/
update-wokwi-libs.bat → update-third-party.bat
docs/WOKWI_LIBS.md → docs/THIRD_PARTY.md
Submodule reconfiguration:
.gitmodules — 4 path= and section names updated
.git/modules/wokwi-libs/ → .git/modules/third-party/
each submodule's .git file rewired to ../../.git/modules/third-party/<name>
Reference updates (~80 files): vite.config.ts aliases, Dockerfile
COPY paths, GH Actions workflow steps, build_qemu_*.sh, all
docs/* and test/*/autosearch/* entries that mention the path,
package-lock.json file: dependencies, .gitignore patterns,
sitemap.xml + index.html SEO blurbs, scripts/generate-component-*,
.dockerignore, .idea/vcs.xml. Bulk replaced both `wokwi-libs/`
(path) and bare `wokwi-libs` (textual mentions in docs/comments).
Verified:
- npx tsc -b --noEmit produces no new errors related to these paths
- vite.config.ts aliases now point at ../third-party/avr8js etc.
- All 4 git submodules (avr8js, rp2040js, wokwi-elements,
wokwi-features) are linked under third-party/ with their
worktrees re-populated and config files referencing the new path
- `grep -r wokwi-libs` returns zero hits outside node_modules,
.vite, frontend/dist, third-party/ (upstream submodule contents),
*.pyc caches, and *.dll.pre-camera rollback binaries
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 10:58:57 +07:00
|
|
|
QEMU_DIR="${REPO_ROOT}/third-party/qemu-lcgamboa"
|
2026-04-01 06:53:56 +07:00
|
|
|
BACKEND_SERVICES="${REPO_ROOT}/backend/app/services"
|
|
|
|
|
|
|
|
|
|
echo "=== Building QEMU ESP32 DLLs (Xtensa + RISC-V) with slirp ==="
|
|
|
|
|
echo " QEMU source: ${QEMU_DIR}"
|
|
|
|
|
echo " Output dir: ${BACKEND_SERVICES}"
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
cd "${QEMU_DIR}"
|
|
|
|
|
|
|
|
|
|
# Step 1: Build both targets
|
|
|
|
|
echo "--- Running build script ---"
|
|
|
|
|
bash build_libqemu-esp32-win.sh
|
|
|
|
|
|
|
|
|
|
# Step 2: Copy DLLs to backend
|
|
|
|
|
echo ""
|
|
|
|
|
echo "=== Copying DLLs to backend ==="
|
|
|
|
|
|
|
|
|
|
if [ -f build/libqemu-xtensa.dll ]; then
|
|
|
|
|
cp build/libqemu-xtensa.dll "${BACKEND_SERVICES}/"
|
|
|
|
|
echo " Copied libqemu-xtensa.dll ($(du -h build/libqemu-xtensa.dll | cut -f1))"
|
|
|
|
|
else
|
|
|
|
|
echo " WARNING: libqemu-xtensa.dll not found!"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -f build/libqemu-riscv32.dll ]; then
|
|
|
|
|
cp build/libqemu-riscv32.dll "${BACKEND_SERVICES}/"
|
|
|
|
|
echo " Copied libqemu-riscv32.dll ($(du -h build/libqemu-riscv32.dll | cut -f1))"
|
|
|
|
|
else
|
|
|
|
|
echo " WARNING: libqemu-riscv32.dll not found!"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Step 3: Verify slirp in both DLLs
|
|
|
|
|
echo ""
|
|
|
|
|
echo "=== Verifying slirp support ==="
|
|
|
|
|
|
|
|
|
|
for dll in libqemu-xtensa.dll libqemu-riscv32.dll; do
|
|
|
|
|
path="${BACKEND_SERVICES}/${dll}"
|
|
|
|
|
if [ -f "$path" ]; then
|
|
|
|
|
if objdump -p "$path" 2>/dev/null | grep -q "libslirp"; then
|
|
|
|
|
echo " ${dll}: slirp OK"
|
|
|
|
|
else
|
|
|
|
|
echo " ${dll}: WARNING - slirp NOT found!"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Step 4: Verify picsimlab exports
|
|
|
|
|
echo ""
|
|
|
|
|
echo "=== Verifying picsimlab exports ==="
|
|
|
|
|
|
|
|
|
|
for dll in libqemu-xtensa.dll libqemu-riscv32.dll; do
|
|
|
|
|
path="${BACKEND_SERVICES}/${dll}"
|
|
|
|
|
if [ -f "$path" ]; then
|
|
|
|
|
count=$(objdump -p "$path" 2>/dev/null | grep -c "picsimlab" || true)
|
|
|
|
|
echo " ${dll}: ${count} picsimlab exports"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "=== Done ==="
|