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