From 0ee996bfbd300c62f2a31a8b6466de7565022da0 Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Tue, 19 May 2015 01:10:06 +0300 Subject: [PATCH 10/10] gnu: base: Added glibc-for-target macro. gnu/packages/base.scm (glibc): Add macro. --- gnu/packages/base.scm | 178 +++++++++++++++++++++++++++----------------------- 1 file changed, 95 insertions(+), 83 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index f6fd55d..34bff29 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -43,7 +43,9 @@ #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system gnu) - #:use-module (guix build-system trivial)) + #:use-module (guix build-system trivial) + #:use-module (ice-9 match) + #:export (glibc)) ;;; Commentary: ;;; @@ -432,7 +434,7 @@ store.") (export make-ld-wrapper) -(define-public glibc +(define-public glibc/linux (package (name "glibc") (version "2.21") @@ -600,6 +602,97 @@ with the Linux kernel.") (license lgpl2.0+) (home-page "http://www.gnu.org/software/libc/"))) +(define-public glibc/hurd + (package (inherit glibc/linux) + (name "glibc-hurd") + (version "2.19") + (source (origin + (method url-fetch) + (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-" + version "-hurd+libpthread-20150515" ".tar.gz")) + (sha256 + (base32 + "17gsh0kaz0zyvghjmx861mi2p65m9901lngi179x61zm6v2v3xc4")) + (patches (map search-patch + '("glibc-hurd-extern-inline.patch"))))) + + ;; Libc provides , 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/linux) + ("mig" ,mig) + ("perl" ,perl))) + + (arguments + (substitute-keyword-arguments (package-arguments glibc/linux) + ((#:configure-flags original-configure-flags) + `(append (list "--host=i686-pc-gnu" + + ;; nscd fails to build for GNU/Hurd: + ;; . + ;; 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)))))))) + + +(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 + ;; . + (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 (glibc-for-target target) + "Return the glibc for TARGET, glibc/linux for a linux host or +glibc/hurd for a hurd host" + (match target + ("i686-pc-gnu" glibc/hurd) + (_ glibc/linux))) + +(define-syntax glibc + (identifier-syntax (glibc-for-target (or (%current-target-system) (%current-system))))) + (define-public glibc-locales (package (inherit glibc) @@ -696,87 +789,6 @@ 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.19") - (source (origin - (method url-fetch) - (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-" - version "-hurd+libpthread-20150515" ".tar.gz")) - (sha256 - (base32 - "17gsh0kaz0zyvghjmx861mi2p65m9901lngi179x61zm6v2v3xc4")) - (patches (map search-patch - '("glibc-hurd-extern-inline.patch"))))) - - ;; Libc provides , 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) - ("mig" ,mig) - ("perl" ,perl))) - - (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: - ;; . - ;; 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)))))))) - - -(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 - ;; . - (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") -- 2.4.1