Archived
1
0
Fork 0

gnu: xen: Update package style.

* gnu/packages/virtualization.scm (xen)
[arguments]: Rewrite as G-expressions.  Use SEARCH-INPUT-FILE whenever
possible.  Put SUBSTITUTE* features to use.
[native-inputs, inputs]: Remove input labels.
This commit is contained in:
Tobias Geerinckx-Rice 2023-09-24 02:00:00 +02:00
parent 11f1d72dd8
commit 91097713ee
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -2291,98 +2291,84 @@ DOS or Microsoft Windows.")
"1cdzpxbihkdn4za8ly0lgkbxrafjzbxjflhfn83kyg4bam1vv7mn")))) "1cdzpxbihkdn4za8ly0lgkbxrafjzbxjflhfn83kyg4bam1vv7mn"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:configure-flags (list
(list "--enable-rpath" #:configure-flags
"--disable-qemu-traditional" ; It tries to do "git clone" #~(list "--enable-rpath"
"--disable-rombios" ; would try to "git clone" via etherboot. "--disable-qemu-traditional" ; tries to "git clone"
"--disable-rombios" ; tries to "git clone" via etherboot
;; TODO: Re-enable stubdom (it's "more secure" to use it). ;; TODO: Re-enable stubdom (it's "more secure" to use it).
"--disable-stubdom" ; tries to "git clone" old patched newlib. "--disable-stubdom" ; tries to "git clone" old patched newlib
(string-append "--with-initddir=" (string-append "--with-initddir=" #$output "/etc/init.d")
(assoc-ref %outputs "out")
"/etc/init.d")
(string-append "--with-system-qemu=" (string-append "--with-system-qemu="
(assoc-ref %build-inputs "qemu") (search-input-file %build-inputs
"/bin/qemu-system-i386") "bin/qemu-system-i386"))
(string-append "--with-system-seabios=" (string-append "--with-system-seabios="
(assoc-ref %build-inputs "seabios") (search-input-file %build-inputs
"/share/firmware/bios.bin") "share/firmware/bios.bin"))
(string-append "--with-system-ovmf=" (string-append "--with-system-ovmf="
(assoc-ref %build-inputs "ovmf") (search-input-file %build-inputs
"/share/firmware/ovmf_ia32.bin")) "share/firmware/ovmf_ia32.bin")))
#:make-flags (list "-j" "1" #:make-flags
#~(list "-j" "1"
"XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970" "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
"XEN_BUILD_TIME=01:00:01" "XEN_BUILD_TIME=01:00:01"
"XEN_BUILD_HOST=" "XEN_BUILD_HOST="
"ETHERBOOT_NICS=" "ETHERBOOT_NICS="
"SMBIOS_REL_DATE=01/01/1970" "SMBIOS_REL_DATE=01/01/1970"
"VGABIOS_REL_DATE=01 Jan 1970" "VGABIOS_REL_DATE=01 Jan 1970"
; QEMU_TRADITIONAL_LOC ;; QEMU_TRADITIONAL_LOC
; QEMU_UPSTREAM_LOC ;; QEMU_UPSTREAM_LOC
"SYSCONFIG_DIR=/tmp/etc/default" "SYSCONFIG_DIR=/tmp/etc/default"
(string-append "BASH_COMPLETION_DIR=" (string-append "BASH_COMPLETION_DIR=" #$output
(assoc-ref %outputs "out")
"/etc/bash_completion.d") "/etc/bash_completion.d")
(string-append "BOOT_DIR=" (string-append "BOOT_DIR=" #$output "/boot")
(assoc-ref %outputs "out") (string-append "DEBUG_DIR=" #$output "/lib/debug")
"/boot") (string-append "EFI_DIR=" #$output "/lib/efi")
(string-append "DEBUG_DIR=" "MINIOS_UPSTREAM_URL=")
(assoc-ref %outputs "out")
"/lib/debug")
(string-append "EFI_DIR="
(assoc-ref %outputs "out")
"/lib/efi") ; TODO lib64 ?
"MINIOS_UPSTREAM_URL="
;(string-append "DISTDIR="
; (assoc-ref %outputs "out"))
)
#:test-target "test" #:test-target "test"
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'unpack-mini-os (add-after 'unpack 'unpack-mini-os
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os"))) (let ((mini-os (dirname (search-input-file inputs "minios.mk"))))
(copy-recursively mini-os "extras/mini-os"))))
(add-after 'unpack-mini-os 'patch (add-after 'unpack-mini-os 'patch
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(substitute* "tools/firmware/Rules.mk" (substitute* "tools/firmware/Rules.mk"
(("override XEN_TARGET_ARCH = x86_32") (("override XEN_TARGET_ARCH = x86_32" match)
(string-append "override XEN_TARGET_ARCH = x86_32 (string-append match "\noverride CC = "
override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc")) (search-input-file inputs
(("^CFLAGS =$") "bin/i686-linux-gnu-gcc")))
(string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc") (("^CFLAGS =$" match)
(string-append match " -I" (assoc-ref inputs "cross-libc")
"/include\n"))) "/include\n")))
(substitute* "config/x86_32.mk" (substitute* "config/x86_32.mk"
(("CFLAGS += -m32 -march=i686") (("(CFLAGS += )-m32 -march=i686" _ match)
(string-append "CFLAGS += -march=i686 -I" (string-append match "-march=i686 -I"
(assoc-ref inputs "cross-libc") (assoc-ref inputs "cross-libc") "/include")))
"/include"))) ;; /var is not in /gnu/store, so don't try to create it.
;; /var is not in /gnu/store , so don't try to create it.
(substitute* '("tools/Makefile" (substitute* '("tools/Makefile"
"tools/xenstore/Makefile" "tools/xenstore/Makefile"
"tools/xenpaging/Makefile") "tools/xenpaging/Makefile")
(("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*") (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
"\n") "\n")
(("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*") (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*") "\n"))
"\n")) ;; Prevent xen from creating /etc.
;; Prevent xen from creating /etc .
(substitute* "tools/examples/Makefile" (substitute* "tools/examples/Makefile"
((" install-readmes") "") ((" install-(configs|readmes)") ""))
((" install-configs") ""))
;; Set rpath. ;; Set rpath.
(substitute* "tools/pygrub/setup.py" (substitute* "tools/pygrub/setup.py"
(("library_dirs =") (("library_dirs =" match)
; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'], ;; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
(string-append "runtime_library_dirs = ['" (string-append "runtime_library_dirs = ['" #$output "/lib'],"
(assoc-ref outputs "out") "\n" match)))))
"/lib'],\nlibrary_dirs =")))))
(add-before 'configure 'patch-xen-script-directory (add-before 'configure 'patch-xen-script-directory
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(substitute* '("configure" (substitute* '("configure"
"tools/configure" "tools/configure"
"docs/configure") "docs/configure")
(("XEN_SCRIPT_DIR=.*") (("(XEN_SCRIPT_DIR=).*" _ match)
(string-append "XEN_SCRIPT_DIR=" (string-append match #$output "/etc/xen/scripts")))))
(assoc-ref outputs "out")
"/etc/xen/scripts")))))
(add-before 'configure 'set-environment-up (add-before 'configure 'set-environment-up
(lambda* (#:key make-flags #:allow-other-keys) (lambda* (#:key make-flags #:allow-other-keys)
(define (cross? x) (define (cross? x)
@ -2403,7 +2389,8 @@ override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
(setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH")) (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
(setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH")) (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
(filter-environment! cross? (filter-environment! cross?
'("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH" '("CROSS_C_INCLUDE_PATH"
"CROSS_CPLUS_INCLUDE_PATH"
"CROSS_LIBRARY_PATH")) "CROSS_LIBRARY_PATH"))
(filter-environment! (lambda (e) (not (cross? e))) (filter-environment! (lambda (e) (not (cross? e)))
'("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
@ -2422,33 +2409,32 @@ override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
(lambda* (#:key make-flags #:allow-other-keys) (lambda* (#:key make-flags #:allow-other-keys)
(apply invoke "make" "world" make-flags)))))) (apply invoke "make" "world" make-flags))))))
(inputs (inputs
`(("acpica" ,acpica) ; TODO: patch iasl invocation. (list acpica ; TODO: patch iasl invocation
("bridge-utils" ,bridge-utils) ; TODO: patch invocations. bridge-utils ; TODO: patch invocations
("glib" ,glib) glib
("iproute" ,iproute) ; TODO: patch invocations. iproute ; TODO: patch invocations
("libaio" ,libaio) libaio
("libx11" ,libx11) libx11
("yajl" ,yajl) yajl
("ncurses" ,ncurses) ncurses
("openssl" ,openssl) openssl
("ovmf" ,ovmf) ovmf
("pixman" ,pixman) pixman
("qemu" ,qemu-minimal) qemu-minimal
("seabios" ,seabios) seabios
("util-linux" ,util-linux "lib") ; uuid `(,util-linux "lib") ; uuid
; TODO: ocaml-findlib, ocaml-nox. ;; TODO: ocaml-findlib, ocaml-nox.
("xz" ,xz) ; for liblzma xz ; for liblzma
("zlib" ,zlib))) zlib))
(native-inputs (native-inputs
`(("dev86" ,dev86) (list dev86
("bison" ,bison) bison
("cmake" ,cmake-minimal) cmake-minimal
("figlet" ,figlet) figlet
("flex" ,flex) flex
("gettext" ,gettext-minimal) gettext-minimal
("libnl" ,libnl) libnl
("mini-os" (origin
,(origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://xenbits.xen.org/git-http/mini-os.git") (url "https://xenbits.xen.org/git-http/mini-os.git")
@ -2459,17 +2445,17 @@ override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
(commit "f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5"))) (commit "f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5")))
(sha256 (sha256
(base32 "04y7grxs47amvjcq1rq4jgk174rhid5m2z9w8wrv7rfd2xhazxy1")) (base32 "04y7grxs47amvjcq1rq4jgk174rhid5m2z9w8wrv7rfd2xhazxy1"))
(file-name (string-append name "-" version "-mini-os-git-checkout")))) (file-name (string-append name "-" version "-mini-os-git-checkout")))
("perl" ,perl) perl
; TODO: markdown ;; TODO: markdown.
("pkg-config" ,pkg-config) pkg-config
("python" ,python-2) python-2
("wget" ,wget) wget
("cross-gcc" ,(cross-gcc "i686-linux-gnu" (cross-gcc "i686-linux-gnu"
#:xbinutils (cross-binutils "i686-linux-gnu") #:xbinutils (cross-binutils "i686-linux-gnu")
#:libc (cross-libc "i686-linux-gnu"))) #:libc (cross-libc "i686-linux-gnu"))
("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files (cross-libc "i686-linux-gnu") ; header files
("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static"))) `(,(cross-libc "i686-linux-gnu") "static")))
(home-page "https://xenproject.org/") (home-page "https://xenproject.org/")
(synopsis "Xen Virtual Machine Monitor") (synopsis "Xen Virtual Machine Monitor")
(description "This package provides the Xen Virtual Machine Monitor (description "This package provides the Xen Virtual Machine Monitor