gnu: hurd: Add hurd-source-url procedure.
[jackhill/guix/guix.git] / gnu / packages / hurd.scm
CommitLineData
0193c004 1;;; GNU Guix --- Functional package management for GNU
8df672aa 2;;; Copyright © 2014, 2015, 2016, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
0193c004
MR
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)
21a8fe1b 23 #:use-module (gnu packages)
e1ecd50e 24 #:use-module (guix utils)
396b3c8b 25 #:use-module (guix build-system gnu)
38efbcbb 26 #:use-module (guix build-system trivial)
396b3c8b 27 #:use-module (gnu packages flex)
dc91c10f
MR
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages perl)
21a8fe1b 30 #:use-module (gnu packages base)
62596a15
MR
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"))))
0193c004 37
41bfcac3
MR
38(define (gnumach-source-url version)
39 (string-append "mirror://gnu/gnumach/gnumach-"
40 version ".tar.gz"))
41
b005a37a
MR
42(define (hurd-source-url version)
43 (string-append "mirror://gnu/hurd/hurd-"
44 version ".tar.gz"))
45
0193c004
MR
46(define-public gnumach-headers
47 (package
48 (name "gnumach-headers")
d950f038 49 (version "1.8")
0193c004
MR
50 (source
51 (origin
52 (method url-fetch)
41bfcac3 53 (uri (gnumach-source-url version))
0193c004
MR
54 (sha256
55 (base32
d950f038 56 "02hygsfpd2dljl5lg1vjjg9pizi9jyxd4aiiqzjshz6jax62jm9f"))))
0193c004
MR
57 (build-system gnu-build-system)
58 (arguments
59 `(#:phases (alist-replace
60 'install
61 (lambda _
62 (zero?
63 (system* "make" "install-data")))
64 (alist-delete
65 'build
66 %standard-phases))
67
68 ;; GNU Mach supports only IA32 currently, so cheat so that we can at
69 ;; least install its headers.
26a28c8a
MR
70 ,@(if (%current-target-system)
71 '()
72 ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-06/msg00042.html>
73 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00716.html>
74 '(#:configure-flags '("--build=i586-pc-gnu")))
0193c004
MR
75
76 #:tests? #f))
77 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
78 (synopsis "GNU Mach kernel headers")
79 (description
80 "Headers of the GNU Mach kernel.")
81 (license gpl2+)))
396b3c8b
MR
82
83(define-public mig
84 (package
85 (name "mig")
9c9402be 86 (version "1.8")
396b3c8b
MR
87 (source
88 (origin
89 (method url-fetch)
90 (uri (string-append "mirror://gnu/mig/mig-"
91 version ".tar.gz"))
92 (sha256
93 (base32
9c9402be 94 "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706"))))
396b3c8b 95 (build-system gnu-build-system)
a7ecc92d
MR
96 ;; Flex is needed both at build and run time.
97 (inputs `(("gnumach-headers" ,gnumach-headers)
98 ("flex" ,flex)))
396b3c8b
MR
99 (native-inputs
100 `(("flex" ,flex)
101 ("bison" ,bison)))
102 (arguments `(#:tests? #f))
6fd52309 103 (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html")
396b3c8b
MR
104 (synopsis "Mach 3.0 interface generator for the Hurd")
105 (description
106 "GNU MIG is the GNU distribution of the Mach 3.0 interface generator
107MIG, as maintained by the GNU Hurd developers for the GNU project.
108You need this tool to compile the GNU Mach and GNU Hurd distributions,
35b9e423 109and to compile the GNU C library for the Hurd. Also, you will need it
396b3c8b
MR
110for other software in the GNU system that uses Mach-based inter-process
111communication.")
112 (license gpl2+)))
dc91c10f
MR
113
114(define-public hurd-headers
115 (package
116 (name "hurd-headers")
be6a70ed 117 (version "0.9")
dc91c10f
MR
118 (source (origin
119 (method url-fetch)
b005a37a 120 (uri (hurd-source-url version))
dc91c10f
MR
121 (sha256
122 (base32
be6a70ed 123 "1nw9gly0n7pyv3cpfm4mmxy4yccrx4g0lyrvd3vk2vil26jpbggw"))))
dc91c10f
MR
124 (build-system gnu-build-system)
125 (native-inputs
90b5d00b 126 `(("mig" ,mig)))
dc91c10f
MR
127 (arguments
128 `(#:phases (alist-replace
129 'install
130 (lambda _
131 (zero? (system* "make" "install-headers" "no_deps=t")))
132 (alist-delete 'build %standard-phases))
133
134 #:configure-flags '(;; Pretend we're on GNU/Hurd; 'configure' wants
135 ;; that.
6648cf63
MR
136 ,@(if (%current-target-system)
137 '()
138 '("--host=i586-pc-gnu"))
dc91c10f
MR
139
140 ;; Reduce set of dependencies.
e1ecd50e
MR
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")
dc91c10f
MR
149
150 #:tests? #f))
6fd52309 151 (home-page "https://www.gnu.org/software/hurd/hurd.html")
dc91c10f
MR
152 (synopsis "GNU Hurd headers")
153 (description
154 "This package provides C headers of the GNU Hurd, used to build the GNU C
155Library and other user programs.")
156 (license gpl2+)))
21a8fe1b
MR
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
90b5d00b 163 `(("mig" ,mig)))
21a8fe1b 164 (arguments
e1ecd50e
MR
165 (substitute-keyword-arguments (package-arguments hurd-headers)
166 ((#:phases _)
167 '(alist-replace
168 '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 (alist-replace
181 'build
182 (lambda _
183 (zero? (system* "make" "-Clibihash" "libihash.a")))
184 %standard-phases)))))
6fd52309 185 (home-page "https://www.gnu.org/software/hurd/hurd.html")
21a8fe1b
MR
186 (synopsis "GNU Hurd libraries")
187 (description
a124bbd2 188 "This package provides libihash, needed to build the GNU C
21a8fe1b
MR
189Library for GNU/Hurd.")
190 (license gpl2+)))
38efbcbb
MR
191
192(define-public hurd-core-headers
193 (package
194 (name "hurd-core-headers")
195 (version (package-version hurd-headers))
196 (source #f)
197 (build-system trivial-build-system)
198 (arguments
199 '(#:modules ((guix build union))
200 #:builder (begin
201 (use-modules (ice-9 match)
202 (guix build union))
203 (match %build-inputs
204 (((names . directories) ...)
205 (union-build (assoc-ref %outputs "out")
206 directories))))))
207 (inputs `(("gnumach-headers" ,gnumach-headers)
208 ("hurd-headers" ,hurd-headers)
209 ("hurd-minimal" ,hurd-minimal)))
210 (synopsis "Union of the Hurd headers and libraries")
211 (description
212 "This package contains the union of the Mach and Hurd headers and the
213Hurd-minimal package which are needed for both glibc and GCC.")
214 (home-page (package-home-page hurd-headers))
215 (license (package-license hurd-headers))))
8df672aa
MR
216
217(define-public gnumach
218 (package
219 (name "gnumach")
220 (version "1.8")
221 (source (origin
222 (method url-fetch)
223 (uri (gnumach-source-url version))
224 (sha256
225 (base32
226 "02hygsfpd2dljl5lg1vjjg9pizi9jyxd4aiiqzjshz6jax62jm9f"))))
227 (build-system gnu-build-system)
228 (arguments
229 `(#:phases (modify-phases %standard-phases
230 (add-after 'install 'produce-image
231 (lambda* (#:key outputs #:allow-other-keys)
232 (let* ((out (assoc-ref outputs "out"))
233 (boot (string-append out "/boot")))
234 (and (zero? (system* "make" "gnumach.gz"))
235 (begin
236 (install-file "gnumach.gz" boot)
237 #t))))))))
238 (native-inputs
239 `(("mig" ,mig)
240 ("perl" ,perl)))
241 (supported-systems (cons "i686-linux" %hurd-systems))
242 (home-page
243 "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
244 (synopsis "Microkernel of the GNU system")
245 (description
246 "GNU Mach is the microkernel upon which a GNU Hurd system is based.")
247 (license gpl2+)))