# shellcheck shell=bash # Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # QEMU 11.1.2: the PC emulator the Haiku ports (src/hosted/be) are run and # gated in, x86_64 and i386 system emulation only, with KVM when /dev/kvm is # usable. Built from the release source into toolchains/opt/qemu, with # pixman 0.46.4 (its display library, which distributions split into a -dev # package that may be missing) built first as a static library and linked # in. SDL2 gives joey-run its window; the wav audio backend the audio gate # records through is always built in. compDescription="emulator: QEMU 11.1.2 + pixman 0.46.4 (Haiku, BeOS)" compGroups="emulator:haiku emulator:haiku32 emulator:beos" compRequires="host" compHostDeps="build-tools pkg-config python3 python3-venv ninja meson glib-dev zlib-dev sdl2-dev pulse-dev asound-dev" compUrl="https://download.qemu.org/qemu-11.1.2.tar.xz" compSha256="731b5681e4bb18be313231579b8efd0296c5b015fa36dc533874b639ba838016" pixmanUrl="https://cairographics.org/releases/pixman-0.46.4.tar.xz" pixmanSha256="a098c33924754ad43f981b740f6d576c70f9ed1006e12221b1845431ebce1239" compPin="$compSha256:$pixmanSha256" compInstall() { local archive local pixmanArchive local src local pixmanSrc local pixmanPrefix archive="$(fetchFile "$compUrl" "$compSha256")" pixmanArchive="$(fetchFile "$pixmanUrl" "$pixmanSha256")" src="$(freshBuildDir "$compId")" pixmanSrc="$src/pixman" pixmanPrefix="$src/pixman-install" extractArchive "$pixmanArchive" "$pixmanSrc" 1 meson setup "$pixmanSrc/build" "$pixmanSrc" \ --prefix="$pixmanPrefix" \ --libdir=lib \ --buildtype=release \ -Ddefault_library=static \ -Dtests=disabled \ -Ddemos=disabled \ -Dgtk=disabled \ -Dlibpng=disabled ninja -C "$pixmanSrc/build" -j"$JOEY_JOBS" install extractArchive "$archive" "$src/qemu" 1 ( cd "$src/qemu" PKG_CONFIG_PATH="$pixmanPrefix/lib/pkgconfig" ./configure \ --prefix="$compDir" \ --target-list=x86_64-softmmu,i386-softmmu \ --enable-kvm \ --enable-sdl \ --disable-gtk \ --disable-docs \ --disable-werror \ --disable-guest-agent \ --audio-drv-list=pa,alsa,sdl make -j"$JOEY_JOBS" rm -rf "$compDir" make install ) dropBuildDir "$compId" } compInstalled() { [ -x "$compDir/bin/qemu-system-x86_64" ] && [ -x "$compDir/bin/qemu-system-i386" ] && [ -x "$compDir/bin/qemu-img" ] } # Both emulators start and know the devices the Haiku VMs use: the HD audio # controller and codec, and the VGA card. compVerify() { local machine local devices for machine in x86_64 i386; do devices="$("$compDir/bin/qemu-system-$machine" -device help 2>&1)" || return 1 [[ "$devices" == *'"intel-hda"'* && "$devices" == *'"hda-duplex"'* && "$devices" == *'"VGA"'* ]] || return 1 done "$compDir/bin/qemu-system-x86_64" -audiodev help 2>&1 | grep -qx wav } compEnv() { envVar QEMU_DIR "$compDir" }