b959776068
Native and wasm now share one source tree, so the xteink machine and SD fixes never diverge. scripts/build-qemu.sh configures a dedicated build-native/ dir (ucontext coroutine backend; the fork defaults to the wasm fiber backend) that never clobbers the Emscripten build/ config. Retires the separate _scratch/qemu-src patch-based native build.
34 lines
1.0 KiB
Bash
Executable File
34 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
# Native build shares the third_party/qemu submodule with the wasm build so the
|
|
# xteink machine and device fixes never diverge. A dedicated build-native dir
|
|
# keeps the native meson config from clobbering the Emscripten build/ config.
|
|
SRC="${QEMU_SRC:-$ROOT/third_party/qemu}"
|
|
[[ "$SRC" = /* ]] || SRC="$ROOT/$SRC"
|
|
BUILD="$SRC/build-native"
|
|
JOBS="${JOBS:-$(nproc 2>/dev/null || echo 2)}"
|
|
|
|
if [ ! -f "$SRC/tcg/wasm32.c" ]; then
|
|
echo "third_party/qemu submodule not checked out; run: git submodule update --init" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$BUILD/build.ninja" ]; then
|
|
mkdir -p "$BUILD"
|
|
cd "$BUILD"
|
|
"$SRC/configure" \
|
|
--target-list=riscv32-softmmu \
|
|
--with-devices-riscv32=xteink \
|
|
--with-coroutine=ucontext \
|
|
--enable-gcrypt \
|
|
--enable-slirp \
|
|
--disable-werror \
|
|
--disable-docs \
|
|
--disable-tools
|
|
fi
|
|
|
|
ninja -C "$BUILD" -j"$JOBS" qemu-system-riscv32
|
|
printf '%s\n' "$BUILD/qemu-system-riscv32"
|