[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/06: gnu: base: Add glibc-hurd and hurd-minimal.
From: |
Manolis Fragkiskos Ragkousis |
Subject: |
01/06: gnu: base: Add glibc-hurd and hurd-minimal. |
Date: |
Tue, 05 May 2015 13:10:59 +0000 |
phant0mas pushed a commit to branch wip-hurd
in repository guix.
commit 66b75f063ee7ca8eb74d085c9f0dfb0fc8046ef8
Author: Manolis Ragkousis <address@hidden>
Date: Sat Sep 27 20:07:19 2014 +0300
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-hurd-extern-inline.patch: New file.
* gnu/packages/patches/libpthread-glibc-preparation.patch: New file.
* gnu-system.am (dist_patch_DATA): Add them.
Co-authored-by: Ludovic Courtès <address@hidden>
Co-authored-by: Mark H Weaver <address@hidden>
---
gnu-system.am | 2 +
gnu/packages/base.scm | 106 ++++++++++++++
gnu/packages/hurd.scm | 57 ++++++++-
.../patches/glibc-hurd-extern-inline.patch | 35 +++++
.../patches/libpthread-glibc-preparation.patch | 146 ++++++++++++++++++++
5 files changed, 345 insertions(+), 1 deletions(-)
diff --git a/gnu-system.am b/gnu-system.am
index 798188f..bff0176 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -437,6 +437,7 @@ dist_patch_DATA =
\
gnu/packages/patches/glibc-locales.patch \
gnu/packages/patches/gmp-arm-asm-nothumb.patch \
gnu/packages/patches/gnutls-fix-duplicate-manpages.patch \
+ gnu/packages/patches/glibc-hurd-extern-inline.patch \
gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch \
gnu/packages/patches/gobject-introspection-cc.patch \
gnu/packages/patches/gobject-introspection-girepository.patch \
@@ -473,6 +474,7 @@ dist_patch_DATA =
\
gnu/packages/patches/libvpx-vp9-out-of-bounds-access.patch \
gnu/packages/patches/linux-libre-libreboot-fix.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/lua51-liblua-so.patch \
gnu/packages/patches/luajit-no_ldconfig.patch \
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index c6206fd..6f46119 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2012 Nikita Karetnikov <address@hidden>
;;; Copyright © 2014, 2015 Mark H Weaver <address@hidden>
;;; Copyright © 2014 Alex Kost <address@hidden>
+;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -33,11 +34,14 @@
#: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 (gnu packages gettext)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix git-download)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial))
@@ -689,6 +693,108 @@ variety of options. It is an alternative to the shell
\"type\" built-in
command.")
(license gpl3+))) ; some files are under GPLv2+
+(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 "cc94b3cfe65523f980359e5f0e93a26196bda1d3")))
+ (sha256
+ (base32
+ "17gsh0kaz0zyvghjmx861mi2p65m9901lngi179x61zm6v2v3xc4"))
+ (file-name (string-append name "-" version))
+ (patches (map 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
+ `(,@(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")))))
+
+ (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"))
+ #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 62dc043..393d3c1 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,55 @@ 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 (inherit hurd-headers)
+ (name "hurd-minimal")
+ (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"
+ ;; Skip the clnt_create check because it expects
+ ;; a working glibc causing a circular dependency.
+ "ac_cv_search_clnt_create=no")
+ #: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..a609b1f
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-extern-inline.patch
@@ -0,0 +1,35 @@
+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) ') )' \
+ ) > address@hidden
++ifeq ($(patsubst gnu%,,$(config-os)),)
++ echo 'INPUT ( AS_NEEDED ( -lmachuser -lhurduser ) )' >> address@hidden
++endif
+ mv -f address@hidden $@
+
+ endif
\ No newline at end of file
diff --git a/gnu/packages/patches/libpthread-glibc-preparation.patch
b/gnu/packages/patches/libpthread-glibc-preparation.patch
new file mode 100644
index 0000000..a432454
--- /dev/null
+++ b/gnu/packages/patches/libpthread-glibc-preparation.patch
@@ -0,0 +1,146 @@
+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
- branch wip-hurd created (now b2611e8), Manolis Fragkiskos Ragkousis, 2015/05/05
- 03/06: gnu: bootstrap: Add the location of where ld.so is located on Hurd systems., Manolis Fragkiskos Ragkousis, 2015/05/05
- 04/06: gnu: cross-base: Make it aware of non-Linux (ie. Hurd) systems., Manolis Fragkiskos Ragkousis, 2015/05/05
- 01/06: gnu: base: Add glibc-hurd and hurd-minimal.,
Manolis Fragkiskos Ragkousis <=
- 02/06: gnu: cross-base: Add support to cross-build libc for GNU/Hurd., Manolis Fragkiskos Ragkousis, 2015/05/05
- 05/06: gnu: gcc: Also substitute the dynamic linker name for GNU (ie. Hurd) systems., Manolis Fragkiskos Ragkousis, 2015/05/05
- 06/06: gnu: acl: Fix i686-gnu build., Manolis Fragkiskos Ragkousis, 2015/05/05