unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: base: Add Glibc-Hurd.
@ 2014-06-02 21:09 Manolis Ragkousis
  2014-06-02 21:38 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Manolis Ragkousis @ 2014-06-02 21:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

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

next is glibc/hurd-headers

[-- Attachment #2: 0001-gnu-base-Add-Glibc-Hurd.patch --]
[-- Type: text/x-patch, Size: 10337 bytes --]

From f3a0685b57d8ff7135d2d04ef0c3cb3a78f0fc90 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Tue, 3 Jun 2014 00:00:01 +0000
Subject: [PATCH] gnu: base: Add Glibc-Hurd.

* gnu/packages/base.scm (glibc/hurd): New variable.
* gnu/packages/patches/glibc-make-4.0.patch: New patch.
* gnu/packages/patches/glibc-manual-fix.patch: New patch.
* gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                               |   2 +
 gnu/packages/base.scm                       | 138 ++++++++++++++++++++++++++++
 gnu/packages/patches/glibc-make-4.0.patch   |  12 +++
 gnu/packages/patches/glibc-manual-fix.patch |  12 +++
 4 files changed, 164 insertions(+)
 create mode 100644 gnu/packages/patches/glibc-make-4.0.patch
 create mode 100644 gnu/packages/patches/glibc-manual-fix.patch

diff --git a/gnu-system.am b/gnu-system.am
index 38e886b..533eb8d 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -302,6 +302,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/glib-tests-prlimit.patch			\
   gnu/packages/patches/glibc-bootstrap-system.patch		\
   gnu/packages/patches/glibc-ldd-x86_64.patch			\
+  gnu/packages/patches/glibc-make-4.0.patch			\
+  gnu/packages/patches/glibc-manual-fix.patch 			\
   gnu/packages/patches/gnunet-fix-scheduler.patch		\
   gnu/packages/patches/gnunet-fix-tests.patch    		\
   gnu/packages/patches/gobject-introspection-cc.patch		\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 09cbe89..8faf797 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,6 +35,10 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages gettext)
+  #:use-module (gnu packages hurd)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
@@ -508,6 +513,139 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/")))
 
