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 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages hurd)
24 #:use-module (guix licenses)
25 #:use-module (guix download)
26 #:use-module (guix packages)
27 #:use-module (gnu packages)
28 #:use-module (guix utils)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages flex)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages texinfo)
37 #:use-module (guix git-download)
38 #:export (hurd-system?
42 (define (hurd-triplet? triplet)
43 (and (string-suffix? "-gnu" triplet)
44 (not (string-contains triplet "linux"))))
46 (define (hurd-target?)
47 "Return true if the cross-compilation target or the current system is
49 (or (and=> (%current-target-system) hurd-triplet?)
50 (and (not (%current-target-system))
51 (and=> (%current-system) hurd-triplet?))))
53 (define (hurd-system?)
54 "Return true if the current system is the Hurd."
55 (and=> (%current-system) hurd-triplet?))
57 (define (hurd-source-url version)
58 (string-append "mirror://gnu/hurd/hurd-"
61 (define-public gnumach-headers
62 (let ((commit "097f9cf735ffa1212b828682ad92f0f6c5f1c552")
65 (name "gnumach-headers")
66 (version (git-version "1.8" revision commit))
71 (url "https://git.savannah.gnu.org/git/hurd/gnumach.git")
73 (file-name (git-file-name "gnumach" version))
76 "0q36z7k02bykrld90zaxbhyzxlmwlqqs4divgir6ix38zsp6icqk"))))
77 (build-system gnu-build-system)
80 (modify-phases %standard-phases
83 (invoke "make" "install-data")))
86 ;; GNU Mach supports only IA32 currently, so cheat so that we can at
87 ;; least install its headers.
88 ,@(if (%current-target-system)
90 ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-06/msg00042.html>
91 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00716.html>
92 '(#:configure-flags '("--build=i586-pc-gnu"
93 "--host=i686-linux-gnu")))
97 `(("autoconf" ,autoconf)
98 ("automake" ,automake)
99 ("texinfo" ,texinfo-4)))
100 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
101 (synopsis "GNU Mach kernel headers")
103 "Headers of the GNU Mach kernel.")
113 (uri (string-append "mirror://gnu/mig/mig-"
117 "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706"))))
118 (build-system gnu-build-system)
119 ;; Flex is needed both at build and run time.
120 (inputs `(("gnumach-headers" ,gnumach-headers)
125 (arguments `(#:tests? #f))
126 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html")
127 (synopsis "Mach 3.0 interface generator for the Hurd")
129 "GNU MIG is the GNU distribution of the Mach 3.0 interface generator
130 MIG, as maintained by the GNU Hurd developers for the GNU project.
131 You need this tool to compile the GNU Mach and GNU Hurd distributions,
132 and to compile the GNU C library for the Hurd. Also, you will need it
133 for other software in the GNU system that uses Mach-based inter-process
137 (define-public hurd-headers
138 ;; Resort to a post-0.9 snapshot that provides the 'file_utimens' and
139 ;; 'file_exec_paths' RPCs that glibc 2.28 expects.
141 (commit "91a51672ff4cfe1f1a0712b4c542ded3081c825b"))
143 (name "hurd-headers")
144 (version (git-version "0.9" revision commit))
148 (url "https://git.savannah.gnu.org/git/hurd/hurd.git")
152 "16k9wkahz9wasviijz53n6i13nmiwa9fs64ikf1jqh8rl60hw7cz"))
153 (file-name (git-file-name name version))))
154 (build-system gnu-build-system)
157 ("autoconf" ,autoconf)
158 ("automake" ,automake)))
161 (modify-phases %standard-phases
164 (invoke "make" "install-headers" "no_deps=t")))
167 #:configure-flags '( ;; Pretend we're on GNU/Hurd; 'configure' wants
169 ,@(if (%current-target-system)
171 '("--host=i586-pc-gnu"))
173 ;; Reduce set of dependencies.
180 ;; Skip the clnt_create check because it expects
181 ;; a working glibc causing a circular dependency.
182 "ac_cv_search_clnt_create=no"
184 ;; Annihilate the checks for the 'file_exec_paths'
185 ;; & co. libc functions to avoid "link tests are
186 ;; not allowed after AC_NO_EXECUTABLES" error.
187 "ac_cv_func_file_exec_paths=no"
188 "ac_cv_func_exec_exec_paths=no"
189 "ac_cv_func__hurd_exec_paths=no"
190 "ac_cv_func_file_futimens=no")
193 (home-page "https://www.gnu.org/software/hurd/hurd.html")
194 (synopsis "GNU Hurd headers")
196 "This package provides C headers of the GNU Hurd, used to build the GNU C
197 Library and other user programs.")
200 (define-public hurd-minimal
201 (package (inherit hurd-headers)
202 (name "hurd-minimal")
203 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
205 (substitute-keyword-arguments (package-arguments hurd-headers)
207 '(modify-phases %standard-phases
209 (lambda* (#:key outputs #:allow-other-keys)
210 (let ((out (assoc-ref outputs "out")))
211 ;; We need to copy libihash.a to the output directory manually,
212 ;; since there is no target for that in the makefile.
213 (mkdir-p (string-append out "/include"))
214 (copy-file "libihash/ihash.h"
215 (string-append out "/include/ihash.h"))
216 (mkdir-p (string-append out "/lib"))
217 (copy-file "libihash/libihash.a"
218 (string-append out "/lib/libihash.a"))
222 ;; Install <assert-backtrace.h> & co.
223 (invoke "make" "-Clibshouldbeinlibc"
224 "../include/assert-backtrace.h")
227 (invoke "make" "-Clibihash" "libihash.a")))))))
228 (home-page "https://www.gnu.org/software/hurd/hurd.html")
229 (synopsis "GNU Hurd libraries")
231 "This package provides libihash, needed to build the GNU C
232 Library for GNU/Hurd.")
235 (define-public hurd-core-headers
237 (name "hurd-core-headers")
238 (version (package-version hurd-headers))
240 (build-system trivial-build-system)
242 '(#:modules ((guix build union))
244 (use-modules (ice-9 match)
247 (((names . directories) ...)
248 (union-build (assoc-ref %outputs "out")
251 (inputs `(("gnumach-headers" ,gnumach-headers)
252 ("hurd-headers" ,hurd-headers)
253 ("hurd-minimal" ,hurd-minimal)))
254 (synopsis "Union of the Hurd headers and libraries")
256 "This package contains the union of the Mach and Hurd headers and the
257 Hurd-minimal package which are needed for both glibc and GCC.")
258 (home-page (package-home-page hurd-headers))
259 (license (package-license hurd-headers))))
261 (define-public gnumach
263 (inherit gnumach-headers)
266 `(#:phases (modify-phases %standard-phases
267 (add-after 'install 'produce-image
268 (lambda* (#:key outputs #:allow-other-keys)
269 (let* ((out (assoc-ref outputs "out"))
270 (boot (string-append out "/boot")))
271 (invoke "make" "gnumach.gz")
272 (install-file "gnumach.gz" boot)
277 (supported-systems (cons "i686-linux" %hurd-systems))
278 (synopsis "Microkernel of the GNU system")
280 "GNU Mach is the microkernel upon which a GNU Hurd system is based.")))
285 (version (package-version hurd-headers))
286 (source (origin (inherit (package-source hurd-headers))
287 (patches (search-patches "hurd-cross.patch"))))
290 (modify-phases %standard-phases
291 (add-before 'build 'pre-build
293 ;; Don't change the ownership of any file at this time.
294 (substitute* '("daemons/Makefile" "utils/Makefile")
295 (("-o root -m 4755") ""))
297 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
302 "--without-parted")))
303 (build-system gnu-build-system)
304 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
306 `(("autoconf" ,autoconf)
307 ("automake" ,automake)
310 ("texinfo" ,texinfo-4)))
311 (supported-systems %hurd-systems)
312 (home-page "https://www.gnu.org/software/hurd/hurd.html")
313 (synopsis "The kernel servers for the GNU operating system")
315 "The Hurd is the kernel for the GNU system, a replacement and
316 augmentation of standard Unix kernels. It is a collection of protocols for
317 system interaction (file systems, networks, authentication), and servers