1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
3 ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages hurd)
21 #:use-module (guix licenses)
22 #:use-module (guix download)
23 #:use-module (guix packages)
24 #:use-module (gnu packages)
25 #:use-module (guix utils)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system trivial)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages flex)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages base)
33 #:use-module (guix git-download)
34 #:export (hurd-triplet?
37 (define (hurd-triplet? triplet)
38 (and (string-suffix? "-gnu" triplet)
39 (not (string-contains triplet "linux"))))
41 (define (hurd-target?)
42 "Return true if the cross-compilation target or the current system is
44 (or (and=> (%current-target-system) hurd-triplet?)
45 (string-suffix? (%current-system) "-gnu")))
47 (define (gnumach-source-url version)
48 (string-append "mirror://gnu/gnumach/gnumach-"
51 (define (hurd-source-url version)
52 (string-append "mirror://gnu/hurd/hurd-"
55 (define (patch-url repository commit)
56 (string-append "https://git.savannah.gnu.org/cgit/hurd/" repository
57 ".git/patch/?id=" commit))
59 (define-public gnumach-headers
61 (name "gnumach-headers")
66 (uri (gnumach-source-url version))
69 "02hygsfpd2dljl5lg1vjjg9pizi9jyxd4aiiqzjshz6jax62jm9f"))
70 (patches (list (origin
71 ;; This patch adds <mach/vm_wire.h>, which defines the
72 ;; VM_WIRE_* constants needed by glibc 2.28.
74 (uri (patch-url "gnumach" "2b0f19f602e08fd9d37268233b962674fd592634"))
77 "01iajnwsmka0w9hwjkxxijc4xfhwqbvlkw1w8n71hpnhfixd0y28"))
78 (file-name "gnumach-vm-wire-header.patch"))))
79 (modules '((guix build utils)))
82 ;; Actually install vm_wire.h.
83 (substitute* "Makefile.in"
84 (("^include_mach_HEADERS =")
85 "include_mach_HEADERS = include/mach/vm_wire.h"))
87 (build-system gnu-build-system)
90 (modify-phases %standard-phases
93 (invoke "make" "install-data")))
96 ;; GNU Mach supports only IA32 currently, so cheat so that we can at
97 ;; least install its headers.
98 ,@(if (%current-target-system)
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")))
105 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
106 (synopsis "GNU Mach kernel headers")
108 "Headers of the GNU Mach kernel.")
118 (uri (string-append "mirror://gnu/mig/mig-"
122 "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706"))))
123 (build-system gnu-build-system)
124 ;; Flex is needed both at build and run time.
125 (inputs `(("gnumach-headers" ,gnumach-headers)
130 (arguments `(#:tests? #f))
131 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html")
132 (synopsis "Mach 3.0 interface generator for the Hurd")
134 "GNU MIG is the GNU distribution of the Mach 3.0 interface generator
135 MIG, as maintained by the GNU Hurd developers for the GNU project.
136 You need this tool to compile the GNU Mach and GNU Hurd distributions,
137 and to compile the GNU C library for the Hurd. Also, you will need it
138 for other software in the GNU system that uses Mach-based inter-process
142 (define-public hurd-headers
143 ;; Resort to a post-0.9 snapshot that provides the 'file_utimens' and
144 ;; 'file_exec_paths' RPCs that glibc 2.28 expects.
146 (commit "98b33905c89b7e5c309c74ae32302a5745901a6e"))
148 (name "hurd-headers")
153 (url "https://git.savannah.gnu.org/git/hurd/hurd.git")
157 "1mj22sxgscas2675vrbxr477mwbxdj68pqcrh65lbir8qlssrgrf"))
158 (file-name (git-file-name name version))))
159 (build-system gnu-build-system)
162 ("autoconf" ,autoconf)
163 ("automake" ,automake)))
166 (modify-phases %standard-phases
169 (invoke "make" "install-headers" "no_deps=t")))
172 #:configure-flags '( ;; Pretend we're on GNU/Hurd; 'configure' wants
174 ,@(if (%current-target-system)
176 '("--host=i586-pc-gnu"))
178 ;; Reduce set of dependencies.
184 ;; Skip the clnt_create check because it expects
185 ;; a working glibc causing a circular dependency.
186 "ac_cv_search_clnt_create=no"
188 ;; Annihilate the checks for the 'file_exec_paths'
189 ;; & co. libc functions to avoid "link tests are
190 ;; not allowed after AC_NO_EXECUTABLES" error.
191 "ac_cv_func_file_exec_paths=no"
192 "ac_cv_func_exec_exec_paths=no"
193 "ac_cv_func__hurd_exec_paths=no"
194 "ac_cv_func_file_futimens=no")
197 (home-page "https://www.gnu.org/software/hurd/hurd.html")
198 (synopsis "GNU Hurd headers")
200 "This package provides C headers of the GNU Hurd, used to build the GNU C
201 Library and other user programs.")
204 (define-public hurd-minimal
205 (package (inherit hurd-headers)
206 (name "hurd-minimal")
207 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
209 (substitute-keyword-arguments (package-arguments hurd-headers)
211 '(modify-phases %standard-phases
213 (lambda* (#:key outputs #:allow-other-keys)
214 (let ((out (assoc-ref outputs "out")))
215 ;; We need to copy libihash.a to the output directory manually,
216 ;; since there is no target for that in the makefile.
217 (mkdir-p (string-append out "/include"))
218 (copy-file "libihash/ihash.h"
219 (string-append out "/include/ihash.h"))
220 (mkdir-p (string-append out "/lib"))
221 (copy-file "libihash/libihash.a"
222 (string-append out "/lib/libihash.a"))
226 ;; Install <assert-backtrace.h> & co.
227 (invoke "make" "-Clibshouldbeinlibc"
228 "../include/assert-backtrace.h")
231 (invoke "make" "-Clibihash" "libihash.a")))))))
232 (home-page "https://www.gnu.org/software/hurd/hurd.html")
233 (synopsis "GNU Hurd libraries")
235 "This package provides libihash, needed to build the GNU C
236 Library for GNU/Hurd.")
239 (define-public hurd-core-headers
241 (name "hurd-core-headers")
242 (version (package-version hurd-headers))
244 (build-system trivial-build-system)
246 '(#:modules ((guix build union))
248 (use-modules (ice-9 match)
251 (((names . directories) ...)
252 (union-build (assoc-ref %outputs "out")
255 (inputs `(("gnumach-headers" ,gnumach-headers)
256 ("hurd-headers" ,hurd-headers)
257 ("hurd-minimal" ,hurd-minimal)))
258 (synopsis "Union of the Hurd headers and libraries")
260 "This package contains the union of the Mach and Hurd headers and the
261 Hurd-minimal package which are needed for both glibc and GCC.")
262 (home-page (package-home-page hurd-headers))
263 (license (package-license hurd-headers))))
265 (define-public gnumach
271 (uri (gnumach-source-url version))
274 "02hygsfpd2dljl5lg1vjjg9pizi9jyxd4aiiqzjshz6jax62jm9f"))))
275 (build-system gnu-build-system)
277 `(#:phases (modify-phases %standard-phases
278 (add-after 'install 'produce-image
279 (lambda* (#:key outputs #:allow-other-keys)
280 (let* ((out (assoc-ref outputs "out"))
281 (boot (string-append out "/boot")))
282 (invoke "make" "gnumach.gz")
283 (install-file "gnumach.gz" boot)
288 (supported-systems (cons "i686-linux" %hurd-systems))
290 "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
291 (synopsis "Microkernel of the GNU system")
293 "GNU Mach is the microkernel upon which a GNU Hurd system is based.")
302 (uri (hurd-source-url version))
305 "1nw9gly0n7pyv3cpfm4mmxy4yccrx4g0lyrvd3vk2vil26jpbggw"))
306 (patches (search-patches "hurd-fix-eth-multiplexer-dependency.patch"))))
309 (modify-phases %standard-phases
310 (add-before 'build 'pre-build
312 ;; Don't change the ownership of any file at this time.
313 (substitute* '("daemons/Makefile" "utils/Makefile")
314 (("-o root -m 4755") ""))
316 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
321 "--without-parted")))
322 (build-system gnu-build-system)
323 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
327 (supported-systems %hurd-systems)
328 (home-page "https://www.gnu.org/software/hurd/hurd.html")
329 (synopsis "The kernel servers for the GNU operating system")
331 "The Hurd is the kernel for the GNU system, a replacement and
332 augmentation of standard Unix kernels. It is a collection of protocols for
333 system interaction (file systems, networks, authentication), and servers