build-system: linux-module: Support source-directory.

As with guile-build-system, the module to be build need not necessarily live
at the root of the build tree.

* guix/build/linux-module-build-system.scm (build, install): Add
source-directory argument and append it to "M" variable when invoking make.
* guix/build-system/linux-module.scm (linux-module-build): Add
source-directory argument.
This commit is contained in:
Liliana Marie Prikler 2021-09-14 23:27:36 +02:00
parent a72519489f
commit c8e2358cca
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
2 changed files with 8 additions and 5 deletions

View file

@ -158,6 +158,7 @@
(outputs '("out")) (outputs '("out"))
(make-flags ''()) (make-flags ''())
(system (%current-system)) (system (%current-system))
(source-directory ".")
(guile #f) (guile #f)
(substitutable? #t) (substitutable? #t)
(imported-modules (imported-modules
@ -175,7 +176,8 @@
((source) ((source)
source) source)
(source (source
source)) source))
#:source-directory ,source-directory
#:search-paths ',(map search-path-specification->sexp #:search-paths ',(map search-path-specification->sexp
search-paths) search-paths)
#:phases ,phases #:phases ,phases

View file

@ -49,16 +49,17 @@
; TODO: kernel ".config". ; TODO: kernel ".config".
#t) #t)
(define* (build #:key inputs make-flags #:allow-other-keys) (define* (build #:key inputs make-flags (source-directory ".") #:allow-other-keys)
(apply invoke "make" "-C" (apply invoke "make" "-C"
(string-append (assoc-ref inputs "linux-module-builder") (string-append (assoc-ref inputs "linux-module-builder")
"/lib/modules/build") "/lib/modules/build")
(string-append "M=" (getcwd)) (string-append "M=" (getcwd) "/" source-directory)
(or make-flags '()))) (or make-flags '())))
;; This block was copied from make-linux-libre--only took the "modules_install" ;; This block was copied from make-linux-libre--only took the "modules_install"
;; part. ;; part.
(define* (install #:key make-flags inputs native-inputs outputs (define* (install #:key make-flags (source-directory ".")
inputs native-inputs outputs
#:allow-other-keys) #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(moddir (string-append out "/lib/modules"))) (moddir (string-append out "/lib/modules")))
@ -67,7 +68,7 @@
(apply invoke "make" "-C" (apply invoke "make" "-C"
(string-append (assoc-ref inputs "linux-module-builder") (string-append (assoc-ref inputs "linux-module-builder")
"/lib/modules/build") "/lib/modules/build")
(string-append "M=" (getcwd)) (string-append "M=" (getcwd) "/" source-directory)
;; Disable depmod because the Guix system's module directory ;; Disable depmod because the Guix system's module directory
;; is an union of potentially multiple packages. It is not ;; is an union of potentially multiple packages. It is not
;; possible to use depmod to usefully calculate a dependency ;; possible to use depmod to usefully calculate a dependency