Ports: Add a QEMU port

This commit is contained in:
Tim Schumacher 2022-04-22 04:52:55 +02:00 committed by Brian Gianforcaro
parent 5835373fc6
commit a813b941b8
Notes: sideshowbarker 2024-07-17 11:30:05 +09:00
5 changed files with 119 additions and 0 deletions

View File

@ -193,6 +193,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`pt2-clone`](pt2-clone/) | ProTracker 2 clone | 1.49 | https://github.com/8bitbubsy/pt2-clone |
| [`pv`](pv/) | Pipe Viewer | 1.6.20 | http://www.ivarch.com/programs/pv.shtml |
| [`python3`](python3/) | Python | 3.10.4 | https://www.python.org/ |
| [`qemu`](qemu/) | QEMU | 7.0.0 | https://qemu.org |
| [`qoi`](qoi/) | Quite OK Image Format for fast, lossless image compression | edb8d7b | https://github.com/phoboslab/qoi |
| [`qt6-qtbase`](qt6-qtbase/) | Qt6 QtBase | 6.2.3 | https://qt.io |
| [`qt6-serenity`](qt6-serenity/) | QSerenityPlatform | | https://github.com/SerenityPorts/QSerenityPlatform |

35
Ports/qemu/package.sh Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env -S bash ../.port_include.sh
port='qemu'
version='7.0.0'
useconfigure='true'
configopts=(
"--target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu"
"--cross-prefix=${SERENITY_ARCH}-pc-serenity-"
"--extra-ldflags=-lm"
"--without-default-features"
"--disable-strip"
"--enable-pie"
"--enable-sdl"
"--enable-tcg"
"--enable-tools"
)
depends=("glib" "pixman" "SDL2")
files="https://download.qemu.org/qemu-${version}.tar.xz qemu-${version}.tar.xz f6b375c7951f728402798b0baabb2d86478ca53d44cedbefabbe1c46bf46f839"
auth_type='sha256'
pre_patch() {
# Disable tests (those need way more stuff than QEMU itself) by clearing the respective meson file.
echo '' > "${workdir}/tests/meson.build"
}
post_install() {
# Add a drop-in fstab entry to make sure that we can use anonymous executable memory and bypass W^X
mkdir -p "${SERENITY_INSTALL_ROOT}/etc/fstab.d"
rm -rf "${SERENITY_INSTALL_ROOT}/etc/fstab.d/qemu"
for i in /usr/local/bin/qemu-system-{aarch64,i386,x86_64}; do
echo "${i} ${i} bind bind,wxallowed,axallowed" >> "${SERENITY_INSTALL_ROOT}/etc/fstab.d/qemu"
done
}
# We don't have '<arch>-pc-serenity-pkg-config', so just use the "normal" one.
export PKG_CONFIG="pkg-config"

View File

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <timschumi@gmx.de>
Date: Thu, 5 May 2022 18:49:17 +0200
Subject: [PATCH] Add build system support for SerenityOS
---
configure | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/configure b/configure
index 7c08c18..3177605 100755
--- a/configure
+++ b/configure
@@ -496,6 +496,8 @@ elif check_define __NetBSD__; then
targetos=netbsd
elif check_define __APPLE__; then
targetos=darwin
+elif check_define __serenity__; then
+ targetos=serenity
else
# This is a fatal error, but don't report it yet, because we
# might be going to just print the --help text, or it might
@@ -509,6 +511,7 @@ mingw32="no"
bsd="no"
linux="no"
solaris="no"
+serenity="no"
case $targetos in
windows)
mingw32="yes"
@@ -565,6 +568,9 @@ linux)
linux="yes"
vhost_user=${default_feature:-yes}
;;
+serenity)
+ serenity="yes"
+;;
esac
if test ! -z "$cpu" ; then

View File

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <timschumi@gmx.de>
Date: Thu, 5 May 2022 18:50:31 +0200
Subject: [PATCH] Extend short scan sets into the full list
We don't support the (apparently nonstandard) short variant of scan
sets, so extend them into a full list manually.
---
chardev/char.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chardev/char.c b/chardev/char.c
index 0169d8d..03ce487 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -382,11 +382,11 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename,
if (strstart(filename, "vc", &p)) {
qemu_opt_set(opts, "backend", "vc", &error_abort);
if (*p == ':') {
- if (sscanf(p+1, "%7[0-9]x%7[0-9]", width, height) == 2) {
+ if (sscanf(p+1, "%7[0123456789]x%7[0123456789]", width, height) == 2) {
/* pixels */
qemu_opt_set(opts, "width", width, &error_abort);
qemu_opt_set(opts, "height", height, &error_abort);
- } else if (sscanf(p+1, "%7[0-9]Cx%7[0-9]C", width, height) == 2) {
+ } else if (sscanf(p+1, "%7[0123456789]Cx%7[0123456789]C", width, height) == 2) {
/* chars */
qemu_opt_set(opts, "cols", width, &error_abort);
qemu_opt_set(opts, "rows", height, &error_abort);

View File

@ -0,0 +1,14 @@
# Patches for qemu on SerenityOS
## `0001-Add-build-system-support-for-SerenityOS.patch`
Add build system support for SerenityOS
## `0002-Extend-short-scan-sets-into-the-full-list.patch`
Extend short scan sets into the full list
We don't support the (apparently nonstandard) short variant of scan
sets, so extend them into a full list manually.