+(define-public glibc/hurd
+  (package (inherit glibc)
+    (name "glibc-hurd")
+    (version "2.18")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "git://git.sv.gnu.org/hurd/glibc")
+             (commit "a9d8d3808f18de4da9b587e9bdfb6cca4704344b")))
+       (sha256
+        (base32
+         "0jmczzdyps5syhrqyf7lgl3h77br8s74qw0417jp8b4f29ks7pbz"))
+       (file-name (string-append name "-" version))
+       (modules '((guix build utils)))
+       (patches (list (search-patch "glibc-make-4.0.patch")
+                      (search-patch "glibc-manual-fix.patch")))))
+
+    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
+                         ("hurd-headers" ,hurd-headers)
+                         ("hurd-minimal" ,hurd-minimal)))
+    (native-inputs
+     `(("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
+       ("mig" ,mig)
+       ("perl" ,perl)
+       ("texinfo",texinfo)
+       ("gettext" ,gnu-gettext)
+       ("libpthread" ,(origin
+                        (method git-fetch)
+                        (uri (git-reference
+                              (url "git://git.sv.gnu.org/hurd/libpthread")
+                              (commit "f517024dce3e21c525a7b634eab61302d6b99150")))
+                        (sha256
+                         (base32
+                          "0yqfm1hfqlyjzqv3mgf9a3mh4qxx1mqkzn5xiac2vlvji8nns35y"))
+                        (file-name "libpthread" )))))
+
+    (arguments
+     `(#:out-of-source? #t
+       #:configure-flags
+       (list "--enable-add-ons"
+             "--host=i686-pc-gnu"
+             "--disable-profile"
+             "--disable-multi-arch"
+
+             ;; Library functions can not contact the nscd daemon
+             ;; so we disable it.
+             "--disable-nscd"
+             
+             ;; Installs NIS and RPC related headers that 
+             ;; are not installed by default
+             "--enable-obsolete-rpc"
+
+             ;; Install the rpc data base file under `$out/etc/rpc'.
+             (string-append "--sysconfdir="
+                            (assoc-ref %outputs "out")
+                            "/etc")
+
+             (string-append "--localedir=" (assoc-ref %outputs "locales")
+                            "/share/locale")
+             (string-append "libc_cv_localedir="
+                            (assoc-ref %outputs "locales")
+                            "/share/locale")
+             
+             ;; Use our Bash instead of /bin/sh.
+             (string-append "BASH_SHELL="
+                            (assoc-ref %build-inputs "bash")
+                            "/bin/bash"))
+       #:tests? #f
+       #:phases  (alist-cons-after 
+                  'unpack 'bootstrap 
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
+                    (copy-file "libpthread/sysdeps/generic/bits/pthread.h" 
+                               "bits/pthread.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/thread-attr.h" 
+                               "bits/thread-attr.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/mutex-attr.h" 
+                               "bits/mutex-attr.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/thread-specific.h" 
+                               "bits/thread-specific.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/mutex.h" 
+                               "bits/mutex.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/condition-attr.h" 
+                               "bits/condition-attr.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/condition.h" 
+                               "bits/condition.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/rwlock-attr.h" 
+                               "bits/rwlock-attr.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/rwlock.h" 
+                               "bits/rwlock.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/barrier-attr.h" 
+                               "bits/barrier-attr.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/barrier.h" 
+                               "bits/barrier.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/once.h" 
+                               "bits/once.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/cancelation.h" 
+                               "bits/cancelation.h")
+                    (copy-file "libpthread/sysdeps/generic/bits/pthread-np.h" 
+                               "bits/pthread-np.h")
+                    
+                    (zero? (system* "patch" "-p1" "-i" 
+                                    (assoc-ref %build-inputs 
+                                               "patch/libpthread-patch")))
+                    #t)
+                  (alist-cons-before
+                   'configure 'pre-configure
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (let* ((out  (assoc-ref outputs "out"))
+                            (bin  (string-append out "/bin")))
+                       ;; Use `pwd', not `/bin/pwd'.
+                       (substitute* "configure"
+                         (("/bin/pwd") "pwd"))
+                       
+                       ;; Copy a statically-linked Bash in the output, with
+                       ;; no references to other store paths.
+                       (mkdir-p bin)
+                       (copy-file (string-append (assoc-ref inputs "static-bash")
+                                                 "/bin/bash")
+                                  (string-append bin "/bash"))
+                       (remove-store-references (string-append bin "/bash"))
+                       (chmod (string-append bin "/bash") #o555)
+                       
+                       ;; Keep a symlink, for `patch-shebang' resolution.
+                       (with-directory-excursion bin
+                         (symlink "bash" "sh"))))
+                   (alist-cons-after
+                    'install 'install-locales
+                    (lambda _
+                      (zero? (system* "make" "localedata/install-locales")))
+                    %standard-phases)))))))
+
 (define-public tzdata
   (package
     (name "tzdata")
diff --git a/gnu/packages/patches/glibc-make-4.0.patch b/gnu/packages/patches/glibc-make-4.0.patch
new file mode 100644
index 0000000..d83de1d
--- /dev/null
+++ b/gnu/packages/patches/glibc-make-4.0.patch
@@ -0,0 +1,12 @@
+Allow libc to be compiled with GNU Make 4.0.
+
+--- glibc-2.18/configure	2013-08-11 00:52:55.000000000 +0200
++++ glibc-2.18/configure	2013-10-16 16:53:09.000000000 +0200
+@@ -4772,7 +4772,7 @@ $as_echo_n "checking version of $MAKE...
+   ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+   case $ac_prog_version in
+     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+-    3.79* | 3.[89]*)
++    3.79* | 3.[89]* | 4.*)
+        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/gnu/packages/patches/glibc-manual-fix.patch b/gnu/packages/patches/glibc-manual-fix.patch
new file mode 100644
index 0000000..7370f59
--- /dev/null
+++ b/gnu/packages/patches/glibc-manual-fix.patch
@@ -0,0 +1,12 @@
+diff --git a/manual/contrib.texi b/manual/contrib.texi
+index 3b9d23c..376b40d 100644
+--- a/manual/contrib.texi
++++ b/manual/contrib.texi
+@@ -1,3 +1,4 @@
++@end deftypefun
+ @node Contributors, Free Manuals, Platform, Top
+ @c %MENU% Who wrote what parts of the GNU C Library
+ @appendix Contributors to @theglibc{}
+-- 
+1.9.2
+
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] gnu: base: Add Glibc-Hurd.
  2014-06-02 21:09 [PATCH] gnu: base: Add Glibc-Hurd Manolis Ragkousis
@ 2014-06-02 21:38 ` Ludovic Courtès
  2014-06-06 22:23   ` Manolis Ragkousis
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2014-06-02 21:38 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> From f3a0685b57d8ff7135d2d04ef0c3cb3a78f0fc90 Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Tue, 3 Jun 2014 00:00:01 +0000
> Subject: [PATCH] gnu: base: Add Glibc-Hurd.
>
> * gnu/packages/base.scm (glibc/hurd): New variable.
> * gnu/packages/patches/glibc-make-4.0.patch: New patch.
> * gnu/packages/patches/glibc-manual-fix.patch: New patch.
> * gnu-system.am (dist_patch_DATA): Add it.

[...]

> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "git://git.sv.gnu.org/hurd/glibc")
> +             (commit "a9d8d3808f18de4da9b587e9bdfb6cca4704344b")))
> +       (sha256
> +        (base32
> +         "0jmczzdyps5syhrqyf7lgl3h77br8s74qw0417jp8b4f29ks7pbz"))
> +       (file-name (string-append name "-" version))
> +       (modules '((guix build utils)))

I believe the ‘modules’ field can be omitted.

> +    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
> +                         ("hurd-headers" ,hurd-headers)
> +                         ("hurd-minimal" ,hurd-minimal)))

Add a one-line comment saying why they’re propagated.

> +    (arguments
> +     `(#:out-of-source? #t
> +       #:configure-flags
> +       (list "--enable-add-ons"
> +             "--host=i686-pc-gnu"
> +             "--disable-profile"
> +             "--disable-multi-arch"
> +
> +             ;; Library functions can not contact the nscd daemon
> +             ;; so we disable it.
> +             "--disable-nscd"
> +             
> +             ;; Installs NIS and RPC related headers that 
> +             ;; are not installed by default
> +             "--enable-obsolete-rpc"
> +
> +             ;; Install the rpc data base file under `$out/etc/rpc'.
> +             (string-append "--sysconfdir="
> +                            (assoc-ref %outputs "out")
> +                            "/etc")
> +
> +             (string-append "--localedir=" (assoc-ref %outputs "locales")
> +                            "/share/locale")
> +             (string-append "libc_cv_localedir="
> +                            (assoc-ref %outputs "locales")
> +                            "/share/locale")
> +             
> +             ;; Use our Bash instead of /bin/sh.
> +             (string-append "BASH_SHELL="
> +                            (assoc-ref %build-inputs "bash")
> +                            "/bin/bash"))

Is --host the only thing that differs from ‘glibc’?  If so, we need to
factorize things.

> +       #:tests? #f
> +       #:phases  (alist-cons-after 
> +                  'unpack 'bootstrap 
> +                  (lambda* (#:key inputs #:allow-other-keys)
> +                    (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
> +                    (copy-file "libpthread/sysdeps/generic/bits/pthread.h" 
> +                               "bits/pthread.h")
> +                    (copy-file "libpthread/sysdeps/generic/bits/thread-attr.h" 
> +                               "bits/thread-attr.h")
> +                    (copy-file "libpthread/sysdeps/generic/bits/mutex-attr.h" 
> +                               "bits/mutex-attr.h")

Seems to me that ‘copy-recursively’ will come in handy here.  :-)

However, why do the headers need to be copied in the first place?  I
believe the sysdeps headers of add-ons are automatically picked up the
libc’s build system normally.  Could you check what’s going on?

> +                    (zero? (system* "patch" "-p1" "-i" 
> +                                    (assoc-ref %build-inputs 
> +                                               "patch/libpthread-patch")))
> +                    #t)

Remove #t, otherwise the result of ‘zero?’ is ignored.

> --- /dev/null
> +++ b/gnu/packages/patches/glibc-make-4.0.patch
> @@ -0,0 +1,12 @@
> +Allow libc to be compiled with GNU Make 4.0.
> +
> +--- glibc-2.18/configure	2013-08-11 00:52:55.000000000 +0200
> ++++ glibc-2.18/configure	2013-10-16 16:53:09.000000000 +0200
> +@@ -4772,7 +4772,7 @@ $as_echo_n "checking version of $MAKE...
> +   ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
> +   case $ac_prog_version in
> +     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
> +-    3.79* | 3.[89]*)
> ++    3.79* | 3.[89]* | 4.*)
> +        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
> +     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;

(This is a sign that hurd/glibc.git is still at 2.18, which sucks.)

> --- /dev/null
> +++ b/gnu/packages/patches/glibc-manual-fix.patch
> @@ -0,0 +1,12 @@
> +diff --git a/manual/contrib.texi b/manual/contrib.texi
> +index 3b9d23c..376b40d 100644
> +--- a/manual/contrib.texi
> ++++ b/manual/contrib.texi
> +@@ -1,3 +1,4 @@
> ++@end deftypefun
> + @node Contributors, Free Manuals, Platform, Top
> + @c %MENU% Who wrote what parts of the GNU C Library
> + @appendix Contributors to @theglibc{}

What’s this?  (Missing explanation.)

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gnu: base: Add Glibc-Hurd.
  2014-06-02 21:38 ` Ludovic Courtès
@ 2014-06-06 22:23   ` Manolis Ragkousis
  2014-06-09 19:27     ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Manolis Ragkousis @ 2014-06-06 22:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

> I believe the ‘modules’ field can be omitted.
Done, I forgot to do that in the first place :P
>
>> +    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
>> +                         ("hurd-headers" ,hurd-headers)
>> +                         ("hurd-minimal" ,hurd-minimal)))
>
> Add a one-line comment saying why they’re propagated.

Actually I am not sure, should they be propagated? Linux glibc does it
this way, because

>  ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
>  ;; users should automatically pull Linux headers as well.

Should I change it to inputs?

> Is --host the only thing that differs from ‘glibc’?  If so, we need to
> factorize things.

In order for glibc/hurd to build, we need to remove

> (string-append "--with-headers="
>                            (assoc-ref %build-inputs "linux-headers")
>                            "/include")
> "--enable-kernel=2.6.30"
> ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
> "libc_cv_ssp=no"

which are linux specific, and add

> "--host=i686-pc-gnu"
> "--disable-profile"
> "--disable-multi-arch"
> "--disable-nscd"
> "--enable-obsolete-rpc"

How do you suggest doing it? :-)

> However, why do the headers need to be copied in the first place?  I
> believe the sysdeps headers of add-ons are automatically picked up the
> libc’s build system normally.  Could you check what’s going on?

When these headers are included, they are used like that
> <bits/...>
so, while they are normally included in the path, it only looks in the
directory "bits/" for them not in libpthread/sysdeps/generic/bits/.

Any suggestions?


> Remove #t, otherwise the result of ‘zero?’ is ignored.
Done.

>> --- /dev/null
>> +++ b/gnu/packages/patches/glibc-manual-fix.patch
>> @@ -0,0 +1,12 @@
>> +diff --git a/manual/contrib.texi b/manual/contrib.texi
>> +index 3b9d23c..376b40d 100644
>> +--- a/manual/contrib.texi
>> ++++ b/manual/contrib.texi
>> +@@ -1,3 +1,4 @@
>> ++@end deftypefun
>> + @node Contributors, Free Manuals, Platform, Top
>> + @c %MENU% Who wrote what parts of the GNU C Library
>> + @appendix Contributors to @theglibc{}
>
> What’s this?  (Missing explanation.)

Without this, I get the error
> ./contrib.texi:1: @node seen before @end deftypefun

Manolis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gnu: base: Add Glibc-Hurd.
  2014-06-06 22:23   ` Manolis Ragkousis
@ 2014-06-09 19:27     ` Ludovic Courtès
  2014-06-18 19:56       ` Manolis Ragkousis
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2014-06-09 19:27 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Γειά σας!

Manolis Ragkousis <manolis837@gmail.com> skribis:

>>
>>> +    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
>>> +                         ("hurd-headers" ,hurd-headers)
>>> +                         ("hurd-minimal" ,hurd-minimal)))
>>
>> Add a one-line comment saying why they’re propagated.
>
> Actually I am not sure, should they be propagated?

Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
so both should be propagated.

Can you add this explanation in a comment above ‘propagated-inputs’?

[...]

>> Is --host the only thing that differs from ‘glibc’?  If so, we need to
>> factorize things.
>
> In order for glibc/hurd to build, we need to remove
>
>> (string-append "--with-headers="
>>                            (assoc-ref %build-inputs "linux-headers")
>>                            "/include")
>> "--enable-kernel=2.6.30"
>> ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
>> "libc_cv_ssp=no"
>
> which are linux specific, and add
>
>> "--host=i686-pc-gnu"
>> "--disable-profile"
>> "--disable-multi-arch"
>> "--disable-nscd"
>> "--enable-obsolete-rpc"
>
> How do you suggest doing it? :-)

Something like:

  (define glibc-hurd
    (package (inherit glibc)
      (arguments
        (substitute-keyword-arguments (package-arguments glibc)
          ((#:configure-flags cf)
           `("--host=i686-pc-gnu"
             "--disable-multi-arch"
             ,@cf))))))

There are examples of that in base.scm.

Could you add a comment justifying each of these --enable/disable flags?
For instance, I don’t see why nscd would need to be disabled.

>> However, why do the headers need to be copied in the first place?  I
>> believe the sysdeps headers of add-ons are automatically picked up the
>> libc’s build system normally.  Could you check what’s going on?
>
> When these headers are included, they are used like that
>> <bits/...>
> so, while they are normally included in the path, it only looks in the
> directory "bits/" for them not in libpthread/sysdeps/generic/bits/.
>
> Any suggestions?

No, I think that’s more a question for the Hurd hackers, but I’m pretty
sure this ought to work by default.  Could you check with bug-hurd or on
IRC?

>>> --- /dev/null
>>> +++ b/gnu/packages/patches/glibc-manual-fix.patch
>>> @@ -0,0 +1,12 @@
>>> +diff --git a/manual/contrib.texi b/manual/contrib.texi
>>> +index 3b9d23c..376b40d 100644
>>> +--- a/manual/contrib.texi
>>> ++++ b/manual/contrib.texi
>>> +@@ -1,3 +1,4 @@
>>> ++@end deftypefun
>>> + @node Contributors, Free Manuals, Platform, Top
>>> + @c %MENU% Who wrote what parts of the GNU C Library
>>> + @appendix Contributors to @theglibc{}
>>
>> What’s this?  (Missing explanation.)
>
> Without this, I get the error
>> ./contrib.texi:1: @node seen before @end deftypefun

I suppose you could do without the patch by using ‘texinfo-4’ instead of
‘texinfo’, which would be easier.  Could you check that?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gnu: base: Add Glibc-Hurd.
  2014-06-09 19:27     ` Ludovic Courtès
@ 2014-06-18 19:56       ` Manolis Ragkousis
  2014-06-21 15:20         ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Manolis Ragkousis @ 2014-06-18 19:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

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

2014-06-09 19:27 GMT+00:00 Ludovic Courtès <ludo@gnu.org>:
> Γειά σας!
>
Γεια σου Λουδοβικε ! :P


> Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
> so both should be propagated.
>
> Can you add this explanation in a comment above ‘propagated-inputs’?
>
Done


>>> Is --host the only thing that differs from ‘glibc’?  If so, we need to
>>> factorize things.
>>
Factorizing done. Everything seems okay.

>
> Could you add a comment justifying each of these --enable/disable flags?
> For instance, I don’t see why nscd would need to be disabled.

If we don't, the build will fail, cause it cannot contact nscd. Check
the attached log.
>
>>> However, why do the headers need to be copied in the first place?  I
>>> believe the sysdeps headers of add-ons are automatically picked up the
>>> libc’s build system normally.  Could you check what’s going on?

Normally before building glibc, we should first do make
install-headers for libpthread. But because that would need a lot of
things to be done, and a libpthread headers package, copying the
headers in the right place is much easier and faster.

>
>>>> --- /dev/null
>>>> +++ b/gnu/packages/patches/glibc-manual-fix.patch
>>>> @@ -0,0 +1,12 @@
>>>> +diff --git a/manual/contrib.texi b/manual/contrib.texi
>>>> +index 3b9d23c..376b40d 100644
>>>> +--- a/manual/contrib.texi
>>>> ++++ b/manual/contrib.texi
>>>> +@@ -1,3 +1,4 @@
>>>> ++@end deftypefun
>>>> + @node Contributors, Free Manuals, Platform, Top
>>>> + @c %MENU% Who wrote what parts of the GNU C Library
>>>> + @appendix Contributors to @theglibc{}
>>>
>>> What’s this?  (Missing explanation.)
>>
>> Without this, I get the error
>>> ./contrib.texi:1: @node seen before @end deftypefun
>
> I suppose you could do without the patch by using ‘texinfo-4’ instead of
> ‘texinfo’, which would be easier.  Could you check that?
still the same, added explanation.

In the last patch I forgot to send the libpthread-glibc-preparation
patch, which I added now.

In the glibc-fix.patch I remove #define _EXTERN_INLINE because it
doesn't get defined as it should. I onced asked about it in bug-hurd,
but I forgot about that. I am looking into it now.

[-- Attachment #2: build-log-with-nscd.drv.bz2 --]
[-- Type: application/x-bzip2, Size: 275901 bytes --]

[-- Attachment #3: 0001-gnu-base-Add-Glibc-Hurd.patch --]
[-- Type: text/x-patch, Size: 9702 bytes --]

From 7d16e8d7a69cbc452fa60c287c2436c69043678e Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Wed, 18 Jun 2014 22:16:27 +0000
Subject: [PATCH] gnu: base: Add Glibc-Hurd.

* gnu/packages/base.scm (glibc/hurd): New variable.
* gnu/packages/patches/glibc-make-4.0.patch: New patch.
* gnu/packages/patches/glibc-fix.patch: New patch.
* gnu/packages/patches/libpthread-glibc-preparation.patch: New patch.
* gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                                      |  3 +
 gnu/packages/base.scm                              | 69 ++++++++++++++++++++++
 gnu/packages/patches/glibc-fix.patch               | 29 +++++++++
 gnu/packages/patches/glibc-make-4.0.patch          | 12 ++++
 .../patches/libpthread-glibc-preparation.patch     | 51 ++++++++++++++++
 5 files changed, 164 insertions(+)
 create mode 100644 gnu/packages/patches/glibc-fix.patch
 create mode 100644 gnu/packages/patches/glibc-make-4.0.patch
 create mode 100644 gnu/packages/patches/libpthread-glibc-preparation.patch

diff --git a/gnu-system.am b/gnu-system.am
index 36ae689..04b2d62 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -302,6 +302,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/glib-tests-prlimit.patch			\
   gnu/packages/patches/glibc-bootstrap-system.patch		\
   gnu/packages/patches/glibc-ldd-x86_64.patch			\
+  gnu/packages/patches/glibc-make-4.0.patch			\
+  gnu/packages/patches/glibc-fix.patch 				\
   gnu/packages/patches/gnunet-fix-scheduler.patch		\
   gnu/packages/patches/gnunet-fix-tests.patch    		\
   gnu/packages/patches/gobject-introspection-cc.patch		\
@@ -324,6 +326,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/libtool-skip-tests.patch			\
   gnu/packages/patches/libtool-skip-tests-for-mips.patch	\
   gnu/packages/patches/libssh-CVE-2014-0017.patch		\
+  gnu/packages/patches/libpthread-glibc-preparation.patch	\
   gnu/packages/patches/luit-posix.patch				\
   gnu/packages/patches/m4-gets-undeclared.patch			\
   gnu/packages/patches/m4-readlink-EINVAL.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 2e16f32..7407f06 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,6 +35,10 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages gettext)
+  #:use-module (gnu packages hurd)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
@@ -508,6 +513,70 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/")))
 
+(define-public glibc/hurd 
+  (package (inherit glibc)
+    (name "glibc-hurd")
+    (version "2.18")
+    (source 
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "git://git.sv.gnu.org/hurd/glibc")
+             (commit "a9d8d3808f18de4da9b587e9bdfb6cca4704344b")))
+       (sha256
+        (base32
+         "0jmczzdyps5syhrqyf7lgl3h77br8s74qw0417jp8b4f29ks7pbz"))
+       (file-name (string-append name "-" version))
+       (patches (list (search-patch "glibc-make-4.0.patch")
+                      (search-patch "glibc-manual-fix.patch")))))
+    
+    ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
+    ;; so both should be propagated.
+    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
+                         ("hurd-headers" ,hurd-headers)
+                         ("hurd-minimal" ,hurd-minimal)))
+    (native-inputs
+     `(("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
+       ("mig" ,mig)
+       ("perl" ,perl)
+       ("texinfo",texinfo)
+       ("gettext" ,gnu-gettext)
+       ("libpthread" ,(origin
+                        (method git-fetch)
+                        (uri (git-reference
+                              (url "git://git.sv.gnu.org/hurd/libpthread")
+                              (commit "f517024dce3e21c525a7b634eab61302d6b99150")))
+                        (sha256
+                         (base32 
+                          "0yqfm1hfqlyjzqv3mgf9a3mh4qxx1mqkzn5xiac2vlvji8nns35y"))
+                        (file-name "libpthread" )))))
+
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc)
+       ((#:configure-flags cf)
+        `(append (list "--host=i686-pc-gnu"
+                       ;; Since Hurd supports only i686
+                       ;; disable everything else
+                       "--disable-multi-arch"
+                       ;; nscd is not available so we disable it
+                       "--disable-nscd")
+                 ,cf))
+       ((#:phases phases)
+        `(alist-cons-after
+          'unpack 'prepare-libpthread
+          (lambda* (#:key inputs #:allow-other-keys)
+            (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
+
+            (zero? (system* "patch" "-p1" "-i"
+                   (assoc-ref %build-inputs
+                              "patch/libpthread-patch")))
+
+            ;; Instead of make install-headers we do this
+            ;; We change the permissions so we can overwrite it
+            (chmod "bits/pthreadtypes.h" #o777)
+            (copy-recursively "libpthread/sysdeps/generic/bits" "bits"))
+          ,phases))))))
+
 (define-public tzdata
   (package
     (name "tzdata")
diff --git a/gnu/packages/patches/glibc-fix.patch b/gnu/packages/patches/glibc-fix.patch
new file mode 100644
index 0000000..62b0aee
--- /dev/null
+++ b/gnu/packages/patches/glibc-fix.patch
@@ -0,0 +1,29 @@
+diff --git a/signal/sigsetops.c b/signal/sigsetops.c
+index 0317662..77bd1dc 100644
+--- a/signal/sigsetops.c
++++ b/signal/sigsetops.c
+@@ -3,7 +3,6 @@
+ 
+ #include <features.h>
+ 
+-#define _EXTERN_INLINE
+ #ifndef __USE_EXTERN_INLINES
+ # define __USE_EXTERN_INLINES 1
+ #endif
+-- 
+1.9.0
+
+fix the error @node found before @end deftypefun
+
+diff --git a/manual/contrib.texi b/manual/contrib.texi
+index 3b9d23c..376b40d 100644
+--- a/manual/contrib.texi
++++ b/manual/contrib.texi
+@@ -1,3 +1,4 @@
++@end deftypefun
+ @node Contributors, Free Manuals, Platform, Top
+ @c %MENU% Who wrote what parts of the GNU C Library
+ @appendix Contributors to @theglibc{}
+-- 
+1.9.2
+
diff --git a/gnu/packages/patches/glibc-make-4.0.patch b/gnu/packages/patches/glibc-make-4.0.patch
new file mode 100644
index 0000000..d83de1d
--- /dev/null
+++ b/gnu/packages/patches/glibc-make-4.0.patch
@@ -0,0 +1,12 @@
+Allow libc to be compiled with GNU Make 4.0.
+
+--- glibc-2.18/configure	2013-08-11 00:52:55.000000000 +0200
++++ glibc-2.18/configure	2013-10-16 16:53:09.000000000 +0200
+@@ -4772,7 +4772,7 @@ $as_echo_n "checking version of $MAKE...
+   ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+   case $ac_prog_version in
+     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+-    3.79* | 3.[89]*)
++    3.79* | 3.[89]* | 4.*)
+        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/gnu/packages/patches/libpthread-glibc-preparation.patch b/gnu/packages/patches/libpthread-glibc-preparation.patch
new file mode 100644
index 0000000..cbb3551
--- /dev/null
+++ b/gnu/packages/patches/libpthread-glibc-preparation.patch
@@ -0,0 +1,51 @@
+This will allow libpthread to be build as an addon.
+
+diff --git a/libpthread/configure b/libpthread/configure
+new file mode 100644
+index 0000000..2cdbc71
+--- /dev/null
++++ b/libpthread/configure
+@@ -0,0 +1,2 @@
++libc_add_on_canonical=libpthread
++libc_add_on_subdirs=.
+\ No newline at end of file
+-- 
+1.9.0
+
+There is no definition for  __thread_terminate_release yet, so according to Samuel we disable it.
+
+diff --git a/libpthread/sysdeps/mach/pt-thread-terminate.c b/libpthread/sysdeps/mach/pt-thread-terminate.c
+index 6672065..129a611 100644
+--- a/libpthread/sysdeps/mach/pt-thread-terminate.c
++++ b/libpthread/sysdeps/mach/pt-thread-terminate.c
+@@ -70,9 +70,9 @@ __pthread_thread_terminate (struct __pthread *thread)
+   __mach_port_destroy (__mach_task_self (), wakeup_port);
+ 
+   /* Terminate and release all that's left.  */
+-  err = __thread_terminate_release (kernel_thread, mach_task_self (),
+-				    kernel_thread, reply_port,
+-				    stackaddr, stacksize);
++  /* err = __thread_terminate_release (kernel_thread, mach_task_self (), */
++  /* 				    kernel_thread, reply_port, */
++  /* 				    stackaddr, stacksize); */
+ 
+   /* The kernel does not support it yet.  Leak but at least terminate
+      correctly.  */
+-- 
+1.9.2
+
+__SPIN_LOCK_INITIALIZER gets defined to zero so we can start using libpthread.
+
+diff --git a/libpthread/sysdeps/mach/bits/spin-lock.h b/libpthread/sysdeps/mach/bits/spin-lock.h
+index 537dac9..fca0e5a 100644
+--- a/libpthread/sysdeps/mach/bits/spin-lock.h
++++ b/libpthread/sysdeps/mach/bits/spin-lock.h
+@@ -30,7 +30,7 @@ typedef __spin_lock_t __pthread_spinlock_t;
+ 
+ /* Initializer for a spin lock object.  */
+ #ifndef __PTHREAD_SPIN_LOCK_INITIALIZER
+-#error __PTHREAD_SPIN_LOCK_INITIALIZER undefined: should be defined by <lock-intern.h>.
++#define __PTHREAD_SPIN_LOCK_INITIALIZER __SPIN_LOCK_INITIALIZER
+ #endif
+ 
+ __END_DECLS
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] gnu: base: Add Glibc-Hurd.
  2014-06-18 19:56       ` Manolis Ragkousis
@ 2014-06-21 15:20         ` Ludovic Courtès
  2014-07-17 15:39           ` Manolis Ragkousis
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2014-06-21 15:20 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Sorry for the delay!

Manolis Ragkousis <manolis837@gmail.com> skribis:

[...]

>>>> However, why do the headers need to be copied in the first place?  I
>>>> believe the sysdeps headers of add-ons are automatically picked up the
>>>> libc’s build system normally.  Could you check what’s going on?
>
> Normally before building glibc, we should first do make
> install-headers for libpthread.

I don’t think so.  Given that libpthread is a libc add-on, its headers
should be picked automatically.  We should check with bug-hurd people,
and keep what you’ve done in the meantime.

>>>>> --- /dev/null
>>>>> +++ b/gnu/packages/patches/glibc-manual-fix.patch
>>>>> @@ -0,0 +1,12 @@
>>>>> +diff --git a/manual/contrib.texi b/manual/contrib.texi
>>>>> +index 3b9d23c..376b40d 100644
>>>>> +--- a/manual/contrib.texi
>>>>> ++++ b/manual/contrib.texi
>>>>> +@@ -1,3 +1,4 @@
>>>>> ++@end deftypefun
>>>>> + @node Contributors, Free Manuals, Platform, Top
>>>>> + @c %MENU% Who wrote what parts of the GNU C Library
>>>>> + @appendix Contributors to @theglibc{}
>>>>
>>>> What’s this?  (Missing explanation.)
>>>
>>> Without this, I get the error
>>>> ./contrib.texi:1: @node seen before @end deftypefun
>>
>> I suppose you could do without the patch by using ‘texinfo-4’ instead of
>> ‘texinfo’, which would be easier.  Could you check that?
> still the same, added explanation.

It’s very surprising that the manual doesn’t build, not even with
Texinfo 4.

> In the last patch I forgot to send the libpthread-glibc-preparation
> patch, which I added now.
>
> In the glibc-fix.patch I remove #define _EXTERN_INLINE because it
> doesn't get defined as it should. I onced asked about it in bug-hurd,
> but I forgot about that. I am looking into it now.

Regarding nscd, the build log you posted shows that the problem is a
conflict between Mach’s thread_info type and nscd’s.  I’ve just emailed
bug-hurd.

The patch itself looks good to me!  Some mostly cosmetic comments:

@@ -302,6 +302,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/glib-tests-prlimit.patch			\
   gnu/packages/patches/glibc-bootstrap-system.patch		\
   gnu/packages/patches/glibc-ldd-x86_64.patch			\
+  gnu/packages/patches/glibc-make-4.0.patch			\
+  gnu/packages/patches/glibc-fix.patch 				\

Please call the latter glibc-hurd-extern-inline.patch, for instance.

--- /dev/null
+++ b/gnu/packages/patches/glibc-fix.patch
@@ -0,0 +1,29 @@

This patch misses a one-line explanation of what it does.

--- /dev/null
+++ b/gnu/packages/patches/libpthread-glibc-preparation.patch
@@ -0,0 +1,51 @@
+This will allow libpthread to be build as an addon.

Likewise, please add a sentence explaining what’s going on, possibly
with links to discussions on the subject.

+There is no definition for  __thread_terminate_release yet, so according to Samuel we disable it.

Same, better explain why __thread_terminate_release is missing, why it’s
OK to remove that call, with a link to the discussion.

+__SPIN_LOCK_INITIALIZER gets defined to zero so we can start using libpthread.

Same here.

These are all small changes, but I think it’s important to keep track of
why all these things are done this way, because it’s not trivial.

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gnu: base: Add Glibc-Hurd.
  2014-06-21 15:20         ` Ludovic Courtès
@ 2014-07-17 15:39           ` Manolis Ragkousis
  0 siblings, 0 replies; 7+ messages in thread
From: Manolis Ragkousis @ 2014-07-17 15:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

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

Sorry for the delay, (damn greek summer temperatures)

here is the updated patch.

I added explanations to all the patches as you told me, so to be
better understood why I did what I did.

Thanks,
Manolis

[-- Attachment #2: 0001-gnu-base-Add-Glibc-Hurd.patch --]
[-- Type: text/x-patch, Size: 10363 bytes --]

From 9195c2d57bc0e3aad2a4beb6806ba8d6be8b33e4 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Thu, 17 Jul 2014 18:26:27 +0000
Subject: [PATCH] gnu: base: Add Glibc-Hurd.

* gnu/packages/base.scm (glibc/hurd): New variable.
* gnu/packages/patches/glibc-make-4.0.patch: New patch.
* gnu/packages/patches/glibc-hurd-extern-inline.patch: New patch.
* gnu/packages/patches/libpthread-glibc-preparation.patch: New patch.
* gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                                      |  3 +
 gnu/packages/base.scm                              | 69 ++++++++++++++++++++++
 .../patches/glibc-hurd-extern-inline.patch         | 34 +++++++++++
 gnu/packages/patches/glibc-make-4.0.patch          | 12 ++++
 .../patches/libpthread-glibc-preparation.patch     | 58 ++++++++++++++++++
 5 files changed, 176 insertions(+)
 create mode 100644 gnu/packages/patches/glibc-hurd-extern-inline.patch
 create mode 100644 gnu/packages/patches/glibc-make-4.0.patch
 create mode 100644 gnu/packages/patches/libpthread-glibc-preparation.patch

diff --git a/gnu-system.am b/gnu-system.am
index 7d2fbcc..6e26693 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -307,6 +307,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/glib-tests-timer.patch			\
   gnu/packages/patches/glibc-bootstrap-system.patch		\
   gnu/packages/patches/glibc-ldd-x86_64.patch			\
+  gnu/packages/patches/glibc-make-4.0.patch			\
+  gnu/packages/patches/glibc-hurd-extern-inline.patch		\
   gnu/packages/patches/gnunet-fix-scheduler.patch		\
   gnu/packages/patches/gnunet-fix-tests.patch    		\
   gnu/packages/patches/gobject-introspection-cc.patch		\
@@ -333,6 +335,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/libtool-skip-tests.patch			\
   gnu/packages/patches/libtool-skip-tests-for-mips.patch	\
   gnu/packages/patches/libssh-CVE-2014-0017.patch		\
+  gnu/packages/patches/libpthread-glibc-preparation.patch	\
   gnu/packages/patches/luit-posix.patch				\
   gnu/packages/patches/m4-gets-undeclared.patch			\
   gnu/packages/patches/m4-readlink-EINVAL.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index c280cff..2166a77 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -35,6 +36,9 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages gettext)
+  #:use-module (gnu packages hurd)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
@@ -512,6 +516,71 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/")))
 
+(define-public glibc/hurd 
+  (package (inherit glibc)
+    (name "glibc-hurd")
+    (version "2.18")
+    (source 
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "git://git.sv.gnu.org/hurd/glibc")
+             (commit "a9d8d3808f18de4da9b587e9bdfb6cca4704344b")))
+       (sha256
+        (base32
+         "0jmczzdyps5syhrqyf7lgl3h77br8s74qw0417jp8b4f29ks7pbz"))
+       (file-name (string-append name "-" version))
+       (patches (list (search-patch "glibc-make-4.0.patch")
+                      (search-patch "glibc-hurd-extern-inline.patch")))))
+    
+    ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
+    ;; so both should be propagated.
+    (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
+                         ("hurd-headers" ,hurd-headers)
+                         ("hurd-minimal" ,hurd-minimal)))
+    (native-inputs
+     `(("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
+       ("mig" ,mig)
+       ("perl" ,perl)
+       ("texinfo",texinfo)
+       ("gettext" ,gnu-gettext)
+       ("libpthread" ,(origin
+                        (method git-fetch)
+                        (uri (git-reference
+                              (url "git://git.sv.gnu.org/hurd/libpthread")
+                              (commit "f517024dce3e21c525a7b634eab61302d6b99150")))
+                        (sha256
+                         (base32 
+                          "0yqfm1hfqlyjzqv3mgf9a3mh4qxx1mqkzn5xiac2vlvji8nns35y"))
+                        (file-name "libpthread" )))))
+
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc)
+       ((#:configure-flags cf)
+        `(append (list "--host=i686-pc-gnu"
+                       ;; Since Hurd supports only i686
+                       ;; disable everything else
+                       "--disable-multi-arch"
+                       ;; nscd in Hurd is broken for now,
+                       ;; so we disable it
+                       "--disable-nscd")
+                 ,cf))
+       ((#:phases phases)
+        `(alist-cons-after
+          'unpack 'prepare-libpthread
+          (lambda* (#:key inputs #:allow-other-keys)
+            (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
+
+            (zero? (system* "patch" "-p1" "-i"
+                   (assoc-ref %build-inputs
+                              "patch/libpthread-patch")))
+
+            ;; Instead of make install-headers we do this
+            ;; We change the permissions so we can overwrite it
+            (chmod "bits/pthreadtypes.h" #o777)
+            (copy-recursively "libpthread/sysdeps/generic/bits" "bits"))
+          ,phases))))))
+
 (define-public tzdata
   (package
     (name "tzdata")
diff --git a/gnu/packages/patches/glibc-hurd-extern-inline.patch b/gnu/packages/patches/glibc-hurd-extern-inline.patch
new file mode 100644
index 0000000..fe45d90
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-extern-inline.patch
@@ -0,0 +1,34 @@
+This changes the way _EXTERN_INLINE is defined so we can 
+avoid external definition errors.
+https://lists.gnu.org/archive/html/bug-hurd/2014-04/msg00002.html
+
+diff --git a/signal/sigsetops.c b/signal/sigsetops.c
+index 0317662..b92c296 100644
+--- a/signal/sigsetops.c
++++ b/signal/sigsetops.c
+@@ -3,7 +3,9 @@
+ 
+ #include <features.h>
+ 
+-#define _EXTERN_INLINE
++#ifndef _EXTERN_INLINE
++#define _EXTERN_INLINE __extern_inline
++#endif
+ #ifndef __USE_EXTERN_INLINES
+ # define __USE_EXTERN_INLINES  1
+ #endif
+
+This fixes the error @node found before @end deftypefun
+
+diff --git a/manual/contrib.texi b/manual/contrib.texi
+index 3b9d23c..376b40d 100644
+--- a/manual/contrib.texi
++++ b/manual/contrib.texi
+@@ -1,3 +1,4 @@
++@end deftypefun
+ @node Contributors, Free Manuals, Platform, Top
+ @c %MENU% Who wrote what parts of the GNU C Library
+ @appendix Contributors to @theglibc{}
+-- 
+1.9.2
+
diff --git a/gnu/packages/patches/glibc-make-4.0.patch b/gnu/packages/patches/glibc-make-4.0.patch
new file mode 100644
index 0000000..d83de1d
--- /dev/null
+++ b/gnu/packages/patches/glibc-make-4.0.patch
@@ -0,0 +1,12 @@
+Allow libc to be compiled with GNU Make 4.0.
+
+--- glibc-2.18/configure	2013-08-11 00:52:55.000000000 +0200
++++ glibc-2.18/configure	2013-10-16 16:53:09.000000000 +0200
+@@ -4772,7 +4772,7 @@ $as_echo_n "checking version of $MAKE...
+   ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+   case $ac_prog_version in
+     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+-    3.79* | 3.[89]*)
++    3.79* | 3.[89]* | 4.*)
+        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/gnu/packages/patches/libpthread-glibc-preparation.patch b/gnu/packages/patches/libpthread-glibc-preparation.patch
new file mode 100644
index 0000000..6764b9f
--- /dev/null
+++ b/gnu/packages/patches/libpthread-glibc-preparation.patch
@@ -0,0 +1,58 @@
+This helps to integrate libpthread as a glibc module. It 
+writes the configure file, removes an rpc call not yet 
+implemented on the version of gnumach we use and defines
+a missing macro.
+
+diff --git a/libpthread/configure b/libpthread/configure
+new file mode 100644
+index 0000000..2cdbc71
+--- /dev/null
++++ b/libpthread/configure
+@@ -0,0 +1,2 @@
++libc_add_on_canonical=libpthread
++libc_add_on_subdirs=.
+\ No newline at end of file
+-- 
+1.9.0
+
+Because we are using and older version of gnumach, there is no
+support for it yet and thread_terminate_release has to be removed.
+The rpc call thread_terminate will be enough for our needs.
+http://lists.gnu.org/archive/html/bug-hurd/2014-05/msg00127.html
+
+diff --git a/libpthread/sysdeps/mach/pt-thread-terminate.c b/libpthread/sysdeps/mach/pt-thread-terminate.c
+index 6672065..129a611 100644
+--- a/libpthread/sysdeps/mach/pt-thread-terminate.c
++++ b/libpthread/sysdeps/mach/pt-thread-terminate.c
+@@ -70,9 +70,9 @@ __pthread_thread_terminate (struct __pthread *thread)
+   __mach_port_destroy (__mach_task_self (), wakeup_port);
+ 
+   /* Terminate and release all that's left.  */
+-  err = __thread_terminate_release (kernel_thread, mach_task_self (),
+-				    kernel_thread, reply_port,
+-				    stackaddr, stacksize);
++  /* err = __thread_terminate_release (kernel_thread, mach_task_self (), */
++  /* 				    kernel_thread, reply_port, */
++  /* 				    stackaddr, stacksize); */
+ 
+   /* The kernel does not support it yet.  Leak but at least terminate
+      correctly.  */
+-- 
+1.9.2
+
+The __PTHREAD_SPIN_LOCK_INITIALIZER definition is missing, so we 
+define it to __SPIN_LOCK_INITIALIZER which already exists.
+  
+diff --git a/libpthread/sysdeps/mach/bits/spin-lock.h b/libpthread/sysdeps/mach/bits/spin-lock.h
+index 537dac9..fca0e5a 100644
+--- a/libpthread/sysdeps/mach/bits/spin-lock.h
++++ b/libpthread/sysdeps/mach/bits/spin-lock.h
+@@ -30,7 +30,7 @@ typedef __spin_lock_t __pthread_spinlock_t;
+ 
+ /* Initializer for a spin lock object.  */
+ #ifndef __PTHREAD_SPIN_LOCK_INITIALIZER
+-#error __PTHREAD_SPIN_LOCK_INITIALIZER undefined: should be defined by <lock-intern.h>.
++#define __PTHREAD_SPIN_LOCK_INITIALIZER __SPIN_LOCK_INITIALIZER
+ #endif
+ 
+ __END_DECLS
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-17 15:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 21:09 [PATCH] gnu: base: Add Glibc-Hurd Manolis Ragkousis
2014-06-02 21:38 ` Ludovic Courtès
2014-06-06 22:23   ` Manolis Ragkousis
2014-06-09 19:27     ` Ludovic Courtès
2014-06-18 19:56       ` Manolis Ragkousis
2014-06-21 15:20         ` Ludovic Courtès
2014-07-17 15:39           ` Manolis Ragkousis

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).