~ruther/guix-local

5d4d7a9aa9d76b7c626c50f3d07d9a03770981e3 — Manolis Ragkousis 9 years ago 2cf0221
gnu: glibc-hurd: Update to 20160518.

* gnu/packages/base.scm (glibc/hurd)[version]: Update to version 20160518.
  [propagated-inputs]: Use hurd-core-headers.
  [native-inputs]: Remove libpthread's source and "patch/libpthread-patch".
  [arguments]: Add augment-libc.so and pre-configure-set-pwd phases.
  Remove prepare-libpthread phase.  Stop removing "--with-headers="
  from original-configure-flags.
* gnu/packages/patches/glibc-hurd-extern-inline.patch: Remove patch.
* gnu/packages/patches/libpthread-glibc-preparation.patch: Likewise.
* gnu/local.mk (dist_patch_DATA): Remove them.
4 files changed, 32 insertions(+), 225 deletions(-)

M gnu/local.mk
M gnu/packages/base.scm
D gnu/packages/patches/glibc-hurd-extern-inline.patch
D gnu/packages/patches/libpthread-glibc-preparation.patch
M gnu/local.mk => gnu/local.mk +0 -2
@@ 502,7 502,6 @@ dist_patch_DATA =						\
  gnu/packages/patches/glib-networking-ssl-cert-file.patch	\
  gnu/packages/patches/glib-tests-timer.patch			\
  gnu/packages/patches/glibc-bootstrap-system.patch		\
  gnu/packages/patches/glibc-hurd-extern-inline.patch		\
  gnu/packages/patches/glibc-ldd-x86_64.patch			\
  gnu/packages/patches/glibc-locales.patch			\
  gnu/packages/patches/glibc-o-largefile.patch			\


@@ 601,7 600,6 @@ dist_patch_DATA =						\
  gnu/packages/patches/libxslt-generated-ids.patch		\
  gnu/packages/patches/libxslt-remove-date-timestamps.patch	\
  gnu/packages/patches/lirc-localstatedir.patch			\
  gnu/packages/patches/libpthread-glibc-preparation.patch	\
  gnu/packages/patches/lm-sensors-hwmon-attrs.patch		\
  gnu/packages/patches/lua-pkgconfig.patch                      \
  gnu/packages/patches/lua51-liblua-so.patch                    \

