From 168c2dba591d2766951bec58d5a4ea80915c0519 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sat, 18 May 2024 20:04:20 +0200 Subject: qemu: use inferior to pin to the guix where it worked --- qemu-build-info-manual.patch | 62 ---- qemu-disable-aarch64-migration-test.patch | 13 - qemu-fix-agent-paths.patch | 65 ---- qemu-glibc-2.27.patch | 55 ---- qemu-glibc-2.30.patch | 57 ---- qemu.scm | 473 ++---------------------------- 6 files changed, 24 insertions(+), 701 deletions(-) delete mode 100644 qemu-build-info-manual.patch delete mode 100644 qemu-disable-aarch64-migration-test.patch delete mode 100644 qemu-fix-agent-paths.patch delete mode 100644 qemu-glibc-2.27.patch delete mode 100644 qemu-glibc-2.30.patch diff --git a/qemu-build-info-manual.patch b/qemu-build-info-manual.patch deleted file mode 100644 index ff28266..0000000 --- a/qemu-build-info-manual.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 2793f47c066ed396b38893c10533202fceb1a05f Mon Sep 17 00:00:00 2001 -From: Maxim Cournoyer -Date: Thu, 17 Sep 2020 13:28:19 -0400 -Subject: [PATCH] build: Build and install a Texinfo version of the manual. - -Take advantage of the Sphinx texinfo backend to generate a QEMU info -manual. The Texinfo format allows for more structure and info readers -provide more advanced navigation capabilities compared to manpages -readers. - -* docs/meson.build (texi, info): New targets. - -Signed-off-by: Maxim Cournoyer - -diff --git a/docs/meson.build b/docs/meson.build ---- a/docs/meson.build -+++ b/docs/meson.build -@@ -92,4 +92,25 @@ if build_docs - alias_target('sphinxdocs', sphinxdocs) - alias_target('html', sphinxdocs) - alias_target('man', sphinxmans) -+ -+ # Generate a Texinfo version of the QEMU manual. -+ makeinfo = find_program(['texi2any', 'makeinfo']) -+ if makeinfo.found() -+ sphinxtexi = custom_target( -+ 'QEMU manual generated texinfo source', -+ output: ['QEMU.texi', 'sphinxtexi.stamp'], -+ depfile: 'sphinxtexi.d', -+ command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@', -+ '-Ddepfile_stamp=@OUTPUT1@', '-b', 'texinfo', -+ meson.current_source_dir(), meson.current_build_dir()]) -+ sphinxinfo = custom_target( -+ 'QEMU info manual', -+ input: sphinxtexi, -+ output: 'QEMU.info', -+ install: true, -+ install_dir: get_option('infodir'), -+ command: [makeinfo, '--no-split', '@INPUT0@', '--output=@OUTPUT@']) -+ alias_target('texi', sphinxtexi) -+ alias_target('info', sphinxinfo) -+ endif - endif -diff --git a/meson.build b/meson.build ---- a/meson.build -+++ b/meson.build -@@ -37,6 +37,7 @@ endif - qemu_confdir = get_option('sysconfdir') / get_option('qemu_suffix') - qemu_datadir = get_option('datadir') / get_option('qemu_suffix') - qemu_docdir = get_option('docdir') / get_option('qemu_suffix') -+qemu_infodir = get_option('infodir') / get_option('qemu_suffix') - qemu_moddir = get_option('libdir') / get_option('qemu_suffix') - - qemu_desktopdir = get_option('datadir') / 'applications' -@@ -3698,6 +3699,7 @@ else - summary_info += {'local state directory': 'queried at runtime'} - endif - summary_info += {'Doc directory': get_option('prefix') / get_option('docdir')} -+summary_info += {'Info directory': get_option('prefix') / get_option('infodir')} - summary_info += {'Build directory': meson.current_build_dir()} - summary_info += {'Source path': meson.current_source_dir()} - summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']} diff --git a/qemu-disable-aarch64-migration-test.patch b/qemu-disable-aarch64-migration-test.patch deleted file mode 100644 index bf60ed2..0000000 --- a/qemu-disable-aarch64-migration-test.patch +++ /dev/null @@ -1,13 +0,0 @@ -Disable the qtest-aarch64/migration-test, which sometimes fail non-deterministically. -See: https://gitlab.com/qemu-project/qemu/-/issues/1230. - ---- qemu-7.1.0/tests/qtest/meson.build.old 1969-12-31 19:00:01.000000000 -0500 -+++ qemu-7.1.0/tests/qtest/meson.build 2022-09-26 11:11:05.434209797 -0400 -@@ -219,7 +219,6 @@ - ['arm-cpu-features', - 'numa-test', - 'boot-serial-test', -- 'migration-test', - 'bcm2835-dma-test'] - - qtests_s390x = \ diff --git a/qemu-fix-agent-paths.patch b/qemu-fix-agent-paths.patch deleted file mode 100644 index 0c29890..0000000 --- a/qemu-fix-agent-paths.patch +++ /dev/null @@ -1,65 +0,0 @@ -Allow a QEMU host to set the time and shutdown Guix guests. Styled -after the patch from the Nix package: - -https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch - -diff --git a/qga/commands-posix.c b/qga/commands-posix.c ---- a/qga/commands-posix.c -+++ b/qga/commands-posix.c -@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp) - void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) - { - const char *shutdown_flag; -+ const char *command; - Error *local_err = NULL; - pid_t pid; - int status; -@@ -101,10 +102,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) - slog("guest-shutdown called, mode: %s", mode); - if (!has_mode || strcmp(mode, "powerdown") == 0) { - shutdown_flag = powerdown_flag; -+ command = "shutdown"; - } else if (strcmp(mode, "halt") == 0) { - shutdown_flag = halt_flag; -+ command = "halt"; - } else if (strcmp(mode, "reboot") == 0) { - shutdown_flag = reboot_flag; -+ command = "reboot"; - } else { - error_setg(errp, - "mode is invalid (valid values are: halt|powerdown|reboot"); -@@ -123,6 +127,11 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) - execl("/sbin/shutdown", "shutdown", shutdown_flag, "-g0", "-y", - "hypervisor initiated shutdown", (char *)NULL); - #else -+ /* try Guix’s shutdown/halt/reboot first */ -+ char *path = g_strdup_printf("/run/current-system/profile/sbin/%s", command); -+ execl(path, command, (char *)NULL); -+ g_free(path); -+ - execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", - "hypervisor initiated shutdown", (char *)NULL); - #endif -@@ -159,10 +168,12 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) - Error *local_err = NULL; - struct timeval tv; - static const char hwclock_path[] = "/sbin/hwclock"; -+ static const char hwclock_path_guix[] = "/run/current-system/profile/sbin/hwclock"; - static int hwclock_available = -1; - - if (hwclock_available < 0) { -- hwclock_available = (access(hwclock_path, X_OK) == 0); -+ hwclock_available = (access(hwclock_path_guix, X_OK) == 0) || -+ (access(hwclock_path, X_OK) == 0); - } - - if (!hwclock_available) { -@@ -208,6 +219,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) - - /* Use '/sbin/hwclock -w' to set RTC from the system time, - * or '/sbin/hwclock -s' to set the system time from RTC. */ -+ execl(hwclock_path_guix, "hwclock", has_time ? "-w" : "-s", -+ NULL); - execl(hwclock_path, "hwclock", has_time ? "-w" : "-s", NULL); - _exit(EXIT_FAILURE); - } else if (pid < 0) { diff --git a/qemu-glibc-2.27.patch b/qemu-glibc-2.27.patch deleted file mode 100644 index b1f354a..0000000 --- a/qemu-glibc-2.27.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 75e5b70e6b5dcc4f2219992d7cffa462aa406af0 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Tue, 28 Nov 2017 11:51:27 +0100 -Subject: [PATCH] memfd: fix configure test -MIME-Version: 1.0 -Content-Type: text/plain; charset=utf8 -Content-Transfer-Encoding: 8bit - -Recent glibc added memfd_create in sys/mman.h. This conflicts with -the definition in util/memfd.c: - - /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration - -Fix the configure test, and remove the sys/memfd.h inclusion since the -file actually does not exist---it is a typo in the memfd_create(2) man -page. - -Cc: Marc-André Lureau -Signed-off-by: Paolo Bonzini ---- - configure | 2 +- - util/memfd.c | 4 +--- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/configure b/configure -index 9c8aa5a..99ccc17 100755 ---- a/configure -+++ b/configure -@@ -3923,7 +3923,7 @@ fi - # check if memfd is supported - memfd=no - cat > $TMPC << EOF --#include -+#include - - int main(void) - { -diff --git a/util/memfd.c b/util/memfd.c -index 4571d1a..412e94a 100644 ---- a/util/memfd.c -+++ b/util/memfd.c -@@ -31,9 +31,7 @@ - - #include "qemu/memfd.h" - --#ifdef CONFIG_MEMFD --#include --#elif defined CONFIG_LINUX -+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD - #include - #include - --- -1.8.3.1 - diff --git a/qemu-glibc-2.30.patch b/qemu-glibc-2.30.patch deleted file mode 100644 index 1b74dee..0000000 --- a/qemu-glibc-2.30.patch +++ /dev/null @@ -1,57 +0,0 @@ -This patch was taken from NixOS -https://raw.githubusercontent.com/Mindavi/nixpkgs/1a737743a829746e48f4869ac517ff29c23c9d09/pkgs/tools/security/afl/qemu-patches/syscall-glibc2_30.diff -It is based on an unmerged patch against american-fuzzy-lop and was -never merged upstream because the author was unable to sign Google's CLA. -Based on https://github.com/google/AFL/commit/6c917e3d63a2a0685d58c3518524f9615b001893.patch - ---- qemu-2.10.0-clean/linux-user/syscall.c 2020-03-12 18:47:47.898592169 +0100 -+++ qemu-2.10.0/linux-user/syscall.c 2020-03-13 09:13:42.461809699 +0100 -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include // https://lkml.org/lkml/2019/6/3/988 - #include - #include - #ifdef __ia64__ -@@ -256,7 +257,9 @@ static type name (type1 arg1,type2 arg2, - #endif - - #ifdef __NR_gettid --_syscall0(int, gettid) -+// taken from https://patchwork.kernel.org/patch/10862231/ -+#define __NR_sys_gettid __NR_gettid -+_syscall0(int, sys_gettid) - #else - /* This is a replacement for the host gettid() and must return a host - errno. */ -@@ -6219,7 +6222,7 @@ static void *clone_func(void *arg) - cpu = ENV_GET_CPU(env); - thread_cpu = cpu; - ts = (TaskState *)cpu->opaque; -- info->tid = gettid(); -+ info->tid = sys_gettid(); - task_settid(ts); - if (info->child_tidptr) - put_user_u32(info->tid, info->child_tidptr); -@@ -6363,9 +6366,9 @@ static int do_fork(CPUArchState *env, un - mapping. We can't repeat the spinlock hack used above because - the child process gets its own copy of the lock. */ - if (flags & CLONE_CHILD_SETTID) -- put_user_u32(gettid(), child_tidptr); -+ put_user_u32(sys_gettid(), child_tidptr); - if (flags & CLONE_PARENT_SETTID) -- put_user_u32(gettid(), parent_tidptr); -+ put_user_u32(sys_gettid(), parent_tidptr); - ts = (TaskState *)cpu->opaque; - if (flags & CLONE_SETTLS) - cpu_set_tls (env, newtls); -@@ -11402,7 +11405,7 @@ abi_long do_syscall(void *cpu_env, int n - break; - #endif - case TARGET_NR_gettid: -- ret = get_errno(gettid()); -+ ret = get_errno(sys_gettid()); - break; - #ifdef TARGET_NR_readahead - case TARGET_NR_readahead: diff --git a/qemu.scm b/qemu.scm index 445c313..6627439 100644 --- a/qemu.scm +++ b/qemu.scm @@ -1,453 +1,28 @@ ; We need this because we have issues with 8.1.X: ; https://gitlab.com/qemu-project/qemu/-/issues/1908 (define-module (qemu) - #:use-module (gnu packages) - #:use-module (gnu packages acl) - #:use-module (gnu packages admin) - #:use-module (gnu packages assembly) - #:use-module (gnu packages attr) - #:use-module (gnu packages autotools) - #:use-module (gnu packages backup) - #:use-module (gnu packages base) - #:use-module (gnu packages bash) - #:use-module (gnu packages bison) - #:use-module (gnu packages bootloaders) - #:use-module (gnu packages build-tools) - #:use-module (gnu packages check) - #:use-module (gnu packages cluster) - #:use-module (gnu packages cmake) - #:use-module (gnu packages compression) - #:use-module (gnu packages containers) - #:use-module (gnu packages cross-base) - #:use-module (gnu packages cryptsetup) - #:use-module (gnu packages curl) - #:use-module (gnu packages cyrus-sasl) - #:use-module (gnu packages debian) - #:use-module (gnu packages disk) - #:use-module (gnu packages dns) - #:use-module (gnu packages docbook) - #:use-module (gnu packages documentation) - #:use-module (gnu packages figlet) - #:use-module (gnu packages firmware) - #:use-module (gnu packages flex) - #:use-module (gnu packages fonts) - #:use-module (gnu packages fontutils) - #:use-module (gnu packages freedesktop) - #:use-module (gnu packages gettext) - #:use-module (gnu packages gcc) - #:use-module (gnu packages gl) - #:use-module (gnu packages glib) - #:use-module (gnu packages gnome) - #:use-module (gnu packages gnupg) - #:use-module (gnu packages golang) - #:use-module (gnu packages graphviz) - #:use-module (gnu packages gtk) - #:use-module (gnu packages haskell) - #:use-module (gnu packages haskell-apps) - #:use-module (gnu packages haskell-check) - #:use-module (gnu packages haskell-crypto) - #:use-module (gnu packages haskell-web) - #:use-module (gnu packages haskell-xyz) - #:use-module (gnu packages image) - #:use-module (gnu packages libbsd) - #:use-module (gnu packages libusb) - #:use-module (gnu packages linux) - #:use-module (gnu packages m4) - #:use-module (gnu packages man) - #:use-module (gnu packages multiprecision) - #:use-module (gnu packages ncurses) - #:use-module (gnu packages nettle) - #:use-module (gnu packages networking) - #:use-module (gnu packages ninja) - #:use-module (gnu packages onc-rpc) - #:use-module (gnu packages package-management) - #:use-module (gnu packages pciutils) - #:use-module (gnu packages pcre) - #:use-module (gnu packages perl) - #:use-module (gnu packages pkg-config) - #:use-module (gnu packages polkit) - #:use-module (gnu packages protobuf) - #:use-module (gnu packages python) - #:use-module (gnu packages python-build) - #:use-module (gnu packages python-check) - #:use-module (gnu packages python-crypto) - #:use-module (gnu packages python-web) - #:use-module (gnu packages python-xyz) - #:use-module (gnu packages pulseaudio) - #:use-module (gnu packages readline) - #:use-module (gnu packages rsync) - #:use-module (gnu packages selinux) - #:use-module (gnu packages sdl) - #:use-module (gnu packages sphinx) - #:use-module (gnu packages spice) - #:use-module (gnu packages ssh) - #:use-module (gnu packages texinfo) - #:use-module (gnu packages textutils) - #:use-module (gnu packages tls) - #:use-module (gnu packages web) - #:use-module (gnu packages wget) - #:use-module (gnu packages xdisorg) - #:use-module (gnu packages xml) - #:use-module (gnu packages xorg) - #:use-module (guix build-system cmake) - #:use-module (guix build-system gnu) - #:use-module (guix build-system go) - #:use-module (guix build-system meson) - #:use-module (guix build-system python) - #:use-module (guix build-system trivial) - #:use-module (guix download) - #:use-module (guix git-download) - #:use-module (guix gexp) - #:use-module ((guix licenses) #:prefix license:) - #:use-module (guix packages) - #:use-module (guix utils) - #:use-module (srfi srfi-1) - #:use-module (srfi srfi-26) - #:use-module (ice-9 match)) + #:use-module (guix inferior) + #:use-module (guix channels) + #:use-module (srfi srfi-1)) + +(define channels + (list + (channel + (name 'ekaitz) + (url "git://git.elenq.tech/guix-packages") + (branch "master") + (commit + "228e85fc043aa127ab0820109068def10db5861b")) + (channel + (name 'guix) + (url "https://git.savannah.gnu.org/git/guix.git") + (branch "master") + (commit + "447e9c96259e8fa15a828de9b2dd3400e2ffafe6")))) + + +(define inferior + (inferior-for-channels channels)) + +(define-public qemu-7 (first (lookup-inferior-packages inferior "qemu" "7"))) -(define-public qemu - (package - (name "qemu") - (version "7.2.4") - (source - (origin - (method url-fetch) - (uri (string-append "https://download.qemu.org/qemu-" - version ".tar.xz")) - (sha256 - (base32 "0795l8xsy67fnh4mbdz40jm880iisd7q6d7ly6nfzpac3gjr8zyf")) - (patches (search-patches "qemu-build-info-manual.patch" - "qemu-disable-aarch64-migration-test.patch" - "qemu-fix-agent-paths.patch")) - (modules '((guix build utils))) - (snippet - '(begin - ;; TODO: Scrub all firmwares from this directory! - (with-directory-excursion "pc-bios" - ;; Delete firmwares provided by SeaBIOS. - (for-each delete-file (find-files "." "^(bios|vgabios).*\\.bin$")) - ;; Delete SGABIOS. - (delete-file "sgabios.bin") - ;; Delete ppc64 OpenBIOS. TODO: Remove sparc32 and sparc64 too - ;; once they are supported in Guix. - (delete-file "openbios-ppc") - ;; Delete riscv64 OpenSBI. TODO: Remove riscv32 when supported - ;; in Guix. - (delete-file "opensbi-riscv64-generic-fw_dynamic.bin") - ;; Delete iPXE firmwares. - (for-each delete-file (find-files "." "^(efi|pxe)-.*\\.rom$"))) - ;; Delete bundled code that we provide externally. - (for-each delete-file-recursively - '("dtc" "meson" - "roms/ipxe" - "roms/openbios" - "roms/opensbi" - "roms/seabios" - "roms/sgabios")))))) - (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs - (build-system gnu-build-system) - (arguments - (list - #:tests? #f - #:configure-flags - #~(let ((gcc (search-input-file %build-inputs "/bin/gcc")) - (meson (search-input-file %build-inputs "bin/meson")) - (openbios (search-input-file %build-inputs - "share/qemu/openbios-ppc")) - (opensbi (search-input-file - %build-inputs - "share/qemu/opensbi-riscv64-generic-fw_dynamic.bin")) - (seabios (search-input-file %build-inputs - "share/qemu/bios.bin")) - (sgabios (search-input-file %build-inputs - "/share/qemu/sgabios.bin")) - (ipxe (search-input-file %build-inputs - "share/qemu/pxe-virtio.rom")) - (out #$output)) - (list (string-append "--cc=" gcc) - ;; Some architectures insist on using HOST_CC. - (string-append "--host-cc=" gcc) - (string-append "--meson=" meson) - (string-append "--prefix=" out) - - "--sysconfdir=/etc" - "--enable-fdt=system" - (string-append "--firmwarepath=" out "/share/qemu:" - (dirname seabios) ":" - (dirname ipxe) ":" - (dirname openbios) ":" - (dirname opensbi) ":" - (dirname sgabios)) - (string-append "--smbd=" out "/libexec/samba-wrapper") - "--disable-debug-info" ;for space considerations - ;; The binaries need to be linked against -lrt. - "--disable-docs" ;; They now explode for some reason - (string-append "--extra-ldflags=-lrt"))) - ;; Make build and test output verbose to facilitate investigation upon failure. - #:make-flags #~'("V=1") - #:modules `((srfi srfi-1) - (srfi srfi-26) - (ice-9 ftw) - (ice-9 match) - ,@%gnu-build-system-modules) - #:phases - #~(modify-phases %standard-phases - ;; Since we removed the bundled firmwares above, many tests - ;; can't work. Re-add them here. - (add-after 'unpack 'replace-firmwares - (lambda* (#:key inputs #:allow-other-keys) - (let* ((seabios (dirname (search-input-file - inputs "share/qemu/bios.bin"))) - (seabios-firmwares (find-files seabios "\\.bin$")) - (sgabios (search-input-file inputs "share/qemu/sgabios.bin")) - (ipxe (dirname (search-input-file - inputs "share/qemu/pxe-virtio.rom"))) - (ipxe-firmwares (find-files ipxe "\\.rom$")) - (openbios (search-input-file - inputs "share/qemu/openbios-ppc")) - (opensbi-riscv64 - (search-input-file - inputs - "share/qemu/opensbi-riscv64-generic-fw_dynamic.bin")) - (allowed-differences - ;; Ignore minor differences (addresses etc) in the firmware - ;; data tables compared to what the test suite expects. - '("tests/data/acpi/pc/SSDT.dimmpxm" - "tests/data/acpi/pc/DSDT.dimmpxm" - "tests/data/acpi/pc/ERST.acpierst" - "tests/data/acpi/q35/ERST.acpierst" - "tests/data/acpi/q35/DSDT.cxl")) - (allowed-differences-whitelist - (open-file "tests/qtest/bios-tables-test-allowed-diff.h" - "a"))) - (with-directory-excursion "pc-bios" - (for-each (lambda (file) - (symlink file (basename file))) - (append seabios-firmwares ipxe-firmwares - (list openbios opensbi-riscv64 sgabios)))) - (for-each (lambda (file) - (format allowed-differences-whitelist - "\"~a\",~%" file)) - allowed-differences) - (close-port allowed-differences-whitelist)))) - (add-after 'unpack 'extend-test-time-outs - (lambda _ - ;; These tests can time out on heavily-loaded and/or slow storage. - (substitute* (cons* "tests/qemu-iotests/common.qemu" - (find-files "tests/qemu-iotests" "^[0-9]+$")) - (("QEMU_COMM_TIMEOUT=[0-9]+" match) - (string-append match "9"))))) - (add-after 'unpack 'disable-unusable-tests - (lambda _ - (substitute* "tests/unit/meson.build" - ;; Comment out the test-qga test, which needs /sys and - ;; fails within the build environment. - (("tests.*test-qga.*$" all) - (string-append "# " all)) - ;; Comment out the test-char test, which needs networking and - ;; fails within the build environment. - ((".*'test-char':.*" all) - (string-append "# " all))) - (substitute* "tests/qtest/meson.build" - ;; These tests fail to get the expected number of tests - ;; on arm platforms. - (("'arm-cpu-features',") "")))) - #$@(if (target-riscv64?) - '((add-after 'unpack 'disable-some-tests - (lambda _ - ;; qemu.qmp.QMPConnectError: - ;; Unexpected empty reply from server - (delete-file "tests/qemu-iotests/040") - (delete-file "tests/qemu-iotests/041") - (delete-file "tests/qemu-iotests/256") - - ;; No 'PCI' bus found for device 'virtio-scsi-pci' - (delete-file "tests/qemu-iotests/127") - (delete-file "tests/qemu-iotests/267")))) - '()) - (add-after 'patch-source-shebangs 'patch-embedded-shebangs - (lambda* (#:key native-inputs inputs #:allow-other-keys) - ;; Ensure the executables created by these source files reference - ;; /bin/sh from the store so they work inside the build container. - (substitute* '("block/cloop.c" "migration/exec.c" - "net/tap.c" "tests/qtest/libqtest.c" - "tests/qtest/vhost-user-blk-test.c") - (("/bin/sh") (search-input-file inputs "/bin/sh"))) - (substitute* "tests/qemu-iotests/testenv.py" - (("#!/usr/bin/env python3") - (string-append "#!" (search-input-file (or native-inputs inputs) - "/bin/python3")))))) - (add-before 'configure 'fix-optionrom-makefile - (lambda _ - ;; Work around the inability of the rules defined in this - ;; Makefile to locate the firmware files (e.g.: No rule to make - ;; target 'multiboot.bin') by extending the VPATH. - (substitute* "pc-bios/optionrom/Makefile" - (("^VPATH = \\$\\(SRC_DIR\\)") - "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios")))) - ;; XXX ./configure is being re-run at beginning of build phase... - (replace 'configure - (lambda* (#:key inputs configure-flags #:allow-other-keys) - ;; The `configure' script doesn't understand some of the - ;; GNU options. Thus, add a new phase that's compatible. - (setenv "SHELL" (which "bash")) - ;; Ensure config.status gets the correct shebang off the bat. - ;; The build system gets confused if we change it later and - ;; attempts to re-run the whole configuration, and fails. - (substitute* "configure" - (("#!/bin/sh") - (string-append "#!" (which "sh")))) - (mkdir-p "b/qemu") - (chdir "b/qemu") - (apply invoke "../../configure" configure-flags))) - - ;; Configure, build and install QEMU user-emulation static binaries. - (add-after 'configure 'configure-user-static - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((static (assoc-ref outputs "static")) - (gcc (search-input-file inputs "/bin/gcc")) - ;; This is the common set of configure flags; it is - ;; duplicated here to isolate this phase from manipulations - ;; to the #:configure-flags build argument, as done in - ;; derived packages such as qemu-minimal. - (configure-flags (list (string-append "--cc=" gcc) - (string-append "--host-cc=" gcc) - "--sysconfdir=/etc" - "--disable-debug-info"))) - (mkdir-p "../user-static") - (with-directory-excursion "../user-static" - (apply invoke "../../configure" - "--static" - "--disable-docs" ;already built - "--disable-system" - "--enable-linux-user" - (string-append "--prefix=" static) - configure-flags))))) - (add-after 'build 'build-user-static - (lambda args - (with-directory-excursion "../user-static" - (apply (assoc-ref %standard-phases 'build) args)))) - (add-after 'install 'install-user-static - (lambda* (#:key outputs #:allow-other-keys) - (let* ((static (assoc-ref outputs "static")) - (bin (string-append static "/bin"))) - (with-directory-excursion "../user-static" - (for-each (cut install-file <> bin) - (append-map (cut find-files <> "^qemu-" #:stat stat) - (scandir "." - (cut string-suffix? - "-linux-user" <>)))))))) - - (add-after 'install 'delete-firmwares - (lambda _ - ;; Delete firmares that are accessible on --firmwarepath. - ;; For some reason tests fail if we simply remove them from - ;; pc-bios/meson.build, hence this roundabout way. - (with-directory-excursion (string-append #$output "/share/qemu") - (for-each delete-file - (append - '("openbios-ppc" - "opensbi-riscv64-generic-fw_dynamic.bin" - "sgabios.bin") - (find-files "." "^(vga)?bios(-[a-z0-9-]+)?\\.bin$") - (find-files "." "^(efi|pxe)-.*\\.rom$")))))) - ;; Create a wrapper for Samba. This allows QEMU to use Samba without - ;; pulling it in as an input. Note that you need to explicitly install - ;; Samba in your Guix profile for Samba support. - (add-after 'install 'create-samba-wrapper - (lambda* (#:key inputs #:allow-other-keys) - (let ((libexec (string-append #$output "/libexec"))) - (call-with-output-file "samba-wrapper" - (lambda (port) - (format port "#!/bin/sh -exec smbd $@"))) - (chmod "samba-wrapper" #o755) - (install-file "samba-wrapper" libexec)))) - (add-after 'install 'move-html-doc - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out #$output) - (doc #$output:doc) - (qemu-doc (string-append doc "/share/doc/qemu-" - #$(package-version this-package)))) - (mkdir-p qemu-doc) - (rename-file (string-append out "/share/doc/qemu") - (string-append qemu-doc "/html")))))))) - (inputs - (list alsa-lib - bash-minimal - dtc - glib - gtk+ - ipxe-qemu - libaio - libcacard ;smartcard support - attr libcap-ng ;VirtFS support - libdrm - libepoxy - libjpeg-turbo - libpng - libseccomp - libslirp - liburing - libusb ;USB pass-through support - mesa - ncurses - openbios-qemu-ppc - opensbi-qemu - ;; ("pciutils" ,pciutils) - pixman - pulseaudio - sdl2 - seabios-qemu - sgabios - spice - usbredir - util-linux - vde2 - virglrenderer - - ;; Formats to support for .qcow2 (and possibly other) compression. - zlib - `(,zstd "lib"))) - (native-inputs - ;; Note: acpica is here only to pretty-print firmware differences with IASL - ;; (see the replace-firmwares phase above). - (list acpica - bison - flex - gettext-minimal - `(,glib "bin") ;gtester, etc. - meson - ninja - perl - pkg-config - python-wrapper - python-sphinx - python-sphinx-rtd-theme - texinfo - ;; The following static libraries are required to build - ;; the static output of QEMU. - `(,glib "static") - `(,pcre "static") - `(,zlib "static"))) - (home-page "https://www.qemu.org") - (synopsis "Machine emulator and virtualizer") - (description - "QEMU is a generic machine emulator and virtualizer. - -When used as a machine emulator, QEMU can run OSes and programs made for one -machine (e.g. an ARM board) on a different machine---e.g., your own PC. By -using dynamic translation, it achieves very good performance. - -When used as a virtualizer, QEMU achieves near native performances by -executing the guest code directly on the host CPU. QEMU supports -virtualization when executing under the Xen hypervisor or using -the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, -server and embedded PowerPC, and S390 guests.") - - ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'. - (license license:gpl2) - - ;; Several tests fail on MIPS; see . - (supported-systems (fold delete %supported-systems - '("mips64el-linux" "i586-gnu"))))) -- cgit v1.2.3