From 21fe31fb235c322654959c458f73c5f192efee7c Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Tue, 9 Jun 2015 01:08:55 +0300 Subject: [PATCH] gnu: base: Add glibc-for-target macro. * gnu/packages/base.scm (glibc): Add macro. --- gnu/packages/base.scm | 104 ++++++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 64eea3a..5b60e2c 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: ;;; @@ -430,7 +432,7 @@ store.") (export make-ld-wrapper) -(define-public glibc +(define-public glibc/linux (package (name "glibc") (version "2.21") @@ -598,6 +600,61 @@ 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 + "0fkmn1kfsbhyrkf1wqqvc47dl5bzflnbcggjjfp5s9c489z916zw")) + (patches (list (search-patch "glibc-hurd-libs.patch") + (search-patch "libpthread-remove-duplicate.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* (glibc-for-target #:optional + (target (or (%current-target-system) + (%current-system)))) + "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))) + (define-public glibc-locales (package (inherit glibc) @@ -694,49 +751,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 - "0fkmn1kfsbhyrkf1wqqvc47dl5bzflnbcggjjfp5s9c489z916zw")) - (patches (list (search-patch "glibc-hurd-libs.patch") - (search-patch "libpthread-remove-duplicate.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") -- 2.4.2