mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: ipxe: Use G-expression.
* gnu/packages/bootloaders.scm (ipxe)[arguments]: Convert to G-expression. While at it, remove trailing #t's and label usage.
This commit is contained in:
parent
998c8db2a5
commit
b435f631a6
1 changed files with 81 additions and 84 deletions
|
@ -3,7 +3,7 @@
|
||||||
;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
|
||||||
;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
|
;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
|
||||||
;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;; Copyright © 2016-2018, 2021-2022 Marius Bakke <marius@gnu.org>
|
;;; Copyright © 2016-2018, 2021-2023 Marius Bakke <marius@gnu.org>
|
||||||
;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org>
|
;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org>
|
||||||
;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
|
;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
|
||||||
;;; Copyright © 2017, 2018, 2020, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
|
;;; Copyright © 2017, 2018, 2020, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
|
||||||
|
@ -1522,97 +1522,94 @@ order to add a suitable bootloader menu entry.")
|
||||||
"1pkf1n1c0rdlzfls8fvjvi1sd9xjd9ijqlyz3wigr70ijcv6x8i9"))))
|
"1pkf1n1c0rdlzfls8fvjvi1sd9xjd9ijqlyz3wigr70ijcv6x8i9"))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:modules ((guix build utils)
|
(list
|
||||||
|
#:modules `((guix build utils)
|
||||||
(guix build gnu-build-system)
|
(guix build gnu-build-system)
|
||||||
(guix base32)
|
(guix base32)
|
||||||
(ice-9 string-fun)
|
(ice-9 string-fun)
|
||||||
(ice-9 regex)
|
(ice-9 regex)
|
||||||
(rnrs bytevectors))
|
(rnrs bytevectors))
|
||||||
#:imported-modules ((guix base32)
|
#:imported-modules `((guix base32)
|
||||||
,@%gnu-build-system-modules)
|
,@%gnu-build-system-modules)
|
||||||
#:make-flags
|
#:make-flags
|
||||||
;; XXX: 'BUILD_ID' is used to determine when another ROM in the
|
;; XXX: 'BUILD_ID' is used to determine when another ROM in the
|
||||||
;; system contains identical code in order to save space within the
|
;; system contains identical code in order to save space within the
|
||||||
;; legacy BIOS option ROM area, which is extremely limited in size.
|
;; legacy BIOS option ROM area, which is extremely limited in size.
|
||||||
;; It is supposed to be collision-free across all ROMs, to do so we
|
;; It is supposed to be collision-free across all ROMs, to do so we
|
||||||
;; use the truncated output hash of the package.
|
;; use the truncated output hash of the package.
|
||||||
(let ((build-id
|
#~(let ((build-id
|
||||||
(lambda (out)
|
(lambda (out)
|
||||||
(let* ((nix-store (string-append
|
(let* ((nix-store (string-append
|
||||||
(or (getenv "NIX_STORE") "/gnu/store")
|
(or (getenv "NIX_STORE") "/gnu/store")
|
||||||
"/"))
|
"/"))
|
||||||
(filename
|
(filename
|
||||||
(string-replace-substring out nix-store ""))
|
(string-replace-substring out nix-store ""))
|
||||||
(hash (match:substring (string-match "[0-9a-z]{32}"
|
(hash (match:substring (string-match "[0-9a-z]{32}"
|
||||||
filename)))
|
filename)))
|
||||||
(bv (nix-base32-string->bytevector hash)))
|
(bv (nix-base32-string->bytevector hash)))
|
||||||
(format #f "0x~x"
|
(format #f "0x~x"
|
||||||
(bytevector-u32-ref bv 0 (endianness big))))))
|
(bytevector-u32-ref bv 0 (endianness big))))))
|
||||||
(out (assoc-ref %outputs "out"))
|
(syslinux #$(this-package-native-input "syslinux")))
|
||||||
(syslinux (assoc-ref %build-inputs "syslinux")))
|
(list "ECHO_E_BIN_ECHO=echo"
|
||||||
(list "ECHO_E_BIN_ECHO=echo"
|
"ECHO_E_BIN_ECHO_E=echo -e"
|
||||||
"ECHO_E_BIN_ECHO_E=echo -e"
|
|
||||||
|
|
||||||
;; cdrtools' mkisofs will silently ignore a missing isolinux.bin!
|
;; cdrtools' mkisofs will silently ignore a missing isolinux.bin!
|
||||||
;; Luckily xorriso is more strict.
|
;; Luckily xorriso is more strict.
|
||||||
(string-append "ISOLINUX_BIN=" syslinux
|
(string-append "ISOLINUX_BIN=" syslinux
|
||||||
"/share/syslinux/isolinux.bin")
|
"/share/syslinux/isolinux.bin")
|
||||||
(string-append "SYSLINUX_MBR_DISK_PATH=" syslinux
|
(string-append "SYSLINUX_MBR_DISK_PATH=" syslinux
|
||||||
"/share/syslinux/isohdpfx.bin")
|
"/share/syslinux/isohdpfx.bin")
|
||||||
|
|
||||||
;; Build reproducibly.
|
;; Build reproducibly.
|
||||||
(string-append "BUILD_ID_CMD=echo -n " (build-id out))
|
(string-append "BUILD_ID_CMD=echo -n " (build-id #$output))
|
||||||
(string-append "BUILD_TIMESTAMP=" ,timestamp)
|
(string-append "BUILD_TIMESTAMP=" #$timestamp)
|
||||||
"everything"))
|
"everything"))
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'enter-source-directory
|
(add-after 'unpack 'enter-source-directory
|
||||||
(lambda _ (chdir "src") #t))
|
(lambda _ (chdir "src")))
|
||||||
(add-after 'enter-source-directory 'set-version
|
(add-after 'enter-source-directory 'set-version
|
||||||
(lambda _
|
(lambda _
|
||||||
;; When not building from a git checkout, iPXE encodes the
|
;; When not building from a git checkout, iPXE encodes the
|
||||||
;; version as "1.0.0+". Use the package version instead.
|
;; version as "1.0.0+". Use the package version instead.
|
||||||
(substitute* "Makefile"
|
(substitute* "Makefile"
|
||||||
(("^VERSION[[:blank:]]+=.*")
|
(("^VERSION[[:blank:]]+=.*")
|
||||||
(string-append "VERSION = " ,(package-version this-package)
|
(string-append "VERSION = " #$(package-version this-package)
|
||||||
"-guix\n")))))
|
"-guix\n")))))
|
||||||
(add-after 'enter-source-directory 'set-options
|
(add-after 'enter-source-directory 'set-options
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* "config/general.h"
|
(substitute* "config/general.h"
|
||||||
(("^//(#define PING_CMD.*)" _ uncommented) uncommented)
|
(("^//(#define PING_CMD.*)" _ uncommented) uncommented)
|
||||||
(("^//(#define IMAGE_TRUST_CMD.*)" _ uncommented)
|
(("^//(#define IMAGE_TRUST_CMD.*)" _ uncommented)
|
||||||
uncommented)
|
uncommented)
|
||||||
(("^#undef.*(DOWNLOAD_PROTO_HTTPS.*)" _ option)
|
(("^#undef.*(DOWNLOAD_PROTO_HTTPS.*)" _ option)
|
||||||
(string-append "#define " option))
|
(string-append "#define " option))
|
||||||
(("^#undef.*(DOWNLOAD_PROTO_NFS.*)" _ option)
|
(("^#undef.*(DOWNLOAD_PROTO_NFS.*)" _ option)
|
||||||
(string-append "#define " option)))
|
(string-append "#define " option)))))
|
||||||
#t))
|
(delete 'configure) ; no configure script
|
||||||
(delete 'configure) ; no configure script
|
(replace 'install
|
||||||
(replace 'install
|
(lambda _
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(let* ((ipxe (string-append #$output "/lib/ipxe"))
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(exts-re
|
||||||
(ipxe (string-append out "/lib/ipxe"))
|
"\\.(efi|efirom|iso|kkpxe|kpxe|lkrn|mrom|pxe|rom|usb)$")
|
||||||
(exts-re
|
(dirs '("bin" "bin-i386-linux" "bin-x86_64-pcbios"
|
||||||
"\\.(efi|efirom|iso|kkpxe|kpxe|lkrn|mrom|pxe|rom|usb)$")
|
"bin-x86_64-efi" "bin-x86_64-linux" "bin-i386-efi"))
|
||||||
(dirs '("bin" "bin-i386-linux" "bin-x86_64-pcbios"
|
(files (apply append
|
||||||
"bin-x86_64-efi" "bin-x86_64-linux" "bin-i386-efi"))
|
(map (lambda (dir)
|
||||||
(files (apply append
|
(find-files dir exts-re)) dirs))))
|
||||||
(map (lambda (dir)
|
(for-each (lambda (file)
|
||||||
(find-files dir exts-re)) dirs))))
|
(let* ((subdir (dirname file))
|
||||||
(for-each (lambda (file)
|
(fn (basename file))
|
||||||
(let* ((subdir (dirname file))
|
(tgtsubdir (cond
|
||||||
(fn (basename file))
|
((string=? "bin" subdir) "")
|
||||||
(tgtsubdir (cond
|
((string-prefix? "bin-" subdir)
|
||||||
((string=? "bin" subdir) "")
|
(string-drop subdir 4)))))
|
||||||
((string-prefix? "bin-" subdir)
|
(install-file file
|
||||||
(string-drop subdir 4)))))
|
(string-append ipxe "/" tgtsubdir))))
|
||||||
(install-file file
|
files))))
|
||||||
(string-append ipxe "/" tgtsubdir))))
|
(add-after 'install 'leave-source-directory
|
||||||
files))
|
(lambda _ (chdir ".."))))
|
||||||
#t))
|
#:tests? #f)) ; no test suite
|
||||||
(add-after 'install 'leave-source-directory
|
|
||||||
(lambda _ (chdir "..") #t)))
|
|
||||||
#:tests? #f)) ; no test suite
|
|
||||||
(native-inputs
|
(native-inputs
|
||||||
(list perl syslinux xorriso))
|
(list perl syslinux xorriso))
|
||||||
(home-page "https://ipxe.org")
|
(home-page "https://ipxe.org")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue