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