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