From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manolis Ragkousis Subject: Re: [PATCH] gnu: make-bootstrap: Produce the correct %glibc-bootstrap-tarball for Hurd systems. Date: Tue, 26 Jul 2016 16:41:36 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------24D728FA6404DCE8A2B8669D" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS2cE-0006sI-4O for guix-devel@gnu.org; Tue, 26 Jul 2016 09:41:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS2c8-0005HI-7L for guix-devel@gnu.org; Tue, 26 Jul 2016 09:41:45 -0400 In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= Cc: guix-devel@gnu.org This is a multi-part message in MIME format. --------------24D728FA6404DCE8A2B8669D Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hello everyone, This is an updated version of the patch. There was a reference to another patch of mine, so it couldn't apply cleanly on core-updates-next. Ludo is it okay to push to core-updates-next? On 06/17/16 19:09, Manolis Ragkousis wrote: > Hello everyone, > > This is a patch from wip-hurd modified to apply on core-updates. > > Thank you, > Manolis > Thank you, Manolis --------------24D728FA6404DCE8A2B8669D Content-Type: text/x-patch; name="0001-gnu-make-bootstrap-Produce-the-correct-glibc-bootstr.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-gnu-make-bootstrap-Produce-the-correct-glibc-bootstr.pa"; filename*1="tch" =46rom a8541a554f9e1653c78b6b45f323426e330d5215 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Mon, 25 Jul 2016 16:53:40 +0300 Subject: [PATCH] gnu: make-bootstrap: Produce the correct %glibc-bootstrap-tarball for Hurd systems. * gnu/packages/make-bootstrap.scm (%glibc-bootstrap-tarball): Make it a p= rocedure. (%glibc-stripped): Make it a procedure and move the kernel specific par= t from here to ... * guix/build/make-bootstrap.scm (make-stripped-libc): ... here. New file.= * Makefile.am (MODULES): Add it. --- Makefile.am | 1 + gnu/packages/make-bootstrap.scm | 67 +++++++++++--------------------- guix/build/make-bootstrap.scm | 84 +++++++++++++++++++++++++++++++++++= ++++++ 3 files changed, 108 insertions(+), 44 deletions(-) create mode 100644 guix/build/make-bootstrap.scm diff --git a/Makefile.am b/Makefile.am index 0771447..fff2500 100644 --- a/Makefile.am +++ b/Makefile.am @@ -107,6 +107,7 @@ MODULES =3D \ guix/build/emacs-utils.scm \ guix/build/graft.scm \ guix/build/bournish.scm \ + guix/build/make-bootstrap.scm \ guix/search-paths.scm \ guix/packages.scm \ guix/import/utils.scm \ diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstra= p.scm index def9c23..45c09a4 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) @@ -325,61 +326,39 @@ for `sh' in $PATH, and without nscd, and with stati= c NSS modules." #t)))) (inputs `(("binutils" ,%binutils-static))))) =20 -(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 "kernel-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|n= sl|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-generi= c") - (string-append incdir "/asm-generic")) - - #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))) - ("kernel-headers" ,linux-libre-headers))) + glibc))))) =20 ;; Only one output. (outputs '("out"))))) @@ -639,9 +618,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)) =20 -(define %glibc-bootstrap-tarball +(define (%glibc-bootstrap-tarball) ;; A tarball with GNU libc's shared libraries, dynamic linker, and hea= ders. - (tarball-package %glibc-stripped)) + (tarball-package (%glibc-stripped))) =20 (define %gcc-bootstrap-tarball ;; A tarball with a dynamic-linked GCC and its headers. @@ -681,7 +660,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 "Tarballs containing all the bootstrap binaries") (description synopsis) diff --git a/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.sc= m new file mode 100644 index 0000000..283a13e --- /dev/null +++ b/guix/build/make-bootstrap.scm @@ -0,0 +1,84 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2015 Manolis Fragkiskos Ragkousis +;;; Copyright =C2=A9 2015 Ludovic Court=C3=A8s +;;; +;;; 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 (a= t +;;; 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 . + +(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)) + +;; Commentary: +;; +;; This module provides facilities to build the bootstrap binaries. +;; +;; Code: + +(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)) + =20 + (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/lin= ux/" 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-gene= ric") + (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(\\..*)?|\ +lib(machuser|hurduser).so.*|libc(rt|)_nonshared\\.a)$")) + #t) + + (if (directory-exists? (string-append kernel-headers "/include/mach"= )) + (copy-mach-headers output kernel-headers) + (copy-linux-headers output kernel-headers))) + + --=20 2.9.0 --------------24D728FA6404DCE8A2B8669D--