unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal.
@ 2015-02-14 15:40 Manolis Ragkousis
  2015-02-15  0:09 ` Mark H Weaver
  0 siblings, 1 reply; 4+ messages in thread
From: Manolis Ragkousis @ 2015-02-14 15:40 UTC (permalink / raw)
  To: Ludovic Courtès, mhw; +Cc: Guix-devel

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

There was only a minor change here, to work around the error I told
you in a previous mail.

http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00156.html

[-- Attachment #2: 0001-gnu-base-Add-glibc-hurd-and-hurd-minimal.patch --]
[-- Type: text/x-patch, Size: 17250 bytes --]

From c9fd013956718c4d3178608b3eca6392b6f5cea3 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Sat, 27 Sep 2014 20:07:19 +0300
Subject: [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal.

Reinstates commit bc046a94, among other things.

* gnu/packages/base.scm (glibc/hurd, glibc/hurd-headers): New variables.
* gnu/packages/hurd.scm (hurd-minimal): New variable.
* gnu/packages/patches/glibc-make-4.0.patch: New file.
* gnu/packages/patches/glibc-hurd-extern-inline.patch: New file.
* gnu/packages/patches/libpthread-glibc-preparation.patch: New file.
* gnu/packages/patches/hurd-minimal.patch: New file.
* gnu-system.am (dist_patch_DATA): Add them.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu-system.am                                      |   4 +
 gnu/packages/base.scm                              | 104 +++++++++++++++++++++
 gnu/packages/hurd.scm                              |  67 ++++++++++++-
 .../patches/glibc-hurd-extern-inline.patch         |  34 +++++++
 gnu/packages/patches/glibc-make-4.0.patch          |  12 +++
 gnu/packages/patches/hurd-minimal.patch            |  22 +++++
 .../patches/libpthread-glibc-preparation.patch     |  59 ++++++++++++
 7 files changed, 301 insertions(+), 1 deletion(-)
 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/hurd-minimal.patch
 create mode 100644 gnu/packages/patches/libpthread-glibc-preparation.patch

diff --git a/gnu-system.am b/gnu-system.am
index a46647e..d649223 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -395,6 +395,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/glibc-ldd-x86_64.patch			\
   gnu/packages/patches/glibc-mips-dangling-vfork-ref.patch	\
   gnu/packages/patches/gmp-arm-asm-nothumb.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-absolute-shlib-path.patch \
@@ -412,6 +414,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/gtkglext-disable-disable-deprecated.patch \
   gnu/packages/patches/hop-bigloo-4.0b.patch			\
   gnu/packages/patches/irrlicht-mesa-10.patch			\
+  gnu/packages/patches/hurd-minimal.patch			\
   gnu/packages/patches/jbig2dec-ignore-testtest.patch		\
   gnu/packages/patches/kmod-module-directory.patch		\
   gnu/packages/patches/libarchive-CVE-2013-0211.patch		\
@@ -429,6 +432,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/libvpx-fix-armhf-link.patch		\
   gnu/packages/patches/libvpx-fix-ssse3-quantize.patch		\
   gnu/packages/patches/libvpx-vp9-out-of-bounds-access.patch	\
+  gnu/packages/patches/libpthread-glibc-preparation.patch	\
   gnu/packages/patches/lm-sensors-hwmon-attrs.patch		\
   gnu/packages/patches/lua51-liblua-so.patch                    \
   gnu/packages/patches/luit-posix.patch				\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index be33cb2..556eb47 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,9 +33,13 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages gettext)
+  #:use-module (gnu packages hurd)
   #:use-module (gnu packages pkg-config)
+  #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
 
 ;;; Commentary:
@@ -520,6 +525,105 @@ 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 (map search-patch
+                            '("glibc-make-4.0.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
+     `(,@(package-native-inputs glibc)
+       ("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
+       ("mig" ,mig)
+       ("perl" ,perl)
+       ("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
+     `(#:modules ((guix build utils)
+                  (guix build gnu-build-system))
+       ,@(substitute-keyword-arguments (package-arguments glibc)
+           ((#:configure-flags cf)
+            `(append (list "--host=i686-pc-gnu"
+
+                           ;; nscd fails to build for GNU/Hurd:
+                           ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
+                           ;; Disable it.
+                           "--disable-nscd")))
+           ((#:phases phases)
+            `(alist-cons-after
+              'unpack 'prepare-libpthread
+              (lambda* (#:key inputs #:allow-other-keys)
+                (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
+
+                (system* "patch" "-p1" "-i"
+                         (assoc-ref %build-inputs "patch/libpthread-patch"))
+
+                ;; Make the file writable.
+                (chmod "bits/pthreadtypes.h" #o666)
+                (copy-recursively "libpthread/sysdeps/generic/bits" "bits"))
+              ,phases)))))))
+
+(define-public glibc/hurd-headers
+  (package (inherit glibc/hurd)
+    (name "glibc-hurd-headers")
+    (outputs '("out"))
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc/hurd)
+       ;; We just pass the flags really needed to build the headers.
+       ((#:configure-flags _)
+        `(list "--enable-add-ons"
+               "--host=i686-pc-gnu"
+               "--enable-obsolete-rpc"))
+       ((#:phases _)
+        '(alist-replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (and (zero? (system* "make" "install-headers"))
+
+                 ;; Make an empty stubs.h to work around not being able to
+                 ;; produce a valid stubs.h and causing the build to fail. See
+                 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
+                 (let ((out (assoc-ref outputs "out")))
+                   (close-port
+                    (open-output-file
+                     (string-append out "/include/gnu/stubs.h"))))))
+
+          ;; Nothing to build.
+          (alist-delete
+           'build
+
+           (alist-cons-before
+            'configure 'pre-configure
+            (lambda _
+              ;; Use the right 'pwd'.
+              (substitute* "configure"
+                (("/bin/pwd") "pwd")))
+            %standard-phases))))))))
+
 (define-public tzdata
   (package
     (name "tzdata")
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 8ac78d3..5108114 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -20,11 +20,14 @@
   #:use-module (guix licenses)
   #:use-module (guix download)
   #:use-module (guix packages)
+  #:use-module (gnu packages)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages perl)
-  #:use-module (gnu packages autotools))
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (guix git-download))
 
 (define-public gnumach-headers
   (package
@@ -128,3 +131,65 @@ communication.")
      "This package provides C headers of the GNU Hurd, used to build the GNU C
 Library and other user programs.")
     (license gpl2+)))
+
+(define-public hurd-minimal
+  (package
+    (name "hurd-minimal")
+    (version "0.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "git://git.savannah.gnu.org/hurd/hurd")
+             (commit "a5ca1de1eb575294dbc865a2c4ff643efc117ef4")))
+       (sha256
+        (base32
+         "17vqdlpy1ifw4ijhc3ydkp8p5d406c7aq4ghpmg4a1h1wlwy32kr"))
+       (file-name (string-append name "-" version))
+       (patches (list (search-patch "hurd-minimal.patch")))))
+    (build-system gnu-build-system)
+    (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
+    (native-inputs
+     `(("autoconf" ,(autoconf-wrapper))
+       ("mig" ,mig)))
+
+    (arguments
+     `(#:phases (alist-replace
+                 'install
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let ((out (assoc-ref outputs "out")))
+                     ;; We need to copy libihash.a to the output directory manually,
+                     ;; since there is no target for that in the makefile.
+                     (mkdir-p (string-append out "/include"))
+                     (copy-file "libihash/ihash.h"
+                                (string-append out "/include/ihash.h"))
+                     (mkdir-p (string-append out "/lib"))
+                     (copy-file "libihash/libihash.a"
+                                (string-append out "/lib/libihash.a"))
+                     #t))
+                 (alist-replace
+                  'build
+                  (lambda _
+                    (zero? (system* "make" "-Clibihash" "libihash.a")))
+                  (alist-cons-before
+                   'configure 'bootstrap
+                   (lambda _
+                     (zero? (system* "autoreconf" "-vfi")))
+                   %standard-phases)))
+       #:configure-flags '(;; Pretend we're on GNU/Hurd; 'configure' wants
+                           ;; that.
+                           "--host=i686-pc-gnu"
+
+                           ;; Reduce set of dependencies.
+                           "--disable-ncursesw"
+                           "--disable-test"
+                           "--without-libbz2"
+                           "--without-libz"
+                           "--without-parted")
+       #:tests? #f))
+    (home-page "http://www.gnu.org/software/hurd/hurd.html")
+    (synopsis "GNU Hurd libraries")
+    (description
+     "This package provides libihash, needed to build the GNU C 
+Library for GNU/Hurd")
+    (license gpl2+)))
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..f13903c
--- /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/hurd-minimal.patch b/gnu/packages/patches/hurd-minimal.patch
new file mode 100644
index 0000000..b551d5c
--- /dev/null
+++ b/gnu/packages/patches/hurd-minimal.patch
@@ -0,0 +1,22 @@
+We want to build the Hurd's libihash very early so that we can then
+build libc.  Because of that, we cannot link against libc, and thus
+we miss 'clnt_create' and friends.
+
+See <http://lists.gnu.org/archive/html/bug-hurd/2014-04/msg00116.html>.
+
+diff --git a/configure.ac b/configure.ac
+index f8856db..a381219 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -297,9 +297,9 @@ AC_SUBST([XKB_BASE])
+ AC_DEFINE_UNQUOTED([X11_PREFIX], "$X11_PREFIX")
+ AC_SUBST([X11_KEYSYMDEF_H])
+ 
+-# Check for Sun RPC headers and library.
++# Check only for Sun RPC headers. We do not need the library yet.
+ AC_CHECK_HEADER([rpc/types.h], [HAVE_SUN_RPC=yes], [HAVE_SUN_RPC=no])
+-AC_SEARCH_LIBS([clnt_create], [], [:], [HAVE_SUN_RPC=no])
++# AC_SEARCH_LIBS([clnt_create], [], [:], [HAVE_SUN_RPC=no])
+ AC_SUBST([HAVE_SUN_RPC])
+ 
+ if test -f ./$ac_unique_file; then
diff --git a/gnu/packages/patches/libpthread-glibc-preparation.patch b/gnu/packages/patches/libpthread-glibc-preparation.patch
new file mode 100644
index 0000000..1897248
--- /dev/null
+++ b/gnu/packages/patches/libpthread-glibc-preparation.patch
@@ -0,0 +1,59 @@
+This patch helps to integrate the Hurd's libpthread as a libc add-on.
+
+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=.
+-- 
+1.9.0
+
+We are using a version of GNU Mach that lacks 'thread_terminate_release'
+(not introduced yet).  The 'thread_terminate' RPC call will be enough for
+our needs.
+See <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.
+See <http://lists.gnu.org/archive/html/commit-hurd/2009-04/msg00006.html>.
+  
+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.3.0


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

