hurd.scm 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  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. ((#:make-flags flags ''())
  287. `(cons "CFLAGS=-fcommon" ,flags))
  288. ((#:configure-flags flags ''())
  289. `(cons "--enable-kdb" ,flags)) ;enable kernel debugger
  290. ((#:phases phases '%standard-phases)
  291. `(modify-phases %standard-phases
  292. (add-after 'install 'produce-image
  293. (lambda* (#:key outputs #:allow-other-keys)
  294. (let* ((out (assoc-ref outputs "out"))
  295. (boot (string-append out "/boot")))
  296. (invoke "make" "gnumach.gz")
  297. (install-file "gnumach.gz" boot))))))))
  298. (native-inputs
  299. `(("mig" ,mig)
  300. ("perl" ,perl)
  301. ("autoconf" ,autoconf)
  302. ("automake" ,automake)
  303. ("texinfo" ,texinfo-4)))
  304. (supported-systems (cons "i686-linux" %hurd-systems))
  305. (synopsis "Microkernel of the GNU system")
  306. (description
  307. "GNU Mach is the microkernel upon which a GNU Hurd system is based.")))
  308. (define unifont
  309. ;; GNU Unifont, <http://gnu.org/s/unifont>.
  310. ;; Used the the VGA driver of the Hurd's console client.
  311. (origin
  312. (method url-fetch)
  313. (uri
  314. "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
  315. (sha256
  316. (base32
  317. "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
  318. (define dde-sources
  319. ;; This is the current tip of the dde branch
  320. (let ((commit "ac1c7eb7a8b24b7469bed5365be38a968d59a136"))
  321. (origin
  322. (method git-fetch)
  323. (uri (git-reference
  324. (url "https://git.savannah.gnu.org/git/hurd/incubator.git")
  325. (commit commit)))
  326. (sha256
  327. (base32
  328. "1vryinbg75xpydfrv9dbgfnds6knlh8l8bk2rxp32y9dc58z0692"))
  329. (file-name (git-file-name "dde" commit)))))
  330. (define-public hurd
  331. (package
  332. (name "hurd")
  333. (version (package-version hurd-headers))
  334. (source (origin (inherit (package-source hurd-headers))
  335. (patches (search-patches "hurd-cross.patch"
  336. "hurd-xattr.patch"))))
  337. (arguments
  338. `(#:phases
  339. (modify-phases %standard-phases
  340. (add-after 'unpack 'prepare-dde
  341. (lambda* (#:key native-inputs inputs #:allow-other-keys)
  342. (substitute* "Makefile"
  343. (("libbpf ")
  344. "libbpf libmachdev libmachdevdde libddekit"))
  345. (for-each make-file-writable (find-files "."))
  346. (let ((dde (or (assoc-ref inputs "dde-sources")
  347. (assoc-ref native-inputs "dde-sources"))))
  348. (for-each (lambda (dir)
  349. (copy-recursively
  350. (string-append dde "/" dir ) dir))
  351. '("libmachdev" "libmachdevdde" "libddekit")))
  352. #t))
  353. (add-after 'unpack 'find-tirpc
  354. (lambda* (#:key inputs #:allow-other-keys)
  355. (for-each (lambda (var)
  356. (setenv var
  357. (string-append
  358. (search-input-directory inputs
  359. "include/tirpc")
  360. ":" (or (getenv var) ""))))
  361. '("CROSS_C_INCLUDE_PATH" "C_INCLUDE_PATH"
  362. "CROSS_CPATH" "CPATH"))
  363. #t))
  364. (add-after 'unpack 'fix-rpc-headers
  365. (lambda _
  366. (substitute* "nfs/mount.c"
  367. (("#undef (TRUE|FALSE)") "")
  368. (("#include <rpc/pmap_prot.h>" m)
  369. (string-append "#include <rpc/xdr.h>\n" m)))
  370. (substitute* '("nfsd/cache.c")
  371. (("#undef (TRUE|FALSE)") ""))
  372. (substitute* '("nfsd/loop.c"
  373. "nfsd/main.c"
  374. "nfsd/ops.c")
  375. (("#include <rpc/pmap_prot.h>" m)
  376. (string-append "#include <rpc/types.h>\n#include <rpc/xdr.h>\n" m)))
  377. #t))
  378. (add-before 'build 'pre-build
  379. (lambda _
  380. ;; Don't change the ownership of any file at this time.
  381. (substitute* '("daemons/Makefile" "utils/Makefile")
  382. (("-o root -m 4755") ""))
  383. #t))
  384. (add-after 'unpack 'create-runsystem
  385. (lambda _
  386. ;; XXX Work towards having startup.c invoke the Guile rc
  387. (delete-file "daemons/runsystem.sh")
  388. (with-output-to-file "daemons/runsystem.sh"
  389. (lambda _
  390. (display "#! /bin/bash
  391. # XXX Guile needs pipe support for its finalizer thread, to start.
  392. # Remove this script when Linux and the Hurd have xattr patches.
  393. PATH=@PATH@
  394. fsck --yes --force /
  395. fsysopts / --writable
  396. # Note: this /hurd/ gets substituted
  397. settrans --create /servers/socket/1 /hurd/pflocal
  398. # parse multiboot arguments
  399. for i in \"$@\"; do
  400. case $i in
  401. (--system=*)
  402. system=${i#--system=}
  403. ;;
  404. esac
  405. done
  406. echo Starting ${system}/rc...
  407. exec ${system}/rc \"$@\"
  408. ")))))
  409. (add-before 'build 'set-file-names
  410. (lambda* (#:key inputs outputs #:allow-other-keys)
  411. (let* ((out (assoc-ref outputs "out"))
  412. (bash (assoc-ref inputs "bash-minimal"))
  413. (coreutils (assoc-ref inputs "coreutils"))
  414. (sed (assoc-ref inputs "sed"))
  415. (grep (assoc-ref inputs "grep"))
  416. (util-linux (assoc-ref inputs "util-linux")))
  417. (substitute* '("daemons/runttys.c" "daemons/getty.c" "utils/login.c")
  418. (("/bin/login")
  419. (string-append out "/bin/login"))
  420. (("/bin/bash") (string-append bash "/bin/bash")))
  421. (substitute* '("startup/startup.c" "config/ttys")
  422. (("/libexec/")
  423. (string-append out "/libexec/")))
  424. (substitute* '("utils/uptime.sh")
  425. (("/bin/w")
  426. (string-append out "/bin/w")))
  427. ;; Upon first boot the /hurd symlink does not exist; it is
  428. ;; created during activation: Hard-code the .../hurd store file
  429. ;; name.
  430. (substitute* '("boot/boot.c"
  431. "daemons/console-run.c"
  432. "startup/startup.c")
  433. (("/hurd/")
  434. (string-append out "/hurd/")))
  435. (substitute* '("libdiskfs/boot-start.c"
  436. "libdiskfs/opts-std-startup.c")
  437. (("_HURD_STARTUP")
  438. (string-append "\"" out "/hurd/startup\"")))
  439. (substitute* '("daemons/runsystem.sh"
  440. "utils/fakeroot.sh"
  441. "utils/remap.sh"
  442. "sutils/MAKEDEV.sh"
  443. "sutils/losetup.sh")
  444. (("^PATH=.*")
  445. (string-append "PATH=" out "/bin"
  446. ":" out "/sbin"
  447. ":" coreutils "/bin"
  448. ":" grep "/bin"
  449. ":" sed "/bin"
  450. ":" util-linux "/sbin\n"))
  451. (("/sbin/") (string-append out "/sbin/"))
  452. (("/libexec/") (string-append out "/libexec/"))
  453. (("/hurd/") (string-append out "/hurd/")))
  454. #t)))
  455. (add-after 'patch-shebangs 'patch-libexec-shebangs
  456. (lambda* (#:key inputs outputs #:allow-other-keys)
  457. ;; XXX: Since the 'patch-shebangs' phase doesn't traverse
  458. ;; /libexec, do it here.
  459. (let* ((out (assoc-ref outputs "out"))
  460. (bash (assoc-ref inputs "bash-minimal"))
  461. (path (list (string-append bash "/bin"))))
  462. (for-each (lambda (file)
  463. (patch-shebang file path))
  464. (find-files (string-append out "/libexec")))
  465. #t)))
  466. (add-after 'install 'install-goodies
  467. (lambda* (#:key inputs outputs #:allow-other-keys)
  468. ;; Install additional goodies.
  469. ;; TODO: Build & install *.msgids for rpctrace.
  470. (let* ((out (assoc-ref outputs "out"))
  471. (datadir (string-append out "/share/hurd")))
  472. ;; Install the fancy UTF-8 motd.
  473. (mkdir-p (string-append out "/etc"))
  474. (copy-file "console/motd.UTF8"
  475. (string-append out "/etc/motd"))
  476. ;; Install the BDF font for use by the console client.
  477. (copy-file (assoc-ref inputs "unifont")
  478. "unifont.gz")
  479. (invoke "gunzip" "unifont.gz")
  480. (mkdir-p datadir)
  481. (copy-file "unifont"
  482. (string-append datadir "/vga-system.bdf"))
  483. #t))))
  484. #:configure-flags
  485. ,#~(list (string-append "LDFLAGS=-Wl,-rpath="
  486. #$output "/lib")
  487. "--disable-ncursesw"
  488. "--without-libbz2"
  489. "--without-libz"
  490. "--without-parted"
  491. ;; This is needed to pass the configure check for
  492. ;; clnt_create
  493. "ac_func_search_save_LIBS=-ltirpc"
  494. "ac_cv_search_clnt_create=false"
  495. "CFLAGS=-fcommon")))
  496. (build-system gnu-build-system)
  497. (inputs
  498. `(("glibc-hurd-headers" ,glibc/hurd-headers)
  499. ("libgcrypt" ,libgcrypt) ;for /hurd/random
  500. ("libdaemon" ,libdaemon) ;for /bin/console --daemonize
  501. ("unifont" ,unifont)
  502. ("libpciaccess" ,libpciaccess)
  503. ;; For NFS support
  504. ("libtirpc" ,libtirpc/hurd)
  505. ;; Tools for the /libexec/* scripts.
  506. ("bash-minimal" ,bash-minimal)
  507. ("coreutils" ,coreutils)
  508. ("sed" ,sed)
  509. ("grep" ,grep)
  510. ("util-linux" ,util-linux)))
  511. (native-inputs
  512. `(("autoconf" ,autoconf)
  513. ("automake" ,automake)
  514. ("libgcrypt" ,libgcrypt) ;for 'libgcrypt-config'
  515. ("pkg-config" ,pkg-config)
  516. ("mig" ,(if (%current-target-system)
  517. ;; XXX: When targeting i586-pc-gnu, we need a 32-bit MiG,
  518. ;; hence this hack.
  519. mig/32-bit
  520. mig))
  521. ("perl" ,perl)
  522. ("texinfo" ,texinfo-4)
  523. ("dde-sources" ,dde-sources)))
  524. (supported-systems %hurd-systems)
  525. (home-page "https://www.gnu.org/software/hurd/hurd.html")
  526. (synopsis "The kernel servers for the GNU operating system")
  527. (description
  528. "The Hurd is the kernel for the GNU system, a replacement and
  529. augmentation of standard Unix kernels. It is a collection of protocols for
  530. system interaction (file systems, networks, authentication), and servers
  531. implementing them.")
  532. (license gpl2+)))
  533. (define-public netdde
  534. (let ((commit "4a1016f130b6f2065d3f088325e5fb0b2997ae12")
  535. (revision "1"))
  536. (package
  537. (name "netdde")
  538. ;; The version prefix corresponds to the version of Linux from which the
  539. ;; drivers were taken.
  540. (version (git-version "2.6.32.65" revision commit))
  541. (source (origin
  542. (method git-fetch)
  543. (uri (git-reference
  544. (url "https://git.savannah.gnu.org/git/hurd/incubator.git")
  545. (commit commit)))
  546. (sha256
  547. (base32
  548. "1njv9dszq4lj05yq4v9j5v247hfghpzvvz4hzy0khjjr35mw7hr8"))
  549. (file-name (git-file-name name commit))))
  550. (build-system gnu-build-system)
  551. (arguments
  552. `(#:make-flags
  553. (list (string-append "SHELL=" (assoc-ref %build-inputs "bash")
  554. "/bin/bash")
  555. "PKGDIR=libdde_linux26"
  556. ,@(if (%current-target-system)
  557. (list "CC=i586-pc-gnu-gcc"
  558. "LINK_PROGRAM=i586-pc-gnu-gcc")
  559. (list "CC=gcc")))
  560. #:configure-flags
  561. ,#~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
  562. #:phases
  563. (modify-phases %standard-phases
  564. (delete 'configure)
  565. (add-after 'unpack 'prepare-dde
  566. (lambda* (#:key native-inputs inputs #:allow-other-keys)
  567. (for-each make-file-writable (find-files "."))
  568. (let ((dde (or (assoc-ref inputs "dde-sources")
  569. (assoc-ref native-inputs "dde-sources"))))
  570. (for-each (lambda (dir)
  571. (copy-recursively
  572. (string-append dde "/" dir ) dir))
  573. '("libdde_linux26" "libddekit")))
  574. (substitute* "libdde_linux26/mk/rel2abs.sh"
  575. (("/bin/bash") (which "bash")))
  576. #t))
  577. (add-after 'patch-generated-file-shebangs 'build-libdde-linux26
  578. (lambda* (#:key make-flags #:allow-other-keys)
  579. (with-directory-excursion "libdde_linux26"
  580. (apply invoke "make"
  581. (delete "PKGDIR=libdde_linux26" make-flags)))))
  582. (add-after 'build-libdde-linux26 'convert
  583. (lambda* (#:key make-flags #:allow-other-keys)
  584. (apply invoke "make" "convert" make-flags)))
  585. (replace 'build
  586. (lambda* (#:key make-flags #:allow-other-keys)
  587. ;; no-common can be dropped with GCC 10+ where this is the
  588. ;; default.
  589. (apply invoke "make" "CFLAGS=-fno-common" make-flags)))
  590. (replace 'install
  591. (lambda* (#:key outputs #:allow-other-keys)
  592. (install-file "netdde"
  593. (string-append (assoc-ref outputs "out")
  594. "/bin"))
  595. #t)))))
  596. (inputs
  597. `(("hurd" ,hurd)
  598. ("libpciaccess" ,libpciaccess)
  599. ("zlib" ,zlib)))
  600. (native-inputs
  601. `(("coreutils" ,coreutils)
  602. ("gawk" ,gawk)
  603. ("grep" ,grep)
  604. ("perl" ,perl)
  605. ("sed" ,sed)
  606. ("dde-sources" ,dde-sources)))
  607. (supported-systems %hurd-systems)
  608. (home-page "https://www.gnu.org/software/hurd/hurd.html")
  609. (synopsis "Linux network drivers glued by the DDE layer")
  610. (description
  611. "This package provides Linux 2.6 network drivers that can be embedded
  612. in userland processes thanks to the DDE layer.")
  613. ;; Some drivers are dually licensed with the options being GPLv2 or one
  614. ;; of MPL/Expat/BSD-3 (dependent on the driver).
  615. (license gpl2))))