Subject: [PATCH] gnu: Use make-linux-libre-headers.

From: Carl Dong <[email-masked]>
Date: Fri, 24 May 2019 21:57:29 +0000

* gnu/packages/linux.scm (make-linux-libre-headers): New variable.
  (linux-libre): Rename and define as linux-libre-5.1.
  (linux-libre-headers): Rename and define as
  linux-libre-headers-4.14.67.
  (linux-libre-5.1, linux-libre-headers-4.14.67): Use
  make-linux-libre-headers.
  (linux-libre-5.1, linux-libre-headers-5.1, linux-libre-headers-4.19,
  %linux-libre-4.15-version, %linux-libre-4.15-hash, linux-libre-4.15,
  linux-libre-headers-4.15, linux-libre-headers-4.14): New variables.
---
 gnu/packages/linux.scm | 48 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 41 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index b645249649..18e091a95a 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -169,18 +169,20 @@ defconfig.  Return the appropriate make target if applicable, otherwise return
          "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
          version "-gnu.tar.xz")))
 
-(define-public linux-libre-headers
+(define (make-linux-libre-headers version hash)
   (package
     (name "linux-libre-headers")
-    (version "4.14.67")
+    (version version)
     (source (origin
              (method url-fetch)
              (uri (linux-libre-urls version))
-             (sha256
-              (base32
-               "050zvdxjy6sc64q75pr1gxsmh49chwav2pwxz8xlif39bvahnrpg"))))
+             (sha256 (base32 hash))))
     (build-system gnu-build-system)
-    (native-inputs `(("perl" ,perl)))
+    (native-inputs `(("perl" ,perl)
+                     ,@(if (version>=? version "4.16")
+                           `(("flex" ,flex)
+                             ("bison" ,bison))
+                           '())))
     (arguments
      `(#:modules ((guix build gnu-build-system)
                   (guix build utils)
@@ -433,13 +435,17 @@ It has been modified to remove all non-free binary blobs.")
   (list %boot-logo-patch
         %linux-libre-arm-export-__sync_icache_dcache-patch))
 
-(define-public linux-libre
+(define-public linux-libre-5.1
   (make-linux-libre %linux-libre-version
                     %linux-libre-hash
                     '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux")
                     #:patches %linux-libre-5.1-patches
                     #:configuration-file kernel-config))
 
+(define-public linux-libre-headers-5.1
+  (make-linux-libre-headers %linux-libre-version
+                            %linux-libre-hash))
+
 (define %linux-libre-4.19-version "4.19.45")
 (define %linux-libre-4.19-hash "1wiy8vzpzzml4k76nv3ycjx7ky55x7dqx3mgpjqbh73mj2gcr5bx")
 
@@ -454,6 +460,23 @@ It has been modified to remove all non-free binary blobs.")
                     #:patches %linux-libre-4.19-patches
                     #:configuration-file kernel-config))
 
+(define-public linux-libre-headers-4.19
+  (make-linux-libre-headers %linux-libre-4.19-version
+                            %linux-libre-4.19-hash))
+
+(define %linux-libre-4.15-version "4.15.18")
+(define %linux-libre-4.15-hash "0f0s4drx888ydlwjcm9qcxqian4850yiv2vamyw9bbjf83frwxyw")
+
+(define-public linux-libre-4.15
+  (make-linux-libre %linux-libre-4.15-version
+                    %linux-libre-4.15-hash
+                    '("x86_64-linux" "i686-linux" "armhf-linux")
+                    #:configuration-file kernel-config))
+
+(define-public linux-libre-headers-4.15
+  (make-linux-libre-headers %linux-libre-4.15-version
+                            %linux-libre-4.15-hash))
+
 (define %linux-libre-4.14-version "4.14.121")
 (define %linux-libre-4.14-hash "1g7gyjmp056pasf9m34dqs8pa15my6hqasdd551jw8mgkbhsfnxg")
 
@@ -463,6 +486,10 @@ It has been modified to remove all non-free binary blobs.")
                     '("x86_64-linux" "i686-linux" "armhf-linux")
                     #:configuration-file kernel-config))
 
+(define-public linux-libre-headers-4.14
+  (make-linux-libre-headers %linux-libre-4.14-version
+                            %linux-libre-4.14-hash))
+
 (define-public linux-libre-4.9
   (make-linux-libre "4.9.178"
                     "1ridlkymf382qnkc6hi07pkghrrxfv2avx55snjnkfcpdccvsmrb"
@@ -481,6 +508,13 @@ It has been modified to remove all non-free binary blobs.")
                        ("CONFIG_DEVPTS_MULTIPLE_INSTANCES" . #t))
                      %default-extra-linux-options)))
 
+(define-public linux-libre-headers-4.14.67
+  (make-linux-libre-headers "4.14.67"
+                            "050zvdxjy6sc64q75pr1gxsmh49chwav2pwxz8xlif39bvahnrpg"))
+
+(define-public linux-libre-headers linux-libre-headers-4.14.67)
+(define-public linux-libre linux-libre-5.1)
+
 (define-public linux-libre-arm-generic
   (make-linux-libre %linux-libre-version
                     %linux-libre-hash
-- 
2.21.0