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 (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
(list
;; FIXME: Disable tests on i686 to work around ;; FIXME: Disable tests on i686 to work around
;; <https://bugs.gnu.org/40527>. ;; <https://bugs.gnu.org/40527>.
`(#:tests? ,(or (%current-target-system) #:tests? (or (%current-target-system)
(not (string=? "i686-linux" (%current-system)))) (not (string=? "i686-linux" (%current-system))))
#:configure-flags #:configure-flags
(let ((gcc (search-input-file %build-inputs "/bin/gcc")) #~(let ((gcc (search-input-file %build-inputs "/bin/gcc"))
(out (assoc-ref %outputs "out"))) (out #$output))
(list (string-append "--cc=" gcc) (list (string-append "--cc=" gcc)
;; Some architectures insist on using HOST_CC. ;; Some architectures insist on using HOST_CC.
(string-append "--host-cc=" gcc) (string-append "--host-cc=" gcc)
@ -194,14 +195,14 @@
;; The binaries need to be linked against -lrt. ;; The binaries need to be linked against -lrt.
(string-append "--extra-ldflags=-lrt"))) (string-append "--extra-ldflags=-lrt")))
;; Make build and test output verbose to facilitate investigation upon failure. ;; Make build and test output verbose to facilitate investigation upon failure.
#:make-flags '("V=1") #:make-flags #~'("V=1")
#:modules ((srfi srfi-1) #:modules `((srfi srfi-1)
(srfi srfi-26) (srfi srfi-26)
(ice-9 ftw) (ice-9 ftw)
(ice-9 match) (ice-9 match)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'extend-test-time-outs (add-after 'unpack 'extend-test-time-outs
(lambda _ (lambda _
;; These tests can time out on heavily-loaded and/or slow storage. ;; These tests can time out on heavily-loaded and/or slow storage.
@ -220,10 +221,11 @@
;; fails within the build environment. ;; fails within the build environment.
((".*'test-char':.*" all) ((".*'test-char':.*" all)
(string-append "# " all))))) (string-append "# " all)))))
,@(if (target-riscv64?) #$@(if (target-riscv64?)
`((add-after 'unpack 'disable-some-tests '((add-after 'unpack 'disable-some-tests
(lambda _ (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/040")
(delete-file "tests/qemu-iotests/041") (delete-file "tests/qemu-iotests/041")
(delete-file "tests/qemu-iotests/256") (delete-file "tests/qemu-iotests/256")
@ -254,10 +256,9 @@
"VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios")))) "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
;; XXX ./configure is being re-run at beginning of build phase... ;; XXX ./configure is being re-run at beginning of build phase...
(replace 'configure (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 ;; The `configure' script doesn't understand some of the
;; GNU options. Thus, add a new phase that's compatible. ;; GNU options. Thus, add a new phase that's compatible.
(let ((out (assoc-ref outputs "out")))
(setenv "SHELL" (which "bash")) (setenv "SHELL" (which "bash"))
;; Ensure config.status gets the correct shebang off the bat. ;; Ensure config.status gets the correct shebang off the bat.
;; The build system gets confused if we change it later and ;; The build system gets confused if we change it later and
@ -267,12 +268,12 @@
(string-append "#!" (which "sh")))) (string-append "#!" (which "sh"))))
(mkdir-p "b/qemu") (mkdir-p "b/qemu")
(chdir "b/qemu") (chdir "b/qemu")
(apply invoke "../../configure" configure-flags)))) (apply invoke "../../configure" configure-flags)))
;; Configure, build and install QEMU user-emulation static binaries. ;; Configure, build and install QEMU user-emulation static binaries.
(add-after 'configure 'configure-user-static (add-after 'configure 'configure-user-static
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((gcc (search-input-file inputs "/bin/gcc")) (let* ((static (assoc-ref outputs "static"))
(static (assoc-ref outputs "static")) (gcc (search-input-file inputs "/bin/gcc"))
;; This is the common set of configure flags; it is ;; This is the common set of configure flags; it is
;; duplicated here to isolate this phase from manipulations ;; duplicated here to isolate this phase from manipulations
;; to the #:configure-flags build argument, as done in ;; 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 ;; pulling it in as an input. Note that you need to explicitly install
;; Samba in your Guix profile for Samba support. ;; Samba in your Guix profile for Samba support.
(add-after 'install 'create-samba-wrapper (add-after 'install 'create-samba-wrapper
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let ((libexec (string-append #$output "/libexec")))
(libexec (string-append out "/libexec")))
(call-with-output-file "samba-wrapper" (call-with-output-file "samba-wrapper"
(lambda (port) (lambda (port)
(format port "#!/bin/sh (format port "#!/bin/sh
@ -319,9 +319,10 @@ exec smbd $@")))
(install-file "samba-wrapper" libexec)))) (install-file "samba-wrapper" libexec))))
(add-after 'install 'move-html-doc (add-after 'install 'move-html-doc
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out #$output)
(doc (assoc-ref outputs "doc")) (doc #$output:doc)
(qemu-doc (string-append doc "/share/doc/qemu-" ,version))) (qemu-doc (string-append doc "/share/doc/qemu-"
#$(package-version this-package))))
(mkdir-p qemu-doc) (mkdir-p qemu-doc)
(rename-file (string-append out "/share/doc/qemu") (rename-file (string-append out "/share/doc/qemu")
(string-append qemu-doc "/html")))))))) (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") "Machine emulator and virtualizer (without GUI) for the host architecture")
(arguments (arguments
(substitute-keyword-arguments (package-arguments qemu) (substitute-keyword-arguments (package-arguments qemu)
((#:configure-flags configure-flags '(list)) ((#:configure-flags configure-flags #~'())
;; Restrict to the host's architecture. ;; Restrict to the host's architecture.
(let* ((system (or (%current-target-system) (let* ((system (or (%current-target-system)
(%current-system))) (%current-system)))
@ -436,9 +437,9 @@ server and embedded PowerPC, and S390 guests.")
"--target-list=riscv32-softmmu,riscv64-softmmu") "--target-list=riscv32-softmmu,riscv64-softmmu")
(else ; An empty list actually builds all the targets. (else ; An empty list actually builds all the targets.
'())))) '()))))
`(cons ,target-list-arg ,configure-flags))) #~(cons #$target-list-arg #$configure-flags)))
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(delete 'configure-user-static) (delete 'configure-user-static)
(delete 'build-user-static) (delete 'build-user-static)
(delete 'install-user-static))))) (delete 'install-user-static)))))