diff options
Diffstat (limited to 'gnu/packages/virtualization.scm')
-rw-r--r-- | gnu/packages/virtualization.scm | 125 |
1 files changed, 86 insertions, 39 deletions
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index be17ec15f0..371104cf22 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org> -;;; Copyright © 2016, 2017, 2018. 2019 Efraim Flashner <efraim@flashner.co.il> +;;; Copyright © 2016, 2017, 2018. 2019, 2020 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> @@ -13,6 +13,8 @@ ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> +;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com> +;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -99,7 +101,8 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils) - #:use-module (srfi srfi-1)) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match)) (define (qemu-patch commit file-name sha256) "Return an origin for COMMIT." @@ -114,19 +117,14 @@ (define-public qemu (package (name "qemu") - (version "4.2.0") + (version "5.0.0") (source (origin (method url-fetch) (uri (string-append "https://download.qemu.org/qemu-" version ".tar.xz")) - (patches (search-patches "qemu-CVE-2020-1711.patch" - "qemu-CVE-2020-7039.patch" - "qemu-CVE-2020-7211.patch" - "qemu-CVE-2020-8608.patch" - "qemu-fix-documentation-build-failure.patch")) (sha256 (base32 - "1w38hzlw7xp05gcq1nhga7hxvndxy6dfcnzi7q2il8ff110isj6k")))) + "1dlcwyshdp94fwd30pddxf9bn2q8dfw5jsvry2gvdj551wmaj4rg")))) (build-system gnu-build-system) (arguments `(;; Running tests in parallel can occasionally lead to failures, like: @@ -146,8 +144,36 @@ "--audio-drv-list=alsa,pa,sdl") ;; Make build and test output verbose to facilitate investigation upon failure. #:make-flags '("V=1") + #:modules ((srfi srfi-1) + (ice-9 match) + ,@%gnu-build-system-modules) #:phases (modify-phases %standard-phases + (add-after 'set-paths 'hide-glibc + (lambda* (#:key inputs #:allow-other-keys) + ;; Work around https://issues.guix.info/issue/36882. We need to + ;; remove glibc from C_INCLUDE_PATH so that the one hardcoded in GCC, + ;; at the bottom of GCC include search-path is used. + (let* ((filters '("libc")) + (input-directories + (filter-map (lambda (input) + (match input + ((name . dir) + (and (not (member name filters)) + dir)))) + inputs))) + (set-path-environment-variable "C_INCLUDE_PATH" + '("include") + input-directories) + #t))) + (add-after 'patch-source-shebangs 'patch-/bin/sh-references + (lambda _ + ;; 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") + (("/bin/sh") (which "sh"))) + #t)) (replace 'configure (lambda* (#:key inputs outputs (configure-flags '()) #:allow-other-keys) @@ -157,8 +183,16 @@ (setenv "SHELL" (which "bash")) ;; While we're at it, patch for tests. - (substitute* "tests/libqtest.c" - (("/bin/sh") (which "sh"))) + (substitute* "tests/qemu-iotests/check" + (("#!/usr/bin/env python3") + (string-append "#!" (which "python3")))) + + ;; 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 configury, and fails. + (substitute* "configure" + (("#!/bin/sh") + (string-append "#!" (which "sh")))) ;; The binaries need to be linked against -lrt. (setenv "LDFLAGS" "-lrt") @@ -197,12 +231,6 @@ exec smbd $@"))) (chmod "samba-wrapper" #o755) (install-file "samba-wrapper" libexec)) #t)) - (add-before 'configure 'prevent-network-configuration - (lambda _ - ;; Prevent the build from trying to use git to fetch from the net. - (substitute* "Makefile" - (("@./config.status") - "")) #t)) (add-before 'check 'disable-unusable-tests (lambda* (#:key inputs outputs #:allow-other-keys) (substitute* "tests/Makefile.include" @@ -223,7 +251,8 @@ exec smbd $@"))) ("gtk+" ,gtk+) ("libaio" ,libaio) ("libattr" ,attr) - ("libcap" ,libcap) ; virtfs support requires libcap & libattr + ("libcacard" ,libcacard) ; smartcard support + ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr ("libdrm" ,libdrm) ("libepoxy" ,libepoxy) ("libjpeg" ,libjpeg-turbo) @@ -270,25 +299,55 @@ server and embedded PowerPC, and S390 guests.") (license license:gpl2) ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>. - (supported-systems (delete "mips64el-linux" %supported-systems)))) + (supported-systems (fold delete %supported-systems + '("mips64el-linux" "i586-gnu"))))) (define-public qemu-minimal - ;; QEMU without GUI support. + ;; QEMU without GUI support, only supporting the host's architecture (package (inherit qemu) (name "qemu-minimal") - (synopsis "Machine emulator and virtualizer (without GUI)") + (synopsis + "Machine emulator and virtualizer (without GUI) for the host architecture") (arguments (substitute-keyword-arguments (package-arguments qemu) ((#:configure-flags _ '(list)) - ;; Restrict to the targets supported by Guix. - ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu")))) + ;; Restrict to the host's architecture. + (let ((arch (car (string-split (or (%current-target-system) + (%current-system)) + #\-)))) + (cond ((string=? arch "i686") + '(list "--target-list=i386-softmmu")) + ((string-prefix? "x86_64" arch) + '(list "--target-list=i386-softmmu,x86_64-softmmu")) + ((string-prefix? "mips64" arch) + '(list (string-append "--target-list=mips-softmmu,mipsel-softmmu," + "mips64-softmmu,mips64el-softmmu"))) + ((string-prefix? "mips" arch) + '(list "--target-list=mips-softmmu,mipsel-softmmu")) + ((string-prefix? "aarch64" arch) + '(list "--target-list=arm-softmmu,aarch64-softmmu")) + ((string-prefix? "arm" arch) + '(list "--target-list=arm-softmmu")) + ((string-prefix? "alpha" arch) + '(list "--target-list=alpha-softmmu")) + ((string-prefix? "powerpc64" arch) + '(list "--target-list=ppc-softmmu,ppc64-softmmu")) + ((string-prefix? "powerpc" arch) + '(list "--target-list=ppc-softmmu")) + ((string-prefix? "s390" arch) + '(list "--target-list=s390x-softmmu")) + ((string-prefix? "riscv" arch) + '(list "--target-list=riscv32-softmmu,riscv64-softmmu")) + (else ; An empty list actually builds all the targets. + ''())))))) ;; Remove dependencies on optional libraries, notably GUI libraries. (native-inputs (fold alist-delete (package-native-inputs qemu) '("gettext"))) (inputs (fold alist-delete (package-inputs qemu) '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+" - "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"))))) + "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2" + "libcacard"))))) (define-public libosinfo (package @@ -383,12 +442,6 @@ all common programming languages. Vala bindings are also provided.") "/share/doc/" ,name "-" ,version) "--sysconfdir=/etc" "--localstatedir=/var") - #:make-flags - ;; Treat the kernel headers as system headers to silence - ;; compiler warnings from those. - (list (string-append "C_INCLUDE_PATH=" - (assoc-ref %build-inputs "kernel-headers") - "/include")) #:phases (modify-phases %standard-phases (replace 'install @@ -480,7 +533,7 @@ manage system or application containers.") ("libpcap" ,libpcap) ("libnl" ,libnl) ("libtirpc" ,libtirpc) ;for <rpc/rpc.h> - ("libuuid" ,util-linux) + ("libuuid" ,util-linux "lib") ("lvm2" ,lvm2) ;for libdevmapper ("curl" ,curl) ("openssl" ,openssl) @@ -720,13 +773,7 @@ domains, their live performance and resource utilization statistics.") (setenv "C_INCLUDE_PATH" (string-append (assoc-ref inputs "libnl") "/include/libnl3:" - ;; Also add the kernel headers here so that GCC - ;; treats them as "system headers". Otherwise - ;; the build fails with -Werror because parasite.c - ;; includes both <linux/fs.h> and <sys/mount.h>, - ;; which define some of the same constants. - (assoc-ref inputs "kernel-headers") - "/include")) + (or (getenv "C_INCLUDE_PATH") ""))) #t)) (add-after 'configure 'fix-documentation (lambda* (#:key inputs outputs #:allow-other-keys) @@ -1332,7 +1379,7 @@ override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc")) ("pixman" ,pixman) ("qemu" ,qemu-minimal) ("seabios" ,seabios) - ("util-linux" ,util-linux) ; uuid + ("util-linux" ,util-linux "lib") ; uuid ; TODO: ocaml-findlib, ocaml-nox. ("xz" ,xz) ; for liblzma ("zlib" ,zlib))) |