| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014, 2015, 2016, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com> |
| 3 | ;;; Copyright © 2018, 2020 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> |
| 5 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
| 6 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
| 7 | ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net> |
| 8 | ;;; Copyright © 2020 Rene Saavedra <pacoon@protonmail.com> |
| 9 | ;;; |
| 10 | ;;; This file is part of GNU Guix. |
| 11 | ;;; |
| 12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 13 | ;;; under the terms of the GNU General Public License as published by |
| 14 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 15 | ;;; your option) any later version. |
| 16 | ;;; |
| 17 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | ;;; GNU General Public License for more details. |
| 21 | ;;; |
| 22 | ;;; You should have received a copy of the GNU General Public License |
| 23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 24 | |
| 25 | (define-module (gnu packages hurd) |
| 26 | #:use-module ((guix licenses) #:hide (zlib)) |
| 27 | #:use-module (guix download) |
| 28 | #:use-module (guix packages) |
| 29 | #:use-module (gnu packages) |
| 30 | #:use-module (guix gexp) |
| 31 | #:use-module (guix utils) |
| 32 | #:use-module (guix build-system gnu) |
| 33 | #:use-module (guix build-system trivial) |
| 34 | #:use-module (gnu build hurd-boot) |
| 35 | #:use-module (gnu packages autotools) |
| 36 | #:use-module (gnu packages compression) |
| 37 | #:use-module (gnu packages flex) |
| 38 | #:use-module (gnu packages gawk) |
| 39 | #:use-module (gnu packages gnupg) |
| 40 | #:use-module (gnu packages bison) |
| 41 | #:use-module (gnu packages libdaemon) |
| 42 | #:use-module (gnu packages linux) |
| 43 | #:use-module (gnu packages perl) |
| 44 | #:use-module (gnu packages pkg-config) |
| 45 | #:use-module (gnu packages base) |
| 46 | #:use-module (gnu packages bash) |
| 47 | #:use-module (gnu packages texinfo) |
| 48 | #:use-module (gnu packages onc-rpc) |
| 49 | #:use-module (gnu packages xorg) ; libpciaccess |
| 50 | #:use-module (guix git-download) |
| 51 | #:export (hurd-system? |
| 52 | hurd-target? |
| 53 | hurd-triplet?)) |
| 54 | |
| 55 | (define (hurd-triplet? triplet) |
| 56 | (and (string-suffix? "-gnu" triplet) |
| 57 | (not (string-contains triplet "linux")))) |
| 58 | |
| 59 | (define (hurd-target?) |
| 60 | "Return true if the cross-compilation target or the current system is |
| 61 | GNU/Hurd." |
| 62 | (or (and=> (%current-target-system) hurd-triplet?) |
| 63 | (and (not (%current-target-system)) |
| 64 | (and=> (%current-system) hurd-triplet?)))) |
| 65 | |
| 66 | (define (hurd-system?) |
| 67 | "Return true if the current system is the Hurd." |
| 68 | (and=> (%current-system) hurd-triplet?)) |
| 69 | |
| 70 | (define (hurd-source-url version) |
| 71 | (string-append "mirror://gnu/hurd/hurd-" |
| 72 | version ".tar.gz")) |
| 73 | |
| 74 | (define-public gnumach-headers |
| 75 | (let ((commit "097f9cf735ffa1212b828682ad92f0f6c5f1c552") |
| 76 | (revision "1")) |
| 77 | (package |
| 78 | (name "gnumach-headers") |
| 79 | (version (git-version "1.8" revision commit)) |
| 80 | (source |
| 81 | (origin |
| 82 | (method git-fetch) |
| 83 | (uri (git-reference |
| 84 | (url "https://git.savannah.gnu.org/git/hurd/gnumach.git") |
| 85 | (commit commit))) |
| 86 | (file-name (git-file-name "gnumach" version)) |
| 87 | (sha256 |
| 88 | (base32 |
| 89 | "0q36z7k02bykrld90zaxbhyzxlmwlqqs4divgir6ix38zsp6icqk")))) |
| 90 | (build-system gnu-build-system) |
| 91 | (arguments |
| 92 | `(#:phases |
| 93 | (modify-phases %standard-phases |
| 94 | (replace 'install |
| 95 | (lambda _ |
| 96 | (invoke "make" "install-data"))) |
| 97 | (delete 'build)) |
| 98 | |
| 99 | ;; GNU Mach supports only IA32 currently, so cheat so that we can at |
| 100 | ;; least install its headers. |
| 101 | ,@(if (%current-target-system) |
| 102 | '() |
| 103 | ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-06/msg00042.html> |
| 104 | ;; <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00716.html> |
| 105 | '(#:configure-flags '("--build=i586-pc-gnu" |
| 106 | "--host=i686-linux-gnu"))) |
| 107 | |
| 108 | #:tests? #f)) |
| 109 | (native-inputs |
| 110 | `(("autoconf" ,autoconf) |
| 111 | ("automake" ,automake) |
| 112 | ("texinfo" ,texinfo-4))) |
| 113 | (home-page "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html") |
| 114 | (synopsis "GNU Mach kernel headers") |
| 115 | (description |
| 116 | "Headers of the GNU Mach kernel.") |
| 117 | (license gpl2+)))) |
| 118 | |
| 119 | (define-public mig |
| 120 | (package |
| 121 | (name "mig") |
| 122 | (version "1.8") |
| 123 | (source |
| 124 | (origin |
| 125 | (method url-fetch) |
| 126 | (uri (string-append "mirror://gnu/mig/mig-" |
| 127 | version ".tar.gz")) |
| 128 | (sha256 |
| 129 | (base32 |
| 130 | "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706")))) |
| 131 | (build-system gnu-build-system) |
| 132 | ;; Flex is needed both at build and run time. |
| 133 | (inputs `(("gnumach-headers" ,gnumach-headers) |
| 134 | ("flex" ,flex) |
| 135 | ("perl" ,perl))) |
| 136 | (native-inputs |
| 137 | `(("flex" ,flex) |
| 138 | ("bison" ,bison))) |
| 139 | (arguments `(#:tests? #f |
| 140 | #:phases |
| 141 | (modify-phases %standard-phases |
| 142 | (add-after 'install 'patch-non-shebang-references |
| 143 | (lambda* (#:key build inputs outputs #:allow-other-keys) |
| 144 | (let ((perl (assoc-ref inputs "perl")) |
| 145 | (out (assoc-ref outputs "out"))) |
| 146 | (substitute* (string-append out "/bin/mig") |
| 147 | (("perl ") (string-append perl "/bin/perl "))) |
| 148 | #t)))))) |
| 149 | (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html") |
| 150 | (synopsis "Mach 3.0 interface generator for the Hurd") |
| 151 | (description |
| 152 | "GNU MIG is the GNU distribution of the Mach 3.0 interface generator |
| 153 | MIG, as maintained by the GNU Hurd developers for the GNU project. |
| 154 | You need this tool to compile the GNU Mach and GNU Hurd distributions, |
| 155 | and to compile the GNU C library for the Hurd. Also, you will need it |
| 156 | for other software in the GNU system that uses Mach-based inter-process |
| 157 | communication.") |
| 158 | (license gpl2+))) |
| 159 | |
| 160 | (define-public hurd-headers |
| 161 | ;; Resort to a post-0.9 snapshot that provides the 'file_utimens' and |
| 162 | ;; 'file_exec_paths' RPCs that glibc 2.28 expects. |
| 163 | (let ((revision "1") |
| 164 | (commit "91a51672ff4cfe1f1a0712b4c542ded3081c825b")) |
| 165 | (package |
| 166 | (name "hurd-headers") |
| 167 | (version (git-version "0.9" revision commit)) |
| 168 | (source (origin |
| 169 | (method git-fetch) |
| 170 | (uri (git-reference |
| 171 | (url "https://git.savannah.gnu.org/git/hurd/hurd.git") |
| 172 | (commit commit))) |
| 173 | (sha256 |
| 174 | (base32 |
| 175 | "16k9wkahz9wasviijz53n6i13nmiwa9fs64ikf1jqh8rl60hw7cz")) |
| 176 | (file-name (git-file-name name version)))) |
| 177 | (build-system gnu-build-system) |
| 178 | (native-inputs |
| 179 | `(("mig" ,mig) |
| 180 | ("autoconf" ,autoconf) |
| 181 | ("automake" ,automake))) |
| 182 | (arguments |
| 183 | `(#:phases |
| 184 | (modify-phases %standard-phases |
| 185 | (replace 'install |
| 186 | (lambda _ |
| 187 | (invoke "make" "install-headers" "no_deps=t"))) |
| 188 | (delete 'build)) |
| 189 | |
| 190 | #:configure-flags '( ;; Pretend we're on GNU/Hurd; 'configure' wants |
| 191 | ;; that. |
| 192 | ,@(if (%current-target-system) |
| 193 | '() |
| 194 | '("--host=i586-pc-gnu")) |
| 195 | |
| 196 | ;; Reduce set of dependencies. |
| 197 | "--without-parted" |
| 198 | "--disable-ncursesw" |
| 199 | "--disable-test" |
| 200 | "--without-libbz2" |
| 201 | "--without-libcrypt" |
| 202 | "--without-libz" |
| 203 | ;; Skip the clnt_create check because it expects |
| 204 | ;; a working glibc causing a circular dependency. |
| 205 | "ac_cv_search_clnt_create=no" |
| 206 | |
| 207 | ;; Annihilate the checks for the 'file_exec_paths' |
| 208 | ;; & co. libc functions to avoid "link tests are |
| 209 | ;; not allowed after AC_NO_EXECUTABLES" error. |
| 210 | "ac_cv_func_file_exec_paths=no" |
| 211 | "ac_cv_func_exec_exec_paths=no" |
| 212 | "ac_cv_func__hurd_exec_paths=no" |
| 213 | "ac_cv_func_file_futimens=no") |
| 214 | |
| 215 | #:tests? #f)) |
| 216 | (home-page "https://www.gnu.org/software/hurd/hurd.html") |
| 217 | (synopsis "GNU Hurd headers") |
| 218 | (description |
| 219 | "This package provides C headers of the GNU Hurd, used to build the GNU C |
| 220 | Library and other user programs.") |
| 221 | (license gpl2+)))) |
| 222 | |
| 223 | (define-public hurd-minimal |
| 224 | (package (inherit hurd-headers) |
| 225 | (name "hurd-minimal") |
| 226 | (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers))) |
| 227 | (arguments |
| 228 | (substitute-keyword-arguments (package-arguments hurd-headers) |
| 229 | ((#:phases _) |
| 230 | '(modify-phases %standard-phases |
| 231 | (replace 'install |
| 232 | (lambda* (#:key outputs #:allow-other-keys) |
| 233 | (let ((out (assoc-ref outputs "out"))) |
| 234 | ;; We need to copy libihash.a to the output directory manually, |
| 235 | ;; since there is no target for that in the makefile. |
| 236 | (mkdir-p (string-append out "/include")) |
| 237 | (copy-file "libihash/ihash.h" |
| 238 | (string-append out "/include/ihash.h")) |
| 239 | (mkdir-p (string-append out "/lib")) |
| 240 | (copy-file "libihash/libihash.a" |
| 241 | (string-append out "/lib/libihash.a")) |
| 242 | #t))) |
| 243 | (replace 'build |
| 244 | (lambda _ |
| 245 | ;; Install <assert-backtrace.h> & co. |
| 246 | (invoke "make" "-Clibshouldbeinlibc" |
| 247 | "../include/assert-backtrace.h") |
| 248 | |
| 249 | ;; Build libihash. |
| 250 | (invoke "make" "-Clibihash" "libihash.a"))))))) |
| 251 | (home-page "https://www.gnu.org/software/hurd/hurd.html") |
| 252 | (synopsis "GNU Hurd libraries") |
| 253 | (description |
| 254 | "This package provides libihash, needed to build the GNU C |
| 255 | Library for GNU/Hurd.") |
| 256 | (license gpl2+))) |
| 257 | |
| 258 | (define-public hurd-core-headers |
| 259 | (package |
| 260 | (name "hurd-core-headers") |
| 261 | (version (package-version hurd-headers)) |
| 262 | (source #f) |
| 263 | (build-system trivial-build-system) |
| 264 | (arguments |
| 265 | '(#:modules ((guix build union)) |
| 266 | #:builder (begin |
| 267 | (use-modules (srfi srfi-1) |
| 268 | (srfi srfi-26) |
| 269 | (ice-9 match) |
| 270 | (guix build union)) |
| 271 | (let ((inputs (filter |
| 272 | (compose (cute member <> '("gnumach-headers" |
| 273 | "hurd-headers" |
| 274 | "hurd-minimal")) |
| 275 | car) |
| 276 | %build-inputs))) |
| 277 | (match inputs |
| 278 | (((names . directories) ...) |
| 279 | (union-build (assoc-ref %outputs "out") |
| 280 | directories) |
| 281 | #t)))))) |
| 282 | (inputs `(("gnumach-headers" ,gnumach-headers) |
| 283 | ("hurd-headers" ,hurd-headers) |
| 284 | ("hurd-minimal" ,hurd-minimal))) |
| 285 | (synopsis "Union of the Hurd headers and libraries") |
| 286 | (description |
| 287 | "This package contains the union of the Mach and Hurd headers and the |
| 288 | Hurd-minimal package which are needed for both glibc and GCC.") |
| 289 | (home-page (package-home-page hurd-headers)) |
| 290 | (license (package-license hurd-headers)))) |
| 291 | |
| 292 | (define-public gnumach |
| 293 | (package |
| 294 | (inherit gnumach-headers) |
| 295 | (name "gnumach") |
| 296 | (arguments |
| 297 | (substitute-keyword-arguments (package-arguments gnumach-headers) |
| 298 | ((#:configure-flags flags ''()) |
| 299 | `(cons "--enable-kdb" ,flags)) ;enable kernel debugger |
| 300 | ((#:phases phases '%standard-phases) |
| 301 | `(modify-phases %standard-phases |
| 302 | (add-after 'install 'produce-image |
| 303 | (lambda* (#:key outputs #:allow-other-keys) |
| 304 | (let* ((out (assoc-ref outputs "out")) |
| 305 | (boot (string-append out "/boot"))) |
| 306 | (invoke "make" "gnumach.gz") |
| 307 | (install-file "gnumach.gz" boot) |
| 308 | #t))))))) |
| 309 | (native-inputs |
| 310 | `(("mig" ,mig) |
| 311 | ("perl" ,perl) |
| 312 | ("autoconf" ,autoconf) |
| 313 | ("automake" ,automake) |
| 314 | ("texinfo" ,texinfo-4))) |
| 315 | (supported-systems (cons "i686-linux" %hurd-systems)) |
| 316 | (synopsis "Microkernel of the GNU system") |
| 317 | (description |
| 318 | "GNU Mach is the microkernel upon which a GNU Hurd system is based."))) |
| 319 | |
| 320 | (define unifont |
| 321 | ;; GNU Unifont, <http://gnu.org/s/unifont>. |
| 322 | ;; Used the the VGA driver of the Hurd's console client. |
| 323 | (origin |
| 324 | (method url-fetch) |
| 325 | (uri |
| 326 | "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz") |
| 327 | (sha256 |
| 328 | (base32 |
| 329 | "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys")))) |
| 330 | |
| 331 | (define dde-sources |
| 332 | ;; This is the current tip of the dde branch |
| 333 | (let ((commit "ac1c7eb7a8b24b7469bed5365be38a968d59a136")) |
| 334 | (origin |
| 335 | (method git-fetch) |
| 336 | (uri (git-reference |
| 337 | (url "https://git.savannah.gnu.org/git/hurd/incubator.git") |
| 338 | (commit commit))) |
| 339 | (sha256 |
| 340 | (base32 |
| 341 | "1vryinbg75xpydfrv9dbgfnds6knlh8l8bk2rxp32y9dc58z0692")) |
| 342 | (file-name (git-file-name "dde" commit))))) |
| 343 | |
| 344 | (define-public hurd |
| 345 | (package |
| 346 | (name "hurd") |
| 347 | (version (package-version hurd-headers)) |
| 348 | (source (origin (inherit (package-source hurd-headers)) |
| 349 | (patches (search-patches "hurd-cross.patch" |
| 350 | "hurd-xattr.patch")))) |
| 351 | (arguments |
| 352 | `(#:phases |
| 353 | (modify-phases %standard-phases |
| 354 | (add-after 'unpack 'prepare-dde |
| 355 | (lambda* (#:key native-inputs inputs #:allow-other-keys) |
| 356 | (substitute* "Makefile" |
| 357 | (("libbpf ") |
| 358 | "libbpf libmachdev libmachdevdde libddekit")) |
| 359 | (for-each make-file-writable (find-files ".")) |
| 360 | (let ((dde (or (assoc-ref inputs "dde-sources") |
| 361 | (assoc-ref native-inputs "dde-sources")))) |
| 362 | (for-each (lambda (dir) |
| 363 | (copy-recursively |
| 364 | (string-append dde "/" dir ) dir)) |
| 365 | '("libmachdev" "libmachdevdde" "libddekit"))) |
| 366 | #t)) |
| 367 | (add-after 'unpack 'find-tirpc |
| 368 | (lambda* (#:key inputs #:allow-other-keys) |
| 369 | (for-each (lambda (var) |
| 370 | (setenv var |
| 371 | (string-append (assoc-ref inputs "libtirpc") |
| 372 | "/include/tirpc:" |
| 373 | (or (getenv var) "")))) |
| 374 | '("CROSS_C_INCLUDE_PATH" "C_INCLUDE_PATH" |
| 375 | "CROSS_CPATH" "CPATH")) |
| 376 | #t)) |
| 377 | (add-after 'unpack 'fix-rpc-headers |
| 378 | (lambda _ |
| 379 | (substitute* "nfs/mount.c" |
| 380 | (("#undef (TRUE|FALSE)") "") |
| 381 | (("#include <rpc/pmap_prot.h>" m) |
| 382 | (string-append "#include <rpc/xdr.h>\n" m))) |
| 383 | (substitute* '("nfsd/cache.c") |
| 384 | (("#undef (TRUE|FALSE)") "")) |
| 385 | (substitute* '("nfsd/loop.c" |
| 386 | "nfsd/main.c" |
| 387 | "nfsd/ops.c") |
| 388 | (("#include <rpc/pmap_prot.h>" m) |
| 389 | (string-append "#include <rpc/types.h>\n#include <rpc/xdr.h>\n" m))) |
| 390 | #t)) |
| 391 | (add-before 'build 'pre-build |
| 392 | (lambda _ |
| 393 | ;; Don't change the ownership of any file at this time. |
| 394 | (substitute* '("daemons/Makefile" "utils/Makefile") |
| 395 | (("-o root -m 4755") "")) |
| 396 | #t)) |
| 397 | (add-after 'unpack 'create-runsystem |
| 398 | (lambda _ |
| 399 | ;; XXX Work towards having startup.c invoke the Guile rc |
| 400 | (delete-file "daemons/runsystem.sh") |
| 401 | (with-output-to-file "daemons/runsystem.sh" |
| 402 | (lambda _ |
| 403 | (display "#! /bin/bash |
| 404 | |
| 405 | # XXX Guile needs pipe support for its finalizer thread, to start. |
| 406 | # Remove this script when Linux and the Hurd have xattr patches. |
| 407 | PATH=@PATH@ |
| 408 | |
| 409 | fsck --yes --force / |
| 410 | fsysopts / --writable |
| 411 | |
| 412 | # Note: this /hurd/ gets substituted |
| 413 | settrans --create /servers/socket/1 /hurd/pflocal |
| 414 | |
| 415 | # parse multiboot arguments |
| 416 | for i in \"$@\"; do |
| 417 | case $i in |
| 418 | (--system=*) |
| 419 | system=${i#--system=} |
| 420 | ;; |
| 421 | esac |
| 422 | done |
| 423 | |
| 424 | echo Starting ${system}/rc... |
| 425 | exec ${system}/rc \"$@\" |
| 426 | "))))) |
| 427 | (add-before 'build 'set-file-names |
| 428 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 429 | (let* ((out (assoc-ref outputs "out")) |
| 430 | (bash (assoc-ref inputs "bash-minimal")) |
| 431 | (coreutils (assoc-ref inputs "coreutils")) |
| 432 | (sed (assoc-ref inputs "sed")) |
| 433 | (grep (assoc-ref inputs "grep")) |
| 434 | (util-linux (assoc-ref inputs "util-linux"))) |
| 435 | (substitute* '("daemons/runttys.c" "daemons/getty.c" "utils/login.c") |
| 436 | (("/bin/login") |
| 437 | (string-append out "/bin/login")) |
| 438 | (("/bin/bash") (string-append bash "/bin/bash"))) |
| 439 | (substitute* '("startup/startup.c" "config/ttys") |
| 440 | (("/libexec/") |
| 441 | (string-append out "/libexec/"))) |
| 442 | (substitute* '("utils/uptime.sh") |
| 443 | (("/bin/w") |
| 444 | (string-append out "/bin/w"))) |
| 445 | ;; Upon first boot the /hurd symlink does not exist; it is |
| 446 | ;; created during activation: Hard-code the .../hurd store file |
| 447 | ;; name. |
| 448 | (substitute* '("boot/boot.c" |
| 449 | "daemons/console-run.c" |
| 450 | "startup/startup.c") |
| 451 | (("/hurd/") |
| 452 | (string-append out "/hurd/"))) |
| 453 | (substitute* '("libdiskfs/boot-start.c" |
| 454 | "libdiskfs/opts-std-startup.c") |
| 455 | (("_HURD_STARTUP") |
| 456 | (string-append "\"" out "/hurd/startup\""))) |
| 457 | (substitute* '("daemons/runsystem.sh" |
| 458 | "utils/fakeroot.sh" |
| 459 | "utils/remap.sh" |
| 460 | "sutils/MAKEDEV.sh" |
| 461 | "sutils/losetup.sh") |
| 462 | (("^PATH=.*") |
| 463 | (string-append "PATH=" out "/bin" |
| 464 | ":" out "/sbin" |
| 465 | ":" coreutils "/bin" |
| 466 | ":" grep "/bin" |
| 467 | ":" sed "/bin" |
| 468 | ":" util-linux "/sbin\n")) |
| 469 | (("/sbin/") (string-append out "/sbin/")) |
| 470 | (("/libexec/") (string-append out "/libexec/")) |
| 471 | (("/hurd/") (string-append out "/hurd/"))) |
| 472 | #t))) |
| 473 | (add-after 'patch-shebangs 'patch-libexec-shebangs |
| 474 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 475 | ;; XXX: Since the 'patch-shebangs' phase doesn't traverse |
| 476 | ;; /libexec, do it here. |
| 477 | (let* ((out (assoc-ref outputs "out")) |
| 478 | (bash (assoc-ref inputs "bash-minimal")) |
| 479 | (path (list (string-append bash "/bin")))) |
| 480 | (for-each (lambda (file) |
| 481 | (patch-shebang file path)) |
| 482 | (find-files (string-append out "/libexec"))) |
| 483 | #t))) |
| 484 | (add-after 'install 'install-goodies |
| 485 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 486 | ;; Install additional goodies. |
| 487 | ;; TODO: Build & install *.msgids for rpctrace. |
| 488 | (let* ((out (assoc-ref outputs "out")) |
| 489 | (datadir (string-append out "/share/hurd"))) |
| 490 | ;; Install the fancy UTF-8 motd. |
| 491 | (mkdir-p (string-append out "/etc")) |
| 492 | (copy-file "console/motd.UTF8" |
| 493 | (string-append out "/etc/motd")) |
| 494 | |
| 495 | ;; Install the BDF font for use by the console client. |
| 496 | (copy-file (assoc-ref inputs "unifont") |
| 497 | "unifont.gz") |
| 498 | (invoke "gunzip" "unifont.gz") |
| 499 | (mkdir-p datadir) |
| 500 | (copy-file "unifont" |
| 501 | (string-append datadir "/vga-system.bdf")) |
| 502 | #t)))) |
| 503 | #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath=" |
| 504 | %output "/lib") |
| 505 | "--disable-ncursesw" |
| 506 | "--without-libbz2" |
| 507 | "--without-libz" |
| 508 | "--without-parted" |
| 509 | ;; This is needed to pass the configure check for |
| 510 | ;; clnt_create |
| 511 | "ac_func_search_save_LIBS=-ltirpc" |
| 512 | "ac_cv_search_clnt_create=false"))) |
| 513 | (build-system gnu-build-system) |
| 514 | (inputs |
| 515 | `(("glibc-hurd-headers" ,glibc/hurd-headers) |
| 516 | |
| 517 | ("libgcrypt" ,libgcrypt) ;for /hurd/random |
| 518 | ("libdaemon" ,libdaemon) ;for /bin/console --daemonize |
| 519 | ("unifont" ,unifont) |
| 520 | ("libpciaccess" ,libpciaccess) |
| 521 | |
| 522 | ;; For NFS support |
| 523 | ("libtirpc" ,libtirpc/hurd) |
| 524 | |
| 525 | ;; Tools for the /libexec/* scripts. |
| 526 | ("bash-minimal" ,bash-minimal) |
| 527 | ("coreutils" ,coreutils) |
| 528 | ("sed" ,sed) |
| 529 | ("grep" ,grep) |
| 530 | ("util-linux" ,util-linux))) |
| 531 | (native-inputs |
| 532 | `(("autoconf" ,autoconf) |
| 533 | ("automake" ,automake) |
| 534 | ("libgcrypt" ,libgcrypt) ;for 'libgcrypt-config' |
| 535 | ("pkg-config" ,pkg-config) |
| 536 | ("mig" ,(if (%current-target-system) |
| 537 | ;; XXX: When targeting i586-pc-gnu, we need a 32-bit MiG, |
| 538 | ;; hence this hack. |
| 539 | (package |
| 540 | (inherit mig) |
| 541 | (arguments `(#:system "i686-linux"))) |
| 542 | mig)) |
| 543 | ("perl" ,perl) |
| 544 | ("texinfo" ,texinfo-4) |
| 545 | ("dde-sources" ,dde-sources))) |
| 546 | (supported-systems %hurd-systems) |
| 547 | (home-page "https://www.gnu.org/software/hurd/hurd.html") |
| 548 | (synopsis "The kernel servers for the GNU operating system") |
| 549 | (description |
| 550 | "The Hurd is the kernel for the GNU system, a replacement and |
| 551 | augmentation of standard Unix kernels. It is a collection of protocols for |
| 552 | system interaction (file systems, networks, authentication), and servers |
| 553 | implementing them.") |
| 554 | (license gpl2+))) |
| 555 | |
| 556 | (define-public netdde |
| 557 | (let ((commit "4a1016f130b6f2065d3f088325e5fb0b2997ae12") |
| 558 | (revision "1")) |
| 559 | (package |
| 560 | (name "netdde") |
| 561 | ;; The version prefix corresponds to the version of Linux from which the |
| 562 | ;; drivers were taken. |
| 563 | (version (git-version "2.6.32.65" revision commit)) |
| 564 | (source (origin |
| 565 | (method git-fetch) |
| 566 | (uri (git-reference |
| 567 | (url "https://git.savannah.gnu.org/git/hurd/incubator.git") |
| 568 | (commit commit))) |
| 569 | (sha256 |
| 570 | (base32 |
| 571 | "1njv9dszq4lj05yq4v9j5v247hfghpzvvz4hzy0khjjr35mw7hr8")) |
| 572 | (file-name (git-file-name name commit)))) |
| 573 | (build-system gnu-build-system) |
| 574 | (arguments |
| 575 | `(#:make-flags |
| 576 | (list (string-append "SHELL=" (assoc-ref %build-inputs "bash") |
| 577 | "/bin/bash") |
| 578 | "PKGDIR=libdde_linux26" |
| 579 | ,@(if (%current-target-system) |
| 580 | (list "CC=i586-pc-gnu-gcc" |
| 581 | "LINK_PROGRAM=i586-pc-gnu-gcc") |
| 582 | (list "CC=gcc"))) |
| 583 | #:configure-flags |
| 584 | (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib")) |
| 585 | #:phases |
| 586 | (modify-phases %standard-phases |
| 587 | (delete 'configure) |
| 588 | (add-after 'unpack 'prepare-dde |
| 589 | (lambda* (#:key native-inputs inputs #:allow-other-keys) |
| 590 | (for-each make-file-writable (find-files ".")) |
| 591 | (let ((dde (or (assoc-ref inputs "dde-sources") |
| 592 | (assoc-ref native-inputs "dde-sources")))) |
| 593 | (for-each (lambda (dir) |
| 594 | (copy-recursively |
| 595 | (string-append dde "/" dir ) dir)) |
| 596 | '("libdde_linux26" "libddekit"))) |
| 597 | (substitute* "libdde_linux26/mk/rel2abs.sh" |
| 598 | (("/bin/bash") (which "bash"))) |
| 599 | #t)) |
| 600 | (add-after 'patch-generated-file-shebangs 'build-libdde-linux26 |
| 601 | (lambda* (#:key make-flags #:allow-other-keys) |
| 602 | (with-directory-excursion "libdde_linux26" |
| 603 | (apply invoke "make" |
| 604 | (delete "PKGDIR=libdde_linux26" make-flags))))) |
| 605 | (add-after 'build-libdde-linux26 'convert |
| 606 | (lambda* (#:key make-flags #:allow-other-keys) |
| 607 | (apply invoke "make" "convert" make-flags))) |
| 608 | (replace 'build |
| 609 | (lambda* (#:key make-flags #:allow-other-keys) |
| 610 | ;; no-common can be dropped with GCC 10+ where this is the |
| 611 | ;; default. |
| 612 | (apply invoke "make" "CFLAGS=-fno-common" make-flags))) |
| 613 | (replace 'install |
| 614 | (lambda* (#:key outputs #:allow-other-keys) |
| 615 | (install-file "netdde" |
| 616 | (string-append (assoc-ref outputs "out") |
| 617 | "/bin")) |
| 618 | #t))))) |
| 619 | (inputs |
| 620 | `(("hurd" ,hurd) |
| 621 | ("libpciaccess" ,libpciaccess) |
| 622 | ("zlib" ,zlib))) |
| 623 | (native-inputs |
| 624 | `(("coreutils" ,coreutils) |
| 625 | ("gawk" ,gawk) |
| 626 | ("grep" ,grep) |
| 627 | ("perl" ,perl) |
| 628 | ("sed" ,sed) |
| 629 | ("dde-sources" ,dde-sources))) |
| 630 | (supported-systems %hurd-systems) |
| 631 | (home-page "https://www.gnu.org/software/hurd/hurd.html") |
| 632 | (synopsis "Linux network drivers glued by the DDE layer") |
| 633 | (description |
| 634 | "This package provides Linux 2.6 network drivers that can be embedded |
| 635 | in userland processes thanks to the DDE layer.") |
| 636 | ;; Some drivers are dually licensed with the options being GPLv2 or one |
| 637 | ;; of MPL/Expat/BSD-3 (dependent on the driver). |
| 638 | (license gpl2)))) |