summary refs log tree commit diff
path: root/gnu/packages/linux.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/linux.scm')
-rw-r--r--gnu/packages/linux.scm25
1 files changed, 16 insertions, 9 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index ca4ca563a3..91f7125e8a 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -31,18 +31,25 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu))
 
+(define-public (system->linux-architecture arch)
+  "Return the Linux architecture name for ARCH, a Guix system name such as
+\"x86_64-linux\"."
+  (let ((arch (car (string-split arch #\-))))
+    (cond ((string=? arch "i686") "i386")
+          ((string-prefix? "mips" arch) "mips")
+          ((string-prefix? "arm" arch) "arm")
+          (else arch))))
+
 (define-public linux-libre-headers
   (let* ((version* "3.3.8")
          (build-phase
-          '(lambda* (#:key system #:allow-other-keys)
-             (let ((arch (car (string-split system #\-))))
-               (setenv "ARCH"
-                       (cond ((string=? arch "i686") "i386")
-                             (else arch)))
-               (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
+          (lambda (arch)
+            `(lambda _
+               (setenv "ARCH" ,(system->linux-architecture arch))
+               (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
 
-             (and (zero? (system* "make" "defconfig"))
-                  (zero? (system* "make" "mrproper" "headers_check")))))
+               (and (zero? (system* "make" "defconfig"))
+                    (zero? (system* "make" "mrproper" "headers_check"))))))
          (install-phase
           `(lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
@@ -73,7 +80,7 @@
                   (guix build utils)
                   (srfi srfi-1))
        #:phases (alist-replace
-                 'build ,build-phase
+                 'build ,(build-phase (%current-system))
                  (alist-replace
                   'install ,install-phase
                   (alist-delete 'configure %standard-phases)))