Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / hurd.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages hurd)
20 #:use-module (guix licenses)
21 #:use-module (guix download)
22 #:use-module (guix packages)
23 #:use-module (gnu packages)
24 #:use-module (guix utils)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system trivial)
27 #:use-module (gnu packages flex)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages perl)
30 #:use-module (gnu packages base)
31 #:use-module (guix git-download)
32 #:export (hurd-triplet?))
33
34 (define (hurd-triplet? triplet)
35 (and (string-suffix? "-gnu" triplet)
36 (not (string-contains triplet "linux"))))
37
38 (define (gnumach-source-url version)
39 (string-append "mirror://gnu/gnumach/gnumach-"
40 version ".tar.gz"))
41
42 (define (hurd-source-url version)
43 (string-append "mirror://gnu/hurd/hurd-"
44 version ".tar.gz"))
45
46 (define-public gnumach-headers
47 (package
48 (name "gnumach-headers")
49 (version "1.8")
50 (source
51 (origin
52 (method url-fetch)
53 (uri (gnumach-source-url version))
54 (sha256
55 (base32
56 "02hygsfpd2dljl5lg1vjjg9pizi9jyxd4aiiqzjshz6jax62jm9f"))))
57 (build-system gnu-build-system)
58 (arguments
59 `(#:phases
60 (modify-phases %standard-phases
61 (replace 'install
62 (lambda _
63 (zero?
64 (system* "make" "install-data"))))
65 (delete 'build))
66
67 ;; GNU Mach supports only IA32 currently, so cheat so that we can at
68 ;; least install its headers.
69 ,@(if (%current-target-system)
70 '()
71 ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-06/msg00042.html>
72 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00716.html>
73 '(#:configure-flags '("--build=i586-pc-gnu")))
74
75 #:tests? #f))
76 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
77 (synopsis "GNU Mach kernel headers")
78 (description
79 "Headers of the GNU Mach kernel.")
80 (license gpl2+)))
81
82 (define-public mig
83 (package
84 (name "mig")
85 (version "1.8")
86 (source
87 (origin
88 (method url-fetch)
89 (uri (string-append "mirror://gnu/mig/mig-"
90 version ".tar.gz"))
91 (sha256
92 (base32
93 "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706"))))
94 (build-system gnu-build-system)
95 ;; Flex is needed both at build and run time.
96 (inputs `(("gnumach-headers" ,gnumach-headers)
97 ("flex" ,flex)))
98 (native-inputs
99 `(("flex" ,flex)
100 ("bison" ,bison)))
101 (arguments `(#:tests? #f))
102 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html")
103 (synopsis "Mach 3.0 interface generator for the Hurd")
104 (description
105 "GNU MIG is the GNU distribution of the Mach 3.0 interface generator
106 MIG, as maintained by the GNU Hurd developers for the GNU project.
107 You need this tool to compile the GNU Mach and GNU Hurd distributions,
108 and to compile the GNU C library for the Hurd. Also, you will need it
109 for other software in the GNU system that uses Mach-based inter-process
110 communication.")
111 (license gpl2+)))
112
113 (define-public hurd-headers
114 (package
115 (name "hurd-headers")
116 (version "0.9")
117 (source (origin
118 (method url-fetch)
119 (uri (hurd-source-url version))
120 (sha256
121 (base32
122 "1nw9gly0n7pyv3cpfm4mmxy4yccrx4g0lyrvd3vk2vil26jpbggw"))))
123 (build-system gnu-build-system)
124 (native-inputs
125 `(("mig" ,mig)))
126 (arguments
127 `(#:phases
128 (modify-phases %standard-phases
129 (replace 'install
130 (lambda _
131 (zero? (system* "make" "install-headers" "no_deps=t"))))
132 (delete 'build))
133
134 #:configure-flags '(;; Pretend we're on GNU/Hurd; 'configure' wants
135 ;; that.
136 ,@(if (%current-target-system)
137 '()
138 '("--host=i586-pc-gnu"))
139
140 ;; Reduce set of dependencies.
141 "--without-parted"
142 "--disable-ncursesw"
143 "--disable-test"
144 "--without-libbz2"
145 "--without-libz"
146 ;; Skip the clnt_create check because it expects
147 ;; a working glibc causing a circular dependency.
148 "ac_cv_search_clnt_create=no")
149
150 #:tests? #f))
151 (home-page "https://www.gnu.org/software/hurd/hurd.html")
152 (synopsis "GNU Hurd headers")
153 (description
154 "This package provides C headers of the GNU Hurd, used to build the GNU C
155 Library and other user programs.")
156 (license gpl2+)))
157
158 (define-public hurd-minimal
159 (package (inherit hurd-headers)
160 (name "hurd-minimal")
161 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
162 (native-inputs
163 `(("mig" ,mig)))
164 (arguments
165 (substitute-keyword-arguments (package-arguments hurd-headers)
166 ((#:phases _)
167 '(modify-phases %standard-phases
168 (replace 'install
169 (lambda* (#:key outputs #:allow-other-keys)
170 (let ((out (assoc-ref outputs "out")))
171 ;; We need to copy libihash.a to the output directory manually,
172 ;; since there is no target for that in the makefile.
173 (mkdir-p (string-append out "/include"))
174 (copy-file "libihash/ihash.h"
175 (string-append out "/include/ihash.h"))
176 (mkdir-p (string-append out "/lib"))
177 (copy-file "libihash/libihash.a"
178 (string-append out "/lib/libihash.a"))
179 #t)))
180 (replace 'build
181 (lambda _
182 (zero? (system* "make" "-Clibihash" "libihash.a"))))))))
183 (home-page "https://www.gnu.org/software/hurd/hurd.html")
184 (synopsis "GNU Hurd libraries")
185 (description
186 "This package provides libihash, needed to build the GNU C
187 Library for GNU/Hurd.")
188 (license gpl2+)))
189
190 (define-public hurd-core-headers
191 (package
192 (name "hurd-core-headers")
193 (version (package-version hurd-headers))
194 (source #f)
195 (build-system trivial-build-system)
196 (arguments
197 '(#:modules ((guix build union))
198 #:builder (begin
199 (use-modules (ice-9 match)
200 (guix build union))
201 (match %build-inputs
202 (((names . directories) ...)
203 (union-build (assoc-ref %outputs "out")
204 directories))))))
205 (inputs `(("gnumach-headers" ,gnumach-headers)
206 ("hurd-headers" ,hurd-headers)
207 ("hurd-minimal" ,hurd-minimal)))
208 (synopsis "Union of the Hurd headers and libraries")
209 (description
210 "This package contains the union of the Mach and Hurd headers and the
211 Hurd-minimal package which are needed for both glibc and GCC.")
212 (home-page (package-home-page hurd-headers))
213 (license (package-license hurd-headers))))
214
215 (define-public gnumach
216 (package
217 (name "gnumach")
218 (version "1.8")
219 (source (origin
220 (method url-fetch)
221 (uri (gnumach-source-url version))
222 (sha256
223 (base32
224 "02hygsfpd2dljl5lg1vjjg9pizi9jyxd4aiiqzjshz6jax62jm9f"))))
225 (build-system gnu-build-system)
226 (arguments
227 `(#:phases (modify-phases %standard-phases
228 (add-after 'install 'produce-image
229 (lambda* (#:key outputs #:allow-other-keys)
230 (let* ((out (assoc-ref outputs "out"))
231 (boot (string-append out "/boot")))
232 (and (zero? (system* "make" "gnumach.gz"))
233 (begin
234 (install-file "gnumach.gz" boot)
235 #t))))))))
236 (native-inputs
237 `(("mig" ,mig)
238 ("perl" ,perl)))
239 (supported-systems (cons "i686-linux" %hurd-systems))
240 (home-page
241 "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
242 (synopsis "Microkernel of the GNU system")
243 (description
244 "GNU Mach is the microkernel upon which a GNU Hurd system is based.")
245 (license gpl2+)))
246
247 (define-public hurd
248 (package
249 (name "hurd")
250 (version "0.9")
251 (source (origin
252 (method url-fetch)
253 (uri (hurd-source-url version))
254 (sha256
255 (base32
256 "1nw9gly0n7pyv3cpfm4mmxy4yccrx4g0lyrvd3vk2vil26jpbggw"))
257 (patches (search-patches "hurd-fix-eth-multiplexer-dependency.patch"))))
258 (arguments
259 `(#:phases
260 (modify-phases %standard-phases
261 (add-before 'build 'pre-build
262 (lambda _
263 ;; Don't change the ownership of any file at this time.
264 (substitute* '("daemons/Makefile" "utils/Makefile")
265 (("-o root -m 4755") ""))
266 #t)))
267 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
268 %output "/lib")
269 "--disable-ncursesw"
270 "--without-libbz2"
271 "--without-libz"
272 "--without-parted")))
273 (build-system gnu-build-system)
274 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
275 (native-inputs
276 `(("mig" ,mig)
277 ("perl" ,perl)))
278 (supported-systems %hurd-systems)
279 (home-page "https://www.gnu.org/software/hurd/hurd.html")
280 (synopsis "The kernel servers for the GNU operating system")
281 (description
282 "The Hurd is the kernel for the GNU system, a replacement and
283 augmentation of standard Unix kernels. It is a collection of protocols for
284 system interaction (file systems, networks, authentication), and servers
285 implementing them.")
286 (license gpl2+)))