hurd-boot: Further cleanup of "rc".
[jackhill/guix/guix.git] / gnu / packages / hurd.scm
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 (native-inputs
136 `(("flex" ,flex)
137 ("bison" ,bison)))
138 (arguments `(#:tests? #f))
139 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html")
140 (synopsis "Mach 3.0 interface generator for the Hurd")
141 (description
142 "GNU MIG is the GNU distribution of the Mach 3.0 interface generator
143 MIG, as maintained by the GNU Hurd developers for the GNU project.
144 You need this tool to compile the GNU Mach and GNU Hurd distributions,
145 and to compile the GNU C library for the Hurd. Also, you will need it
146 for other software in the GNU system that uses Mach-based inter-process
147 communication.")
148 (license gpl2+)))
149
150 (define-public hurd-headers
151 ;; Resort to a post-0.9 snapshot that provides the 'file_utimens' and
152 ;; 'file_exec_paths' RPCs that glibc 2.28 expects.
153 (let ((revision "1")
154 (commit "91a51672ff4cfe1f1a0712b4c542ded3081c825b"))
155 (package
156 (name "hurd-headers")
157 (version (git-version "0.9" revision commit))
158 (source (origin
159 (method git-fetch)
160 (uri (git-reference
161 (url "https://git.savannah.gnu.org/git/hurd/hurd.git")
162 (commit commit)))
163 (sha256
164 (base32
165 "16k9wkahz9wasviijz53n6i13nmiwa9fs64ikf1jqh8rl60hw7cz"))
166 (file-name (git-file-name name version))))
167 (build-system gnu-build-system)
168 (native-inputs
169 `(("mig" ,mig)
170 ("autoconf" ,autoconf)
171 ("automake" ,automake)))
172 (arguments
173 `(#:phases
174 (modify-phases %standard-phases
175 (replace 'install
176 (lambda _
177 (invoke "make" "install-headers" "no_deps=t")))
178 (delete 'build))
179
180 #:configure-flags '( ;; Pretend we're on GNU/Hurd; 'configure' wants
181 ;; that.
182 ,@(if (%current-target-system)
183 '()
184 '("--host=i586-pc-gnu"))
185
186 ;; Reduce set of dependencies.
187 "--without-parted"
188 "--disable-ncursesw"
189 "--disable-test"
190 "--without-libbz2"
191 "--without-libcrypt"
192 "--without-libz"
193 ;; Skip the clnt_create check because it expects
194 ;; a working glibc causing a circular dependency.
195 "ac_cv_search_clnt_create=no"
196
197 ;; Annihilate the checks for the 'file_exec_paths'
198 ;; & co. libc functions to avoid "link tests are
199 ;; not allowed after AC_NO_EXECUTABLES" error.
200 "ac_cv_func_file_exec_paths=no"
201 "ac_cv_func_exec_exec_paths=no"
202 "ac_cv_func__hurd_exec_paths=no"
203 "ac_cv_func_file_futimens=no")
204
205 #:tests? #f))
206 (home-page "https://www.gnu.org/software/hurd/hurd.html")
207 (synopsis "GNU Hurd headers")
208 (description
209 "This package provides C headers of the GNU Hurd, used to build the GNU C
210 Library and other user programs.")
211 (license gpl2+))))
212
213 (define-public hurd-minimal
214 (package (inherit hurd-headers)
215 (name "hurd-minimal")
216 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
217 (arguments
218 (substitute-keyword-arguments (package-arguments hurd-headers)
219 ((#:phases _)
220 '(modify-phases %standard-phases
221 (replace 'install
222 (lambda* (#:key outputs #:allow-other-keys)
223 (let ((out (assoc-ref outputs "out")))
224 ;; We need to copy libihash.a to the output directory manually,
225 ;; since there is no target for that in the makefile.
226 (mkdir-p (string-append out "/include"))
227 (copy-file "libihash/ihash.h"
228 (string-append out "/include/ihash.h"))
229 (mkdir-p (string-append out "/lib"))
230 (copy-file "libihash/libihash.a"
231 (string-append out "/lib/libihash.a"))
232 #t)))
233 (replace 'build
234 (lambda _
235 ;; Install <assert-backtrace.h> & co.
236 (invoke "make" "-Clibshouldbeinlibc"
237 "../include/assert-backtrace.h")
238
239 ;; Build libihash.
240 (invoke "make" "-Clibihash" "libihash.a")))))))
241 (home-page "https://www.gnu.org/software/hurd/hurd.html")
242 (synopsis "GNU Hurd libraries")
243 (description
244 "This package provides libihash, needed to build the GNU C
245 Library for GNU/Hurd.")
246 (license gpl2+)))
247
248 (define-public hurd-core-headers
249 (package
250 (name "hurd-core-headers")
251 (version (package-version hurd-headers))
252 (source #f)
253 (build-system trivial-build-system)
254 (arguments
255 '(#:modules ((guix build union))
256 #:builder (begin
257 (use-modules (ice-9 match)
258 (guix build union))
259 (match %build-inputs
260 (((names . directories) ...)
261 (union-build (assoc-ref %outputs "out")
262 directories)
263 #t)))))
264 (inputs `(("gnumach-headers" ,gnumach-headers)
265 ("hurd-headers" ,hurd-headers)
266 ("hurd-minimal" ,hurd-minimal)))
267 (synopsis "Union of the Hurd headers and libraries")
268 (description
269 "This package contains the union of the Mach and Hurd headers and the
270 Hurd-minimal package which are needed for both glibc and GCC.")
271 (home-page (package-home-page hurd-headers))
272 (license (package-license hurd-headers))))
273
274 (define-public gnumach
275 (package
276 (inherit gnumach-headers)
277 (name "gnumach")
278 (arguments
279 (substitute-keyword-arguments (package-arguments gnumach-headers)
280 ((#:configure-flags flags ''())
281 `(cons "--enable-kdb" ,flags)) ;enable kernel debugger
282 ((#:phases phases '%standard-phases)
283 `(modify-phases %standard-phases
284 (add-after 'install 'produce-image
285 (lambda* (#:key outputs #:allow-other-keys)
286 (let* ((out (assoc-ref outputs "out"))
287 (boot (string-append out "/boot")))
288 (invoke "make" "gnumach.gz")
289 (install-file "gnumach.gz" boot)
290 #t)))))))
291 (native-inputs
292 `(("mig" ,mig)
293 ("perl" ,perl)
294 ("autoconf" ,autoconf)
295 ("automake" ,automake)
296 ("texinfo" ,texinfo-4)))
297 (supported-systems (cons "i686-linux" %hurd-systems))
298 (synopsis "Microkernel of the GNU system")
299 (description
300 "GNU Mach is the microkernel upon which a GNU Hurd system is based.")))
301
302 (define unifont
303 ;; GNU Unifont, <http://gnu.org/s/unifont>.
304 ;; Used the the VGA driver of the Hurd's console client.
305 (origin
306 (method url-fetch)
307 (uri
308 "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
309 (sha256
310 (base32
311 "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
312
313 (define (hurd-rc-script)
314 "Return a script to be installed as /libexec/rc in the 'hurd' package. The
315 script takes care of installing the relevant passive translators on the first
316 boot, since this cannot be done from GNU/Linux. Then, it runs system
317 activation; starting the Shepherd."
318
319 (define rc
320 (with-imported-modules '((guix build utils)
321 (gnu build hurd-boot)
322 (guix build syscalls))
323 #~(begin
324 (use-modules (guix build utils)
325 (gnu build hurd-boot)
326 (guix build syscalls)
327 (ice-9 match)
328 (system repl repl)
329 (srfi srfi-1)
330 (srfi srfi-26))
331
332 ;; "@HURD@" and "@COREUTILS@" are placeholders.
333 (setenv "PATH" "@HURD@/bin:@HURD@/sbin:@COREUTILS@/bin")
334
335 (boot-hurd-system))))
336
337 ;; FIXME: We want the program to use the cross-compiled Guile when
338 ;; cross-compiling. But why do we need to be explicit here?
339 (with-parameters ((%current-target-system "i586-pc-gnu"))
340 (program-file "rc" rc)))
341
342 (define dde-sources
343 ;; This is the current tip of the dde branch
344 (let ((commit "ac1c7eb7a8b24b7469bed5365be38a968d59a136"))
345 (origin
346 (method git-fetch)
347 (uri (git-reference
348 (url "https://git.savannah.gnu.org/git/hurd/incubator.git")
349 (commit commit)))
350 (sha256
351 (base32
352 "1vryinbg75xpydfrv9dbgfnds6knlh8l8bk2rxp32y9dc58z0692"))
353 (file-name (git-file-name "dde" commit)))))
354
355 (define-public hurd
356 (package
357 (name "hurd")
358 (version (package-version hurd-headers))
359 (source (origin (inherit (package-source hurd-headers))
360 (patches (search-patches "hurd-cross.patch"
361 "hurd-xattr.patch"))))
362 (arguments
363 `(#:phases
364 (modify-phases %standard-phases
365 (add-after 'unpack 'prepare-dde
366 (lambda* (#:key native-inputs inputs #:allow-other-keys)
367 (substitute* "Makefile"
368 (("libbpf ")
369 "libbpf libmachdev libmachdevdde libddekit"))
370 (for-each make-file-writable (find-files "."))
371 (let ((dde (or (assoc-ref inputs "dde-sources")
372 (assoc-ref native-inputs "dde-sources"))))
373 (for-each (lambda (dir)
374 (copy-recursively
375 (string-append dde "/" dir ) dir))
376 '("libmachdev" "libmachdevdde" "libddekit")))
377 #t))
378 (add-after 'unpack 'find-tirpc
379 (lambda* (#:key inputs #:allow-other-keys)
380 (for-each (lambda (var)
381 (setenv var
382 (string-append (assoc-ref inputs "libtirpc")
383 "/include/tirpc:"
384 (or (getenv var) ""))))
385 '("CROSS_C_INCLUDE_PATH" "C_INCLUDE_PATH"
386 "CROSS_CPATH" "CPATH"))
387 #t))
388 (add-after 'unpack 'fix-rpc-headers
389 (lambda _
390 (substitute* "nfs/mount.c"
391 (("#undef (TRUE|FALSE)") "")
392 (("#include <rpc/pmap_prot.h>" m)
393 (string-append "#include <rpc/xdr.h>\n" m)))
394 (substitute* '("nfsd/cache.c")
395 (("#undef (TRUE|FALSE)") ""))
396 (substitute* '("nfsd/loop.c"
397 "nfsd/main.c"
398 "nfsd/ops.c")
399 (("#include <rpc/pmap_prot.h>" m)
400 (string-append "#include <rpc/types.h>\n#include <rpc/xdr.h>\n" m)))
401 #t))
402 (add-before 'build 'pre-build
403 (lambda _
404 ;; Don't change the ownership of any file at this time.
405 (substitute* '("daemons/Makefile" "utils/Makefile")
406 (("-o root -m 4755") ""))
407 #t))
408 (add-after 'unpack 'create-runsystem
409 (lambda _
410 ;; XXX Work towards having startup.c invoke the Guile rc
411 (delete-file "daemons/runsystem.sh")
412 (with-output-to-file "daemons/runsystem.sh"
413 (lambda _
414 (display "#! /bin/bash
415
416 # XXX Guile needs pipe support for its finalizer thread, to start.
417 # Remove this script when Linux and the Hurd have xattr patches.
418 PATH=@PATH@
419
420 fsck --yes --force /
421 fsysopts / --writable
422
423 # Note: this /hurd/ gets substituted
424 settrans --create /servers/socket/1 /hurd/pflocal
425 echo Starting /libexec/rc ...
426 exec /libexec/rc \"$@\"
427 ")))
428 ))
429
430 (add-before 'build 'set-file-names
431 (lambda* (#:key inputs outputs #:allow-other-keys)
432 (let* ((out (assoc-ref outputs "out"))
433 (bash (assoc-ref inputs "bash-minimal"))
434 (coreutils (assoc-ref inputs "coreutils"))
435 (sed (assoc-ref inputs "sed"))
436 (grep (assoc-ref inputs "grep"))
437 (util-linux (assoc-ref inputs "util-linux")))
438 (substitute* '("daemons/runttys.c" "daemons/getty.c" "utils/login.c")
439 (("/bin/login")
440 (string-append out "/bin/login"))
441 (("/bin/bash") (string-append bash "/bin/bash")))
442 (substitute* '("startup/startup.c" "config/ttys")
443 (("/libexec/")
444 (string-append out "/libexec/")))
445 (substitute* '("utils/uptime.sh")
446 (("/bin/w")
447 (string-append out "/bin/w")))
448 ;; Upon first boot the /hurd symlink does not exist; it is
449 ;; created during activation: Hard-code the .../hurd store file
450 ;; name.
451 (substitute* '("boot/boot.c"
452 "daemons/console-run.c"
453 "startup/startup.c")
454 (("/hurd/")
455 (string-append out "/hurd/")))
456 (substitute* '("libdiskfs/boot-start.c"
457 "libdiskfs/opts-std-startup.c")
458 (("_HURD_STARTUP")
459 (string-append "\"" out "/hurd/startup\"")))
460 (substitute* '("daemons/runsystem.sh"
461 "utils/fakeroot.sh"
462 "utils/remap.sh"
463 "sutils/MAKEDEV.sh"
464 "sutils/losetup.sh")
465 (("^PATH=.*")
466 (string-append "PATH=" out "/bin"
467 ":" out "/sbin"
468 ":" coreutils "/bin"
469 ":" grep "/bin"
470 ":" sed "/bin"
471 ":" util-linux "/sbin\n"))
472 (("/sbin/") (string-append out "/sbin/"))
473 (("/libexec/") (string-append out "/libexec/"))
474 (("/hurd/") (string-append out "/hurd/")))
475 #t)))
476 (add-after 'patch-shebangs 'patch-libexec-shebangs
477 (lambda* (#:key inputs outputs #:allow-other-keys)
478 ;; XXX: Since the 'patch-shebangs' phase doesn't traverse
479 ;; /libexec, do it here.
480 (let* ((out (assoc-ref outputs "out"))
481 (bash (assoc-ref inputs "bash-minimal"))
482 (path (list (string-append bash "/bin"))))
483 (for-each (lambda (file)
484 (patch-shebang file path))
485 (find-files (string-append out "/libexec")))
486 #t)))
487 (add-after 'install 'install-goodies
488 (lambda* (#:key inputs outputs #:allow-other-keys)
489 ;; Install additional goodies.
490 ;; TODO: Build & install *.msgids for rpctrace.
491 (let* ((out (assoc-ref outputs "out"))
492 (datadir (string-append out "/share/hurd")))
493 ;; Install the fancy UTF-8 motd.
494 (mkdir-p (string-append out "/etc"))
495 (copy-file "console/motd.UTF8"
496 (string-append out "/etc/motd"))
497
498 ;; Install the BDF font for use by the console client.
499 (copy-file (assoc-ref inputs "unifont")
500 "unifont.gz")
501 (invoke "gunzip" "unifont.gz")
502 (mkdir-p datadir)
503 (copy-file "unifont"
504 (string-append datadir "/vga-system.bdf"))
505 #t)))
506 (add-after 'install 'install-rc-file
507 (lambda* (#:key inputs outputs #:allow-other-keys)
508 (let* ((out (assoc-ref outputs "out"))
509 (file (string-append out "/libexec/rc"))
510 (rc (assoc-ref inputs "hurd-rc"))
511 (coreutils (assoc-ref inputs "coreutils")))
512 (delete-file file)
513 (copy-file rc file)
514 (substitute* file
515 (("@HURD@") out)
516 (("@COREUTILS@") coreutils))
517 #t))))
518 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
519 %output "/lib")
520 "--disable-ncursesw"
521 "--without-libbz2"
522 "--without-libz"
523 "--without-parted"
524 ;; This is needed to pass the configure check for
525 ;; clnt_create
526 "ac_func_search_save_LIBS=-ltirpc"
527 "ac_cv_search_clnt_create=false")))
528 (build-system gnu-build-system)
529 (inputs
530 `(("glibc-hurd-headers" ,glibc/hurd-headers)
531 ("hurd-rc" ,(hurd-rc-script))
532
533 ("libgcrypt" ,libgcrypt) ;for /hurd/random
534 ("libdaemon" ,libdaemon) ;for /bin/console --daemonize
535 ("unifont" ,unifont)
536 ("libpciaccess" ,libpciaccess)
537
538 ;; For NFS support
539 ("libtirpc" ,libtirpc/hurd)
540
541 ;; Tools for the /libexec/* scripts.
542 ("bash-minimal" ,bash-minimal)
543 ("coreutils" ,coreutils)
544 ("sed" ,sed)
545 ("grep" ,grep)
546 ("util-linux" ,util-linux)))
547 (native-inputs
548 `(("autoconf" ,autoconf)
549 ("automake" ,automake)
550 ("libgcrypt" ,libgcrypt) ;for 'libgcrypt-config'
551 ("pkg-config" ,pkg-config)
552 ("mig" ,(if (%current-target-system)
553 ;; XXX: When targeting i586-pc-gnu, we need a 32-bit MiG,
554 ;; hence this hack.
555 (package
556 (inherit mig)
557 (arguments `(#:system "i686-linux")))
558 mig))
559 ("perl" ,perl)
560 ("texinfo" ,texinfo-4)
561 ("dde-sources" ,dde-sources)))
562 (supported-systems %hurd-systems)
563 (home-page "https://www.gnu.org/software/hurd/hurd.html")
564 (synopsis "The kernel servers for the GNU operating system")
565 (description
566 "The Hurd is the kernel for the GNU system, a replacement and
567 augmentation of standard Unix kernels. It is a collection of protocols for
568 system interaction (file systems, networks, authentication), and servers
569 implementing them.")
570 (license gpl2+)))
571
572 (define-public netdde
573 (let ((commit "4a1016f130b6f2065d3f088325e5fb0b2997ae12")
574 (revision "1"))
575 (package
576 (name "netdde")
577 ;; The version prefix corresponds to the version of Linux from which the
578 ;; drivers were taken.
579 (version (git-version "2.6.32.65" revision commit))
580 (source (origin
581 (method git-fetch)
582 (uri (git-reference
583 (url "https://git.savannah.gnu.org/git/hurd/incubator.git")
584 (commit commit)))
585 (sha256
586 (base32
587 "1njv9dszq4lj05yq4v9j5v247hfghpzvvz4hzy0khjjr35mw7hr8"))
588 (file-name (git-file-name name commit))))
589 (build-system gnu-build-system)
590 (arguments
591 `(#:make-flags
592 (list (string-append "SHELL=" (assoc-ref %build-inputs "bash")
593 "/bin/bash")
594 "PKGDIR=libdde_linux26"
595 ,@(if (%current-target-system)
596 (list "CC=i586-pc-gnu-gcc"
597 "LINK_PROGRAM=i586-pc-gnu-gcc")
598 (list "CC=gcc")))
599 #:configure-flags
600 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
601 #:phases
602 (modify-phases %standard-phases
603 (delete 'configure)
604 (add-after 'unpack 'prepare-dde
605 (lambda* (#:key native-inputs inputs #:allow-other-keys)
606 (for-each make-file-writable (find-files "."))
607 (let ((dde (or (assoc-ref inputs "dde-sources")
608 (assoc-ref native-inputs "dde-sources"))))
609 (for-each (lambda (dir)
610 (copy-recursively
611 (string-append dde "/" dir ) dir))
612 '("libdde_linux26" "libddekit")))
613 (substitute* "libdde_linux26/mk/rel2abs.sh"
614 (("/bin/bash") (which "bash")))
615 #t))
616 (add-after 'patch-generated-file-shebangs 'build-libdde-linux26
617 (lambda* (#:key make-flags #:allow-other-keys)
618 (with-directory-excursion "libdde_linux26"
619 (apply invoke "make"
620 (delete "PKGDIR=libdde_linux26" make-flags)))))
621 (add-after 'build-libdde-linux26 'convert
622 (lambda* (#:key make-flags #:allow-other-keys)
623 (apply invoke "make" "convert" make-flags)))
624 (replace 'build
625 (lambda* (#:key make-flags #:allow-other-keys)
626 ;; no-common can be dropped with GCC 10+ where this is the
627 ;; default.
628 (apply invoke "make" "CFLAGS=-fno-common" make-flags)))
629 (replace 'install
630 (lambda* (#:key outputs #:allow-other-keys)
631 (install-file "netdde"
632 (string-append (assoc-ref outputs "out")
633 "/bin"))
634 #t)))))
635 (inputs
636 `(("hurd" ,hurd)
637 ("libpciaccess" ,libpciaccess)
638 ("zlib" ,zlib)))
639 (native-inputs
640 `(("coreutils" ,coreutils)
641 ("gawk" ,gawk)
642 ("grep" ,grep)
643 ("perl" ,perl)
644 ("sed" ,sed)
645 ("dde-sources" ,dde-sources)))
646 (supported-systems %hurd-systems)
647 (home-page "https://www.gnu.org/software/hurd/hurd.html")
648 (synopsis "Linux network drivers glued by the DDE layer")
649 (description
650 "This package provides Linux 2.6 network drivers that can be embedded
651 in userland processes thanks to the DDE layer.")
652 ;; Some drivers are dually licensed with the options being GPLv2 or one
653 ;; of MPL/Expat/BSD-3 (dependent on the driver).
654 (license gpl2))))