[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/20: gnu: make-linux-libre*: Use G-expressions.
From: |
guix-commits |
Subject: |
09/20: gnu: make-linux-libre*: Use G-expressions. |
Date: |
Wed, 19 Jan 2022 13:14:10 -0500 (EST) |
nckx pushed a commit to branch master
in repository guix.
commit a61633d4ba0f3b9692e3b4d0760ef46906fa6846
Author: Tobias Geerinckx-Rice <me@tobias.gr>
AuthorDate: Thu Dec 23 06:39:57 2021 +0100
gnu: make-linux-libre*: Use G-expressions.
* gnu/packages/linux.scm (make-linux-libre*)[arguments]:
Rewrite as G-expressions.
---
gnu/packages/linux.scm | 194 +++++++++++++++++++++++++------------------------
1 file changed, 99 insertions(+), 95 deletions(-)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 4141e0fb22..484d312bba 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -807,101 +807,105 @@ for ARCH and optionally VARIANT, or #f if there is no
such configuration."
((? string? config)
`(("kconfig" ,config))))))
(arguments
- `(#:modules ((guix build gnu-build-system)
- (guix build utils)
- (srfi srfi-1)
- (srfi srfi-26)
- (ice-9 ftw)
- (ice-9 match))
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'patch-/bin/pwd
- (lambda _
- (substitute* (find-files "." "^Makefile(\\.include)?$")
- (("/bin/pwd") "pwd"))))
- (replace 'configure
- (lambda* (#:key inputs native-inputs target #:allow-other-keys)
- ;; Avoid introducing timestamps.
- (setenv "KCONFIG_NOTIMESTAMP" "1")
- (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
-
- ;; Other variables useful for reproducibility.
- (setenv "KBUILD_BUILD_USER" "guix")
- (setenv "KBUILD_BUILD_HOST" "guix")
-
- ;; Set ARCH and CROSS_COMPILE.
- (let ((arch ,(system->linux-architecture
- (or (%current-target-system)
- (%current-system)))))
- (setenv "ARCH" arch)
- (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
-
- (when target
- (setenv "CROSS_COMPILE" (string-append target "-"))
- (format #t "`CROSS_COMPILE' set to `~a'~%"
- (getenv "CROSS_COMPILE"))))
-
- (setenv "EXTRAVERSION" ,(and extra-version
- (string-append "-" extra-version)))
-
- (let ((build (assoc-ref %standard-phases 'build))
- (config (assoc-ref (or native-inputs inputs) "kconfig")))
-
- ;; Use a custom kernel configuration file or a default
- ;; configuration file.
- (if config
- (begin
- (copy-file config ".config")
- (chmod ".config" #o666))
- (invoke "make" ,defconfig))
-
- ;; Appending works even when the option wasn't in the
- ;; file. The last one prevails if duplicated.
- (let ((port (open-file ".config" "a"))
- (extra-configuration ,(config->string extra-options)))
- (display extra-configuration port)
- (close-port port))
-
- (invoke "make" "oldconfig"))))
- (replace 'install
- (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (moddir (string-append out "/lib/modules"))
- (dtbdir (string-append out "/lib/dtbs")))
- ;; Install kernel image, kernel configuration and link map.
- (for-each (lambda (file) (install-file file out))
- (find-files "."
"^(\\.config|bzImage|zImage|Image|vmlinuz|System\\.map|Module\\.symvers)$"))
- ;; Install device tree files
- (unless (null? (find-files "." "\\.dtb$"))
- (mkdir-p dtbdir)
- (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
- "dtbs_install"))
- ;; Install kernel modules
- (mkdir-p moddir)
- (invoke "make"
- ;; Disable depmod because the Guix system's module
directory
- ;; is an union of potentially multiple packages. It is
not
- ;; possible to use depmod to usefully calculate a
dependency
- ;; graph while building only one of those packages.
- "DEPMOD=true"
- (string-append "MODULE_DIR=" moddir)
- (string-append "INSTALL_PATH=" out)
- (string-append "INSTALL_MOD_PATH=" out)
- "INSTALL_MOD_STRIP=1"
- "modules_install")
- (let* ((versions (filter (lambda (name)
- (not (string-prefix? "." name)))
- (scandir moddir)))
- (version (match versions
- ((x) x))))
- ;; There are symlinks to the build and source directory,
- ;; both of which will point to target /tmp/guix-build*
- ;; and thus not be useful in a profile. Delete the symlinks.
- (false-if-file-not-found
- (delete-file (string-append moddir "/" version "/build")))
- (false-if-file-not-found
- (delete-file (string-append moddir "/" version
"/source"))))))))
- #:tests? #f))
+ (list #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1)
+ (srfi srfi-26)
+ (ice-9 ftw)
+ (ice-9 match))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-/bin/pwd
+ (lambda _
+ (substitute* (find-files "." "^Makefile(\\.include)?$")
+ (("/bin/pwd") "pwd"))))
+ (replace 'configure
+ (lambda* (#:key inputs target #:allow-other-keys)
+ ;; Avoid introducing timestamps.
+ (setenv "KCONFIG_NOTIMESTAMP" "1")
+ (setenv "KBUILD_BUILD_TIMESTAMP"
+ (getenv "SOURCE_DATE_EPOCH"))
+
+ ;; Other variables useful for reproducibility.
+ (setenv "KBUILD_BUILD_USER" "guix")
+ (setenv "KBUILD_BUILD_HOST" "guix")
+
+ ;; Set ARCH and CROSS_COMPILE.
+ (let ((arch #$(system->linux-architecture
+ (or (%current-target-system)
+ (%current-system)))))
+ (setenv "ARCH" arch)
+ (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
+
+ (when target
+ (setenv "CROSS_COMPILE" (string-append target "-"))
+ (format #t "`CROSS_COMPILE' set to `~a'~%"
+ (getenv "CROSS_COMPILE"))))
+
+ (setenv "EXTRAVERSION"
+ #$(and extra-version
+ (string-append "-" extra-version)))
+
+ (let ((build (assoc-ref %standard-phases 'build))
+ (config (assoc-ref inputs "kconfig")))
+
+ ;; Use a custom kernel configuration file or a default
+ ;; configuration file.
+ (if config
+ (begin
+ (copy-file config ".config")
+ (chmod ".config" #o666))
+ (invoke "make" #$defconfig))
+
+ ;; Appending works even when the option wasn't in the
+ ;; file. The last one prevails if duplicated.
+ (let ((port (open-file ".config" "a"))
+ (extra-configuration #$(config->string
extra-options)))
+ (display extra-configuration port)
+ (close-port port))
+
+ (invoke "make" "oldconfig"))))
+ (replace 'install
+ (lambda* (#:key inputs native-inputs #:allow-other-keys)
+ (let ((moddir (string-append #$output "/lib/modules"))
+ (dtbdir (string-append #$output "/lib/dtbs")))
+ ;; Install kernel image, kernel configuration and link
map.
+ (for-each (lambda (file) (install-file file #$output))
+ (find-files "."
"^(\\.config|bzImage|zImage|Image|vmlinuz|System\\.map|Module\\.symvers)$"))
+ ;; Install device tree files
+ (unless (null? (find-files "." "\\.dtb$"))
+ (mkdir-p dtbdir)
+ (invoke "make" (string-append "INSTALL_DTBS_PATH="
dtbdir)
+ "dtbs_install"))
+ ;; Install kernel modules
+ (mkdir-p moddir)
+ (invoke "make"
+ ;; Disable depmod because the Guix system's
+ ;; module directory is an union of potentially
+ ;; multiple packages. It is not possible to use
+ ;; depmod to usefully calculate a dependency
+ ;; graph while building only one of them.
+ "DEPMOD=true"
+ (string-append "MODULE_DIR=" moddir)
+ (string-append "INSTALL_PATH=" #$output)
+ (string-append "INSTALL_MOD_PATH=" #$output)
+ "INSTALL_MOD_STRIP=1"
+ "modules_install")
+ (let* ((versions (filter (lambda (name)
+ (not (string-prefix? "."
name)))
+ (scandir moddir)))
+ (version (match versions
+ ((x) x))))
+ ;; There are symlinks to the build and source directory.
+ ;; Both will point to target /tmp/guix-build* and thus
+ ;; not be useful in a profile. Delete the symlinks.
+ (false-if-file-not-found
+ (delete-file
+ (string-append moddir "/" version "/build")))
+ (false-if-file-not-found
+ (delete-file
+ (string-append moddir "/" version "/source"))))))))
+ #:tests? #f))
(home-page "https://www.gnu.org/software/linux-libre/")
(synopsis "100% free redistribution of a cleaned Linux kernel")
(description
- branch master updated (6e92790b42 -> 42f246eb84), guix-commits, 2022/01/19
- 01/20: gnu: bind: Update to 9.16.25., guix-commits, 2022/01/19
- 09/20: gnu: make-linux-libre*: Use G-expressions.,
guix-commits <=
- 04/20: gnu: hostapd: Use PKG-CONFIG-FOR-TARGET., guix-commits, 2022/01/19
- 05/20: gnu: hostapd: Use G-expressions., guix-commits, 2022/01/19
- 08/20: gnu: scanbd: Fix build., guix-commits, 2022/01/19
- 06/20: gnu: chromaprint: Update to 1.5.1., guix-commits, 2022/01/19
- 07/20: gnu: scanbd: Use G-expressions., guix-commits, 2022/01/19
- 11/20: gnu: acpi-call-linux-module: Use G-expressions., guix-commits, 2022/01/19
- 10/20: build-system/linux-module: Use G-expressions., guix-commits, 2022/01/19
- 12/20: gnu: librem-ec-acpi-linux-module: Unquote arguments., guix-commits, 2022/01/19
- 15/20: gnu: vhba-module: Unquote arguments., guix-commits, 2022/01/19
- 16/20: gnu: bbswitch-module: Unquote arguments., guix-commits, 2022/01/19