* Re: [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal.
  2015-02-14 15:40 [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal Manolis Ragkousis
@ 2015-02-15  0:09 ` Mark H Weaver
  2015-02-17 22:50   ` Mark H Weaver
  0 siblings, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2015-02-15  0:09 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Manolis Ragkousis <manolis837@gmail.com> writes:

> There was only a minor change here, to work around the error I told
> you in a previous mail.
>
> http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00156.html
>
> From c9fd013956718c4d3178608b3eca6392b6f5cea3 Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Sat, 27 Sep 2014 20:07:19 +0300
> Subject: [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal.
>
> Reinstates commit bc046a94, among other things.

What do you mean by "reinstates"?  I'm not sure there's a need to
reference this obsolete commit.

[...]
> diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
> index be33cb2..556eb47 100644
> --- a/gnu/packages/base.scm
> +++ b/gnu/packages/base.scm
> @@ -4,6 +4,7 @@
>  ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
>  ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
>  ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
> +;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>

I would add 2015 now also.

>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -32,9 +33,13 @@
>    #:use-module (gnu packages perl)
>    #:use-module (gnu packages linux)
>    #:use-module (gnu packages texinfo)
> +  #:use-module (gnu packages gettext)
> +  #:use-module (gnu packages hurd)
>    #:use-module (gnu packages pkg-config)
> +  #:use-module (guix utils)
>    #:use-module (guix packages)
>    #:use-module (guix download)
> +  #:use-module (guix git-download)
>    #:use-module (guix build-system gnu))
>  
>  ;;; Commentary:
> @@ -520,6 +525,105 @@ 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 (map search-patch
> +                            '("glibc-make-4.0.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
> +     `(,@(package-native-inputs glibc)
> +       ("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
> +       ("mig" ,mig)
> +       ("perl" ,perl)
> +       ("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
> +     `(#:modules ((guix build utils)
> +                  (guix build gnu-build-system))

This #:modules argument is already the default, and it's not overridden
by the inherited 'glibc' package, so I think it's not needed here.

> +       ,@(substitute-keyword-arguments (package-arguments glibc)
> +           ((#:configure-flags cf)
> +            `(append (list "--host=i686-pc-gnu"
> +
> +                           ;; nscd fails to build for GNU/Hurd:
> +                           ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
> +                           ;; Disable it.
> +                           "--disable-nscd")))

Did you intend to omit 'cf', the inherited configure-flags from 'glibc'?
Also, you're passing only one argument to 'append', making it a no-op.

Looking at the configure-flags for 'glibc', most of them look desirable
on Hurd, but some of them don't.  The ones that look desirable are:

  "--enable-add-ons"
  "--sysconfdir=/etc"
  "libc_cv_localedir=/run/current-system/locale"
  (string-append "BASH_SHELL="
                 (assoc-ref %build-inputs "bash")
                 "/bin/bash")
  "libc_cv_ssp=no"

The ones that we probably want to remove are:

  (string-append "--with-headers="
                 (assoc-ref %build-inputs "linux-headers")
                 "/include")
  "--enable-kernel=2.6.32"

How about this: (untested)

--8<---------------cut here---------------start------------->8---
           ((#:configure-flags original-configure-flags)
            `(list "--host=i686-pc-gnu"

                   ;; nscd fails to build for GNU/Hurd:
                   ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
                   ;; Disable it.
                   "--disable-nscd"

                   ,@(filter (lambda (flag)
                               (not (or (string-prefix? "--with-headers=" flag)
                                        (string-prefix? "--enable-kernel=" flag))))
                             original-configure-flags)))
--8<---------------cut here---------------end--------------->8---

> +           ((#:phases phases)
> +            `(alist-cons-after
> +              'unpack 'prepare-libpthread
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
> +
> +                (system* "patch" "-p1" "-i"
> +                         (assoc-ref %build-inputs "patch/libpthread-patch"))

Better to use 'inputs' not '%build-inputs' here.  Also, you should also
pass "--force" to 'patch', and check the result status for errors.

--8<---------------cut here---------------start------------->8---
                (unless (zero? (system*
                                "patch" "--force" "-p1" "-i"
                                (assoc-ref inputs "patch/libpthread-patch")))
                  (error "patch/libpthread-patch failed"))
--8<---------------cut here---------------end--------------->8---

> +
> +                ;; Make the file writable.
> +                (chmod "bits/pthreadtypes.h" #o666)

Making it world-writable seems excessive.  How about #o644 ?

> +                (copy-recursively "libpthread/sysdeps/generic/bits" "bits"))

Add a #t to the end here, since 'copy-recursively' doesn't return
anything in particular.

--8<---------------cut here---------------start------------->8---
                (copy-recursively "libpthread/sysdeps/generic/bits" "bits")
                #t)
--8<---------------cut here---------------end--------------->8---

Can you make these changes, see if things still work, and then post an
updated patch?

Thanks for working on this!

      Mark

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

* Re: [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal.
  2015-02-15  0:09 ` Mark H Weaver
@ 2015-02-17 22:50   ` Mark H Weaver
  2015-02-18  9:37     ` Manolis Ragkousis
  0 siblings, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2015-02-17 22:50 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Mark H Weaver <mhw@netris.org> writes:

> Manolis Ragkousis <manolis837@gmail.com> writes:
>
>> +       ,@(substitute-keyword-arguments (package-arguments glibc)
>> +           ((#:configure-flags cf)
>> +            `(append (list "--host=i686-pc-gnu"
>> +
>> +                           ;; nscd fails to build for GNU/Hurd:
>> +                           ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
>> +                           ;; Disable it.
>> +                           "--disable-nscd")))
>
> Did you intend to omit 'cf', the inherited configure-flags from 'glibc'?
> Also, you're passing only one argument to 'append', making it a no-op.
>
> Looking at the configure-flags for 'glibc', most of them look desirable
> on Hurd, but some of them don't.  [...]
[...]
> How about this: (untested)
>
>            ((#:configure-flags original-configure-flags)
>             `(list "--host=i686-pc-gnu"
>
>                    ;; nscd fails to build for GNU/Hurd:
>                    ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
>                    ;; Disable it.
>                    "--disable-nscd"
>
>                    ,@(filter (lambda (flag)
>                                (not (or (string-prefix? "--with-headers=" flag)
>                                         (string-prefix? "--enable-kernel=" flag))))
>                              original-configure-flags)))

The code above didn't work, for two reasons:

(1) 'original-configure-flags' is not actually a list of flags, but
    rather a scheme expression that evaluates to a list of flags.

(2) Evaluating 'original-configure-flags' fails in this context, because
    it includes the expression (from our glibc package)

            (string-append "--with-headers="
                           (assoc-ref %build-inputs "linux-headers")
                           "/include")

    but in this glibc/hurd package, there is no 'linux-headers' input,
    so the 'assoc-ref' returns #f and 'string-append' fails.

After a few iterations on IRC, I proposed this code which seems to work:

--8<---------------cut here---------------start------------->8---
       ((#:configure-flags original-configure-flags)
        `(append (list "--host=i686-pc-gnu"

                       ;; nscd fails to build for GNU/Hurd:
                       ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
                       ;; Disable it.
                       "--disable-nscd")
                 (filter (lambda (flag)
                           (not (or (string-prefix? "--with-headers=" flag)
                                    (string-prefix? "--enable-kernel=" flag))))
                         ;; Evaluate 'original-configure-flags' in a
                         ;; lexical environment that has a dummy
                         ;; "linux-headers" input, to prevent errors.
                         (let ((%build-inputs `(("linux-headers" "@DUMMY@")
                                                ,@%build-inputs)))
                           ,original-configure-flags))))
--8<---------------cut here---------------end--------------->8---

but obviously it's a bit gross.  Ideally, we consider consider having a
'glibc/base' package that is inherited by both 'glibc/linux' and
'glibc/hurd'.  The base package would not add any linux stuff, on the
theory that it is easier and cleaner to add kernel-specific stuff than
to remove it.

     Thoughts?
        Mark

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

* Re: [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal.
  2015-02-17 22:50   ` Mark H Weaver
@ 2015-02-18  9:37     ` Manolis Ragkousis
  0 siblings, 0 replies; 4+ messages in thread
From: Manolis Ragkousis @ 2015-02-18  9:37 UTC (permalink / raw)
  To: mhw; +Cc: Guix-devel

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

> After a few iterations on IRC, I proposed this code which seems to work:
>
> --8<---------------cut here---------------start------------->8---
>        ((#:configure-flags original-configure-flags)
>         `(append (list "--host=i686-pc-gnu"
>
>                        ;; nscd fails to build for GNU/Hurd:
>                        ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
>                        ;; Disable it.
>                        "--disable-nscd")
>                  (filter (lambda (flag)
>                            (not (or (string-prefix? "--with-headers=" flag)
>                                     (string-prefix? "--enable-kernel=" flag))))
>                          ;; Evaluate 'original-configure-flags' in a
>                          ;; lexical environment that has a dummy
>                          ;; "linux-headers" input, to prevent errors.
>                          (let ((%build-inputs `(("linux-headers" "@DUMMY@")
>                                                 ,@%build-inputs)))
>                            ,original-configure-flags))))
> --8<---------------cut here---------------end--------------->8---

The above code works perfectly. Mark I added you as a co-author to this patch
because your help was invaluable. Thank you :-)

> but obviously it's a bit gross.  Ideally, we consider consider having a
> 'glibc/base' package that is inherited by both 'glibc/linux' and
> 'glibc/hurd'.  The base package would not add any linux stuff, on the
> theory that it is easier and cleaner to add kernel-specific stuff than
> to remove it.

The best solution would have been to have a single glibc package for
everything but as
this is not possible with the current status of the hurd glibc, I
believe your idea
would really help avoid any futute problems and help simplify everything.
Then we would just have a simple macro in base.scm that would choose the right
glibc depending on the target/current system. Can/will do and update
you on this.

But for now the current solution will do in order to continue working
on the port.
Here is the updated patch after Mark's suggestions.

[-- Attachment #2: 0001-gnu-base-Add-glibc-hurd-and-hurd-minimal.patch --]
[-- Type: text/x-patch, Size: 17819 bytes --]

From d6b72ba67973c2dbf11ff37d02c97a9aee35c157 Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Sat, 27 Sep 2014 20:07:19 +0300
Subject: [PATCH] gnu: base: Add glibc-hurd and hurd-minimal.

* gnu/packages/base.scm (glibc/hurd, glibc/hurd-headers): New variables.
* gnu/packages/hurd.scm (hurd-minimal): New variable.
* gnu/packages/patches/glibc-make-4.0.patch: New file.
* gnu/packages/patches/glibc-hurd-extern-inline.patch: New file.
* gnu/packages/patches/libpthread-glibc-preparation.patch: New file.
* gnu/packages/patches/hurd-minimal.patch: New file.
* gnu-system.am (dist_patch_DATA): Add them.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Co-authored-by: Mark H Weaver <mhw@netris.org>
---
 gnu-system.am                                      |   4 +
 gnu/packages/base.scm                              | 111 +++++++++++++++++++++
 gnu/packages/hurd.scm                              |  67 ++++++++++++-
 .../patches/glibc-hurd-extern-inline.patch         |  34 +++++++
 gnu/packages/patches/glibc-make-4.0.patch          |  12 +++
 gnu/packages/patches/hurd-minimal.patch            |  22 ++++
 .../patches/libpthread-glibc-preparation.patch     |  59 +++++++++++
 7 files changed, 308 insertions(+), 1 deletion(-)
 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/hurd-minimal.patch
 create mode 100644 gnu/packages/patches/libpthread-glibc-preparation.patch

diff --git a/gnu-system.am b/gnu-system.am
index eeadd8f..4a401ac 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -401,6 +401,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/glibc-locales.patch			\
   gnu/packages/patches/glibc-mips-dangling-vfork-ref.patch	\
   gnu/packages/patches/gmp-arm-asm-nothumb.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-absolute-shlib-path.patch \
@@ -418,6 +420,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/gtkglext-disable-disable-deprecated.patch \
   gnu/packages/patches/hop-bigloo-4.0b.patch			\
   gnu/packages/patches/irrlicht-mesa-10.patch			\
+  gnu/packages/patches/hurd-minimal.patch			\
   gnu/packages/patches/jbig2dec-ignore-testtest.patch		\
   gnu/packages/patches/kmod-module-directory.patch		\
   gnu/packages/patches/libarchive-CVE-2013-0211.patch		\
@@ -435,6 +438,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/libvpx-fix-armhf-link.patch		\
   gnu/packages/patches/libvpx-fix-ssse3-quantize.patch		\
   gnu/packages/patches/libvpx-vp9-out-of-bounds-access.patch	\
+  gnu/packages/patches/libpthread-glibc-preparation.patch	\
   gnu/packages/patches/lm-sensors-hwmon-attrs.patch		\
   gnu/packages/patches/lua51-liblua-so.patch                    \
   gnu/packages/patches/luit-posix.patch				\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 554e848..eec2868 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,10 +33,13 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages gettext)
+  #:use-module (gnu packages hurd)
   #:use-module (gnu packages pkg-config)
   #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
 
 ;;; Commentary:
@@ -555,6 +559,113 @@ the 'share/locale' sub-directory of this package.")
                                         (assoc-ref %outputs "out")
                                         "/share/locale")))))))))
 
