Archived
1
0
Fork 0

build-system/linux-module: Use G-expressions.

* guix/build-system/linux-module.scm (make-linux-module-builder)
[arguments]: Rewrite as G-expressions.
This commit is contained in:
Tobias Geerinckx-Rice 2021-12-23 22:18:22 +01:00
parent a61633d4ba
commit 2e86059172
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -62,15 +62,14 @@
(arguments (arguments
(substitute-keyword-arguments (package-arguments linux) (substitute-keyword-arguments (package-arguments linux)
((#:phases phases) ((#:phases phases)
`(modify-phases ,phases #~(modify-phases #$phases
(replace 'build (replace 'build
(lambda _ (lambda _
(invoke "make" "modules_prepare"))) (invoke "make" "modules_prepare")))
(delete 'strip) ; faster. (delete 'strip) ; faster
(replace 'install (replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let ((out-lib-build (string-append #$output "/lib/modules/build")))
(out-lib-build (string-append out "/lib/modules/build")))
;; Delete some huge items that we probably don't need. ;; Delete some huge items that we probably don't need.
;; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig, ;; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig,
;; scripts, include, ".config". ;; scripts, include, ".config".
@ -81,7 +80,7 @@
(map (lambda (name) (map (lambda (name)
(string-append out-lib-build "/" name)) (string-append out-lib-build "/" name))
'("arch" ; 137 MB '("arch" ; 137 MB
;"tools" ; 44 MB ; Note: is built by our 'build phase. ;;"tools" ; 44 MB built by our 'build phase
"tools/testing" ; 14 MB "tools/testing" ; 14 MB
"tools/perf" ; 17 MB "tools/perf" ; 17 MB
"drivers" ; 600 MB "drivers" ; 600 MB
@ -99,15 +98,15 @@
(mkdir-p (dirname (string-append out-lib-build "/" name))) (mkdir-p (dirname (string-append out-lib-build "/" name)))
(copy-recursively name (copy-recursively name
(string-append out-lib-build "/" name))) (string-append out-lib-build "/" name)))
(append (find-files "arch" "^(dts|include)$" #:directories? #t) (append (find-files "arch" "^(dts|include)$"
#:directories? #t)
(find-files "arch" "^(Makefile|module.lds)$"))) (find-files "arch" "^(Makefile|module.lds)$")))
(let* ((linux (assoc-ref inputs "linux"))) (let* ((linux #$(this-package-input "linux")))
(install-file (string-append linux "/System.map") (install-file (string-append linux "/System.map")
out-lib-build) out-lib-build)
(let ((source (string-append linux "/Module.symvers"))) (let ((source (string-append linux "/Module.symvers")))
(when (file-exists? source) (when (file-exists? source)
(install-file source out-lib-build)))) (install-file source out-lib-build)))))))))))))
#t)))))))))
(define* (lower name (define* (lower name
#:key source inputs native-inputs outputs #:key source inputs native-inputs outputs