hurd.scm 26 KB

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