all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Manolis Ragkousis <manolis837@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel <Guix-devel@gnu.org>
Subject: Re: [PATCH] gnu: make-bootstrap: Produce the correct %glibc-bootstrap-tarball for Hurd systems.
Date: Thu, 2 Jul 2015 00:50:47 +0300	[thread overview]
Message-ID: <CAFtzXzOv693nZzpFmBqVp2GN8FxTn03q=o8nZdfz4qNGE9AFZg@mail.gmail.com> (raw)
In-Reply-To: <87egktynp0.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

Καλησπέρα :-)

Updated patch according to your suggestions.

Your solution is much more elegant. I added you as a co-author, I hope
you don't have a problem with that. :-)

Manolis

[-- Attachment #2: 0001-gnu-make-bootstrap-Produce-the-correct-glibc-bootstr.patch --]
[-- Type: text/x-patch, Size: 10085 bytes --]

From e93fe7ae5b22245d41814e079279a8e893781287 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Tue, 30 Jun 2015 12:53:24 +0300
Subject: [PATCH] gnu: make-bootstrap: Produce the correct
 %glibc-bootstrap-tarball for Hurd systems.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/make-bootstrap.scm (%glibc-bootstrap-tarball): Make it a procedure.
  (%glibc-stripped): Make it a procedure and move the kernel specific part from
  here to ...
* guix/build/make-bootstrap.scm (make-stripped-libc): ... here. New file.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/packages/make-bootstrap.scm | 71 ++++++++++++-------------------------
 guix/build/make-bootstrap.scm   | 77 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+), 48 deletions(-)
 create mode 100644 guix/build/make-bootstrap.scm

diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 3d43421..852044d 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -33,6 +33,7 @@
   #:use-module (gnu packages guile)
   #:use-module (gnu packages bdw-gc)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages hurd)
   #:use-module (gnu packages multiprecision)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -327,65 +328,39 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
            #t))))
     (inputs `(("binutils" ,%binutils-static)))))
 
-(define %glibc-stripped
+(define (%glibc-stripped)
   ;; GNU libc's essential shared libraries, dynamic linker, and headers,
   ;; with all references to store directories stripped.  As a result,
   ;; libc.so is unusable and need to be patched for proper relocation.
+  (define (hurd-triplet? triplet)
+    (and (string-suffix? "-gnu" triplet)
+         (not (string-contains triplet "linux"))))
+
   (let ((glibc (glibc-for-bootstrap)))
     (package (inherit glibc)
       (name "glibc-stripped")
       (build-system trivial-build-system)
       (arguments
-       `(#:modules ((guix build utils))
+       `(#:modules ((guix build utils)
+                    (guix build make-bootstrap))
          #:builder
          (begin
-           (use-modules (guix build utils))
-
-           (setvbuf (current-output-port) _IOLBF)
-           (let* ((out    (assoc-ref %outputs "out"))
-                  (libdir (string-append out "/lib"))
-                  (incdir (string-append out "/include"))
-                  (libc   (assoc-ref %build-inputs "libc"))
-                  (linux  (assoc-ref %build-inputs "linux-headers")))
-             (mkdir-p libdir)
-             (for-each (lambda (file)
-                         (let ((target (string-append libdir "/"
-                                                      (basename file))))
-                           (copy-file file target)
-                           (remove-store-references target)))
-                       (find-files (string-append libc "/lib")
-                                   "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$"))
-
-             (copy-recursively (string-append libc "/include") incdir)
-
-             ;; Copy some of the Linux-Libre headers that glibc headers
-             ;; refer to.
-             (mkdir (string-append incdir "/linux"))
-             (for-each (lambda (file)
-                         (copy-file (string-append linux "/include/linux/" file)
-                                    (string-append incdir "/linux/"
-                                                   (basename file))))
-                       '("limits.h" "errno.h" "socket.h" "kernel.h"
-                         "sysctl.h" "param.h" "ioctl.h" "types.h"
-                         "posix_types.h" "stddef.h"))
-
-             (copy-recursively (string-append linux "/include/asm")
-                               (string-append incdir "/asm"))
-             (copy-recursively (string-append linux "/include/asm-generic")
-                               (string-append incdir "/asm-generic"))
-
-             ;; Remove the '.install' and '..install.cmd' files; the latter
-             ;; contains store paths, which prevents bit reproducibility.
-             (for-each delete-file (find-files incdir "\\.install"))
-
-             #t))))
-      (inputs `(("libc" ,(let ((target (%current-target-system)))
+           (use-modules (guix build make-bootstrap))
+           (make-stripped-libc (assoc-ref %outputs "out")
+                               (assoc-ref %build-inputs "libc")
+                               (assoc-ref %build-inputs "kernel-headers")))))
+      (inputs `(("kernel-headers"
+                 ,(if (or (and (%current-target-system)
+                               (hurd-triplet? (%current-target-system)))
+                          (string-suffix? "-hurd" (%current-system)))
+                      gnumach-headers
+                      linux-libre-headers))
+                ("libc" ,(let ((target (%current-target-system)))
                            (if target
                                (glibc-for-bootstrap
                                 (parameterize ((%current-target-system #f))
                                   (cross-libc target)))
-                               glibc)))
-                ("linux-headers" ,linux-libre-headers)))
+                               glibc)))))
 
       ;; Only one output.
       (outputs '("out")))))
@@ -641,9 +616,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
   ;; A tarball with the statically-linked Binutils programs.
   (tarball-package %binutils-static-stripped))
 
-(define %glibc-bootstrap-tarball
+(define (%glibc-bootstrap-tarball)
   ;; A tarball with GNU libc's shared libraries, dynamic linker, and headers.
-  (tarball-package %glibc-stripped))
+  (tarball-package (%glibc-stripped)))
 
 (define %gcc-bootstrap-tarball
   ;; A tarball with a dynamic-linked GCC and its headers.
@@ -683,7 +658,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
     (inputs `(("guile-tarball" ,%guile-bootstrap-tarball)
               ("gcc-tarball" ,%gcc-bootstrap-tarball)
               ("binutils-tarball" ,%binutils-bootstrap-tarball)
-              ("glibc-tarball" ,%glibc-bootstrap-tarball)
+              ("glibc-tarball" ,(%glibc-bootstrap-tarball))
               ("coreutils&co-tarball" ,%bootstrap-binaries-tarball)))
     (synopsis #f)
     (description #f)
diff --git a/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.scm
new file mode 100644
index 0000000..13669ba
--- /dev/null
+++ b/guix/build/make-bootstrap.scm
@@ -0,0 +1,77 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
+;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build make-bootstrap)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-19)
+  #:use-module (srfi srfi-26)
+  #:use-module (guix build utils)
+  #:export (make-stripped-libc))
+
+(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."
+
+  (define (copy-mach-headers output kernel-headers)
+    (let* ((incdir (string-append output "/include")))
+      (copy-recursively (string-append libc "/include") incdir)
+
+      (copy-recursively (string-append kernel-headers "/include/mach")
+                        (string-append incdir "/mach"))
+      #t))
+  
+  (define (copy-linux-headers output kernel-headers)
+    (let* ((incdir (string-append output "/include")))
+      (copy-recursively (string-append libc "/include") incdir)
+
+      ;; Copy some of the Linux-Libre headers that glibc headers
+      ;; refer to.
+      (mkdir (string-append incdir "/linux"))
+      (for-each (lambda (file)
+                  (copy-file (string-append kernel-headers "/include/linux/" file)
+                             (string-append incdir "/linux/"
+                                            (basename file))))
+                '("limits.h" "errno.h" "socket.h" "kernel.h"
+                  "sysctl.h" "param.h" "ioctl.h" "types.h"
+                  "posix_types.h" "stddef.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"))
+      #t))
+
+  (setvbuf (current-output-port) _IOLBF)
+  (let* ((libdir (string-append output "/lib")))
+    (mkdir-p libdir)
+    (for-each (lambda (file)
+                (let ((target (string-append libdir "/"
+                                             (basename file))))
+                  (copy-file file target)
+                  (remove-store-references target)))
+              (find-files (string-append libc "/lib")
+                          "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$"))
+    #t)
+
+    (if (directory-exists? (string-append kernel-headers "/include/mach"))
+        (copy-mach-headers output kernel-headers)
+        (copy-linux-headers output kernel-headers)))
+
+
-- 
2.4.5


  reply	other threads:[~2015-07-01 21:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 10:14 [PATCH] gnu: make-bootstrap: Produce the correct %glibc-bootstrap-tarball for Hurd systems Manolis Ragkousis
2015-06-30 19:56 ` Ludovic Courtès
2015-07-01 21:50   ` Manolis Ragkousis [this message]
2015-07-07 14:58     ` Ludovic Courtès
2015-07-09  9:54       ` Manolis Ragkousis
2015-07-10 20:48         ` Ludovic Courtès
2015-07-11  8:29           ` Manolis Ragkousis
2015-07-12 12:43             ` Manolis Ragkousis
2015-07-13 20:43               ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2016-06-17 16:09 Manolis Ragkousis
2016-07-26 13:41 ` Manolis Ragkousis
2016-07-26 14:44   ` Ludovic Courtès
2016-12-07  9:55     ` Manolis Ragkousis
2016-12-07 10:50       ` Ludovic Courtès
2016-12-07 11:01         ` Manolis Ragkousis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFtzXzOv693nZzpFmBqVp2GN8FxTn03q=o8nZdfz4qNGE9AFZg@mail.gmail.com' \
    --to=manolis837@gmail.com \
    --cc=Guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.