mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-17 20:27:36 -05:00
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:
parent
a61633d4ba
commit
2e86059172
1 changed files with 46 additions and 47 deletions
|
@ -61,53 +61,52 @@ (define (make-linux-module-builder linux)
|
|||
`(("linux" ,linux)))
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments linux)
|
||||
((#:phases phases)
|
||||
`(modify-phases ,phases
|
||||
(replace 'build
|
||||
(lambda _
|
||||
(invoke "make" "modules_prepare")))
|
||||
(delete 'strip) ; faster.
|
||||
(replace 'install
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(let* ((out (assoc-ref outputs "out"))
|
||||
(out-lib-build (string-append out "/lib/modules/build")))
|
||||
;; Delete some huge items that we probably don't need.
|
||||
;; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig,
|
||||
;; scripts, include, ".config".
|
||||
(copy-recursively "." out-lib-build)
|
||||
(for-each (lambda (name)
|
||||
(when (file-exists? name)
|
||||
(delete-file-recursively name)))
|
||||
(map (lambda (name)
|
||||
(string-append out-lib-build "/" name))
|
||||
'("arch" ; 137 MB
|
||||
;"tools" ; 44 MB ; Note: is built by our 'build phase.
|
||||
"tools/testing" ; 14 MB
|
||||
"tools/perf" ; 17 MB
|
||||
"drivers" ; 600 MB
|
||||
"Documentation" ; 52 MB
|
||||
"fs" ; 43 MB
|
||||
"net" ; 33 MB
|
||||
"samples" ; 2 MB
|
||||
"sound"))) ; 40 MB
|
||||
;; Reinstate arch/**/dts since "scripts/dtc" depends on it.
|
||||
;; Reinstate arch/**/include directories.
|
||||
;; Reinstate arch/**/Makefile.
|
||||
;; Reinstate arch/**/module.lds.
|
||||
(for-each
|
||||
(lambda (name)
|
||||
(mkdir-p (dirname (string-append out-lib-build "/" name)))
|
||||
(copy-recursively name
|
||||
(string-append out-lib-build "/" name)))
|
||||
(append (find-files "arch" "^(dts|include)$" #:directories? #t)
|
||||
(find-files "arch" "^(Makefile|module.lds)$")))
|
||||
(let* ((linux (assoc-ref inputs "linux")))
|
||||
(install-file (string-append linux "/System.map")
|
||||
out-lib-build)
|
||||
(let ((source (string-append linux "/Module.symvers")))
|
||||
(when (file-exists? source)
|
||||
(install-file source out-lib-build))))
|
||||
#t)))))))))
|
||||
((#:phases phases)
|
||||
#~(modify-phases #$phases
|
||||
(replace 'build
|
||||
(lambda _
|
||||
(invoke "make" "modules_prepare")))
|
||||
(delete 'strip) ; faster
|
||||
(replace 'install
|
||||
(lambda* (#:key inputs #:allow-other-keys)
|
||||
(let ((out-lib-build (string-append #$output "/lib/modules/build")))
|
||||
;; Delete some huge items that we probably don't need.
|
||||
;; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig,
|
||||
;; scripts, include, ".config".
|
||||
(copy-recursively "." out-lib-build)
|
||||
(for-each (lambda (name)
|
||||
(when (file-exists? name)
|
||||
(delete-file-recursively name)))
|
||||
(map (lambda (name)
|
||||
(string-append out-lib-build "/" name))
|
||||
'("arch" ; 137 MB
|
||||
;;"tools" ; 44 MB built by our 'build phase
|
||||
"tools/testing" ; 14 MB
|
||||
"tools/perf" ; 17 MB
|
||||
"drivers" ; 600 MB
|
||||
"Documentation" ; 52 MB
|
||||
"fs" ; 43 MB
|
||||
"net" ; 33 MB
|
||||
"samples" ; 2 MB
|
||||
"sound"))) ; 40 MB
|
||||
;; Reinstate arch/**/dts since "scripts/dtc" depends on it.
|
||||
;; Reinstate arch/**/include directories.
|
||||
;; Reinstate arch/**/Makefile.
|
||||
;; Reinstate arch/**/module.lds.
|
||||
(for-each
|
||||
(lambda (name)
|
||||
(mkdir-p (dirname (string-append out-lib-build "/" name)))
|
||||
(copy-recursively name
|
||||
(string-append out-lib-build "/" name)))
|
||||
(append (find-files "arch" "^(dts|include)$"
|
||||
#:directories? #t)
|
||||
(find-files "arch" "^(Makefile|module.lds)$")))
|
||||
(let* ((linux #$(this-package-input "linux")))
|
||||
(install-file (string-append linux "/System.map")
|
||||
out-lib-build)
|
||||
(let ((source (string-append linux "/Module.symvers")))
|
||||
(when (file-exists? source)
|
||||
(install-file source out-lib-build)))))))))))))
|
||||
|
||||
(define* (lower name
|
||||
#:key source inputs native-inputs outputs
|
||||
|
|
Loading…
Reference in a new issue