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