From b09617da042ea6adc819df7a2ee04011133f696b Mon Sep 17 00:00:00 2001 From: Manolis Ragkousis Date: Mon, 6 Jun 2016 17:21:51 +0300 Subject: gnu: base: Add glibc-for-target macro. * gnu/packages/base.scm (glibc): Add macro. (glibc/linux): Rename glibc to glibc/linux. (glibc/hurd): Adjust accordingly. --- gnu/packages/base.scm | 132 ++++++++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 59 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index d0ef06209f..74194bccdb 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -44,7 +44,9 @@ (define-module (gnu packages base) #: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: ;;; @@ -464,7 +466,7 @@ (define* (make-ld-wrapper name #:key binutils (export make-ld-wrapper) -(define-public glibc +(define-public glibc/linux (package (name "glibc") (version "2.23") @@ -641,6 +643,75 @@ (define-public glibc (license lgpl2.0+) (home-page "http://www.gnu.org/software/libc/"))) +(define-public glibc/hurd + ;; The Hurd's libc variant. + (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-20160518" ".tar.gz")) + (sha256 + (base32 + "12zmdjviybpsdb2kq4cg98rds7909f0cc96fzdahdfrzlxx1q0px")))) + + ;; Libc provides , which includes a bunch of Hurd and Mach headers, + ;; so both should be propagated. + (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers))) + (native-inputs + `(,@(package-native-inputs glibc/linux) + ("mig" ,mig) + ("perl" ,perl))) + + (arguments + (substitute-keyword-arguments (package-arguments glibc/linux) + ((#:phases original-phases) + ;; Add libmachuser.so and libhurduser.so to libc.so's search path. + ;; See . + `(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: + ;; . + ;; Disable it. + "--disable-nscd") + (filter (lambda (flag) + (not (string-prefix? "--enable-kernel=" flag))) + ,original-configure-flags))))) + (synopsis "The GNU C Library (GNU Hurd variant)") + (supported-systems %hurd-systems))) + +(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 + ((or "i586-pc-gnu" "i586-gnu") glibc/hurd) + (_ glibc/linux))) + +(define-syntax glibc + (identifier-syntax (glibc-for-target))) + (define-public glibc-2.21 ;; The old libc, which we use mostly to build locale data in the old format ;; (which the new libc can cope with.) @@ -760,63 +831,6 @@ (define-public which command.") (license gpl3+))) ; some files are under GPLv2+ -(define-public glibc/hurd - ;; The Hurd's libc variant. - (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-20160518" ".tar.gz")) - (sha256 - (base32 - "12zmdjviybpsdb2kq4cg98rds7909f0cc96fzdahdfrzlxx1q0px")))) - - ;; Libc provides , which includes a bunch of Hurd and Mach headers, - ;; so both should be propagated. - (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers))) - (native-inputs - `(,@(package-native-inputs glibc) - ("mig" ,mig) - ("perl" ,perl))) - - (arguments - (substitute-keyword-arguments (package-arguments glibc) - ((#:phases original-phases) - ;; Add libmachuser.so and libhurduser.so to libc.so's search path. - ;; See . - `(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: - ;; . - ;; Disable it. - "--disable-nscd") - (filter (lambda (flag) - (not (string-prefix? "--enable-kernel=" flag))) - ,original-configure-flags))))) - (synopsis "The GNU C Library (GNU Hurd variant)") - (supported-systems %hurd-systems))) - (define-public glibc/hurd-headers (package (inherit glibc/hurd) (name "glibc-hurd-headers") -- cgit v1.2.3