M gnu/packages/base.scm => gnu/packages/base.scm +32 -42
@@ 761,66 761,56 @@ command.")
  ;; The Hurd's libc variant.
  (package (inherit glibc)
    (name "glibc-hurd")
    (version "2.18")
    (version "2.19")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "git://git.sv.gnu.org/hurd/glibc")
                    (commit "cc94b3cfe65523f980359e5f0e93a26196bda1d3")))
              (method url-fetch)
              (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-"
                                  version "-hurd+libpthread-20160518" ".tar.gz"))
              (sha256
               (base32
                "17gsh0kaz0zyvghjmx861mi2p65m9901lngi179x61zm6v2v3xc4"))
              (file-name (string-append name "-" version))
              (patches (search-patches "glibc-hurd-extern-inline.patch"))))
                "12zmdjviybpsdb2kq4cg98rds7909f0cc96fzdahdfrzlxx1q0px"))))

    ;; 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)))
    (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers)))
    (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 "0ef7b75c4ba91b6660f0d3d8b51d14d25e3d5bfb")))
                        (sha256
                         (base32
                          "031py18fls15z0wprni33mf762kg6fx8xqijppimhp83yp6ky3l3"))
                        (file-name "libpthread")))))
       ("perl" ,perl)))

    (arguments
     (substitute-keyword-arguments (package-arguments glibc)
       ((#:configure-flags original-configure-flags)
        `(append (list "--host=i686-pc-gnu"
       ((#:phases original-phases)
        ;; Add libmachuser.so and libhurduser.so to libc.so's search path.
        ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-07/msg00051.html>.
        `(alist-cons-after
          'install 'augment-libc.so
          (lambda* (#:key outputs #:allow-other-keys)
            (let* ((out (assoc-ref outputs "out")))
              (substitute* (string-append out "/lib/libc.so")
                (("/[^ ]+/lib/libc.so.0.3")
                 (string-append out "/lib/libc.so.0.3" " libmachuser.so" " libhurduser.so"))))
            #t)
          (alist-cons-after
           'pre-configure 'pre-configure-set-pwd
           (lambda _
             ;; Use the right 'pwd'.
             (substitute* "configure"
               (("/bin/pwd") "pwd")))
          ,original-phases)))
        ((#:configure-flags original-configure-flags)
        `(append (list "--host=i586-pc-gnu"

                       ;; We need this to get a working openpty() function.
                       "--enable-pt_chown"

                       ;; 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"))
            #t)
          ,phases))))
                           (not (string-prefix? "--enable-kernel=" flag)))
                         ,original-configure-flags)))))
    (synopsis "The GNU C Library (GNU Hurd variant)")
    (supported-systems %hurd-systems)))


D gnu/packages/patches/glibc-hurd-extern-inline.patch => gnu/packages/patches/glibc-hurd-extern-inline.patch +0 -35
@@ 1,35 0,0 @@
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

Link libmachuser and libhurduser automatically with libc, since they are
considered a standard part of the API in GNU-land.

--- a/Makerules
+++ b/Makerules
@@ -978,6 +978,9 @@
 	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
	      ' AS_NEEDED (' $(rtlddir)/$(rtld-installed-name) ') )' \
 	) > $@.new
+ifeq ($(patsubst gnu%,,$(config-os)),)
+	echo 'INPUT ( AS_NEEDED ( -lmachuser -lhurduser ) )' >> $@.new
+endif
 	mv -f $@.new $@
 
 endif
\ No newline at end of file

D gnu/packages/patches/libpthread-glibc-preparation.patch => gnu/packages/patches/libpthread-glibc-preparation.patch +0 -146
@@ 1,146 0,0 @@
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

The version of the glibc we use doesn't include the shm-directory.c file and does
not yet support IS_IN.
See <https://lists.gnu.org/archive/html/bug-hurd/2015-03/msg00078.html>

diff --git a/libpthread/Makefile b/libpthread/Makefile
index 2906788..b8dee58 100644
--- a/libpthread/Makefile
+++ b/libpthread/Makefile
@@ -149,8 +149,6 @@ libpthread-routines := pt-attr pt-attr-destroy pt-attr-getdetachstate	    \
 	sem-post sem-timedwait sem-trywait sem-unlink			    \
 	sem-wait							    \
 									    \
-	shm-directory							    \
-									    \
 	cthreads-compat							    \
 	$(SYSDEPS)
 
-- 
2.3.6

diff --git a/libpthread/pthread/pt-create.c b/libpthread/pthread/pt-create.c
index d88afae..84044dc 100644
--- a/libpthread/pthread/pt-create.c
+++ b/libpthread/pthread/pt-create.c
@@ -28,7 +28,7 @@
 
 #include <pt-internal.h>
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
 # include <ctype.h>
 #endif
 #ifdef HAVE_USELOCALE
@@ -50,7 +50,7 @@ entry_point (struct __pthread *self, void *(*start_routine)(void *), void *arg)
   __resp = &self->res_state;
 #endif
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
   /* Initialize pointers to locale data.  */
   __ctype_init ();
 #endif
diff --git a/libpthread/pthread/pt-initialize.c b/libpthread/pthread/pt-initialize.c
index 9e5404b..b9cacbd 100644
--- a/libpthread/pthread/pt-initialize.c
+++ b/libpthread/pthread/pt-initialize.c
@@ -28,7 +28,7 @@
 
 DEFINE_HOOK (__pthread_init, (void));
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
 static const struct pthread_functions pthread_functions =
   {
     .ptr_pthread_attr_destroy = __pthread_attr_destroy,
@@ -81,7 +81,7 @@ static const struct pthread_functions pthread_functions =
 void
 ___pthread_init (void)
 {
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
   __libc_pthread_init(&pthread_functions);
 #endif
   RUN_HOOK (__pthread_init, ());
diff --git a/libpthread/pthread/pt-internal.h b/libpthread/pthread/pt-internal.h
index 18b5b4c..8cdcfce 100644
--- a/libpthread/pthread/pt-internal.h
+++ b/libpthread/pthread/pt-internal.h
@@ -35,7 +35,7 @@
 #include <pt-sysdep.h>
 #include <pt-machdep.h>
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
 # include <ldsodefs.h>
 #endif
 
@@ -60,7 +60,7 @@ enum pthread_state
 # define PTHREAD_SYSDEP_MEMBERS
 #endif
 
-#if !(IS_IN (libpthread))
+#ifndef IS_IN_libpthread
 #ifdef ENABLE_TLS
 /* Type of the TCB.  */
 typedef struct