+(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 (map search-patch
+                            '("glibc-make-4.0.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
+     `(,@(package-native-inputs glibc)
+       ("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
+       ("mig" ,mig)
+       ("perl" ,perl)
+       ("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 original-configure-flags)
+        `(append (list "--host=i686-pc-gnu"
+
+                       ;; nscd fails to build for GNU/Hurd:
+                       ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
+                       ;; Disable it.
+                       "--disable-nscd")
+                 (filter (lambda (flag)
+                           (not (or (string-prefix? "--with-headers=" flag)
+                                    (string-prefix? "--enable-kernel=" flag))))
+                         ;; Evaluate 'original-configure-flags' in a
+                         ;; lexical environment that has a dummy
+                         ;; "linux-headers" input, to prevent errors.
+                         (let ((%build-inputs `(("linux-headers" . "@DUMMY@")
+                                                ,@%build-inputs)))
+                           ,original-configure-flags))))
+       ((#:phases phases)
+        `(alist-cons-after
+          'unpack 'prepare-libpthread
+          (lambda* (#:key inputs #:allow-other-keys)
+            (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
+
+            (system* "patch" "--force" "-p1" "-i"
+                     (assoc-ref inputs "patch/libpthread-patch"))
+
+            ;; Make the file writable.
+            (chmod "bits/pthreadtypes.h" #o644)
+            (copy-recursively "libpthread/sysdeps/generic/bits" "bits")
+            #t)
+          ,phases))))))
+
+(define-public glibc/hurd-headers
+  (package (inherit glibc/hurd)
+    (name "glibc-hurd-headers")
+    (outputs '("out"))
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc/hurd)
+       ;; We just pass the flags really needed to build the headers.
+       ((#:configure-flags _)
+        `(list "--enable-add-ons"
+               "--host=i686-pc-gnu"
+               "--enable-obsolete-rpc"))
+       ((#:phases _)
+        '(alist-replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (and (zero? (system* "make" "install-headers"))
+
+                 ;; Make an empty stubs.h to work around not being able to
+                 ;; produce a valid stubs.h and causing the build to fail. See
+                 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
+                 (let ((out (assoc-ref outputs "out")))
+                   (close-port
+                    (open-output-file
+                     (string-append out "/include/gnu/stubs.h"))))))
+
+          ;; Nothing to build.
+          (alist-delete
+           'build
+
+           (alist-cons-before
+            'configure 'pre-configure
+            (lambda _
+              ;; Use the right 'pwd'.
+              (substitute* "configure"
+                (("/bin/pwd") "pwd")))
+            %standard-phases))))))))
+
 (define-public tzdata
   (package
     (name "tzdata")
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 8ac78d3..5108114 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -20,11 +20,14 @@
   #:use-module (guix licenses)
   #:use-module (guix download)
   #:use-module (guix packages)
+  #:use-module (gnu packages)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages perl)
-  #:use-module (gnu packages autotools))
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (guix git-download))
 
 (define-public gnumach-headers
   (package
@@ -128,3 +131,65 @@ communication.")
      "This package provides C headers of the GNU Hurd, used to build the GNU C
 Library and other user programs.")
     (license gpl2+)))
+
+(define-public hurd-minimal
+  (package
+    (name "hurd-minimal")
+    (version "0.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "git://git.savannah.gnu.org/hurd/hurd")
+             (commit "a5ca1de1eb575294dbc865a2c4ff643efc117ef4")))
+       (sha256
+        (base32
+         "17vqdlpy1ifw4ijhc3ydkp8p5d406c7aq4ghpmg4a1h1wlwy32kr"))
+       (file-name (string-append name "-" version))
+       (patches (list (search-patch "hurd-minimal.patch")))))
+    (build-system gnu-build-system)
+    (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
+    (native-inputs
+     `(("autoconf" ,(autoconf-wrapper))
+       ("mig" ,mig)))
+
+    (arguments
+     `(#:phases (alist-replace
+                 'install
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let ((out (assoc-ref outputs "out")))
+                     ;; We need to copy libihash.a to the output directory manually,
+                     ;; since there is no target for that in the makefile.
+                     (mkdir-p (string-append out "/include"))
+                     (copy-file "libihash/ihash.h"
+                                (string-append out "/include/ihash.h"))
+                     (mkdir-p (string-append out "/lib"))
+                     (copy-file "libihash/libihash.a"
+                                (string-append out "/lib/libihash.a"))
+                     #t))
+                 (alist-replace
+                  'build
+                  (lambda _
+                    (zero? (system* "make" "-Clibihash" "libihash.a")))
+                  (alist-cons-before
+                   'configure 'bootstrap
+                   (lambda _
+                     (zero? (system* "autoreconf" "-vfi")))
+                   %standard-phases)))
+       #:configure-flags '(;; Pretend we're on GNU/Hurd; 'configure' wants
+                           ;; that.
+                           "--host=i686-pc-gnu"
+
+                           ;; Reduce set of dependencies.
+                           "--disable-ncursesw"
+                           "--disable-test"
+                           "--without-libbz2"
+                           "--without-libz"
+                           "--without-parted")
+       #:tests? #f))
+    (home-page "http://www.gnu.org/software/hurd/hurd.html")
+    (synopsis "GNU Hurd libraries")
+    (description
+     "This package provides libihash, needed to build the GNU C 
+Library for GNU/Hurd")
+    (license gpl2+)))
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..f13903c
--- /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/hurd-minimal.patch b/gnu/packages/patches/hurd-minimal.patch
new file mode 100644
index 0000000..b551d5c
--- /dev/null
+++ b/gnu/packages/patches/hurd-minimal.patch
@@ -0,0 +1,22 @@
+We want to build the Hurd's libihash very early so that we can then
+build libc.  Because of that, we cannot link against libc, and thus
+we miss 'clnt_create' and friends.
+
+See <http://lists.gnu.org/archive/html/bug-hurd/2014-04/msg00116.html>.
+
+diff --git a/configure.ac b/configure.ac
+index f8856db..a381219 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -297,9 +297,9 @@ AC_SUBST([XKB_BASE])
+ AC_DEFINE_UNQUOTED([X11_PREFIX], "$X11_PREFIX")
+ AC_SUBST([X11_KEYSYMDEF_H])
+ 
+-# Check for Sun RPC headers and library.
++# Check only for Sun RPC headers. We do not need the library yet.
+ AC_CHECK_HEADER([rpc/types.h], [HAVE_SUN_RPC=yes], [HAVE_SUN_RPC=no])
+-AC_SEARCH_LIBS([clnt_create], [], [:], [HAVE_SUN_RPC=no])
++# AC_SEARCH_LIBS([clnt_create], [], [:], [HAVE_SUN_RPC=no])
+ AC_SUBST([HAVE_SUN_RPC])
+ 
+ if test -f ./$ac_unique_file; then
diff --git a/gnu/packages/patches/libpthread-glibc-preparation.patch b/gnu/packages/patches/libpthread-glibc-preparation.patch
new file mode 100644
index 0000000..1897248
--- /dev/null
+++ b/gnu/packages/patches/libpthread-glibc-preparation.patch
@@ -0,0 +1,59 @@
+This patch helps to integrate the Hurd's libpthread as a libc add-on.
+
+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=.
+-- 
+1.9.0
+
+We are using a version of GNU Mach that lacks 'thread_terminate_release'
+(not introduced yet).  The 'thread_terminate' RPC call will be enough for
+our needs.
+See <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.
+See <http://lists.gnu.org/archive/html/commit-hurd/2009-04/msg00006.html>.
+  
+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.3.0


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

end of thread, other threads:[~2015-02-18  9:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-14 15:40 [PATCH 1/4] gnu: base: Add glibc-hurd and hurd-minimal Manolis Ragkousis
2015-02-15  0:09 ` Mark H Weaver
2015-02-17 22:50   ` Mark H Weaver
2015-02-18  9:37     ` 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).