summary refs log tree commit diff
path: root/gnu/packages/base.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/base.scm')
-rw-r--r--gnu/packages/base.scm152
1 files changed, 101 insertions, 51 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index ada9edf0e6..1fdfaf8a57 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -22,6 +22,7 @@
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 zamfofex <zamfofex@twdb.moe>
 ;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -75,6 +76,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (glibc
+            libc-for-target
             make-ld-wrapper
             libiconv-if-needed))
 
@@ -132,21 +134,17 @@ command-line arguments, multiple languages, and so on.")
                                  (string-append bin "/fgrep"))
                 (("^exec grep")
                  (string-append "exec " bin "/grep"))))))
-        ,@(if (target-hurd?)
-              '((add-before 'check 'skip-triple-backref-test
+        ,@(if (system-hurd?)
+              '((add-before 'check 'skip-test
                   (lambda _
-                    ;; This test is marked as malfunctioning on glibc systems
-                    ;; due to
-                    ;; <https://sourceware.org/bugzilla/show_bug.cgi?id=11053>
-                    ;; and it triggers a segfault with glibc 2.33 on GNU/Hurd.
-                    ;; Skip it.
-                    (substitute* "tests/triple-backref"
-                      (("^warn_" all)
-                       (string-append "exit 77\n" all))))))
-              '()))
-      #:make-flags ,(if (target-hurd?)
-                        ''("XFAIL_TESTS=test-perror2 equiv-classes") ;XXX
-                        ''())))
+                    (substitute*
+                        ;; This test hangs
+                        '("tests/hash-collision-perf"
+                          ;; This test fails
+                          "tests/file")
+                      (("^#!.*" all)
+                       (string-append all "exit 77;\n"))))))
+              '()))))
    (synopsis "Print lines matching a pattern")
    (description
      "grep is a tool for finding text inside files.  Text is found by
@@ -185,10 +183,6 @@ including, for example, recursive directory searching.")
                     "  CONFIG_HEADER='$(CONFIG_HEADER)'\t\t\\\n")))))
             (modules '((guix build utils)))))
    (build-system gnu-build-system)
-   (arguments
-    `(#:make-flags ,(if (target-hurd?)
-                        ''("XFAIL_TESTS=test-perror2")
-                        ''())))
    (synopsis "Stream editor")
    (native-inputs (list perl))                    ;for tests
    (description
@@ -309,9 +303,15 @@ differences.")
             (patches (search-patches "diffutils-fix-signal-processing.patch"))))
    (build-system gnu-build-system)
    (arguments
-    `(#:make-flags ,(if (target-hurd?)
-                        ''("XFAIL_TESTS=test-perror2 large-subopt")
-                        ''())))
+    (list
+     #:phases (if (system-hurd?)
+                  #~(modify-phases %standard-phases
+                      (add-after 'unpack 'skip-tests
+                        (lambda _
+                          (substitute* "tests/large-subopt"
+                            (("^#!.*" all)
+                             (string-append all "exit 77;\n"))))))
+                  #~%standard-phases)))
    (native-inputs (list perl))
    (synopsis "Comparing and merging files")
    (description
@@ -346,10 +346,16 @@ interactive means to merge two files.")
                      (substitute* '("tests/xargs/verbose-quote.sh"
                                     "tests/find/exec-plus-last-file.sh")
                        (("#!/bin/sh")
-                        (string-append "#!" (which "sh")))))))
-      #:make-flags ,(if (target-hurd?)
-                        ''("XFAIL_TESTS=test-strerror_r")
-                        ''())))
+                        (string-append "#!" (which "sh"))))))
+                 ,@(if (system-hurd?)
+                       '((add-after 'unpack 'skip-tests
+                           (lambda _
+                             (substitute*
+                                 ;; This test fails non-deterministically
+                                 "gnulib-tests/test-strerror_r.c"
+                               (("(^| )main *\\(.*" all)
+                                (string-append all "{\n  exit (77);//"))))))
+                       '()))))
    (synopsis "Operating on files matching given criteria")
    (description
     "Findutils supplies the basic file directory searching utilities of the
@@ -395,23 +401,13 @@ used to apply commands with arbitrarily long arguments.")
    (outputs '("out" "debug"))
    (arguments
     `(#:parallel-build? #f            ; help2man may be called too early
-      ,@(if (target-hurd?)
+      ,@(if (system-hurd?)
             '(#:make-flags            ; these tests fail deterministically
-              (list (string-append "XFAIL_TESTS=tests/misc/env-S.pl"
-                                   " tests/misc/kill.sh"
-                                   " tests/misc/nice.sh"
-                                   " tests/misc/pwd-long.sh"
-                                   " tests/split/fail.sh"
-
-                                   ;; /hurd/fifo issue:
-                                   ;; <https://issues.guix.gnu.org/58803>.
-                                   " tests/df/unreadable.sh"
-
+              (list (string-append "XFAIL_TESTS="
                                    ;; Gnulib tests.
                                    " test-fdutimensat"
                                    " test-futimens"
                                    " test-linkat"
-                                   " test-perror2"
                                    " test-renameat"
                                    " test-renameatu"
                                    " test-utimensat")))
@@ -433,10 +429,35 @@ used to apply commands with arbitrarily long arguments.")
                        (("#!/bin/sh") (string-append "#!" (which "sh"))))))
                  (add-after 'unpack 'remove-tests
                    (lambda _
-                     ,@(if (target-hurd?)
-                           '((substitute* "Makefile.in"
-                               ;; this test hangs
-                               (("^ *tests/misc/timeout-group.sh.*") ""))
+                     ,@(if (system-hurd?)
+                           '((substitute*
+                                 ;; These tests hang
+                                 '("tests/cp/sparse-to-pipe.sh"
+                                   "tests/split/fail.sh"
+                                   ;; These tests error
+                                   "tests/dd/nocache.sh"
+                                   ;; These tests fail
+                                   "tests/cp/sparse.sh"
+                                   "tests/cp/special-f.sh"
+                                   "tests/dd/bytes.sh"
+                                   "tests/dd/stats.sh"
+                                   "tests/ls/dangle.sh"
+                                   "tests/ls/follow-slink.sh"
+                                   "tests/ls/hyperlink.sh"
+                                   "tests/ls/infloop.sh"
+                                   "tests/ls/inode.sh"
+                                   "tests/ls/selinux-segfault.sh"
+                                   "tests/misc/env-S.pl"
+                                   "tests/misc/factor-parallel.sh"
+                                   "tests/misc/ls-misc.pl"
+                                   "tests/misc/nice.sh"
+                                   "tests/misc/pwd-long.sh"
+                                   "tests/misc/shred-passes.sh"
+                                   "tests/misc/stat-slash.sh"
+                                   "tests/rm/fail-eperm.xpl"
+                                   "tests/split/filter.sh")
+                               (("^#!.*" all)
+                                (string-append all "exit 77;\n")))
                              (substitute* "gnulib-tests/Makefile.in"
                                ;; This test sometimes fails and sometimes
                                ;; passes, but it does this consistently, so
@@ -1419,25 +1440,44 @@ 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.37")
+    (source (origin
+            (method url-fetch)
+            (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
+            (sha256
+             (base32
+              "0hqsp4dzrjx0iga6jv0magjw26dh82pxlmk8yis5v0d127qyymr2"))
+            (patches (search-patches "glibc-ldd-powerpc.patch"
+                                     "glibc-dl-cache.patch"
+                                     "glibc-2.37-versioned-locpath.patch"
+                                     "glibc-reinstate-prlimit64-fallback.patch"
+                                     "glibc-supported-locales.patch"
+                                     "glibc-2.37-hurd-clock_t_centiseconds.patch"
+                                     "glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch"
+                                     "glibc-hurd-mach-print.patch"
+                                     "glibc-hurd-gettyent.patch"))))
+    (supported-systems %hurd-systems)))
+
 (define-public glibc/hurd-headers
-  (package (inherit glibc)
+  (package/inherit glibc/hurd
     (name "glibc-hurd-headers")
     (outputs '("out"))
     (propagated-inputs (list gnumach-headers hurd-headers))
     (native-inputs
-     (modify-inputs (package-native-inputs glibc)
+     (modify-inputs (package-native-inputs glibc/hurd)
        (prepend (if (%current-target-system)
-                    ;; XXX: When targeting i586-pc-gnu, we need a 32-bit MiG,
-                    ;; hence this hack.
-                    (package (inherit mig)
-                             (arguments `(#:system "i686-linux")))
+                    (let* ((cross-base (resolve-interface '(gnu packages cross-base)))
+                           (cross-mig (module-ref cross-base 'cross-mig)))
+                      (cross-mig (%current-target-system)))
                     mig))))
     (arguments
-     (substitute-keyword-arguments (package-arguments glibc)
+     (substitute-keyword-arguments (package-arguments glibc/hurd)
        ;; We just pass the flags really needed to build the headers.
        ((#:configure-flags flags)
         `(list "--enable-add-ons"
-               "--host=i586-pc-gnu"
                ,@%glibc/hurd-configure-flags))
        ((#:phases _)
         '(modify-phases %standard-phases
@@ -1452,7 +1492,17 @@ command.")
                  (close-port
                   (open-output-file
                    (string-append out "/include/gnu/stubs.h"))))))
-           (delete 'build)))))))                  ; nothing to build
+           (delete 'build)))))                  ; nothing to build
+    (supported-systems %hurd-systems)))
+
+(define* (libc-for-target #:optional
+                          (target (or (%current-target-system)
+                                      (%current-system))))
+  (match target
+    ((? target-hurd?)
+     glibc/hurd)
+    (_
+     glibc)))
 
 (define-public tzdata
   (package
@@ -1602,6 +1652,6 @@ package needs iconv ,@(libiconv-if-needed) should be added."
   "Return the list of \"final inputs\"."
   ;; Avoid circular dependency by lazily resolving 'commencement'.
   (let ((iface (resolve-interface '(gnu packages commencement))))
-    (module-ref iface '%final-inputs)))
+    ((module-ref iface '%final-inputs) (%current-system))))
 
 ;;; base.scm ends here