;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver ;;; Copyright © 2015 Ricardo Wurmus ;;; Copyright © 2013, 2015-2017, 2019, 2023 Ludovic Courtès ;;; Copyright © 2017 Alex Vong ;;; Copyright © 2017, 2018, 2019, 2021, 2023 Efraim Flashner ;;; Copyright © 2017 Leo Famulari ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018, 2020, 2022 Marius Bakke ;;; Copyright © 2019 Mathieu Othacehe ;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages ghostscript) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages compression) #:use-module (gnu packages cups) #:use-module (gnu packages fontutils) #:use-module (gnu packages image) #:use-module (gnu packages man) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages tcl) #:use-module (gnu packages xorg) #:use-module ((guix licen;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013-2017, 2020-2022 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2016-2021, 2023, 2024 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com> ;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca> ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com> ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org> ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org> ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re> ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org> ;;; Copyright © 2020, 2021, 2022, 2023, 2024 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org> ;;; Copyright © 2021 Leo Famulari <leo@famulari.name> ;;; Copyright © 2021, 2022 Pierre Langlois <pierre.langlois@gmx.com> ;;; Copyright © 2021 Dion Mendel <guix@dm9.info> ;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com> ;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com> ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com> ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name> ;;; Copyright © 2022, 2024 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2022, 2023 Ekaitz Zarraga <ekaitz@elenq.tech> ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net> ;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com> ;;; Copyright © 2023 Juliana Sims <juli@incana.org> ;;; Copyright © 2023 Ahmad Draidi <a.r.draidi@redscript.org> ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com> ;;; Copyright © 2023, 2024 Hartmut Goebel <h.goebel@crazy-compilers.com> ;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr> ;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2024 Raven Hallsby <karl@hallsby.com> ;;; Copyright © 2024 jgart <jgart@dismail.de> ;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se> ;;; Copyright © 2024 Jakob Kirsch <jakob.kirsch@web.de> ;;; Copyright © 2024 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com> ;;; Copyright © 2025 Karl Hallsby <karl@hallsby.com> ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages virtualization) #:use-module (gnu packages) #:use-module (gnu packages acl) #:use-module (gnu packages admin) #:use-module (gnu packages apparmor) #:use-module (gnu packages assembly) #:use-module (gnu packages attr) #:use-module (gnu packages apparmor) #:use-module (gnu packages augeas) #: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 cdrom) #: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 cpio) #:use-module (gnu packages crates-io) #:use-module (gnu packages cross-base) #:use-module (gnu packages crypto) #:use-module (gnu packages cryptsetup) #:use-module (gnu packages curl) #:use-module (gnu packages cyrus-sasl) #:use-module (gnu packages dbm) #: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 file) #: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 gcc) #:use-module (gnu packages gettext) #: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 golang-build) #:use-module (gnu packages gperf) #:use-module (gnu packages graphviz) #:use-module (gnu packages gtk) #:use-module (gnu packages java) #: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 llvm) #:use-module (gnu packages lua) #: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 ocaml) #: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 pulseaudio) #: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 readline) #:use-module (gnu packages ruby) #:use-module (gnu packages rsync) #:use-module (gnu packages sdl) #:use-module (gnu packages selinux) #: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 licenses) #:prefix license:) #:use-module (guix build-system cargo) #: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 pyproject) #:use-module (guix build-system python) #:use-module (guix build-system ruby) #:use-module (guix build-system trivial) #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix modules) #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match)) (define (qemu-patch commit file-name sha256-bv) "Return an origin for COMMIT." (origin (method url-fetch) (uri (string-append "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=" commit)) (hash (content-hash sha256-bv sha256)) (file-name file-name))) (define-public qemu (package (name "qemu") (version "8.2.2") (source (origin (method url-fetch) (uri (string-append "https://download.qemu.org/qemu-" version ".tar.xz")) (sha256 (base32 "1wy45fbf4816l4ylsz8b8cbypva9apcdnvlgqfr586icp30lcww4")) (patches (search-patches "qemu-build-info-manual.patch" "qemu-disable-bios-tables-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 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 '("roms/u-boot/scripts/dtc" "roms/ipxe" "roms/openbios" "roms/opensbi" "roms/seabios")))))) (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs (build-system gnu-build-system) (arguments (list ;; FIXME: Disable tests on i686 to work around ;; <https://bugs.gnu.org/40527>. #:tests? (or (%current-target-system) (not (string=? "i686-linux" (%current-system)))) #:configure-flags #~(let ((gcc (search-input-file %build-inputs "/bin/gcc")) (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")) (ipxe #$@(if (this-package-input "ipxe-qemu") #~((search-input-file %build-inputs "share/qemu/pxe-virtio.rom")) #~((string-append #$output "/share/qemu")))) (out #$output)) (list (string-append "--cc=" gcc) ;; Some architectures insist on using HOST_CC. (string-append "--host-cc=" gcc) (string-append "--prefix=" out) "--sysconfdir=/etc" "--enable-fdt=system" (string-append "--firmwarepath=" out "/share/qemu:" (dirname seabios) ":" (dirname ipxe) ":" (dirname openbios) ":" (dirname opensbi)) (string-append "--smbd=" out "/libexec/samba-wrapper") "--disable-debug-info" ;for space considerations ;; The binaries need to be linked against -lrt. (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) ,@%default-gnu-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$")) (ipxe #$@(if (this-package-input "ipxe-qemu") #~((dirname (search-input-file inputs "share/qemu/pxe-virtio.rom"))) #~((string-append #$output "/share/qemu")))) (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)))) (for-each (lambda (file) (format allowed-differences-whitelist "\"~a\",~%" file)) allowed-differences) (close-port allowed-differences-whitelist)))) ;; If the ipxe firmware isn't available, remove it from the list ;; of files expected to be available and remove some of the tests. #$@(if (not (this-package-input "ipxe-qemu")) #~((add-after 'unpack 'dont-require-ipxe-firmware (lambda _ (substitute* "pc-bios/meson.build" ((".*(pxe|efi)-.*") "")) (substitute* "