From 2d546858b139e5fcf2cbdf9958a17fd98803ac4c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 18 Nov 2018 23:12:36 +0100 Subject: gnu: hurd: Build against glibc 2.28. Version 2.28 of glibc is the first in a long time that fully supports GNU/Hurd. This change updates the Hurd and Mach to provide the features glibc 2.28 expects and adjusts the cross-compilation tool chain for "i586-pc-gnu". * gnu/packages/base.scm (glibc/linux): Rename to... (glibc): ... this. [propagated-inputs]: Add 'hurd-target?' case. [arguments]: Use '--disable-werror' when 'hurd-target?'. Add 'augment-libc.so' phase when 'hurd-target?'. [native-inputs]: Add MIG and PERL when 'hurd-target?'. (glibc/hurd, glibc-for-target): Remove (glibc/hurd-headers): Inherit from GLIBC, not GLIBC/HURD. [arguments]: Remove "--enable-obsolete-rpc" configure flag and 'patch-configure-script' phase. * gnu/packages/cross-base.scm (cross-kernel-headers)[xglibc/hurd-headers]: Move 'set-cross-headers-path' after 'unpack'. * gnu/packages/cross-base.scm (cross-libc)[cross-libc-for-target]: Remove. Pass "--disable-werror" when TARGET matches 'hurd-triplet?'. * gnu/packages/hurd.scm (hurd-target?, patch-url): New procedures. (gnumach-headers)[source](patches, modules, snippet): New fields. (hurd-headers): Use Git commit 98b3390. [native-inputs]: Add AUTOCONF and AUTOMAKE. [arguments]: Add "ac_cv_func_*" configure flags. (hurd-minimal)[native-inputs]: Remove. [arguments]: In 'build' phase, build "include/assert-backtrace.h" first. --- gnu/packages/base.scm | 139 ++++++++++++++------------------------------------ 1 file changed, 39 insertions(+), 100 deletions(-) (limited to 'gnu/packages/base.scm') diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 3a1186673e..60f8051dc6 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -577,7 +577,9 @@ store.") (export make-ld-wrapper) -(define-public glibc/linux +(define-public glibc + ;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to + ;; version 2.28, GNU/Hurd used a different glibc branch. (package (name "glibc") ;; Note: Always use a dot after the minor version since various places rely @@ -608,8 +610,13 @@ store.") (build-system gnu-build-system) ;; Glibc's refers to , for instance, so glibc - ;; users should automatically pull Linux headers as well. - (propagated-inputs `(("kernel-headers" ,linux-libre-headers))) + ;; users should automatically pull Linux headers as well. On GNU/Hurd, + ;; libc provides , which includes a bunch of Hurd and Mach headers, + ;; so both should be propagated. + (propagated-inputs + (if (hurd-target?) + `(("hurd-core-headers" ,hurd-core-headers)) + `(("kernel-headers" ,linux-libre-headers)))) (outputs '("out" "debug" "static")) ;9 MiB of .a files @@ -664,7 +671,13 @@ store.") ;; Use our Bash instead of /bin/sh. (string-append "BASH_SHELL=" (assoc-ref %build-inputs "bash") - "/bin/bash")) + "/bin/bash") + + ;; On GNU/Hurd we get discarded-qualifiers warnings for + ;; 'device_write_inband' among other things. Ignore them. + ,@(if (hurd-target?) + '("--disable-werror") + '())) #:tests? #f ; XXX #:phases (modify-phases %standard-phases @@ -769,7 +782,18 @@ store.") (filter linker-script? (map (cut string-append slib "/" <>) files))) - #t)))))) + #t))) + + ,@(if (hurd-target?) + '((add-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))) + '())))) (inputs `(("static-bash" ,static-bash))) @@ -778,7 +802,12 @@ store.") (native-inputs `(("texinfo" ,texinfo) ("perl" ,perl) ("bison" ,bison) - ("gettext" ,gettext-minimal))) + ("gettext" ,gettext-minimal) + + ,@(if (hurd-target?) + `(("mig" ,mig) + ("perl" ,perl)) + '()))) (native-search-paths ;; Search path for packages that provide locale data. This is useful @@ -800,89 +829,6 @@ with the Linux kernel.") (license lgpl2.0+) (home-page "https://www.gnu.org/software/libc/"))) -(define-public glibc/hurd - ;; The Hurd's libc variant. - (package (inherit glibc/linux) - (name "glibc-hurd") - (version "2.23") - (source (origin - (method url-fetch) - (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-" - version "-hurd+libpthread-20161218" ".tar.gz")) - (sha256 - (base32 - "0vpdv05j6j3ria5bw8gp468i64gij94cslxkxj9xkfgi6p615b8p")))) - - ;; 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 . - `(modify-phases ,original-phases - (add-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)) - (add-after 'pre-configure 'pre-configure-set-pwd - (lambda _ - ;; Use the right 'pwd'. - (substitute* "configure" - (("/bin/pwd") "pwd")) - #t)) - (replace 'build - (lambda _ - ;; Force mach/hurd/libpthread subdirs to build first in order to avoid - ;; linking errors. - ;; See - (let ((flags (list "-j" (number->string (parallel-job-count))))) - (define (make target) - (apply invoke "make" target flags)) - (make "mach/subdir_lib") - (make "hurd/subdir_lib") - (make "libpthread/subdir_lib") - (apply invoke "make" flags)))))) - ((#:configure-flags original-configure-flags) - `(append (list "--host=i586-pc-gnu" - - ;; We need this to get a working openpty() function. - "--enable-pt_chown" - - ;; - "--disable-werror" - - ;; 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))) - ;; Below are old libc versions, which we use mostly to build locale data in ;; the old format (which the new libc cannot cope with.) @@ -1121,18 +1067,17 @@ command.") (license gpl3+))) ; some files are under GPLv2+ (define-public glibc/hurd-headers - (package (inherit glibc/hurd) + (package (inherit glibc) (name "glibc-hurd-headers") (outputs '("out")) (propagated-inputs `(("gnumach-headers" ,gnumach-headers) ("hurd-headers" ,hurd-headers))) (arguments - (substitute-keyword-arguments (package-arguments glibc/hurd) + (substitute-keyword-arguments (package-arguments glibc) ;; We just pass the flags really needed to build the headers. ((#:configure-flags _) `(list "--enable-add-ons" - "--host=i586-pc-gnu" - "--enable-obsolete-rpc")) + "--host=i586-pc-gnu")) ((#:phases _) '(modify-phases %standard-phases (replace 'install @@ -1147,13 +1092,7 @@ command.") (open-output-file (string-append out "/include/gnu/stubs.h")))) #t)) - (delete 'build) ; nothing to build - (add-before 'configure 'patch-configure-script - (lambda _ - ;; Use the right 'pwd'. - (substitute* "configure" - (("/bin/pwd") "pwd")) - #t)))))))) + (delete 'build))))))) ; nothing to build (define-public tzdata (package -- cgit v1.2.3