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>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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?
39 (define (hurd-triplet? triplet)
40 (and (string-suffix? "-gnu" triplet)
41 (not (string-contains triplet "linux"))))
43 (define (hurd-target?)
44 "Return true if the cross-compilation target or the current system is
46 (or (and=> (%current-target-system) hurd-triplet?)
47 (string-suffix? (%current-system) "-gnu")))
49 (define (hurd-source-url version)
50 (string-append "mirror://gnu/hurd/hurd-"
53 (define-public gnumach-headers
54 (let ((commit "097f9cf735ffa1212b828682ad92f0f6c5f1c552")
57 (name "gnumach-headers")
58 (version (git-version "1.8" revision commit))
63 (url "https://git.savannah.gnu.org/git/hurd/gnumach.git")
65 (file-name (git-file-name "gnumach" version))
68 "0q36z7k02bykrld90zaxbhyzxlmwlqqs4divgir6ix38zsp6icqk"))))
69 (build-system gnu-build-system)
72 (modify-phases %standard-phases
75 (invoke "make" "install-data")))
78 ;; GNU Mach supports only IA32 currently, so cheat so that we can at
79 ;; least install its headers.
80 ,@(if (%current-target-system)
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")))
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")
95 "Headers of the GNU Mach kernel.")
105 (uri (string-append "mirror://gnu/mig/mig-"
109 "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706"))))
110 (build-system gnu-build-system)
111 ;; Flex is needed both at build and run time.
112 (inputs `(("gnumach-headers" ,gnumach-headers)
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")
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
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.
133 (commit "98b33905c89b7e5c309c74ae32302a5745901a6e"))
135 (name "hurd-headers")
140 (url "https://git.savannah.gnu.org/git/hurd/hurd.git")
144 "1mj22sxgscas2675vrbxr477mwbxdj68pqcrh65lbir8qlssrgrf"))
145 (file-name (git-file-name name version))))
146 (build-system gnu-build-system)
149 ("autoconf" ,autoconf)
150 ("automake" ,automake)))
153 (modify-phases %standard-phases
156 (invoke "make" "install-headers" "no_deps=t")))
159 #:configure-flags '( ;; Pretend we're on GNU/Hurd; 'configure' wants
161 ,@(if (%current-target-system)
163 '("--host=i586-pc-gnu"))
165 ;; Reduce set of dependencies.
171 ;; Skip the clnt_create check because it expects
172 ;; a working glibc causing a circular dependency.
173 "ac_cv_search_clnt_create=no"
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")
184 (home-page "https://www.gnu.org/software/hurd/hurd.html")
185 (synopsis "GNU Hurd headers")
187 "This package provides C headers of the GNU Hurd, used to build the GNU C
188 Library and other user programs.")
191 (define-public hurd-minimal
192 (package (inherit hurd-headers)
193 (name "hurd-minimal")
194 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
196 (substitute-keyword-arguments (package-arguments hurd-headers)
198 '(modify-phases %standard-phases
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"))
213 ;; Install <assert-backtrace.h> & co.
214 (invoke "make" "-Clibshouldbeinlibc"
215 "../include/assert-backtrace.h")
218 (invoke "make" "-Clibihash" "libihash.a")))))))
219 (home-page "https://www.gnu.org/software/hurd/hurd.html")
220 (synopsis "GNU Hurd libraries")
222 "This package provides libihash, needed to build the GNU C
223 Library for GNU/Hurd.")
226 (define-public hurd-core-headers
228 (name "hurd-core-headers")
229 (version (package-version hurd-headers))
231 (build-system trivial-build-system)
233 '(#:modules ((guix build union))
235 (use-modules (ice-9 match)
238 (((names . directories) ...)
239 (union-build (assoc-ref %outputs "out")
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")
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))))
252 (define-public gnumach
254 (inherit gnumach-headers)
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)
268 (supported-systems (cons "i686-linux" %hurd-systems))
269 (synopsis "Microkernel of the GNU system")
271 "GNU Mach is the microkernel upon which a GNU Hurd system is based.")))
279 (uri (hurd-source-url version))
282 "1nw9gly0n7pyv3cpfm4mmxy4yccrx4g0lyrvd3vk2vil26jpbggw"))
283 (patches (search-patches "hurd-fix-eth-multiplexer-dependency.patch"))))
286 (modify-phases %standard-phases
287 (add-before 'build 'pre-build
289 ;; Don't change the ownership of any file at this time.
290 (substitute* '("daemons/Makefile" "utils/Makefile")
291 (("-o root -m 4755") ""))
293 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
298 "--without-parted")))
299 (build-system gnu-build-system)
300 (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers)))
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")
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