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