* [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
@ 2016-06-24 13:55 Manolis Ragkousis
2016-06-26 21:49 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Manolis Ragkousis @ 2016-06-24 13:55 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 151 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-commencement-Add-support-for-a-native-GNU-Hurd-s.patch --]
[-- Type: text/x-patch; name="0001-gnu-commencement-Add-support-for-a-native-GNU-Hurd-s.patch", Size: 12704 bytes --]
From 151868431cf3faafbf388dd2815745b3760ac12f Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Fri, 24 Jun 2016 16:10:15 +0300
Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
* 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.scm
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))
;;; Commentary:
;;;
@@ -289,6 +293,44 @@
(current-source-location)
#:guile %bootstrap-guile))))
+(define bison-boot0
+ ;; This Bison is needed to build MiG so we need it early in the process.
+ ;; 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 don't
+ ;; do that (default is "cru".)
+ #:make-flags '("ARFLAGS=crD" "RANLIB=ranlib -D"
+ "V=1"))))))
+ (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 dependencies
@@ -302,6 +344,63 @@
`(("perl" ,perl-boot0)
,@%boot0-inputs)))))
+(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=-Wl,-rpath="
+ (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 for
+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, and
@@ -320,9 +419,19 @@
(current-source-location)
#:guile %bootstrap-guile))))
+(define ld-wrapper-boot0
+ ;; We need this so binaries on Hurd will have libmachuser and libhurduser
+ ;; 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)))
@@ -356,6 +465,15 @@
(setenv "NATIVE_CPATH" (getenv "CPATH"))
(unsetenv "CPATH")
+ ;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
+ ,@(if (string-match "i586-gnu" (%current-system))
+ `((substitute* "libpthread/Makefile"
+ (("LDLIBS-pthread.so =.*")
+ (string-append "LDLIBS-pthread.so = "
+ (assoc-ref %build-inputs "kernel-headers")
+ "/lib/libihash.a\n"))))
+ '())
+
;; 'rpcgen' needs native libc headers to be built.
(substitute* "sunrpc/Makefile"
(("sunrpc-CPPFLAGS =.*" 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
+ ;; 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"))
@@ -430,31 +553,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
("bash" ,bash)))
(inputs '())))
-(define bison-boot1
- ;; XXX: This Bison is 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 don't
- ;; do that (default is "cru".)
- #:make-flags '("ARFLAGS=crD" "RANLIB=ranlib -D"
- "V=1"))))))
- (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) & co.
(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))))))
(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))
@@ -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)))))
(define %boot4-inputs
;; Now use the final Bash.
--
2.8.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
2016-06-24 13:55 [PATCH] gnu: commencement: Add support for a native GNU/Hurd system Manolis Ragkousis
@ 2016-06-26 21:49 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2016-06-26 21:49 UTC (permalink / raw)
To: Manolis Ragkousis; +Cc: guix-devel
Hi!
Manolis Ragkousis <manolis837@gmail.com> skribis:
> From 151868431cf3faafbf388dd2815745b3760ac12f Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Fri, 24 Jun 2016 16:10:15 +0300
> Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
>
> * 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.
OK for ‘core-updates-next’.
Please also run something like this on GNU/Linux:
./pre-inst-env guix build -e '(@@ (gnu packages commencement) glibc-final)'
to make sure nothing obvious broke (this runs in a couple of hours on my
laptop IIRC.)
[...]
> +(define* (kernel-headers-boot0 #:optional (system (%current-system)))
> + (match system
> + ("i586-gnu" (hurd-core-headers-boot0))
> + (_ (linux-libre-headers-boot0))))
In an subsequent patch, it might make sense to define ‘kernel-headers’
as a macro like you did for glibc; WDYT?
> + ;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
> + ,@(if (string-match "i586-gnu" (%current-system))
[...]
> + ;; A native MiG is needed to build Glibc on Hurd.
> + ,@(if (string-match "i586-gnu" (%current-system))
In a subsequent patch, could you add:
(define* (hurd? #:optional (system (%current-system)))
(string=? "i585-gnu" (%current-system)))
and use it?
That will make it easier on the day where GNU/Hurd supports other
arches.
These conditionals aren’t great in terms of readability/maintainability.
We should start thinking of a better approach, a mechanism similar in
spirit to “sysdeps” in glibc, which would allow us to weave
platform-specific concerns without having to wire conditionals
everywhere. I don’t have a clear plan in mind, but there’s definitely
something to do here!
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
@ 2015-08-27 19:53 Manolis Ragkousis
2015-09-02 12:56 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Manolis Ragkousis @ 2015-08-27 19:53 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 122 bytes --]
This patch adds the parts needed by guix to build the final
toolchain. This also adds the ld-wrapper I was talking about.
[-- Attachment #2: 0001-gnu-commencement-Add-support-for-a-native-GNU-Hurd-s.patch --]
[-- Type: text/x-patch, Size: 11227 bytes --]
From 3a2f644bfdb39349c585233ef6670081adf57eca Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Fri, 21 Aug 2015 15:01:05 +0300
Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
* gnu/packages/commencement.scm (kernel-headers-boot0): New procedure.
(flex-boot0, bison-boot0, gnumach-headers-boot0, mig-boot0,
hurd-headers-boot0, hurd-minimal-boot0, hurd-kernel-headers-boot0, ld-wrapper-boot0): New variables.
(%boot1-inputs): Add ld-wrapper-boot0.
(glibc-final-with-bootstrap-bash)[propagated-inputs]: Replace with kernel-headers-boot0.
[inputs]: Add "mig".
(glibc-final)[arguments]: Replace with kernel-headers-boot0.
---
gnu/packages/commencement.scm | 141 +++++++++++++++++++++++++++++++++++++-----
1 file changed, 125 insertions(+), 16 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 74c3f30..725dbe9 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))
;;; Commentary:
;;;
@@ -265,6 +269,42 @@
(current-source-location)
#:guile %bootstrap-guile)))
+(define flex-boot0
+ ;; This Flex is needed to build Mig.
+ (let* ((m4 (package-with-bootstrap-guile
+ (package-with-explicit-inputs m4 %boot0-inputs
+ (current-source-location)
+ #:guile %bootstrap-guile)))
+ (indent (package-with-bootstrap-guile
+ (package-with-explicit-inputs indent %boot0-inputs
+ (current-source-location)
+ #:guile %bootstrap-guile)))
+ (flex (package (inherit flex)
+ (native-inputs '())
+ (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 bison-boot0
+ ;; This Bison is needed to build Mig so we need it early in the process.
+ (let* ((m4 (package-with-bootstrap-guile
+ (package-with-explicit-inputs m4 %boot0-inputs
+ (current-source-location)
+ #:guile %bootstrap-guile)))
+ (bison (package (inherit bison)
+ (native-inputs `(("perl" ,perl-boot0)))
+ (propagated-inputs `(("m4" ,m4)))
+ (inputs '()) ;remove Flex...
+ (arguments '(#:tests? #f))))) ;... and thus disable tests
+ (package-with-bootstrap-guile
+ (package-with-explicit-inputs bison %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 dependencies
@@ -278,6 +318,58 @@
`(("perl" ,perl-boot0)
,@%boot0-inputs)))))
+(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 '()))))
+ (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-kernel-headers-boot0)
+ "Return Hurd header and minimal-lib files for the bootstrap environment.".
+ (package-with-bootstrap-guile
+ (package (inherit hurd-kernel-headers)
+ (arguments `(#:guile ,%bootstrap-guile
+ ,@(package-arguments hurd-kernel-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-kernel-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, and
@@ -291,9 +383,19 @@
(current-source-location)
#:guile %bootstrap-guile))))
+(define ld-wrapper-boot0
+ ;; We need this so binaries on Hurd will have libmachuser and libhurduser
+ ;; 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)))
@@ -327,6 +429,15 @@
(setenv "NATIVE_CPATH" (getenv "CPATH"))
(unsetenv "CPATH")
+ ;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
+ ,@(if (string-match "i586-gnu" (%current-system))
+ `((substitute* "libpthread/Makefile"
+ (("LDLIBS-pthread.so =.*")
+ (string-append "LDLIBS-pthread.so = "
+ (assoc-ref %build-inputs "kernel-headers")
+ "/lib/libihash.a\n"))))
+ '())
+
;; 'rpcgen' needs native libc headers to be built.
(substitute* "sunrpc/Makefile"
(("sunrpc-CPPFLAGS =.*" all)
@@ -334,7 +445,7 @@
"export CPATH\n"
all "\n"))))
,phases)))))
- (propagated-inputs `(("linux-headers" ,(linux-libre-headers-boot0))))
+ (propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0))))
(native-inputs
`(("texinfo" ,texinfo-boot0)
("perl" ,perl-boot0)))
@@ -343,6 +454,11 @@
;; it in $CPATH, hence the 'pre-configure' phase above.
,@%boot1-inputs
+ ;; 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"))
@@ -404,19 +520,11 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(define bison-boot1
;; XXX: This Bison is 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)
- (native-inputs `(("perl" ,perl-boot0)))
- (propagated-inputs `(("m4" ,m4)))
- (inputs '()) ;remove Flex...
- (arguments '(#:tests? #f))))) ;... and thus disable tests
- (package-with-bootstrap-guile
- (package-with-explicit-inputs bison %boot0-inputs
- (current-source-location)
- #:guile %bootstrap-guile))))
+ (let ((bison (package (inherit bison-boot0))))
+ (package-with-bootstrap-guile
+ (package-with-explicit-inputs bison %boot1-inputs
+ (current-source-location)
+ #:guile %bootstrap-guile))))
(define static-bash-for-glibc
;; A statically-linked Bash to be embedded in GLIBC-FINAL, for use by
@@ -443,6 +551,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(package (inherit gnu-gettext)
(name "gettext-boot0")
(inputs '()) ;zero dependencies
+ ;;
(arguments
(substitute-keyword-arguments
`(#:tests? #f
@@ -489,7 +598,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)
(package-outputs glibc-final-with-bootstrap-bash))
,@(package-arguments glibc-final-with-bootstrap-bash)))))
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
2015-08-27 19:53 Manolis Ragkousis
@ 2015-09-02 12:56 ` Ludovic Courtès
2015-09-17 9:29 ` Manolis Ragkousis
0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2015-09-02 12:56 UTC (permalink / raw)
To: Manolis Ragkousis; +Cc: Guix-devel
Manolis Ragkousis <manolis837@gmail.com> skribis:
> From 3a2f644bfdb39349c585233ef6670081adf57eca Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Fri, 21 Aug 2015 15:01:05 +0300
> Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
>
> * gnu/packages/commencement.scm (kernel-headers-boot0): New procedure.
> (flex-boot0, bison-boot0, gnumach-headers-boot0, mig-boot0,
> hurd-headers-boot0, hurd-minimal-boot0, hurd-kernel-headers-boot0, ld-wrapper-boot0): New variables.
> (%boot1-inputs): Add ld-wrapper-boot0.
> (glibc-final-with-bootstrap-bash)[propagated-inputs]: Replace with kernel-headers-boot0.
> [inputs]: Add "mig".
Please align this last line to the left.
> (glibc-final)[arguments]: Replace with kernel-headers-boot0.
[...]
> +(define flex-boot0
> + ;; This Flex is needed to build Mig.
s/Mig/MiG/ in the whole file.
In the future, we should patch MiG upstream so that the Flex and Bison
byproducts are included in the tarball. That would simplify our life.
> + (let* ((m4 (package-with-bootstrap-guile
> + (package-with-explicit-inputs m4 %boot0-inputs
> + (current-source-location)
> + #:guile %bootstrap-guile)))
> + (indent (package-with-bootstrap-guile
> + (package-with-explicit-inputs indent %boot0-inputs
> + (current-source-location)
> + #:guile %bootstrap-guile)))
> + (flex (package (inherit flex)
> + (native-inputs '())
> + (propagated-inputs `(("m4" ,m4)))
> + (inputs `(("indent" ,indent)))
> + (arguments '(#:tests? #f)))))
I think the redefinitions of m4 and indent can be omitted since
‘package-with-explicit-inputs’ works recursively.
> +(define bison-boot0
> + ;; This Bison is needed to build Mig so we need it early in the process.
> + (let* ((m4 (package-with-bootstrap-guile
> + (package-with-explicit-inputs m4 %boot0-inputs
> + (current-source-location)
> + #:guile %bootstrap-guile)))
> + (bison (package (inherit bison)
> + (native-inputs `(("perl" ,perl-boot0)))
> + (propagated-inputs `(("m4" ,m4)))
> + (inputs '()) ;remove Flex...
> + (arguments '(#:tests? #f))))) ;... and thus disable tests
Same here for m4.
> +(define (hurd-kernel-headers-boot0)
> + "Return Hurd header and minimal-lib files for the bootstrap environment.".
^^ ^^ ^^^^^^^^^^
“Return the Hurd and Mach headers as well as initial Hurd libraries for
the bootstrap environment.”
It’s slightly confusing that a “kernel-headers” package provides .a
files, but OK.
> + (define* (kernel-headers-boot0 #:optional (system (%current-system)))
^
Extra space.
> +(define ld-wrapper-boot0
> + ;; We need this so binaries on Hurd will have libmachuser and libhurduser
> + ;; in their RUNPATH, otherwise validate-runpath? will fail.
‘validate-runpath’ (no question mark.)
> (define bison-boot1
> ;; XXX: This Bison is needed to rebuild Bash's parser, which is modified by
> ;; its CVE patches. Remove it when it's no longer needed.
What about s/bison-boot1/bison-boot0/ in the whole file? These are
essentially the same package.
> @@ -443,6 +551,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
> (package (inherit gnu-gettext)
> (name "gettext-boot0")
> (inputs '()) ;zero dependencies
> + ;;
Hmm, yes? :-)
Could you send an updated patch?
Thanks for all the work!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
2015-09-02 12:56 ` Ludovic Courtès
@ 2015-09-17 9:29 ` Manolis Ragkousis
2015-09-22 15:07 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Manolis Ragkousis @ 2015-09-17 9:29 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 45 bytes --]
Sorry for the delay, updated patch.
Manolis
[-- Attachment #2: 0001-gnu-commencement-Add-support-for-a-native-GNU-Hurd-s.patch --]
[-- Type: text/x-patch, Size: 10459 bytes --]
From 877ff9bab11056c221b4d325561e16a46a9ff09d Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Thu, 17 Sep 2015 12:24:17 +0300
Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
* gnu/packages/commencement.scm (kernel-headers-boot0): New procedure.
(flex-boot0, bison-boot0, gnumach-headers-boot0, mig-boot0,
hurd-headers-boot0, hurd-minimal-boot0, hurd-kernel-headers-boot0, ld-wrapper-boot0): New variables.
(%boot1-inputs): Add ld-wrapper-boot0.
(glibc-final-with-bootstrap-bash)[propagated-inputs]: Replace with kernel-headers-boot0.
[inputs]: Add "mig".
(glibc-final)[arguments]: Replace with kernel-headers-boot0.
---
gnu/packages/commencement.scm | 132 +++++++++++++++++++++++++++++++++++-------
1 file changed, 111 insertions(+), 21 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index efc8379..1b691b4 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))
;;; Commentary:
;;;
@@ -265,6 +269,32 @@
(current-source-location)
#:guile %bootstrap-guile)))
+(define flex-boot0
+ ;; This Flex is needed to build MiG.
+ (let* ((flex (package (inherit flex)
+ (native-inputs '())
+ (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 bison-boot0
+ ;; This Bison is needed to build MiG so we need it early in the process.
+ ;; 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* ((bison (package (inherit bison)
+ (native-inputs `(("perl" ,perl-boot0)))
+ (propagated-inputs `(("m4" ,m4)))
+ (inputs '()) ;remove Flex...
+ (arguments '(#:tests? #f))))) ;... and thus disable tests
+ (package-with-bootstrap-guile
+ (package-with-explicit-inputs bison %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 dependencies
@@ -278,6 +308,59 @@
`(("perl" ,perl-boot0)
,@%boot0-inputs)))))
+(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 '()))))
+ (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-kernel-headers-boot0)
+ "Return the Hurd and Mach headers as well as initial Hurd libraries for
+the bootstrap environment."
+ (package-with-bootstrap-guile
+ (package (inherit hurd-kernel-headers)
+ (arguments `(#:guile ,%bootstrap-guile
+ ,@(package-arguments hurd-kernel-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-kernel-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, and
@@ -291,9 +374,19 @@
(current-source-location)
#:guile %bootstrap-guile))))
+(define ld-wrapper-boot0
+ ;; We need this so binaries on Hurd will have libmachuser and libhurduser
+ ;; 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)))
@@ -327,6 +420,15 @@
(setenv "NATIVE_CPATH" (getenv "CPATH"))
(unsetenv "CPATH")
+ ;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
+ ,@(if (string-match "i586-gnu" (%current-system))
+ `((substitute* "libpthread/Makefile"
+ (("LDLIBS-pthread.so =.*")
+ (string-append "LDLIBS-pthread.so = "
+ (assoc-ref %build-inputs "kernel-headers")
+ "/lib/libihash.a\n"))))
+ '())
+
;; 'rpcgen' needs native libc headers to be built.
(substitute* "sunrpc/Makefile"
(("sunrpc-CPPFLAGS =.*" all)
@@ -334,7 +436,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)))
@@ -343,6 +445,11 @@
;; it in $CPATH, hence the 'pre-configure' phase above.
,@%boot1-inputs
+ ;; 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"))
@@ -401,30 +508,13 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
("bash" ,bash)))
(inputs '())))
-(define bison-boot1
- ;; XXX: This Bison is 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)
- (native-inputs `(("perl" ,perl-boot0)))
- (propagated-inputs `(("m4" ,m4)))
- (inputs '()) ;remove Flex...
- (arguments '(#:tests? #f))))) ;... and thus disable tests
- (package-with-bootstrap-guile
- (package-with-explicit-inputs bison %boot0-inputs
- (current-source-location)
- #:guile %bootstrap-guile))))
-
(define static-bash-for-glibc
;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
(let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
glibc-final-with-bootstrap-bash
(car (assoc-ref %boot1-inputs "bash"))))
(bash (package (inherit static-bash)
- (native-inputs `(("bison" ,bison-boot1)))
+ (native-inputs `(("bison" ,bison-boot0)))
(arguments
`(#:guile ,%bootstrap-guile
,@(package-arguments static-bash))))))
@@ -488,7 +578,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))
--
2.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
2015-09-17 9:29 ` Manolis Ragkousis
@ 2015-09-22 15:07 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-09-22 15:07 UTC (permalink / raw)
To: Manolis Ragkousis; +Cc: Guix-devel
Manolis Ragkousis <manolis837@gmail.com> skribis:
> From 877ff9bab11056c221b4d325561e16a46a9ff09d Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Thu, 17 Sep 2015 12:24:17 +0300
> Subject: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.
>
> * gnu/packages/commencement.scm (kernel-headers-boot0): New procedure.
> (flex-boot0, bison-boot0, gnumach-headers-boot0, mig-boot0,
> hurd-headers-boot0, hurd-minimal-boot0, hurd-kernel-headers-boot0, ld-wrapper-boot0): New variables.
> (%boot1-inputs): Add ld-wrapper-boot0.
> (glibc-final-with-bootstrap-bash)[propagated-inputs]: Replace with kernel-headers-boot0.
> [inputs]: Add "mig".
> (glibc-final)[arguments]: Replace with kernel-headers-boot0.
LGTM. (Please keep lines in commit logs below 80 columns though.)
Since we are about to merge ‘core-updates’, this has to go to ‘wip-hurd’
for now.
In the next ‘core-updates’ cycle, I plan to look at ‘wip-hurd’ and
cherry-pick the last things from there.
Thanks, and apologies for the delay!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-26 21:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-24 13:55 [PATCH] gnu: commencement: Add support for a native GNU/Hurd system Manolis Ragkousis
2016-06-26 21:49 ` Ludovic Courtès
-- strict thread matches above, loose matches on Subject: below --
2015-08-27 19:53 Manolis Ragkousis
2015-09-02 12:56 ` Ludovic Courtès
2015-09-17 9:29 ` Manolis Ragkousis
2015-09-22 15:07 ` Ludovic Courtès
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.