Commit | Line | Data |
---|---|---|
0193c004 | 1 | ;;; GNU Guix --- Functional package management for GNU |
8df672aa | 2 | ;;; Copyright © 2014, 2015, 2016, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com> |
e62f6f77 | 3 | ;;; Copyright © 2018, 2020 Ludovic Courtès <ludo@gnu.org> |
fb9d6f0f | 4 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> |
f379c665 | 5 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
9b943db3 | 6 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
0193c004 MR |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
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. | |
14 | ;;; | |
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. | |
19 | ;;; | |
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/>. | |
22 | ||
23 | (define-module (gnu packages hurd) | |
24 | #:use-module (guix licenses) | |
25 | #:use-module (guix download) | |
26 | #:use-module (guix packages) | |
21a8fe1b | 27 | #:use-module (gnu packages) |
e1ecd50e | 28 | #:use-module (guix utils) |
396b3c8b | 29 | #:use-module (guix build-system gnu) |
38efbcbb | 30 | #:use-module (guix build-system trivial) |
2d546858 | 31 | #:use-module (gnu packages autotools) |
396b3c8b | 32 | #:use-module (gnu packages flex) |
dc91c10f MR |
33 | #:use-module (gnu packages bison) |
34 | #:use-module (gnu packages perl) | |
21a8fe1b | 35 | #:use-module (gnu packages base) |
fb9d6f0f | 36 | #:use-module (gnu packages texinfo) |
62596a15 | 37 | #:use-module (guix git-download) |
9b943db3 JN |
38 | #:export (hurd-system? |
39 | hurd-target? | |
40 | hurd-triplet?)) | |
62596a15 MR |
41 | |
42 | (define (hurd-triplet? triplet) | |
43 | (and (string-suffix? "-gnu" triplet) | |
44 | (not (string-contains triplet "linux")))) | |
0193c004 | 45 | |
2d546858 LC |
46 | (define (hurd-target?) |
47 | "Return true if the cross-compilation target or the current system is | |
48 | GNU/Hurd." | |
49 | (or (and=> (%current-target-system) hurd-triplet?) | |
9b943db3 JN |
50 | (and (not (%current-target-system)) |
51 | (and=> (%current-system) hurd-triplet?)))) | |
52 | ||
53 | (define (hurd-system?) | |
54 | "Return true if the current system is the Hurd." | |
55 | (and=> (%current-system) hurd-triplet?)) | |
2d546858 | 56 | |
b005a37a MR |
57 | (define (hurd-source-url version) |
58 | (string-append "mirror://gnu/hurd/hurd-" | |
59 | version ".tar.gz")) | |
60 | ||
0193c004 | 61 | (define-public gnumach-headers |
fb9d6f0f EF |
62 | (let ((commit "097f9cf735ffa1212b828682ad92f0f6c5f1c552") |
63 | (revision "1")) | |
64 | (package | |
65 | (name "gnumach-headers") | |
66 | (version (git-version "1.8" revision commit)) | |
67 | (source | |
68 | (origin | |
69 | (method git-fetch) | |
70 | (uri (git-reference | |
71 | (url "https://git.savannah.gnu.org/git/hurd/gnumach.git") | |
72 | (commit commit))) | |
73 | (file-name (git-file-name "gnumach" version)) | |
74 | (sha256 | |
75 | (base32 | |
76 | "0q36z7k02bykrld90zaxbhyzxlmwlqqs4divgir6ix38zsp6icqk")))) | |
77 | (build-system gnu-build-system) | |
78 | (arguments | |
79 | `(#:phases | |
80 | (modify-phases %standard-phases | |
81 | (replace 'install | |
82 | (lambda _ | |
83 | (invoke "make" "install-data"))) | |
84 | (delete 'build)) | |
0193c004 | 85 | |
fb9d6f0f EF |
86 | ;; GNU Mach supports only IA32 currently, so cheat so that we can at |
87 | ;; least install its headers. | |
88 | ,@(if (%current-target-system) | |
89 | '() | |
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"))) | |
0193c004 | 94 | |
fb9d6f0f EF |
95 | #:tests? #f)) |
96 | (native-inputs | |
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") | |
102 | (description | |
103 | "Headers of the GNU Mach kernel.") | |
104 | (license gpl2+)))) | |
396b3c8b MR |
105 | |
106 | (define-public mig | |
107 | (package | |
108 | (name "mig") | |
9c9402be | 109 | (version "1.8") |
396b3c8b MR |
110 | (source |
111 | (origin | |
112 | (method url-fetch) | |
113 | (uri (string-append "mirror://gnu/mig/mig-" | |
114 | version ".tar.gz")) | |
115 | (sha256 | |
116 | (base32 | |
9c9402be | 117 | "1gyda8sq6b379nx01hkpbd85lz39irdvz2b9wbr63gicicx8i706")))) |
396b3c8b | 118 | (build-system gnu-build-system) |
a7ecc92d MR |
119 | ;; Flex is needed both at build and run time. |
120 | (inputs `(("gnumach-headers" ,gnumach-headers) | |
121 | ("flex" ,flex))) | |
396b3c8b MR |
122 | (native-inputs |
123 | `(("flex" ,flex) | |
124 | ("bison" ,bison))) | |
125 | (arguments `(#:tests? #f)) | |
6fd52309 | 126 | (home-page "https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html") |
396b3c8b MR |
127 | (synopsis "Mach 3.0 interface generator for the Hurd") |
128 | (description | |
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, | |
35b9e423 | 132 | and to compile the GNU C library for the Hurd. Also, you will need it |
396b3c8b MR |
133 | for other software in the GNU system that uses Mach-based inter-process |
134 | communication.") | |
135 | (license gpl2+))) | |
dc91c10f MR |
136 | |
137 | (define-public hurd-headers | |
2d546858 LC |
138 | ;; Resort to a post-0.9 snapshot that provides the 'file_utimens' and |
139 | ;; 'file_exec_paths' RPCs that glibc 2.28 expects. | |
f379c665 MB |
140 | (let ((revision "1") |
141 | (commit "91a51672ff4cfe1f1a0712b4c542ded3081c825b")) | |
2d546858 LC |
142 | (package |
143 | (name "hurd-headers") | |
f379c665 | 144 | (version (git-version "0.9" revision commit)) |
2d546858 LC |
145 | (source (origin |
146 | (method git-fetch) | |
147 | (uri (git-reference | |
148 | (url "https://git.savannah.gnu.org/git/hurd/hurd.git") | |
149 | (commit commit))) | |
150 | (sha256 | |
151 | (base32 | |
f379c665 | 152 | "16k9wkahz9wasviijz53n6i13nmiwa9fs64ikf1jqh8rl60hw7cz")) |
2d546858 LC |
153 | (file-name (git-file-name name version)))) |
154 | (build-system gnu-build-system) | |
155 | (native-inputs | |
156 | `(("mig" ,mig) | |
157 | ("autoconf" ,autoconf) | |
158 | ("automake" ,automake))) | |
159 | (arguments | |
160 | `(#:phases | |
161 | (modify-phases %standard-phases | |
162 | (replace 'install | |
163 | (lambda _ | |
164 | (invoke "make" "install-headers" "no_deps=t"))) | |
165 | (delete 'build)) | |
dc91c10f | 166 | |
2d546858 LC |
167 | #:configure-flags '( ;; Pretend we're on GNU/Hurd; 'configure' wants |
168 | ;; that. | |
169 | ,@(if (%current-target-system) | |
170 | '() | |
171 | '("--host=i586-pc-gnu")) | |
172 | ||
173 | ;; Reduce set of dependencies. | |
174 | "--without-parted" | |
175 | "--disable-ncursesw" | |
176 | "--disable-test" | |
177 | "--without-libbz2" | |
f379c665 | 178 | "--without-libcrypt" |
2d546858 LC |
179 | "--without-libz" |
180 | ;; Skip the clnt_create check because it expects | |
181 | ;; a working glibc causing a circular dependency. | |
182 | "ac_cv_search_clnt_create=no" | |
183 | ||
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") | |
191 | ||
192 | #:tests? #f)) | |
193 | (home-page "https://www.gnu.org/software/hurd/hurd.html") | |
194 | (synopsis "GNU Hurd headers") | |
195 | (description | |
196 | "This package provides C headers of the GNU Hurd, used to build the GNU C | |
dc91c10f | 197 | Library and other user programs.") |
2d546858 | 198 | (license gpl2+)))) |
21a8fe1b MR |
199 | |
200 | (define-public hurd-minimal | |
201 | (package (inherit hurd-headers) | |
202 | (name "hurd-minimal") | |
203 | (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers))) | |
21a8fe1b | 204 | (arguments |
e1ecd50e MR |
205 | (substitute-keyword-arguments (package-arguments hurd-headers) |
206 | ((#:phases _) | |
dc1d3cde KK |
207 | '(modify-phases %standard-phases |
208 | (replace 'install | |
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")) | |
219 | #t))) | |
220 | (replace 'build | |
221 | (lambda _ | |
2d546858 LC |
222 | ;; Install <assert-backtrace.h> & co. |
223 | (invoke "make" "-Clibshouldbeinlibc" | |
224 | "../include/assert-backtrace.h") | |
225 | ||
226 | ;; Build libihash. | |
a48d22d6 | 227 | (invoke "make" "-Clibihash" "libihash.a"))))))) |
6fd52309 | 228 | (home-page "https://www.gnu.org/software/hurd/hurd.html") |
21a8fe1b MR |
229 | (synopsis "GNU Hurd libraries") |
230 | (description | |
a124bbd2 | 231 | "This package provides libihash, needed to build the GNU C |
21a8fe1b MR |
232 | Library for GNU/Hurd.") |
233 | (license gpl2+))) | |
38efbcbb MR |
234 | |
235 | (define-public hurd-core-headers | |
236 | (package | |
237 | (name "hurd-core-headers") | |
238 | (version (package-version hurd-headers)) | |
239 | (source #f) | |
240 | (build-system trivial-build-system) | |
241 | (arguments | |
242 | '(#:modules ((guix build union)) | |
243 | #:builder (begin | |
244 | (use-modules (ice-9 match) | |
245 | (guix build union)) | |
246 | (match %build-inputs | |
247 | (((names . directories) ...) | |
248 | (union-build (assoc-ref %outputs "out") | |
e3cfef22 MW |
249 | directories) |
250 | #t))))) | |
38efbcbb MR |
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") | |
255 | (description | |
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)))) | |
8df672aa MR |
260 | |
261 | (define-public gnumach | |
262 | (package | |
fb9d6f0f | 263 | (inherit gnumach-headers) |
8df672aa | 264 | (name "gnumach") |
8df672aa | 265 | (arguments |
e62f6f77 | 266 | (substitute-keyword-arguments (package-arguments gnumach-headers) |
29814639 LC |
267 | ((#:configure-flags flags ''()) |
268 | `(cons "--enable-kdb" ,flags)) ;enable kernel debugger | |
e62f6f77 LC |
269 | ((#:phases phases '%standard-phases) |
270 | `(modify-phases %standard-phases | |
271 | (add-after 'install 'produce-image | |
272 | (lambda* (#:key outputs #:allow-other-keys) | |
273 | (let* ((out (assoc-ref outputs "out")) | |
274 | (boot (string-append out "/boot"))) | |
275 | (invoke "make" "gnumach.gz") | |
276 | (install-file "gnumach.gz" boot) | |
277 | #t))))))) | |
8df672aa MR |
278 | (native-inputs |
279 | `(("mig" ,mig) | |
e62f6f77 LC |
280 | ("perl" ,perl) |
281 | ("autoconf" ,autoconf) | |
282 | ("automake" ,automake) | |
283 | ("texinfo" ,texinfo-4))) | |
8df672aa | 284 | (supported-systems (cons "i686-linux" %hurd-systems)) |
8df672aa MR |
285 | (synopsis "Microkernel of the GNU system") |
286 | (description | |
fb9d6f0f | 287 | "GNU Mach is the microkernel upon which a GNU Hurd system is based."))) |
cc4faa35 MR |
288 | |
289 | (define-public hurd | |
290 | (package | |
291 | (name "hurd") | |
496d607d JN |
292 | (version (package-version hurd-headers)) |
293 | (source (origin (inherit (package-source hurd-headers)) | |
294 | (patches (search-patches "hurd-cross.patch")))) | |
cc4faa35 MR |
295 | (arguments |
296 | `(#:phases | |
297 | (modify-phases %standard-phases | |
298 | (add-before 'build 'pre-build | |
299 | (lambda _ | |
300 | ;; Don't change the ownership of any file at this time. | |
301 | (substitute* '("daemons/Makefile" "utils/Makefile") | |
302 | (("-o root -m 4755") "")) | |
303 | #t))) | |
304 | #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath=" | |
305 | %output "/lib") | |
306 | "--disable-ncursesw" | |
307 | "--without-libbz2" | |
308 | "--without-libz" | |
309 | "--without-parted"))) | |
310 | (build-system gnu-build-system) | |
311 | (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers))) | |
312 | (native-inputs | |
496d607d JN |
313 | `(("autoconf" ,autoconf) |
314 | ("automake" ,automake) | |
315 | ("mig" ,mig) | |
316 | ("perl" ,perl) | |
317 | ("texinfo" ,texinfo-4))) | |
cc4faa35 MR |
318 | (supported-systems %hurd-systems) |
319 | (home-page "https://www.gnu.org/software/hurd/hurd.html") | |
320 | (synopsis "The kernel servers for the GNU operating system") | |
321 | (description | |
322 | "The Hurd is the kernel for the GNU system, a replacement and | |
323 | augmentation of standard Unix kernels. It is a collection of protocols for | |
324 | system interaction (file systems, networks, authentication), and servers | |
325 | implementing them.") | |
326 | (license gpl2+))) |