From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manolis Ragkousis Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system. Date: Fri, 24 Jun 2016 16:55:29 +0300 Message-ID: <73d9a0c2-15df-2064-f17a-4f23780e8e06@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------887E834CA3D31EEBD50590C0" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGRaB-0007ks-0Z for guix-devel@gnu.org; Fri, 24 Jun 2016 09:55:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGRa8-0007Un-6N for guix-devel@gnu.org; Fri, 24 Jun 2016 09:55:41 -0400 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: guix-devel@gnu.org This is a multi-part message in MIME format. --------------887E834CA3D31EEBD50590C0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hello everyone, This patch is from wip-hurd modified to apply to core-udpates. If it's okay I will push it to core-updates-next. Thank you, Manolis --------------887E834CA3D31EEBD50590C0 Content-Type: text/x-patch; name="0001-gnu-commencement-Add-support-for-a-native-GNU-Hurd-s.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-gnu-commencement-Add-support-for-a-native-GNU-Hurd-s.pa"; filename*1="tch" =46rom 151868431cf3faafbf388dd2815745b3760ac12f Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Fri, 24 Jun 2016 16:10:15 +0300 Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd sys= tem. * gnu/packages/commencement.scm (kernel-headers-boot0, ld-wrapper-boot0, bison-boot0, flex-boot0, gnumach-headers-boot0, mig-boot0, hurd-headers-boot0, hurd-minimal-boot0, hurd-kernel-headers-boot0): New variables. (bison-boot1): Remove. (%boot1-inputs): Add ld-wrapper-boot0. (glibc-final-with-bootstrap-bash)[arguments]: Allow libpthread to find libihash. [propagated-inputs]: Use kernel-headers-boot0. [inputs]: Add "mig". (glibc-final)[arguments]: Use kernel-headers-boot0. (static-bash-for-glibc, bash-final)[native-inputs]: Use bison-boot0. --- gnu/packages/commencement.scm | 158 ++++++++++++++++++++++++++++++++++--= ------ 1 file changed, 128 insertions(+), 30 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.sc= m index 8c82644..8866ab0 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -27,15 +27,18 @@ #:use-module (gnu packages bash) #:use-module (gnu packages gcc) #:use-module (gnu packages m4) + #:use-module (gnu packages indent) #:use-module (gnu packages file) #:use-module (gnu packages gawk) #:use-module (gnu packages bison) + #:use-module (gnu packages flex) #:use-module (gnu packages guile) #:use-module (gnu packages gettext) #:use-module (gnu packages multiprecision) #:use-module (gnu packages compression) #:use-module (gnu packages perl) #:use-module (gnu packages linux) + #:use-module (gnu packages hurd) #:use-module (gnu packages texinfo) #:use-module (gnu packages pkg-config) #:use-module (guix packages) @@ -46,7 +49,8 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 vlist) - #:use-module (ice-9 match)) + #:use-module (ice-9 match) + #:use-module (ice-9 regex)) =20 ;;; Commentary: ;;; @@ -289,6 +293,44 @@ (current-source-location) #:guile %bootstrap-guile)))) =20 +(define bison-boot0 + ;; This Bison is needed to build MiG so we need it early in the proces= s. + ;; It is also needed to rebuild Bash's parser, which is modified by + ;; its CVE patches. Remove it when it's no longer needed. + (let* ((m4 (package-with-bootstrap-guile + (package-with-explicit-inputs m4 %boot0-inputs + (current-source-location)= + #:guile %bootstrap-guile)= )) + (bison (package (inherit bison) + (propagated-inputs `(("m4" ,m4))) + (inputs '()) ;remove Flex... + (arguments + '(#:tests? #f ;... and thus disable = tests + + ;; Zero timestamps in liby.a; this must be done + ;; explicitly here because the bootstrap Binutils d= on't + ;; do that (default is "cru".) + #:make-flags '("ARFLAGS=3DcrD" "RANLIB=3Dranlib -D"= + "V=3D1")))))) + (package + (inherit (package-with-bootstrap-guile + (package-with-explicit-inputs bison %boot0-inputs + (current-source-location) + #:guile %bootstrap-guile))= ) + (native-inputs `(("perl" ,perl-boot0)))))) + +(define flex-boot0 + ;; This Flex is needed to build MiG. + (let* ((flex (package (inherit flex) + (native-inputs `(("bison" ,bison-boot0))) + (propagated-inputs `(("m4" ,m4))) + (inputs `(("indent" ,indent))) + (arguments '(#:tests? #f))))) + (package-with-bootstrap-guile + (package-with-explicit-inputs flex %boot0-inputs + (current-source-location) + #:guile %bootstrap-guile)))) + (define (linux-libre-headers-boot0) "Return Linux-Libre header files for the bootstrap environment." ;; Note: this is wrapped in a thunk to nicely handle circular dependen= cies @@ -302,6 +344,63 @@ `(("perl" ,perl-boot0) ,@%boot0-inputs))))) =20 +(define gnumach-headers-boot0 + (package-with-bootstrap-guile + (package-with-explicit-inputs gnumach-headers + %boot0-inputs + (current-source-location) + #:guile %bootstrap-guile))) + +(define mig-boot0 + (let* ((mig (package (inherit mig) + (native-inputs `(("bison" ,bison-boot0) + ("flex" ,flex-boot0))) + (inputs `(("flex" ,flex-boot0))) + (arguments + `(#:configure-flags + `(,(string-append "LDFLAGS=3D-Wl,-rpath=3D" + (assoc-ref %build-inputs "flex") "= /lib/"))))))) + (package-with-bootstrap-guile + (package-with-explicit-inputs mig %boot0-inputs + (current-source-location) + #:guile %bootstrap-guile)))) + +(define hurd-headers-boot0 + (let ((hurd-headers (package (inherit hurd-headers) + (native-inputs `(("mig" ,mig-boot0))) + (inputs '())))) + (package-with-bootstrap-guile + (package-with-explicit-inputs hurd-headers %boot0-inputs + (current-source-location) + #:guile %bootstrap-guile)))) + +(define hurd-minimal-boot0 + (let ((hurd-minimal (package (inherit hurd-minimal) + (native-inputs `(("mig" ,mig-boot0))) + (inputs '())))) + (package-with-bootstrap-guile + (package-with-explicit-inputs hurd-minimal %boot0-inputs + (current-source-location) + #:guile %bootstrap-guile)))) + +(define (hurd-core-headers-boot0) + "Return the Hurd and Mach headers as well as initial Hurd libraries fo= r +the bootstrap environment." + (package-with-bootstrap-guile + (package (inherit hurd-core-headers) + (arguments `(#:guile ,%bootstrap-guile + ,@(package-arguments hurd-core-headers)= )) + (inputs + `(("gnumach-headers" ,gnumach-headers-boot0) + ("hurd-headers" ,hurd-headers-boot0) + ("hurd-minimal" ,hurd-minimal-boot0) + ,@%boot0-inputs))))) + +(define* (kernel-headers-boot0 #:optional (system (%current-system))) + (match system + ("i586-gnu" (hurd-core-headers-boot0)) + (_ (linux-libre-headers-boot0)))) + (define texinfo-boot0 ;; Texinfo used to build libc's manual. ;; We build without ncurses because it fails to build at this stage, a= nd @@ -320,9 +419,19 @@ (current-source-location) #:guile %bootstrap-guile)))) =20 +(define ld-wrapper-boot0 + ;; We need this so binaries on Hurd will have libmachuser and libhurdu= ser + ;; in their RUNPATH, otherwise validate-runpath will fail. + (make-ld-wrapper (string-append "ld-wrapper-" (boot-triplet)) + #:target (boot-triplet) + #:binutils binutils-boot0 + #:guile %bootstrap-guile + #:bash (car (assoc-ref %boot0-inputs "bash")))) + (define %boot1-inputs ;; 2nd stage inputs. `(("gcc" ,gcc-boot0) + ("ld-wrapper-cross" ,ld-wrapper-boot0) ("binutils-cross" ,binutils-boot0) ,@(alist-delete "binutils" %boot0-inputs))) =20 @@ -356,6 +465,15 @@ (setenv "NATIVE_CPATH" (getenv "CPATH")) (unsetenv "CPATH") =20 + ;; Tell 'libpthread' where to find 'libihash' on Hurd s= ystems. + ,@(if (string-match "i586-gnu" (%current-system)) + `((substitute* "libpthread/Makefile" + (("LDLIBS-pthread.so =3D.*") + (string-append "LDLIBS-pthread.so =3D " + (assoc-ref %build-inputs "ker= nel-headers") + "/lib/libihash.a\n")))) + '()) + ;; 'rpcgen' needs native libc headers to be built. (substitute* "sunrpc/Makefile" (("sunrpc-CPPFLAGS =3D.*" all) @@ -363,7 +481,7 @@ "export CPATH\n" all "\n")))) ,phases))))) - (propagated-inputs `(("kernel-headers" ,(linux-libre-headers-boot0)= ))) + (propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0)))) (native-inputs `(("texinfo" ,texinfo-boot0) ("perl" ,perl-boot0))) @@ -372,6 +490,11 @@ ;; it in $CPATH, hence the 'pre-configure' phase above. ,@%boot1-inputs =20 + ;; A native MiG is needed to build Glibc on Hurd. + ,@(if (string-match "i586-gnu" (%current-system)) + `(("mig" ,mig-boot0)) + '()) + ;; A native GCC is needed to build `cross-rpcgen'. ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc")) =20 @@ -430,31 +553,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~= a/~a \"$@\"~%" ("bash" ,bash))) (inputs '()))) =20 -(define bison-boot1 - ;; XXX: This Bison is needed to rebuild Bash's parser, which is modifi= ed by - ;; its CVE patches. Remove it when it's no longer needed. - (let* ((m4 (package-with-bootstrap-guile - (package-with-explicit-inputs m4 %boot0-inputs - (current-source-location)= - #:guile %bootstrap-guile)= )) - (bison (package (inherit bison) - (propagated-inputs `(("m4" ,m4))) - (inputs '()) ;remove Flex... - (arguments - '(#:tests? #f ;... and thus disable = tests - - ;; Zero timestamps in liby.a; this must be done - ;; explicitly here because the bootstrap Binutils d= on't - ;; do that (default is "cru".) - #:make-flags '("ARFLAGS=3DcrD" "RANLIB=3Dranlib -D"= - "V=3D1")))))) - (package - (inherit (package-with-bootstrap-guile - (package-with-explicit-inputs bison %boot0-inputs - (current-source-location) - #:guile %bootstrap-guile))= ) - (native-inputs `(("perl" ,perl-boot0)))))) - (define static-bash-for-glibc ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & c= o. (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 @@ -473,7 +571,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a= /~a \"$@\"~%" (package-with-explicit-inputs bash inputs (current-source-location) #:guile %bootstrap-guile))= ) - (native-inputs `(("bison" ,bison-boot1)))))) + (native-inputs `(("bison" ,bison-boot0)))))) =20 (define gettext-boot0 ;; A minimal gettext used during bootstrap. @@ -527,7 +625,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a= /~a \"$@\"~%" ;; if 'allowed-references' were per-output. (arguments `(#:allowed-references - ,(cons* `(,gcc-boot0 "lib") (linux-libre-headers-boot0) + ,(cons* `(,gcc-boot0 "lib") (kernel-headers-boot0) static-bash-for-glibc (package-outputs glibc-final-with-bootstrap-bash)) =20 @@ -685,7 +783,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a= /~a \"$@\"~%" %boot3-inputs (current-source-location) #:guile %bootstrap-guile))) - (native-inputs `(("bison" ,bison-boot1))))) + (native-inputs `(("bison" ,bison-boot0))))) =20 (define %boot4-inputs ;; Now use the final Bash. --=20 2.8.3 --------------887E834CA3D31EEBD50590C0--