unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Manolis Ragkousis <manolis837@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel@gnu.org
Subject: Re: [PATCH] gnu: base: Add Glibc-Hurd.
Date: Thu, 17 Jul 2014 18:39:09 +0300	[thread overview]
Message-ID: <CAFtzXzOt44kF1Ribz5HzCL6VCKhaQ9VMqgLvUeKu2ow-hf1dOA@mail.gmail.com> (raw)
In-Reply-To: <878uoqguh3.fsf@gnu.org>

[-- 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


      reply	other threads:[~2014-07-17 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFtzXzOt44kF1Ribz5HzCL6VCKhaQ9VMqgLvUeKu2ow-hf1dOA@mail.gmail.com \
    --to=manolis837@gmail.com \
    --cc=Guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).