gnu: mig: Do not assume "perl" to be available.
[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)
b37c5441 34 #:use-module (gnu build hurd-boot)
2d546858 35 #:use-module (gnu packages autotools)
d30d3e3f 36 #:use-module (gnu packages compression)
396b3c8b 37 #:use-module (gnu packages flex)
d30d3e3f 38 #:use-module (gnu packages gawk)
abbeaf54 39 #:use-module (gnu packages gnupg)
dc91c10f 40 #:use-module (gnu packages bison)
1d5fc9f7 41 #:use-module (gnu packages libdaemon)
29505c7d 42 #:use-module (gnu packages linux)
dc91c10f 43 #:use-module (gnu packages perl)
1d5fc9f7 44 #:use-module (gnu packages pkg-config)
21a8fe1b 45 #:use-module (gnu packages base)
29505c7d 46 #:use-module (gnu packages bash)
fb9d6f0f 47 #:use-module (gnu packages texinfo)
2e463d6e 48 #:use-module (gnu packages onc-rpc)
706b91ea 49 #:use-module (gnu packages xorg) ; libpciaccess
62596a15 50 #:use-module (guix git-download)
9b943db3
JN
51 #:export (hurd-system?
52 hurd-target?
53 hurd-triplet?))
62596a15
MR
54
55(define (hurd-triplet? triplet)
56 (and (string-suffix? "-gnu" triplet)
57 (not (string-contains triplet "linux"))))
0193c004 58
2d546858
LC
59(define (hurd-target?)
60 "Return true if the cross-compilation target or the current system is
61GNU/Hurd."
62 (or (and=> (%current-target-system) hurd-triplet?)
9b943db3
JN
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?))
2d546858 69
b005a37a
MR
70(define (hurd-source-url version)
71 (string-append "mirror://gnu/hurd/hurd-"
72 version ".tar.gz"))
73
0193c004 74(define-public gnumach-headers
fb9d6f0f
EF
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))
0193c004 98
fb9d6f0f
EF
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")))
0193c004 107
fb9d6f0f
EF
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+))))
396b3c8b
MR
118
119(define-public mig
120 (package
121 (name "mig")
9c9402be 122 (version "1.8")
396b3c8b
MR
123 (source
124 (origin
125 (method url-fetch)
126 (uri (string-append "mirror://gnu/mig/mig-"
127 version ".tar.gz"))
128 (sha256
129 (base32
9c9402be 130 "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706"))))
396b3c8b 131 (build-system gnu-build-system)
a7ecc92d
MR
132 ;; Flex is needed both at build and run time.
133 (inputs `(("gnumach-headers" ,gnumach-headers)
00410bbe
JN
134 ("flex" ,flex)
135 ("perl" ,perl)))
396b3c8b
MR
136 (native-inputs
137 `(("flex" ,flex)
138 ("bison" ,bison)))
00410bbe
JN
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))))))
6fd52309 149 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html")
396b3c8b
MR
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
153MIG, as maintained by the GNU Hurd developers for the GNU project.
154You need this tool to compile the GNU Mach and GNU Hurd distributions,
35b9e423 155and to compile the GNU C library for the Hurd. Also, you will need it
396b3c8b
MR
156for other software in the GNU system that uses Mach-based inter-process
157communication.")
158 (license gpl2+)))
dc91c10f
MR
159
160(define-public hurd-headers
2d546858
LC
161 ;; Resort to a post-0.9 snapshot that provides the 'file_utimens' and
162 ;; 'file_exec_paths' RPCs that glibc 2.28 expects.
f379c665
MB
163 (let ((revision "1")
164 (commit "91a51672ff4cfe1f1a0712b4c542ded3081c825b"))
2d546858
LC
165 (package
166 (name "hurd-headers")
f379c665 167 (version (git-version "0.9" revision commit))
2d546858
LC
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
f379c665 175 "16k9wkahz9wasviijz53n6i13nmiwa9fs64ikf1jqh8rl60hw7cz"))
2d546858
LC
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))
dc91c10f 189
2d546858
LC
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"
f379c665 201 "--without-libcrypt"
2d546858
LC
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
dc91c10f 220Library and other user programs.")
2d546858 221 (license gpl2+))))
21a8fe1b
MR
222
223(define-public hurd-minimal
224 (package (inherit hurd-headers)
225 (name "hurd-minimal")
226 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
21a8fe1b 227 (arguments
e1ecd50e
MR
228 (substitute-keyword-arguments (package-arguments hurd-headers)
229 ((#:phases _)
dc1d3cde
KK
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 _
2d546858
LC
245 ;; Install <assert-backtrace.h> & co.
246 (invoke "make" "-Clibshouldbeinlibc"
247 "../include/assert-backtrace.h")
248
249 ;; Build libihash.
a48d22d6 250 (invoke "make" "-Clibihash" "libihash.a")))))))
6fd52309 251 (home-page "https://www.gnu.org/software/hurd/hurd.html")
21a8fe1b
MR
252 (synopsis "GNU Hurd libraries")
253 (description
a124bbd2 254 "This package provides libihash, needed to build the GNU C
21a8fe1b
MR
255Library for GNU/Hurd.")
256 (license gpl2+)))
38efbcbb
MR
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 (ice-9 match)
268 (guix build union))
269 (match %build-inputs
270 (((names . directories) ...)
271 (union-build (assoc-ref %outputs "out")
e3cfef22
MW
272 directories)
273 #t)))))
38efbcbb
MR
274 (inputs `(("gnumach-headers" ,gnumach-headers)
275 ("hurd-headers" ,hurd-headers)
276 ("hurd-minimal" ,hurd-minimal)))
277 (synopsis "Union of the Hurd headers and libraries")
278 (description
279 "This package contains the union of the Mach and Hurd headers and the
280Hurd-minimal package which are needed for both glibc and GCC.")
281 (home-page (package-home-page hurd-headers))
282 (license (package-license hurd-headers))))
8df672aa
MR
283
284(define-public gnumach
285 (package
fb9d6f0f 286 (inherit gnumach-headers)
8df672aa 287 (name "gnumach")
8df672aa 288 (arguments
e62f6f77 289 (substitute-keyword-arguments (package-arguments gnumach-headers)
29814639
LC
290 ((#:configure-flags flags ''())
291 `(cons "--enable-kdb" ,flags)) ;enable kernel debugger
e62f6f77
LC
292 ((#:phases phases '%standard-phases)
293 `(modify-phases %standard-phases
294 (add-after 'install 'produce-image
295 (lambda* (#:key outputs #:allow-other-keys)
296 (let* ((out (assoc-ref outputs "out"))
297 (boot (string-append out "/boot")))
298 (invoke "make" "gnumach.gz")
299 (install-file "gnumach.gz" boot)
300 #t)))))))
8df672aa
MR
301 (native-inputs
302 `(("mig" ,mig)
e62f6f77
LC
303 ("perl" ,perl)
304 ("autoconf" ,autoconf)
305 ("automake" ,automake)
306 ("texinfo" ,texinfo-4)))
8df672aa 307 (supported-systems (cons "i686-linux" %hurd-systems))
8df672aa
MR
308 (synopsis "Microkernel of the GNU system")
309 (description
fb9d6f0f 310 "GNU Mach is the microkernel upon which a GNU Hurd system is based.")))
cc4faa35 311
ad3bbead
LC
312(define unifont
313 ;; GNU Unifont, <http://gnu.org/s/unifont>.
314 ;; Used the the VGA driver of the Hurd's console client.
315 (origin
316 (method url-fetch)
317 (uri
318 "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
319 (sha256
320 (base32
321 "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
322
71b92e1a
RW
323(define dde-sources
324 ;; This is the current tip of the dde branch
325 (let ((commit "ac1c7eb7a8b24b7469bed5365be38a968d59a136"))
326 (origin
327 (method git-fetch)
328 (uri (git-reference
329 (url "https://git.savannah.gnu.org/git/hurd/incubator.git")
330 (commit commit)))
331 (sha256
332 (base32
333 "1vryinbg75xpydfrv9dbgfnds6knlh8l8bk2rxp32y9dc58z0692"))
334 (file-name (git-file-name "dde" commit)))))
335
cc4faa35
MR
336(define-public hurd
337 (package
338 (name "hurd")
496d607d
JN
339 (version (package-version hurd-headers))
340 (source (origin (inherit (package-source hurd-headers))
4c26229c
JN
341 (patches (search-patches "hurd-cross.patch"
342 "hurd-xattr.patch"))))
cc4faa35
MR
343 (arguments
344 `(#:phases
345 (modify-phases %standard-phases
706b91ea
RW
346 (add-after 'unpack 'prepare-dde
347 (lambda* (#:key native-inputs inputs #:allow-other-keys)
348 (substitute* "Makefile"
349 (("libbpf ")
350 "libbpf libmachdev libmachdevdde libddekit"))
351 (for-each make-file-writable (find-files "."))
352 (let ((dde (or (assoc-ref inputs "dde-sources")
353 (assoc-ref native-inputs "dde-sources"))))
354 (for-each (lambda (dir)
355 (copy-recursively
356 (string-append dde "/" dir ) dir))
357 '("libmachdev" "libmachdevdde" "libddekit")))
358 #t))
2e463d6e
RW
359 (add-after 'unpack 'find-tirpc
360 (lambda* (#:key inputs #:allow-other-keys)
361 (for-each (lambda (var)
362 (setenv var
363 (string-append (assoc-ref inputs "libtirpc")
364 "/include/tirpc:"
365 (or (getenv var) ""))))
366 '("CROSS_C_INCLUDE_PATH" "C_INCLUDE_PATH"
367 "CROSS_CPATH" "CPATH"))
368 #t))
369 (add-after 'unpack 'fix-rpc-headers
370 (lambda _
371 (substitute* "nfs/mount.c"
372 (("#undef (TRUE|FALSE)") "")
373 (("#include <rpc/pmap_prot.h>" m)
374 (string-append "#include <rpc/xdr.h>\n" m)))
375 (substitute* '("nfsd/cache.c")
376 (("#undef (TRUE|FALSE)") ""))
377 (substitute* '("nfsd/loop.c"
378 "nfsd/main.c"
379 "nfsd/ops.c")
380 (("#include <rpc/pmap_prot.h>" m)
381 (string-append "#include <rpc/types.h>\n#include <rpc/xdr.h>\n" m)))
382 #t))
cc4faa35 383 (add-before 'build 'pre-build
f46cf8ef
LC
384 (lambda _
385 ;; Don't change the ownership of any file at this time.
386 (substitute* '("daemons/Makefile" "utils/Makefile")
387 (("-o root -m 4755") ""))
388 #t))
97c94fc2
JN
389 (add-after 'unpack 'create-runsystem
390 (lambda _
391 ;; XXX Work towards having startup.c invoke the Guile rc
392 (delete-file "daemons/runsystem.sh")
393 (with-output-to-file "daemons/runsystem.sh"
394 (lambda _
395 (display "#! /bin/bash
396
397# XXX Guile needs pipe support for its finalizer thread, to start.
398# Remove this script when Linux and the Hurd have xattr patches.
399PATH=@PATH@
400
401fsck --yes --force /
402fsysopts / --writable
403
404# Note: this /hurd/ gets substituted
405settrans --create /servers/socket/1 /hurd/pflocal
97c94fc2 406
68d8c094
JN
407# parse multiboot arguments
408for i in \"$@\"; do
409 case $i in
410 (--system=*)
411 system=${i#--system=}
412 ;;
413 esac
414done
415
416echo Starting ${system}/rc...
417exec ${system}/rc \"$@\"
418")))))
b7e23a92
LC
419 (add-before 'build 'set-file-names
420 (lambda* (#:key inputs outputs #:allow-other-keys)
29505c7d
LC
421 (let* ((out (assoc-ref outputs "out"))
422 (bash (assoc-ref inputs "bash-minimal"))
423 (coreutils (assoc-ref inputs "coreutils"))
424 (sed (assoc-ref inputs "sed"))
425 (grep (assoc-ref inputs "grep"))
426 (util-linux (assoc-ref inputs "util-linux")))
427 (substitute* '("daemons/runttys.c" "daemons/getty.c" "utils/login.c")
b7e23a92 428 (("/bin/login")
29505c7d
LC
429 (string-append out "/bin/login"))
430 (("/bin/bash") (string-append bash "/bin/bash")))
97c94fc2 431 (substitute* '("startup/startup.c" "config/ttys")
29505c7d
LC
432 (("/libexec/")
433 (string-append out "/libexec/")))
2676579d
RS
434 (substitute* '("utils/uptime.sh")
435 (("/bin/w")
436 (string-append out "/bin/w")))
97c94fc2
JN
437 ;; Upon first boot the /hurd symlink does not exist; it is
438 ;; created during activation: Hard-code the .../hurd store file
439 ;; name.
440 (substitute* '("boot/boot.c"
441 "daemons/console-run.c"
442 "startup/startup.c")
29505c7d
LC
443 (("/hurd/")
444 (string-append out "/hurd/")))
97c94fc2
JN
445 (substitute* '("libdiskfs/boot-start.c"
446 "libdiskfs/opts-std-startup.c")
447 (("_HURD_STARTUP")
448 (string-append "\"" out "/hurd/startup\"")))
29505c7d 449 (substitute* '("daemons/runsystem.sh"
97c94fc2
JN
450 "utils/fakeroot.sh"
451 "utils/remap.sh"
452 "sutils/MAKEDEV.sh"
453 "sutils/losetup.sh")
29505c7d 454 (("^PATH=.*")
97c94fc2
JN
455 (string-append "PATH=" out "/bin"
456 ":" out "/sbin"
457 ":" coreutils "/bin"
458 ":" grep "/bin"
459 ":" sed "/bin"
460 ":" util-linux "/sbin\n"))
29505c7d
LC
461 (("/sbin/") (string-append out "/sbin/"))
462 (("/libexec/") (string-append out "/libexec/"))
463 (("/hurd/") (string-append out "/hurd/")))
29505c7d
LC
464 #t)))
465 (add-after 'patch-shebangs 'patch-libexec-shebangs
466 (lambda* (#:key inputs outputs #:allow-other-keys)
467 ;; XXX: Since the 'patch-shebangs' phase doesn't traverse
468 ;; /libexec, do it here.
469 (let* ((out (assoc-ref outputs "out"))
470 (bash (assoc-ref inputs "bash-minimal"))
471 (path (list (string-append bash "/bin"))))
472 (for-each (lambda (file)
473 (patch-shebang file path))
474 (find-files (string-append out "/libexec")))
b7e23a92 475 #t)))
62a3bbfd 476 (add-after 'install 'install-goodies
ad3bbead 477 (lambda* (#:key inputs outputs #:allow-other-keys)
62a3bbfd
LC
478 ;; Install additional goodies.
479 ;; TODO: Build & install *.msgids for rpctrace.
ad3bbead
LC
480 (let* ((out (assoc-ref outputs "out"))
481 (datadir (string-append out "/share/hurd")))
62a3bbfd
LC
482 ;; Install the fancy UTF-8 motd.
483 (mkdir-p (string-append out "/etc"))
484 (copy-file "console/motd.UTF8"
485 (string-append out "/etc/motd"))
ad3bbead
LC
486
487 ;; Install the BDF font for use by the console client.
488 (copy-file (assoc-ref inputs "unifont")
489 "unifont.gz")
490 (invoke "gunzip" "unifont.gz")
491 (mkdir-p datadir)
492 (copy-file "unifont"
493 (string-append datadir "/vga-system.bdf"))
f46cf8ef 494 #t))))
cc4faa35
MR
495 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
496 %output "/lib")
497 "--disable-ncursesw"
498 "--without-libbz2"
499 "--without-libz"
2e463d6e
RW
500 "--without-parted"
501 ;; This is needed to pass the configure check for
502 ;; clnt_create
503 "ac_func_search_save_LIBS=-ltirpc"
504 "ac_cv_search_clnt_create=false")))
cc4faa35 505 (build-system gnu-build-system)
f46cf8ef
LC
506 (inputs
507 `(("glibc-hurd-headers" ,glibc/hurd-headers)
29505c7d 508
abbeaf54 509 ("libgcrypt" ,libgcrypt) ;for /hurd/random
1d5fc9f7 510 ("libdaemon" ,libdaemon) ;for /bin/console --daemonize
ad3bbead 511 ("unifont" ,unifont)
706b91ea 512 ("libpciaccess" ,libpciaccess)
1d5fc9f7 513
2e463d6e
RW
514 ;; For NFS support
515 ("libtirpc" ,libtirpc/hurd)
516
29505c7d
LC
517 ;; Tools for the /libexec/* scripts.
518 ("bash-minimal" ,bash-minimal)
519 ("coreutils" ,coreutils)
520 ("sed" ,sed)
521 ("grep" ,grep)
522 ("util-linux" ,util-linux)))
cc4faa35 523 (native-inputs
496d607d
JN
524 `(("autoconf" ,autoconf)
525 ("automake" ,automake)
abbeaf54 526 ("libgcrypt" ,libgcrypt) ;for 'libgcrypt-config'
1d5fc9f7 527 ("pkg-config" ,pkg-config)
09ac892a
LC
528 ("mig" ,(if (%current-target-system)
529 ;; XXX: When targeting i586-pc-gnu, we need a 32-bit MiG,
530 ;; hence this hack.
531 (package
532 (inherit mig)
533 (arguments `(#:system "i686-linux")))
534 mig))
496d607d 535 ("perl" ,perl)
706b91ea 536 ("texinfo" ,texinfo-4)
71b92e1a 537 ("dde-sources" ,dde-sources)))
cc4faa35
MR
538 (supported-systems %hurd-systems)
539 (home-page "https://www.gnu.org/software/hurd/hurd.html")
540 (synopsis "The kernel servers for the GNU operating system")
541 (description
542 "The Hurd is the kernel for the GNU system, a replacement and
543augmentation of standard Unix kernels. It is a collection of protocols for
544system interaction (file systems, networks, authentication), and servers
545implementing them.")
546 (license gpl2+)))
d30d3e3f
RW
547
548(define-public netdde
549 (let ((commit "4a1016f130b6f2065d3f088325e5fb0b2997ae12")
550 (revision "1"))
551 (package
552 (name "netdde")
553 ;; The version prefix corresponds to the version of Linux from which the
554 ;; drivers were taken.
555 (version (git-version "2.6.32.65" revision commit))
556 (source (origin
557 (method git-fetch)
558 (uri (git-reference
559 (url "https://git.savannah.gnu.org/git/hurd/incubator.git")
560 (commit commit)))
561 (sha256
562 (base32
563 "1njv9dszq4lj05yq4v9j5v247hfghpzvvz4hzy0khjjr35mw7hr8"))
564 (file-name (git-file-name name commit))))
565 (build-system gnu-build-system)
566 (arguments
567 `(#:make-flags
568 (list (string-append "SHELL=" (assoc-ref %build-inputs "bash")
569 "/bin/bash")
570 "PKGDIR=libdde_linux26"
571 ,@(if (%current-target-system)
572 (list "CC=i586-pc-gnu-gcc"
573 "LINK_PROGRAM=i586-pc-gnu-gcc")
574 (list "CC=gcc")))
575 #:configure-flags
576 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
577 #:phases
578 (modify-phases %standard-phases
579 (delete 'configure)
580 (add-after 'unpack 'prepare-dde
581 (lambda* (#:key native-inputs inputs #:allow-other-keys)
582 (for-each make-file-writable (find-files "."))
583 (let ((dde (or (assoc-ref inputs "dde-sources")
584 (assoc-ref native-inputs "dde-sources"))))
585 (for-each (lambda (dir)
586 (copy-recursively
587 (string-append dde "/" dir ) dir))
588 '("libdde_linux26" "libddekit")))
589 (substitute* "libdde_linux26/mk/rel2abs.sh"
590 (("/bin/bash") (which "bash")))
591 #t))
592 (add-after 'patch-generated-file-shebangs 'build-libdde-linux26
593 (lambda* (#:key make-flags #:allow-other-keys)
594 (with-directory-excursion "libdde_linux26"
595 (apply invoke "make"
596 (delete "PKGDIR=libdde_linux26" make-flags)))))
597 (add-after 'build-libdde-linux26 'convert
598 (lambda* (#:key make-flags #:allow-other-keys)
599 (apply invoke "make" "convert" make-flags)))
600 (replace 'build
601 (lambda* (#:key make-flags #:allow-other-keys)
602 ;; no-common can be dropped with GCC 10+ where this is the
603 ;; default.
604 (apply invoke "make" "CFLAGS=-fno-common" make-flags)))
605 (replace 'install
606 (lambda* (#:key outputs #:allow-other-keys)
607 (install-file "netdde"
608 (string-append (assoc-ref outputs "out")
609 "/bin"))
610 #t)))))
611 (inputs
612 `(("hurd" ,hurd)
613 ("libpciaccess" ,libpciaccess)
614 ("zlib" ,zlib)))
615 (native-inputs
616 `(("coreutils" ,coreutils)
617 ("gawk" ,gawk)
618 ("grep" ,grep)
619 ("perl" ,perl)
620 ("sed" ,sed)
621 ("dde-sources" ,dde-sources)))
622 (supported-systems %hurd-systems)
623 (home-page "https://www.gnu.org/software/hurd/hurd.html")
624 (synopsis "Linux network drivers glued by the DDE layer")
625 (description
626 "This package provides Linux 2.6 network drivers that can be embedded
627in userland processes thanks to the DDE layer.")
628 ;; Some drivers are dually licensed with the options being GPLv2 or one
629 ;; of MPL/Expat/BSD-3 (dependent on the driver).
630 (license gpl2))))