chore: untrack obsolete Windows QEMU build helpers (keep local-only)

build_qemu_all.sh and build_qemu_step4.sh are stale MSYS2/MINGW64 dev
helpers (hardcoded /e/Hardware/wokwi_clon paths, output to
backend/app/services/) that built the Windows libqemu-*.dll. They are
superseded by docs/BUILD-QEMU.md (the Linux/macOS .so build from
lcgamboa/qemu) and the prebuilt / CDN binary flow, and are referenced by
no Dockerfile, CI, or deploy step. Remove from the tree and gitignore the
root-scoped paths so they stay local-only.
This commit is contained in:
David Montero 2026-06-16 03:51:26 +02:00
parent 608c2538c9
commit 27032a4878
3 changed files with 6 additions and 181 deletions

6
.gitignore vendored
View File

@ -127,6 +127,12 @@ backend/app/services/libqemu-*.dll.pre-camera
backend/app/services/libqemu-*.dll.new
backend/app/services/libqemu-*.dll.bak
# Obsolete Windows-only QEMU build helpers (MSYS2/MINGW64). Superseded by
# docs/BUILD-QEMU.md (Linux/macOS .so via lcgamboa/qemu) and the prebuilt /
# CDN binary flow; kept local-only on the operator's box, never tracked.
/build_qemu_all.sh
/build_qemu_step4.sh
# esp32-camera repo is cloned during dev (used as include path by the
# arduino-esp32 toolchain via ARDUINO_ESP32_PATH). Not a submodule and
# not part of the main repo — gitignored to keep the working tree clean.

View File

@ -1,72 +0,0 @@
#!/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)"
QEMU_DIR="${REPO_ROOT}/third-party/qemu-lcgamboa"
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 ==="

View File

@ -1,109 +0,0 @@
#!/usr/bin/env bash
# Step 4: Relink qemu-system-xtensa as libqemu-xtensa.dll
set -euo pipefail
export PATH=/mingw64/bin:/usr/bin:$PATH
BUILD="/e/Hardware/wokwi_clon/third-party/qemu-lcgamboa/build"
OUT="/e/Hardware/wokwi_clon/backend/app/services"
cd "$BUILD"
echo "=== Extracting link command from build.ninja ==="
python3 << 'PYEOF'
import re, subprocess, sys, os
with open('build.ninja') as f:
content = f.read()
# Find build block for qemu-system-xtensa.exe
idx = content.find('build qemu-system-xtensa.exe:')
if idx < 0:
print('Target not found!'); sys.exit(1)
block = content[idx:]
end = block.find('\nbuild ', 1)
if end > 0:
block = block[:end]
# Extract LINK_ARGS and LINK_PATH
link_args = ''
link_path = ''
for line in block.split('\n'):
line = line.strip()
if line.startswith('LINK_ARGS ='):
link_args = line.split('=', 1)[1].strip()
elif line.startswith('LINK_PATH ='):
link_path = line.split('=', 1)[1].strip()
# Extract all input objects (everything after c_LINKER_RSP on line 1, excluding the | deps part)
first_line = block.split('\n')[0]
# Remove "build qemu-system-xtensa.exe: c_LINKER_RSP "
objs_raw = first_line.split('c_LINKER_RSP ', 1)[1]
# Remove pipe section (| implicit deps)
if ' | ' in objs_raw:
objs_raw = objs_raw.split(' | ')[0]
objs = objs_raw.split()
# Remove softmmu_main.c.obj (contains main())
objs = [o for o in objs if 'softmmu_main' not in o]
# Also add qemu-system-xtensa.exe.p objects (target-specific .obj files)
# Find them in the .p directory
p_dir = 'qemu-system-xtensa.exe.p'
if os.path.isdir(p_dir):
for f in os.listdir(p_dir):
if f.endswith('.obj') and 'softmmu_main' not in f:
path = f'{p_dir}/{f}'
if path not in objs:
objs.append(path)
print(f'Objects count: {len(objs)}')
print(f'LINK_ARGS: {link_args[:200]}')
print(f'LINK_PATH: {link_path}')
# Build the DLL link command
cmd = (
f'cc -m64 -mcx16 -shared -Wl,--export-all-symbols -Wl,--allow-multiple-definition '
f'-o libqemu-xtensa.dll '
f'{" ".join(objs)} '
f'{link_path} '
f'{link_args}'
)
print(f'\nLink command length: {len(cmd)}')
# Write to a response file to avoid command line length issues
with open('dll_link.rsp', 'w') as f:
f.write(
f'-shared -Wl,--export-all-symbols -Wl,--allow-multiple-definition '
f'-o libqemu-xtensa.dll '
f'{" ".join(objs)} '
f'{link_path} '
f'{link_args}'
)
print('Written to dll_link.rsp')
PYEOF
echo ""
echo "=== Linking libqemu-xtensa.dll ==="
cc -m64 -mcx16 @dll_link.rsp 2>&1
echo "=== Link exit code: $? ==="
if [ -f libqemu-xtensa.dll ]; then
echo ""
echo "=== SUCCESS: libqemu-xtensa.dll ==="
ls -lh libqemu-xtensa.dll
echo ""
echo "=== Checking picsimlab exports ==="
objdump -p libqemu-xtensa.dll 2>/dev/null | grep -iE "picsimlab|qemu_init|qemu_main" | head -20
echo ""
echo "=== Copying to backend/app/services ==="
cp libqemu-xtensa.dll "$OUT/"
echo "Copied!"
else
echo "FAILED - DLL not produced"
exit 1
fi