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