Archived
1
0
Fork 0

gnu: QEMU: Use G-expression.

* gnu/packages/virtualization.scm (qemu, qemu-minimal)[arguments]: Rewrite
with G-expressions.
This commit is contained in:
Marius Bakke 2022-09-09 20:18:59 +02:00
parent 0f6f9317ac
commit b15c0e75f9
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -177,13 +177,14 @@
(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)
#:tests? (or (%current-target-system)
(not (string=? "i686-linux" (%current-system))))
#:configure-flags
(let ((gcc (search-input-file %build-inputs "/bin/gcc"))
(out (assoc-ref %outputs "out")))
#~(let ((gcc (search-input-file %build-inputs "/bin/gcc"))
(out #$output))
(list (string-append "--cc=" gcc)
;; Some architectures insist on using HOST_CC.
(string-append "--host-cc=" gcc)
@ -194,14 +195,14 @@
;; 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)
#: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
#~(modify-phases %standard-phases
(add-after 'unpack 'extend-test-time-outs
(lambda _
;; These tests can time out on heavily-loaded and/or slow storage.
@ -220,10 +221,11 @@
;; fails within the build environment.
((".*'test-char':.*" all)
(string-append "# " all)))))
,@(if (target-riscv64?)
`((add-after 'unpack 'disable-some-tests
#$@(if (target-riscv64?)
'((add-after 'unpack 'disable-some-tests
(lambda _
;; qemu.qmp.QMPConnectError: Unexpected empty reply from server
;; 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")
@ -254,10 +256,9 @@
"VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
;; XXX ./configure is being re-run at beginning of build phase...
(replace 'configure
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
(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.
(let ((out (assoc-ref outputs "out")))
(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
@ -267,12 +268,12 @@
(string-append "#!" (which "sh"))))
(mkdir-p "b/qemu")
(chdir "b/qemu")
(apply invoke "../../configure" configure-flags))))
(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* ((gcc (search-input-file inputs "/bin/gcc"))
(static (assoc-ref outputs "static"))
(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
@ -308,9 +309,8 @@
;; 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 outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(libexec (string-append out "/libexec")))
(lambda* (#:key inputs #:allow-other-keys)
(let ((libexec (string-append #$output "/libexec")))
(call-with-output-file "samba-wrapper"
(lambda (port)
(format port "#!/bin/sh
@ -319,9 +319,10 @@ exec smbd $@")))
(install-file "samba-wrapper" libexec))))
(add-after 'install 'move-html-doc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(doc (assoc-ref outputs "doc"))
(qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
(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"))))))))
@ -405,7 +406,7 @@ server and embedded PowerPC, and S390 guests.")
"Machine emulator and virtualizer (without GUI) for the host architecture")
(arguments
(substitute-keyword-arguments (package-arguments qemu)
((#:configure-flags configure-flags '(list))
((#:configure-flags configure-flags #~'())
;; Restrict to the host's architecture.
(let* ((system (or (%current-target-system)
(%current-system)))
@ -436,9 +437,9 @@ server and embedded PowerPC, and S390 guests.")
"--target-list=riscv32-softmmu,riscv64-softmmu")
(else ; An empty list actually builds all the targets.
'()))))
`(cons ,target-list-arg ,configure-flags)))
#~(cons #$target-list-arg #$configure-flags)))
((#:phases phases)
`(modify-phases ,phases
#~(modify-phases #$phases
(delete 'configure-user-static)
(delete 'build-user-static)
(delete 'install-user-static)))))