Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.

2016-06-26 Thread Ludovic Courtès
Hi!

Manolis Ragkousis  skribis:

> From 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 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’.



[PATCH] gnu: commencement: Add support for a native GNU/Hurd system.

2016-06-24 Thread Manolis Ragkousis
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
From 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 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 

Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.

2015-09-22 Thread Ludovic Courtès
Manolis Ragkousis  skribis:

> From 877ff9bab11056c221b4d325561e16a46a9ff09d Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis 
> 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’.



Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.

2015-09-17 Thread Manolis Ragkousis
Sorry for the delay, updated patch.

Manolis
From 877ff9bab11056c221b4d325561e16a46a9ff09d Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis 
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

Re: [PATCH] gnu: commencement: Add support for a native GNU/Hurd system.

2015-09-02 Thread Ludovic Courtès
Manolis Ragkousis  skribis:

> From 3a2f644bfdb39349c585233ef6670081adf57eca Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis 
> 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’.



[PATCH] gnu: commencement: Add support for a native GNU/Hurd system.

2015-08-27 Thread Manolis Ragkousis
This patch adds the parts needed by guix to build the final
toolchain. This also adds the ld-wrapper I was talking about.
From 3a2f644bfdb39349c585233ef6670081adf57eca Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis 
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)))
+