summary refs log tree commit diff
path: root/gnu/packages/hurd.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/hurd.scm')
-rw-r--r--gnu/packages/hurd.scm434
1 files changed, 326 insertions, 108 deletions
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index c9f77d799a..f697694124 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -3,9 +3,10 @@
 ;;; Copyright © 2018, 2020-2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2020, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020, 2022, 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020 Rene Saavedra <pacoon@protonmail.com>
+;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,6 +34,8 @@
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cross-base)
+  #:use-module (gnu packages disk)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gnupg)
@@ -45,8 +48,9 @@
   #:use-module (gnu packages bash)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages onc-rpc)
-  #:use-module (gnu packages xorg) ; libpciaccess
-  #:use-module (guix git-download))
+  #:use-module (gnu packages xorg) ;libpciaccess-0.17
+  #:use-module (guix git-download)
+  #:use-module (ice-9 match))
 
 (define (hurd-source-url version)
   (string-append "mirror://gnu/hurd/hurd-"
@@ -55,7 +59,7 @@
 (define-public gnumach-headers
   (package
     (name "gnumach-headers")
-    (version "1.8+git20220827") ;; This is an upstream tag
+    (version "1.8+git20221224") ;; This is an upstream tag
     (source
      (origin
        (method git-fetch)
@@ -65,8 +69,7 @@
        (file-name (git-file-name "gnumach" version))
        (sha256
         (base32
-         "07qlaf8vw029y7xdnhjyiiyn788zjzwmyzj79inz7idpswqsnyhf"))
-       (patches (search-patches "gnumach-add-missing-const_mach_port_name_array_t-type.patch"))))
+         "0f49zqxf64ds75rmskizpybl2mw7sxs05k59gjp3pgspvr87w7gs"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -75,19 +78,10 @@
            (lambda _
              (invoke "make" "install-data")))
          (delete 'build))
-
-       ;; GNU Mach supports only IA32 currently, so cheat so that we can at
-       ;; least install its headers.
-       ,@(if (%current-target-system)
-             '()
-             ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-06/msg00042.html>
-             ;; <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00716.html>
-             '(#:configure-flags '("--build=i586-pc-gnu"
-                                   "--host=i686-linux-gnu")))
-
        #:tests? #f))
     (native-inputs
      (list autoconf automake texinfo-4))
+    (supported-systems %hurd-systems)
     (home-page "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
     (synopsis "GNU Mach kernel headers")
     (description
@@ -97,24 +91,20 @@
 (define-public mig
   (package
     (name "mig")
-    (version "1.8+git20220827")
+    (version "1.8+git20230520")
     (source (origin
-              (method url-fetch)
-              ;; XXX: Version 2.35 of glibc can only be built with an
-              ;; unreleased version of MiG:
-              ;; <https://lists.gnu.org/archive/html/bug-hurd/2023-03/msg00025.html>.
-              ;; It cannot be fetched from Git though, as the extra dependency
-              ;; on Autoconf/Automake would complicate bootstrapping.
-              (uri (string-append "mirror://gnu/guix/mirror/mig-"
-                                  version ".tar.gz"))
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://git.savannah.gnu.org/git/hurd/mig.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
               (sha256
                (base32
-                "163d37s9lscd6zxyfng421m9nl857464mgjj90xsrcl5ykbng5p2"))
-              (patches (search-patches "mig-cpu.h-generation.patch"))))
+                "10r0fdjqjzqsy6ajb21rifvhw0wpjvrw6a1zdyliqlzqny5k0qlz"))))
     (build-system gnu-build-system)
     ;; Flex is needed both at build and run time.
     (inputs (list gnumach-headers flex))
-    (native-inputs (list flex bison))
+    (native-inputs (list autoconf automake flex bison))
     (arguments
      (list #:tests? #f
            #:phases
@@ -143,10 +133,10 @@ communication.")
   ;; This commit is now slightly behind 0.9.git20220818 as this one needs a
   ;; newer glibc
   (let ((revision "2")
-        (commit "3ff70531ee672f431dbb0c11f286bfe85dce98fc"))
+        (commit "v0.9.git20230216"))
     (package
       (name "hurd-headers")
-      (version (git-version "0.9" revision commit))
+      (version commit)
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
@@ -154,19 +144,14 @@ communication.")
                       (commit commit)))
                 (sha256
                  (base32
-                  "1jb9f2h2v4lf6acsji1c12aqg3pixkvjdyb4q6axkd8jp22fdgc0"))
-                (file-name (git-file-name name version))
-                (patches (search-patches "hurd-add-without-rump-configure-option.patch"
-                                         "hurd-fix-types-of-read-write-and-readables-methods.patch"
-                                         "hurd-fix-types-of-read-write-and-readables-methods-2.patch"))))
+                  "0jm1dnqkx4kdwmby0z5w0yqp9m5qp4hbxd4jxlyhiqm8nkw9mkvv"))
+                (file-name (git-file-name name version))))
       (build-system gnu-build-system)
       (native-inputs
        (list autoconf
              automake
              (if (%current-target-system)
-                 (let* ((cross-base (resolve-interface '(gnu packages cross-base)))
-                        (cross-mig (module-ref cross-base 'cross-mig)))
-                   (cross-mig (%current-target-system)))
+                 (cross-mig (%current-target-system))
                  mig)))
       (arguments
        `(#:phases
@@ -195,9 +180,11 @@ communication.")
                              "ac_cv_func_exec_exec_paths=no"
                              "ac_cv_func__hurd_exec_paths=no"
                              "ac_cv_func__hurd_libc_proc_init=no"
-                             "ac_cv_func_file_futimens=no")
+                             "ac_cv_func_file_futimens=no"
+                             "ac_cv_lib_acpica_acpi_init=no")
 
          #:tests? #f))
+      (supported-systems %hurd-systems)
       (home-page "https://www.gnu.org/software/hurd/hurd.html")
       (synopsis "GNU Hurd headers")
       (description
@@ -208,36 +195,25 @@ Library and other user programs.")
 (define-public hurd-minimal
   (package (inherit hurd-headers)
     (name "hurd-minimal")
-    (inputs (list glibc/hurd-headers))
+    (inputs (list glibc/hurd-headers gnumach-headers))
     (arguments
      (substitute-keyword-arguments (package-arguments hurd-headers)
+       ((#:make-flags flags '())
+        #~'(#$(string-append "lib-subdirs=libshouldbeinlibc libihash libstore")
+            "prog-subdirs="
+            "other-subdirs="
+            #$@flags))
        ((#:phases _)
-        '(modify-phases %standard-phases
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 ;; We need to copy libihash.a to the output directory manually,
-                 ;; since there is no target for that in the makefile.
-                 (mkdir-p (string-append out "/include"))
-                 (copy-file "libihash/ihash.h"
-                            (string-append out "/include/ihash.h"))
-                 (mkdir-p (string-append out "/lib"))
-                 (copy-file "libihash/libihash.a"
-                            (string-append out "/lib/libihash.a"))
-                 #t)))
-           (replace 'build
-             (lambda _
-               ;; Install <assert-backtrace.h> & co.
-               (invoke "make" "-Clibshouldbeinlibc"
-                       "../include/assert-backtrace.h")
-
-               ;; Build libihash.
-               (invoke "make" "-Clibihash" "libihash.a")))))))
+        #~%standard-phases)
+       ((#:validate-runpath? validate-runpath? #f)
+        #f)))
+    (supported-systems %hurd-systems)
     (home-page "https://www.gnu.org/software/hurd/hurd.html")
     (synopsis "GNU Hurd libraries")
     (description
-     "This package provides libihash, needed to build the GNU C
-Library for GNU/Hurd.")
+     "This package provides libshouldbeinlibc, libihash, libstore, libports,
+libiohelp, libfshelp, libtrivfs, and libmachdev, needed to build the GNU C
+Library, Parted and netdde for GNU/Hurd.")
     (license gpl2+)))
 
 (define-public hurd-core-headers
@@ -265,6 +241,7 @@ Library for GNU/Hurd.")
                                      directories)
                         #t))))))
     (inputs (list gnumach-headers hurd-headers hurd-minimal))
+    (supported-systems %hurd-systems)
     (synopsis "Union of the Hurd headers and libraries")
     (description
      "This package contains the union of the Mach and Hurd headers and the
@@ -276,12 +253,22 @@ Hurd-minimal package which are needed for both glibc and GCC.")
   (package
     (inherit gnumach-headers)
     (name "gnumach")
+    (source (origin
+              (inherit (package-source gnumach-headers))
+              (patches
+               (append
+                (search-patches "gnumach-support-noide.patch")
+                (origin-patches (package-source gnumach-headers))))))
     (arguments
      (substitute-keyword-arguments (package-arguments gnumach-headers)
        ((#:make-flags flags ''())
         `(cons "CFLAGS=-fcommon" ,flags))
        ((#:configure-flags flags ''())
-        `(cons "--enable-kdb" ,flags))            ;enable kernel debugger
+        `(cons* "--enable-kdb" ;enable kernel debugger
+                "--disable-net-group"
+                "--disable-pcmcia-group"
+                "--disable-wireless-group"
+               ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases %standard-phases
            (add-after 'install 'produce-image
@@ -294,13 +281,11 @@ Hurd-minimal package which are needed for both glibc and GCC.")
      (list autoconf
            automake
            (if (%current-target-system)
-                   (let* ((cross-base (resolve-interface '(gnu packages cross-base)))
-                          (cross-mig (module-ref cross-base 'cross-mig)))
-                     (cross-mig (%current-target-system)))
-                   mig)
+               (cross-mig (%current-target-system))
+               mig)
            perl
            texinfo-4))
-    (supported-systems (cons "i686-linux" %hurd-systems))
+    (supported-systems %hurd-systems)
     (synopsis "Microkernel of the GNU system")
     (description
      "GNU Mach is the microkernel upon which a GNU Hurd system is based.")))
@@ -338,17 +323,20 @@ Hurd-minimal package which are needed for both glibc and GCC.")
 (define-public hurd
   (package
     (name "hurd")
-    (source (package-source hurd-headers))
+    (source (origin
+              (inherit (package-source hurd-headers))
+              (patches (search-patches "hurd-fix-rumpdisk-build.patch"
+                                       "hurd-rumpdisk-no-hd.patch"))))
     (version (package-version hurd-headers))
     (arguments
-     `(#:phases
+     `(#:tests? #f                      ;no "check" target
+       #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'prepare-dde
+         (add-after 'unpack 'prepare-addons
            (lambda* (#:key native-inputs inputs #:allow-other-keys)
              ;; First we import the things we want from dde.
              (for-each make-file-writable (find-files "."))
-             (let ((dde (or (assoc-ref inputs "dde-sources")
-                            (assoc-ref native-inputs "dde-sources"))))
+             (let ((dde (assoc-ref (or native-inputs inputs) "dde-sources")))
                (for-each (lambda (dir)
                            (copy-recursively
                             (string-append dde "/" dir ) dir))
@@ -357,7 +345,7 @@ Hurd-minimal package which are needed for both glibc and GCC.")
              ;; Makefile. libdde_linux26 is built later in its own phase.
              (substitute* "Makefile"
                (("libbpf ")
-                "libbpf libmachdevdde libddekit"))))
+                "libbpf libmachdevdde libddekit rumpdisk"))))
          (add-after 'unpack 'find-tirpc
            (lambda* (#:key inputs #:allow-other-keys)
              (for-each (lambda (var)
@@ -478,13 +466,13 @@ exec ${system}/rc \"$@\"
                #t)))
          (add-after 'build 'build-libdde-linux
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
-             (invoke (string-append (assoc-ref native-inputs "make")
+             (invoke (string-append (assoc-ref (or native-inputs inputs) "make")
                                     "/bin/make")
                      ;; XXX There can be a race condition because subdirs
                      ;; aren't interdependent targets in the Makefile.
                      "-j1" "-C" "libdde_linux26"
                      (string-append "SHELL="
-                                    (assoc-ref native-inputs "bash")
+                                    (assoc-ref (or native-inputs inputs) "bash")
                                     "/bin/bash")
                      (string-append "CC="
                                     ,(cc-for-target)))))
@@ -495,12 +483,12 @@ exec ${system}/rc \"$@\"
              (let* ((out (assoc-ref outputs "out"))
                     (datadir (string-append out "/share/hurd")))
                ;; Install libdde_linux26.
-               (invoke (string-append (assoc-ref native-inputs "make")
+               (invoke (string-append (assoc-ref (or native-inputs inputs) "make")
                                       "/bin/make")
                        "-C" "libdde_linux26" "install"
                        (string-append "SHELL="
-                                    (assoc-ref native-inputs "bash")
-                                    "/bin/bash")
+                                      (assoc-ref (or native-inputs inputs) "bash")
+                                      "/bin/bash")
                        (string-append "INSTALLDIR="
                                       out
                                       "/share/libdde_linux26/build/include"))
@@ -520,10 +508,10 @@ exec ${system}/rc \"$@\"
        #:configure-flags
        ,#~(list (string-append "LDFLAGS=-Wl,-rpath="
                                #$output "/lib")
+                "--enable-static-progs=ext2fs,iso9660fs,rumpdisk,pci-arbiter,acpi"
                 "--disable-ncursesw"
                 "--without-libbz2"
                 "--without-libz"
-                "--without-parted"
                 ;; This is needed to pass the configure check for
                 ;; clnt_create
                 "ac_func_search_save_LIBS=-ltirpc"
@@ -534,7 +522,7 @@ exec ${system}/rc \"$@\"
      `(("libgcrypt" ,libgcrypt)                  ;for /hurd/random
        ("libdaemon" ,libdaemon)                  ;for /bin/console --daemonize
        ("unifont" ,unifont)
-       ("libpciaccess" ,libpciaccess)
+       ("libpciaccess" ,libpciaccess-0.17)       ;need libpciaccess > 0.16
 
        ;; For NFS support
        ("libtirpc" ,libtirpc/hurd)
@@ -544,16 +532,16 @@ exec ${system}/rc \"$@\"
        ("coreutils" ,coreutils)
        ("sed" ,sed)
        ("grep" ,grep)
-       ("util-linux" ,util-linux)))
+       ("util-linux" ,util-linux "static")       ;libuuid.a, for parted
+       ("parted" ,parted)                        ;for rumpdisk
+       ("rumpkernel" ,rumpkernel)))
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)
        ("libgcrypt" ,libgcrypt)                   ;for 'libgcrypt-config'
-       ("mig" ,(if (%current-target-system)
-                   (let* ((cross-base (resolve-interface '(gnu packages cross-base)))
-                          (cross-mig (module-ref cross-base 'cross-mig)))
-                     (cross-mig (%current-target-system)))
-                   mig))
+       ("mig" , (if (%current-target-system)
+                    (cross-mig (%current-target-system))
+                    mig))
        ("pkg-config" ,pkg-config)
        ("perl" ,perl)
        ("texinfo" ,texinfo-4)
@@ -569,8 +557,8 @@ implementing them.")
     (license gpl2+)))
 
 (define-public netdde
-  (let ((commit "4a1016f130b6f2065d3f088325e5fb0b2997ae12")
-        (revision "1"))
+  (let ((commit "e67c284ac113d939b10b4578334f27dab29d5b08")
+        (revision "2"))
     (package
       (name "netdde")
       ;; The version prefix corresponds to the version of Linux from which the
@@ -581,20 +569,19 @@ implementing them.")
                 (uri (git-reference
                       (url "https://git.savannah.gnu.org/git/hurd/incubator.git")
                       (commit commit)))
+                (patches (list (search-patch "netdde-build-fix.patch")))
                 (sha256
                  (base32
-                  "1njv9dszq4lj05yq4v9j5v247hfghpzvvz4hzy0khjjr35mw7hr8"))
+                  "0vnkls7sr7srzib5mnw6gybzl5qa8c5a4zf3h08w6gdr7zqbndh0"))
                 (file-name (git-file-name name commit))))
       (build-system gnu-build-system)
       (arguments
-       `(#:make-flags
+       `(#:tests? #f                    ;no "check" target
+         #:make-flags
          (list (string-append "SHELL="
                               (search-input-file %build-inputs "/bin/bash"))
                "PKGDIR=libdde_linux26"
-               ,@(if (%current-target-system)
-                     (list "CC=i586-pc-gnu-gcc"
-                           "LINK_PROGRAM=i586-pc-gnu-gcc")
-                     (list "CC=gcc")))
+               (string-append "CC=" ,(cc-for-target)))
          #:configure-flags
          ,#~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
          #:phases
@@ -603,15 +590,13 @@ implementing them.")
            (add-after 'unpack 'prepare-dde
              (lambda* (#:key native-inputs inputs #:allow-other-keys)
                (for-each make-file-writable (find-files "."))
-               (let ((dde (or (assoc-ref inputs "dde-sources")
-                              (assoc-ref native-inputs "dde-sources"))))
+               (let ((dde (assoc-ref (or native-inputs inputs) "dde-sources")))
                  (for-each (lambda (dir)
                              (copy-recursively
                               (string-append dde "/" dir ) dir))
                            '("libdde_linux26" "libddekit")))
                (substitute* "libdde_linux26/mk/rel2abs.sh"
-                 (("/bin/bash") (which "bash")))
-               #t))
+                 (("/bin/bash") (which "bash")))))
            (add-after 'patch-generated-file-shebangs 'build-libdde-linux26
              (lambda* (#:key make-flags #:allow-other-keys)
                (with-directory-excursion "libdde_linux26"
@@ -622,17 +607,23 @@ implementing them.")
                (apply invoke "make" "convert" make-flags)))
            (replace 'build
              (lambda* (#:key make-flags #:allow-other-keys)
-               ;; no-common can be dropped with GCC 10+ where this is the
-               ;; default.
-               (apply invoke "make" "CFLAGS=-fno-common" make-flags)))
+               (apply invoke "make"
+                      ,(string-append "LINK_PROGRAM=" (cc-for-target))
+                      make-flags)
+               ;; This hack to build netdde.static was found in
+               ;; https://salsa.debian.org/hurd-team/netdde/-/blob/b539b2ad7a171371f140c3da58cce33f1a91ac12/debian/rules
+               (delete-file "Makefile.inc")
+               (apply invoke "make"
+                      ,(string-append "LINK_PROGRAM=" (cc-for-target) " -static")
+                      "TARGET=netdde.static"
+                      make-flags)))
            (replace 'install
              (lambda* (#:key outputs #:allow-other-keys)
-               (install-file "netdde"
-                             (string-append (assoc-ref outputs "out")
-                                            "/bin"))
-               #t)))))
+               (let ((hurd (string-append (assoc-ref outputs "out") "/hurd")))
+                 (install-file "netdde" hurd)
+                 (install-file "netdde.static" hurd)))))))
       (inputs
-       (list hurd libpciaccess zlib))
+       (list hurd libpciaccess-0.17 zlib `(,zlib "static")))
       (native-inputs
        `(("coreutils" ,coreutils)
          ("gawk" ,gawk)
@@ -649,3 +640,230 @@ in userland processes thanks to the DDE layer.")
       ;; Some drivers are dually licensed with the options being GPLv2 or one
       ;; of MPL/Expat/BSD-3 (dependent on the driver).
       (license gpl2))))
+
+(define-public rumpkernel
+  (let ((commit "81043d42fabda9baed7ac9ca36e3f3f5ed11ba81")
+        (revision "3"))
+    (package
+      (name "rumpkernel")
+      (version (git-version "0-20211031" revision commit))
+      ;; This uses the Debian Salsa rumpkernel package git as upstream as that
+      ;; is where development happens.  Once things have stabilized, upstream
+      ;; may change to the NetBSD git from where Debian takes their snapshots.
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://salsa.debian.org/hurd-team/rumpkernel.git")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "0fv0k52qqcg3nq9012hibgsamvsd7mnvn2ikdasmzjhsp8qh5q3r"))
+                (file-name (git-file-name name commit))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:tests? #f
+        #:modules '((srfi srfi-26)
+                    (ice-9 rdelim)
+                    (guix build utils)
+                    (guix build gnu-build-system))
+        ;; As we are using the Debian package as upstream, we follow their
+        ;; build:
+        ;;   * apply patches in debian/patches taken from the
+        ;;     debian/patches/series file
+        ;;   * for the configure, make, and install stages, follow
+        ;;     the code in debian/rules
+        ;; The Debian patchset includes a cross build feature that we
+        ;; use with two differences
+        ;;   * Debian uses a multiarch toolchain
+        ;;   * we use cross-mig
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'apply-patches
+              (lambda* (#:key target #:allow-other-keys)
+                (let* ((patch-directory "debian/patches/")
+                       (series (string-append patch-directory "series"))
+                       (text (with-input-from-file series read-string))
+                       (lines (string-split (string-trim-right text) #\newline))
+                       (patches (filter (negate (cute string-prefix? "#" <>))
+                                        lines))
+                       (patch-files (map
+                                     (cute string-append patch-directory <>)
+                                     patches)))
+                  (for-each
+                   (cute invoke "patch" "--force" "-p1" "-i" <>)
+                   patch-files)
+                  ;; Somewhere in the build.sh/make process MIG is not being
+                  ;; exported, apparently.
+                  (let* ((prefix (if (not target) "" (string-append target "-")))
+                         (mig (string-append prefix "mig")))
+                    (substitute* "pci-userspace/src-gnu/Makefile.inc"
+                      (("MIG=mig")
+                       (string-append "MIG=" mig)))))))
+            (add-before 'configure 'setenv
+              (lambda* (#:key build target #:allow-other-keys)
+                (define (noisy-setenv name value)
+                  (setenv name value)
+                  (format (current-error-port) "set ~a=~s\n" name value))
+                (noisy-setenv "HOST_CC" "gcc")
+                (let* ((prefix (if (not target) "" (string-append target "-"))))
+                  (noisy-setenv "TARGET_AR" (string-append prefix "ar"))
+                  (noisy-setenv "TARGET_CC" (string-append prefix "gcc"))
+                  (noisy-setenv "TARGET_CXX" (string-append prefix "g++"))
+                  (noisy-setenv "TARGET_LD" (string-append prefix "ld"))
+                  (noisy-setenv "TARGET_MIG" (string-append prefix "mig"))
+                  (noisy-setenv "TARGET_NM" (string-append prefix "nm"))
+                  (noisy-setenv "MIG" (string-append prefix "mig")))
+                (setenv "PAWD" "pwd")
+                (for-each
+                 (cute noisy-setenv <> "")
+                 '("_GCC_CRTENDS"
+                   "_GCC_CRTEND"
+                   "_GCC_CRTBEGINS"
+                   "_GCC_CRTBEGIN"
+                   "_GCC_CRTI"
+                   "_GCC_CRTN"))))
+            (replace 'configure
+              (lambda args
+                (let ((configure (assoc-ref %standard-phases 'configure)))
+                  (with-directory-excursion "buildrump.sh/src/lib/librumpuser"
+                    (apply configure args)))))
+            ;; The build has three toplevel entry points
+            ;;   * buildrump.sh/src/build.sh: create a NetBSD-compatible
+            ;;     toolchain and supports cross-compiling
+            ;;   * buildrump.sh/src/lib/librumpuser: the librump* libraries
+            ;;   * pci-userspace/src-gnu: the librumpdev_pci* libraries
+            (replace 'build
+              (lambda* (#:key parallel-build? #:allow-other-keys)
+                (let* ((jobs (if parallel-build? (parallel-job-count) 1))
+                       (host-cpu #$(match (or (%current-target-system)
+                                              (%current-system))
+                                     ((? target-x86-32?)
+                                      "i386")
+                                     ((? target-x86-64?)
+                                      "amd64")
+                                     (_ "unknown")))
+                       (toprump (string-append
+                                 (getcwd)
+                                 "/buildrump.sh/src/sys/rump"))
+                       (rump-make (string-append
+                                   (getcwd)
+                                   "/buildrump.sh/src/obj/tooldir/bin/nbmake-"
+                                   host-cpu)))
+                  (mkdir "obj")
+                  (with-directory-excursion "buildrump.sh/src"
+                    (invoke
+                     "sh" "build.sh"
+                     "-V" "TOOLS_BUILDRUMP=yes"
+                     "-V" "MKBINUTILS=no"
+                     "-V" "MKGDB=no"
+                     "-V" "MKGROFF=no"
+                     "-V" (string-append "TOPRUMP=" toprump)
+                     "-V" "BUILDRUMP_CPPFLAGS=-Wno-error=stringop-overread"
+                     "-V" "RUMPUSER_EXTERNAL_DPLIBS=pthread"
+		     "-V" (string-append
+                           "CPPFLAGS="
+                           " -I../../obj/destdir." host-cpu "/usr/include"
+                           " -D_FILE_OFFSET_BITS=64"
+                           " -DRUMP_REGISTER_T=int"
+                           " -DRUMPUSER_CONFIG=yes"
+                           " -DNO_PCI_MSI_MSIX=yes"
+                           " -DNUSB_DMA=1")
+                     "-V" (string-append
+                           "CWARNFLAGS="
+                           " -Wno-error=maybe-uninitialized"
+                           " -Wno-error=address-of-packed-member"
+                           " -Wno-error=unused-variable"
+                           " -Wno-error=stack-protector"
+                           " -Wno-error=array-parameter"
+                           " -Wno-error=array-bounds"
+                           " -Wno-error=stringop-overflow")
+                     "-V" "LIBCRTBEGIN="
+                     "-V" "LIBCRTEND="
+                     "-V" "LIBCRT0="
+                     "-V" "LIBCRTI="
+                     "-V" "_GCC_CRTENDS="
+                     "-V" "_GCC_CRTEND="
+                     "-V" "_GCC_CRTBEGINS="
+                     "-V" "_GCC_CRTBEGIN="
+                     "-V" "_GCC_CRTI="
+                     "-V" "_GCC_CRTN="
+                     "-U"
+                     "-u"
+                     "-T" "./obj/tooldir"
+                     "-m" host-cpu
+                     "-j" (number->string jobs)
+                     "tools"
+                     "rump"))
+                  (with-directory-excursion "buildrump.sh/src/lib/librumpuser"
+                    (setenv "RUMPRUN" "true")
+                    (invoke rump-make "dependall"))
+                  (with-directory-excursion "pci-userspace/src-gnu"
+                    (invoke rump-make "dependall")))))
+            (replace 'install
+              (lambda _
+                (define (install-file file target)
+                  (let ((dest (string-append target (basename file))))
+                    (format (current-output-port) "`~a' -> `~a'~%" file dest)
+                    (mkdir-p (dirname dest))
+                    ;; Some libraries are duplicated/copied around in the
+                    ;; build system, do not fail trying to install one
+                    ;; a second time.
+                    (if (file-exists? dest)
+                        (format (current-error-port)
+                                "warning: skipping: ~a\n" file)
+                        (let ((stat (lstat file)))
+                          (case (stat:type stat)
+                            ((symlink)
+                             (let ((target (readlink file)))
+                               (symlink target dest)))
+                            (else
+                             (copy-file file dest)))))))
+                (let ((header (string-append #$output "/include/rump"))
+                      (lib (string-append #$output "/lib/")))
+                  (mkdir-p header)
+                  (copy-recursively "buildrump.sh/src/sys/rump/include/rump"
+                                    header)
+                  (mkdir-p lib)
+                  (for-each
+                   (cute install-file <> lib)
+                   (append (find-files "buildrump.sh/src" "librump.*[.](a|so.*)")
+                           (find-files "obj" "librump.*[.](a|so.*)")))))))))
+      (inputs
+       (list gnumach-headers libpciaccess-0.17))
+      (native-inputs
+       (list autoconf
+             automake
+             libgcrypt
+             (if (%current-target-system)
+                 (cross-mig (%current-target-system))
+                 mig)
+             zlib))
+      (supported-systems %hurd-systems)
+      (home-page "https://wiki.netbsd.org/rumpkernel")
+      (synopsis "NetBSD as rumpkernel for the GNU/Hurd")
+      (description
+       "This package provides NetBSD as rumpkernel for the GNU/Hurd, so that
+the Hurd may be installed on iron.  Using this rumpkernel package, the hurd
+package's rumpdisk can be built which provides the pci.arbiter and rumpdisk
+servers.")
+      (license
+       ;; The NetBSD rumpkernel code is a big hodgepodge of softwares many of
+       ;; which have their own different licensing terms, see also
+       ;; https://salsa.debian.org/hurd-team/rumpkernel/-/blob/master/debian/copyright
+       (list asl2.0
+             boost1.0
+             bsd-2
+             bsd-3
+             bsd-4
+             cddl1.0
+             expat
+             gpl1
+             gpl2+
+             gpl3+
+             isc
+             lgpl2.0+
+             public-domain
+             (@ (guix licenses) zlib)
+             (non-copyleft "file://src/lib/libc/hash/hashhl.c"
+                           "See debian/copyright in the distribution."))))))