guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

142/210: gnu: Add %linux-libre-headers-stripped, %linux-libre-headers-bo


From: Jan Nieuwenhuizen
Subject: 142/210: gnu: Add %linux-libre-headers-stripped, %linux-libre-headers-bootstrap-tarball.
Date: Sat, 8 Sep 2018 10:36:23 -0400 (EDT)

janneke pushed a commit to branch wip-bootstrap
in repository guix.

commit 89051cdc8cbf3c157c9073fba5ba5739f864a43c
Author: Jan Nieuwenhuizen <address@hidden>
Date:   Thu Aug 23 22:56:33 2018 +0200

    gnu: Add %linux-libre-headers-stripped, 
%linux-libre-headers-bootstrap-tarball.
    
    * guix/build/make-bootstrap.scm (copy-linux-headers): Extracted and from
    make-stripped-libc, removed libc dependency.  FIXME.
    * gnu/packages/make-bootstrap.scm (%linux-libre-headers-stripped,
    %linux-libre-headers-bootstrap-tarball): New variable.
---
 gnu/packages/bootstrap.scm      | 44 +++++++++++++++++++++++++++++++++++++++++
 gnu/packages/make-bootstrap.scm | 25 +++++++++++++++++++++++
 guix/build/make-bootstrap.scm   | 42 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 110 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index cdca9cd..d4904c1 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -141,6 +141,50 @@ return value is ignored."
     (home-page #f)
     (license gpl3+)))
 
+;;; FIXME: do not run PROGRAM if false -- copied to avoid rebuilding world
+;;; while developing...
+(define* (package-from-tarball-possibly-without-test name source 
program-to-test description
+                                                     #:key snippet)
+  "Return a package that correspond to the extraction of SOURCE.
+PROGRAM-TO-TEST is #f or a string: the program to run after extraction of
+SOURCE to check whether everything is alright.  If SNIPPET is provided, it is
+evaluated after extracting SOURCE.  SNIPPET should return true if successful,
+or false to signal an error."
+  (package
+    (name name)
+    (version "0")
+    (build-system trivial-build-system)
+    (arguments
+     `(#:guile ,%bootstrap-guile
+       #:modules ((guix build utils))
+       #:builder
+       (let ((out     (assoc-ref %outputs "out"))
+             (tar     (assoc-ref %build-inputs "tar"))
+             (xz      (assoc-ref %build-inputs "xz"))
+             (tarball (assoc-ref %build-inputs "tarball")))
+         (use-modules (guix build utils))
+
+         (mkdir out)
+         (copy-file tarball "binaries.tar.xz")
+         (system* xz "-d" "binaries.tar.xz")
+         (let ((builddir (getcwd)))
+           (with-directory-excursion out
+             (and (zero? (system* tar "xvf"
+                                  (string-append builddir "/binaries.tar")))
+                  ,@(if snippet (list snippet) '())
+                  (or (not ,program-to-test)
+                      (zero? (system* (string-append "bin/" ,program-to-test)
+                                      "--version")))))))))
+    (inputs
+     `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
+       ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
+       ("tarball" ,(bootstrap-origin (source (%current-system))))))
+    (source #f)
+    (synopsis description)
+    (description description)
+    (home-page #f)
+    (license gpl3+)))
+
 (define package-with-bootstrap-guile
   (mlambdaq (p)
     "Return a variant of P such that all its origins are fetched with
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index a84cfb3..e78251a 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -43,6 +43,7 @@
   #:export (%bootstrap-binaries-tarball
             %diffutils-bootstrap-tarball
             %make-bootstrap-tarball
+            %linux-libre-headers-bootstrap-tarball
             %binutils-bootstrap-tarball
             %glibc-bootstrap-tarball
             %gcc-bootstrap-tarball
@@ -399,6 +400,26 @@ for `sh' in $PATH, and without nscd, and with static NSS 
modules."
            #t))))
     (inputs `(("make" ,%make-static)))))
 
+(define %linux-libre-headers-stripped
+  ;; The subset of Linux-Libre-Headers that we need.
+  (package (inherit linux-libre-headers)
+    (name (string-append (package-name linux-libre-headers) "-stripped"))
+    (build-system trivial-build-system)
+    (outputs '("out"))
+    (arguments
+     `(#:modules ((guix build utils)
+                  (guix build make-bootstrap))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (guix build make-bootstrap))
+
+         (let* ((in  (assoc-ref %build-inputs "linux-libre-headers"))
+                (out (assoc-ref %outputs "out")))
+           (copy-linux-headers out in)
+           #t))))
+    (inputs `(("linux-libre-headers" ,linux-libre-headers)))))
+
 (define %binutils-static
   ;; Statically-linked Binutils.
   (package (inherit binutils)
@@ -758,6 +779,10 @@ for `sh' in $PATH, and without nscd, and with static NSS 
modules."
   ;; A tarball with the statically-linked Make programs.
   (tarball-package %make-static-stripped))
 
+(define %linux-libre-headers-bootstrap-tarball
+  ;; A tarball with the statically-linked Linux-Libre-Headers programs.
+  (tarball-package %linux-libre-headers-stripped))
+
 (define %binutils-bootstrap-tarball
   ;; A tarball with the statically-linked Binutils programs.
   (tarball-package %binutils-static-stripped))
diff --git a/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.scm
index 43b1362..5dd268f 100644
--- a/guix/build/make-bootstrap.scm
+++ b/guix/build/make-bootstrap.scm
@@ -23,7 +23,8 @@
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (guix build utils)
-  #:export (make-stripped-libc))
+  #:export (copy-linux-headers
+            make-stripped-libc))
 
 ;; Commentary:
 ;;
@@ -31,6 +32,45 @@
 ;;
 ;; Code:
 
+;; FIXME: extracted/copied from make-stripped-libc
+(define (copy-linux-headers output kernel-headers)
+  (let* ((incdir (string-append output "/include")))
+    (mkdir-p incdir)
+
+    ;; Copy some of the Linux-Libre headers that glibc headers
+    ;; refer to.
+    (mkdir (string-append incdir "/linux"))
+    (for-each (lambda (file)
+                (install-file (string-append kernel-headers "/include/linux/" 
file)
+                              (string-append incdir "/linux")))
+              '(
+                "a.out.h"
+                "atalk.h"
+                "errno.h"
+                "falloc.h"
+                "if_ether.h"
+                "ioctl.h"
+                "kernel.h"
+                "limits.h"
+                "param.h"
+                "posix_types.h"
+                "socket.h"
+                "stddef.h"
+                "swab.h"
+                "sysctl.h"
+                "sysinfo.h"
+                "types.h"
+                "version.h"
+                ))
+
+    (copy-recursively (string-append kernel-headers "/include/asm")
+                      (string-append incdir "/asm"))
+    (copy-recursively (string-append kernel-headers "/include/asm-generic")
+                      (string-append incdir "/asm-generic"))
+    (copy-recursively (string-append kernel-headers "/include/linux/byteorder")
+                      (string-append incdir "/linux/byteorder"))
+    #t))
+
 (define (make-stripped-libc output libc kernel-headers)
   "Copy to OUTPUT the subset of LIBC and KERNEL-HEADERS that is needed
 when producing a bootstrap libc."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]