| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.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 base) |
| 21 | #:use-module ((guix licenses) |
| 22 | #:select (gpl3+ lgpl2.0+ public-domain)) |
| 23 | #:use-module (gnu packages) |
| 24 | #:use-module (gnu packages acl) |
| 25 | #:use-module (gnu packages bash) |
| 26 | #:use-module (gnu packages bootstrap) |
| 27 | #:use-module (gnu packages compression) |
| 28 | #:use-module (gnu packages gcc) |
| 29 | #:use-module (gnu packages gawk) |
| 30 | #:use-module (gnu packages guile) |
| 31 | #:use-module (gnu packages multiprecision) |
| 32 | #:use-module (gnu packages perl) |
| 33 | #:use-module (gnu packages linux) |
| 34 | #:use-module (guix packages) |
| 35 | #:use-module (guix download) |
| 36 | #:use-module (guix build-system gnu) |
| 37 | #:use-module (guix build-system trivial) |
| 38 | #:use-module (guix utils) |
| 39 | #:use-module (srfi srfi-1) |
| 40 | #:use-module (srfi srfi-26) |
| 41 | #:use-module (ice-9 match)) |
| 42 | |
| 43 | ;;; Commentary: |
| 44 | ;;; |
| 45 | ;;; Base packages of the Guix-based GNU user-land software distribution. |
| 46 | ;;; |
| 47 | ;;; Code: |
| 48 | |
| 49 | (define-public hello |
| 50 | (package |
| 51 | (name "hello") |
| 52 | (version "2.8") |
| 53 | (source (origin |
| 54 | (method url-fetch) |
| 55 | (uri (string-append "mirror://gnu/hello/hello-" version |
| 56 | ".tar.gz")) |
| 57 | (sha256 |
| 58 | (base32 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6")))) |
| 59 | (build-system gnu-build-system) |
| 60 | (arguments '(#:configure-flags |
| 61 | `("--disable-dependency-tracking" |
| 62 | ,(string-append "--with-gawk=" ; for illustration purposes |
| 63 | (assoc-ref %build-inputs "gawk"))))) |
| 64 | (inputs `(("gawk" ,gawk))) |
| 65 | (synopsis "Hello, GNU world: An example GNU package") |
| 66 | (description "Yeah...") |
| 67 | (home-page "http://www.gnu.org/software/hello/") |
| 68 | (license gpl3+))) |
| 69 | |
| 70 | (define-public grep |
| 71 | (package |
| 72 | (name "grep") |
| 73 | (version "2.14") |
| 74 | (source (origin |
| 75 | (method url-fetch) |
| 76 | (uri (string-append "mirror://gnu/grep/grep-" |
| 77 | version ".tar.xz")) |
| 78 | (sha256 |
| 79 | (base32 |
| 80 | "1qbjb1l7f9blckc5pqy8jlf6482hpx4awn2acmhyf5mv9wfq03p7")))) |
| 81 | (build-system gnu-build-system) |
| 82 | (synopsis "Print lines matching a pattern") |
| 83 | (description |
| 84 | "The grep command searches one or more input files for lines containing a |
| 85 | match to a specified pattern. By default, grep prints the matching |
| 86 | lines.") |
| 87 | (license gpl3+) |
| 88 | (home-page "http://www.gnu.org/software/grep/"))) |
| 89 | |
| 90 | (define-public sed |
| 91 | (package |
| 92 | (name "sed") |
| 93 | (version "4.2.2") |
| 94 | (source (origin |
| 95 | (method url-fetch) |
| 96 | (uri (string-append "mirror://gnu/sed/sed-" version |
| 97 | ".tar.bz2")) |
| 98 | (sha256 |
| 99 | (base32 |
| 100 | "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h")))) |
| 101 | (build-system gnu-build-system) |
| 102 | (synopsis "Stream editor") |
| 103 | (arguments |
| 104 | (if (%current-target-system) |
| 105 | '() |
| 106 | `(#:phases (alist-cons-before |
| 107 | 'patch-source-shebangs 'patch-test-suite |
| 108 | (lambda* (#:key inputs #:allow-other-keys) |
| 109 | (let ((bash (assoc-ref inputs "bash"))) |
| 110 | (patch-makefile-SHELL "testsuite/Makefile.tests") |
| 111 | (substitute* '("testsuite/bsd.sh" |
| 112 | "testsuite/bug-regex9.c") |
| 113 | (("/bin/sh") |
| 114 | (string-append bash "/bin/bash"))))) |
| 115 | %standard-phases)))) |
| 116 | (description |
| 117 | "Sed (stream editor) isn't really a true text editor or text processor. |
| 118 | Instead, it is used to filter text, i.e., it takes text input and performs |
| 119 | some operation (or set of operations) on it and outputs the modified text. |
| 120 | Sed is typically used for extracting part of a file using pattern matching or |
| 121 | substituting multiple occurrences of a string within a file.") |
| 122 | (license gpl3+) |
| 123 | (home-page "http://www.gnu.org/software/sed/"))) |
| 124 | |
| 125 | (define-public tar |
| 126 | (package |
| 127 | (name "tar") |
| 128 | (version "1.26") |
| 129 | (source (origin |
| 130 | (method url-fetch) |
| 131 | (uri (string-append "mirror://gnu/tar/tar-" |
| 132 | version ".tar.bz2")) |
| 133 | (sha256 |
| 134 | (base32 |
| 135 | "0hbdkzmchq9ycr2x1pxqdcgdbaxksh8c6ac0jf75jajhcks6jlss")))) |
| 136 | (build-system gnu-build-system) |
| 137 | (inputs `(("patch/gets" ,(search-patch "tar-gets-undeclared.patch")))) |
| 138 | (arguments |
| 139 | `(#:patches (list (assoc-ref %build-inputs "patch/gets")))) |
| 140 | (synopsis "Managing tar archives") |
| 141 | (description |
| 142 | "The Tar program provides the ability to create tar archives, as well as |
| 143 | various other kinds of manipulation. For example, you can use Tar on |
| 144 | previously created archives to extract files, to store additional files, or |
| 145 | to update or list files which were already stored. |
| 146 | |
| 147 | Initially, tar archives were used to store files conveniently on magnetic |
| 148 | tape. The name \"Tar\" comes from this use; it stands for tape archiver. |
| 149 | Despite the utility's name, Tar can direct its output to available devices, |
| 150 | files, or other programs (using pipes), it can even access remote devices or |
| 151 | files (as archives).") |
| 152 | (license gpl3+) |
| 153 | (home-page "http://www.gnu.org/software/tar/"))) |
| 154 | |
| 155 | (define-public patch |
| 156 | (package |
| 157 | (name "patch") |
| 158 | (version "2.7.1") |
| 159 | (source (origin |
| 160 | (method url-fetch) |
| 161 | (uri (string-append "mirror://gnu/patch/patch-" |
| 162 | version ".tar.xz")) |
| 163 | (sha256 |
| 164 | (base32 |
| 165 | "1sqckf560pzwgniy00vcpdv2c9c11s4cmhlm14yqgg8avd3bl94i")))) |
| 166 | (build-system gnu-build-system) |
| 167 | (native-inputs '()) ; FIXME: needs `ed' for the tests |
| 168 | (arguments |
| 169 | '(#:tests? #f) |
| 170 | ;; TODO: When cross-compiling, add this: |
| 171 | ;; '(#:configure-flags '("ac_cv_func_strnlen_working=yes")) |
| 172 | ) |
| 173 | (synopsis "Apply differences to originals, with optional backups") |
| 174 | (description |
| 175 | "GNU Patch takes a patch file containing a difference listing produced by |
| 176 | the diff program and applies those differences to one or more original files, |
| 177 | producing patched versions.") |
| 178 | (license gpl3+) |
| 179 | (home-page "http://savannah.gnu.org/projects/patch/"))) |
| 180 | |
| 181 | (define-public diffutils |
| 182 | (package |
| 183 | (name "diffutils") |
| 184 | (version "3.3") |
| 185 | (source (origin |
| 186 | (method url-fetch) |
| 187 | (uri (string-append "mirror://gnu/diffutils/diffutils-" |
| 188 | version ".tar.xz")) |
| 189 | (sha256 |
| 190 | (base32 |
| 191 | "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2")))) |
| 192 | (build-system gnu-build-system) |
| 193 | (synopsis "Comparing and merging files") |
| 194 | (description |
| 195 | "GNU Diffutils is a package of several programs related to finding |
| 196 | differences between files. |
| 197 | |
| 198 | Computer users often find occasion to ask how two files differ. Perhaps one |
| 199 | file is a newer version of the other file. Or maybe the two files started out |
| 200 | as identical copies but were changed by different people. |
| 201 | |
| 202 | You can use the diff command to show differences between two files, or each |
| 203 | corresponding file in two directories. diff outputs differences between files |
| 204 | line by line in any of several formats, selectable by command line |
| 205 | options. This set of differences is often called a ‘diff’ or ‘patch’. For |
| 206 | files that are identical, diff normally produces no output; for |
| 207 | binary (non-text) files, diff normally reports only that they are different. |
| 208 | |
| 209 | You can use the cmp command to show the offsets and line numbers where two |
| 210 | files differ. cmp can also show all the characters that differ between the |
| 211 | two files, side by side. |
| 212 | |
| 213 | You can use the diff3 command to show differences among three files. When two |
| 214 | people have made independent changes to a common original, diff3 can report |
| 215 | the differences between the original and the two changed versions, and can |
| 216 | produce a merged file that contains both persons' changes together with |
| 217 | warnings about conflicts. |
| 218 | |
| 219 | You can use the sdiff command to merge two files interactively.") |
| 220 | (license gpl3+) |
| 221 | (home-page "http://www.gnu.org/software/diffutils/"))) |
| 222 | |
| 223 | (define-public findutils |
| 224 | (package |
| 225 | (name "findutils") |
| 226 | (version "4.4.2") |
| 227 | (source (origin |
| 228 | (method url-fetch) |
| 229 | (uri (string-append "mirror://gnu/findutils/findutils-" |
| 230 | version ".tar.gz")) |
| 231 | (sha256 |
| 232 | (base32 |
| 233 | "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3")))) |
| 234 | (build-system gnu-build-system) |
| 235 | (native-inputs |
| 236 | `(("patch/absolute-paths" |
| 237 | ,(search-patch "findutils-absolute-paths.patch")))) |
| 238 | (arguments |
| 239 | `(#:patches (list (assoc-ref %build-inputs "patch/absolute-paths")) |
| 240 | |
| 241 | ;; Work around cross-compilation failure. |
| 242 | ;; See <http://savannah.gnu.org/bugs/?27299#comment1>. |
| 243 | ,@(if (%current-target-system) |
| 244 | '(#:configure-flags '("gl_cv_func_wcwidth_works=yes")) |
| 245 | '()))) |
| 246 | (synopsis "Operating on files matching given criteria") |
| 247 | (description |
| 248 | "The GNU Find Utilities are the basic directory searching utilities of |
| 249 | the GNU operating system. These programs are typically used in conjunction |
| 250 | with other programs to provide modular and powerful directory search and file |
| 251 | locating capabilities to other commands. |
| 252 | |
| 253 | The tools supplied with this package are: |
| 254 | |
| 255 | * find - search for files in a directory hierarchy; |
| 256 | * locate - list files in databases that match a pattern; |
| 257 | * updatedb - update a file name database; |
| 258 | * xargs - build and execute command lines from standard input. |
| 259 | ") |
| 260 | (license gpl3+) |
| 261 | (home-page "http://www.gnu.org/software/findutils/"))) |
| 262 | |
| 263 | (define-public coreutils |
| 264 | (package |
| 265 | (name "coreutils") |
| 266 | (version "8.21") |
| 267 | (source (origin |
| 268 | (method url-fetch) |
| 269 | (uri (string-append "mirror://gnu/coreutils/coreutils-" |
| 270 | version ".tar.xz")) |
| 271 | (sha256 |
| 272 | (base32 |
| 273 | "064f512185iysqqcvhnhaf3bfmzrvcgs7n405qsyp99zmfyl9amd")))) |
| 274 | (build-system gnu-build-system) |
| 275 | (inputs `(("acl" ,acl) ; TODO: add SELinux |
| 276 | ("gmp" ,gmp) |
| 277 | |
| 278 | ;; Perl is needed to run tests; remove it from cross builds. |
| 279 | ,@(if (%current-target-system) |
| 280 | '() |
| 281 | `(("perl" ,perl))))) |
| 282 | (outputs '("out" "debug")) |
| 283 | (arguments |
| 284 | `(#:parallel-build? #f ; help2man may be called too early |
| 285 | #:phases (alist-cons-before |
| 286 | 'build 'patch-shell-references |
| 287 | (lambda* (#:key inputs #:allow-other-keys) |
| 288 | (let ((bash (assoc-ref inputs "bash"))) |
| 289 | (substitute* (cons "src/split.c" |
| 290 | (find-files "gnulib-tests" |
| 291 | "\\.c$")) |
| 292 | (("/bin/sh") |
| 293 | (format #f "~a/bin/sh" bash))) |
| 294 | (substitute* (find-files "tests" "\\.sh$") |
| 295 | (("#!/bin/sh") |
| 296 | (format #f "#!~a/bin/bash" bash))))) |
| 297 | %standard-phases))) |
| 298 | (synopsis "Core GNU utilities (file, text, shell)") |
| 299 | (description |
| 300 | "The GNU Core Utilities are the basic file, shell and text manipulation |
| 301 | utilities of the GNU operating system. These are the core utilities which |
| 302 | are expected to exist on every operating system.") |
| 303 | (license gpl3+) |
| 304 | (home-page "http://www.gnu.org/software/coreutils/"))) |
| 305 | |
| 306 | (define-public gnu-make |
| 307 | (package |
| 308 | (name "make") |
| 309 | (version "3.82") |
| 310 | (source (origin |
| 311 | (method url-fetch) |
| 312 | (uri (string-append "mirror://gnu/make/make-" version |
| 313 | ".tar.bz2")) |
| 314 | (sha256 |
| 315 | (base32 |
| 316 | "0ri98385hsd7li6rh4l5afcq92v8l2lgiaz85wgcfh4w2wzsghg2")))) |
| 317 | (build-system gnu-build-system) |
| 318 | (native-inputs |
| 319 | `(("patch/impure-dirs" ,(search-patch "make-impure-dirs.patch")))) |
| 320 | (outputs '("out" "debug")) |
| 321 | (arguments |
| 322 | '(#:patches (list (assoc-ref %build-inputs "patch/impure-dirs")) |
| 323 | #:phases (alist-cons-before |
| 324 | 'build 'set-default-shell |
| 325 | (lambda* (#:key inputs #:allow-other-keys) |
| 326 | ;; Change the default shell from /bin/sh. |
| 327 | (let ((bash (assoc-ref inputs "bash"))) |
| 328 | (substitute* "job.c" |
| 329 | (("default_shell\\[\\] =.*$") |
| 330 | (format #f "default_shell[] = \"~a/bin/bash\";\n" |
| 331 | bash))))) |
| 332 | %standard-phases))) |
| 333 | (synopsis "Remake files automatically") |
| 334 | (description |
| 335 | "Make is a tool which controls the generation of executables and other |
| 336 | non-source files of a program from the program's source files. |
| 337 | |
| 338 | Make gets its knowledge of how to build your program from a file called the |
| 339 | makefile, which lists each of the non-source files and how to compute it from |
| 340 | other files. When you write a program, you should write a makefile for it, so |
| 341 | that it is possible to use Make to build and install the program.") |
| 342 | (license gpl3+) |
| 343 | (home-page "http://www.gnu.org/software/make/"))) |
| 344 | |
| 345 | (define-public binutils |
| 346 | (package |
| 347 | (name "binutils") |
| 348 | (version "2.23.2") |
| 349 | (source (origin |
| 350 | (method url-fetch) |
| 351 | (uri (string-append "mirror://gnu/binutils/binutils-" |
| 352 | version ".tar.bz2")) |
| 353 | (sha256 |
| 354 | (base32 |
| 355 | "15qhbkz3r266xaa52slh857qn3abw7rb2x2jnhpfrafpzrb4x4gy")))) |
| 356 | (build-system gnu-build-system) |
| 357 | |
| 358 | ;; Split Binutils in several outputs, mostly to avoid collisions in |
| 359 | ;; user profiles with GCC---e.g., libiberty.a. |
| 360 | (outputs '("out" ; ar, ld, binutils.info, etc. |
| 361 | "lib")) ; libbfd.a, bfd.h, etc. |
| 362 | |
| 363 | ;; TODO: Add dependency on zlib + those for Gold. |
| 364 | (native-inputs |
| 365 | `(("patch/new-dtags" ,(search-patch "binutils-ld-new-dtags.patch")))) |
| 366 | (arguments |
| 367 | `(#:patches (list (assoc-ref %build-inputs "patch/new-dtags")) |
| 368 | #:configure-flags '(;; Add `-static-libgcc' to not retain a dependency |
| 369 | ;; on GCC when bootstrapping. |
| 370 | "LDFLAGS=-static-libgcc" |
| 371 | |
| 372 | ;; Don't search under /usr/lib & co. |
| 373 | "--with-lib-path=/no-ld-lib-path" |
| 374 | |
| 375 | ;; Glibc 2.17 has a "comparison of unsigned |
| 376 | ;; expression >= 0 is always true" in wchar.h. |
| 377 | "--disable-werror"))) |
| 378 | |
| 379 | (synopsis "Binary utilities: bfd gas gprof ld") |
| 380 | (description |
| 381 | "The GNU Binutils are a collection of binary tools. The main ones are |
| 382 | `ld' (the GNU linker) and `as' (the GNU assembler). They also include the |
| 383 | BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.") |
| 384 | (license gpl3+) |
| 385 | (home-page "http://www.gnu.org/software/binutils/"))) |
| 386 | |
| 387 | (define-public glibc |
| 388 | (package |
| 389 | (name "glibc") |
| 390 | (version "2.17") |
| 391 | (source (origin |
| 392 | (method url-fetch) |
| 393 | (uri (string-append "mirror://gnu/glibc/glibc-" |
| 394 | version ".tar.xz")) |
| 395 | (sha256 |
| 396 | (base32 |
| 397 | "0gmjnn4kma9vgizccw1jv979xw55a8n1nkk94gg0l3hy80vy6539")))) |
| 398 | (build-system gnu-build-system) |
| 399 | |
| 400 | ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc |
| 401 | ;; users should automatically pull Linux headers as well. |
| 402 | (propagated-inputs `(("linux-headers" ,linux-libre-headers))) |
| 403 | |
| 404 | ;; Store the locales separately (~100 MiB). Note that "out" retains a |
| 405 | ;; reference to them anyway, so there's no space savings here. |
| 406 | ;; TODO: Eventually we may want to add a $LOCALE_ARCHIVE search path like |
| 407 | ;; Nixpkgs does. |
| 408 | (outputs '("out" "locales" "debug")) |
| 409 | |
| 410 | (arguments |
| 411 | `(#:out-of-source? #t |
| 412 | #:patches (list (assoc-ref %build-inputs "patch/ld.so.cache")) |
| 413 | #:configure-flags |
| 414 | (list "--enable-add-ons" |
| 415 | "--sysconfdir=/etc" |
| 416 | (string-append "--localedir=" (assoc-ref %outputs "locales") |
| 417 | "/share/locale") |
| 418 | |
| 419 | ;; `--localedir' is not honored, so work around it. |
| 420 | ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>. |
| 421 | (string-append "libc_cv_localedir=" |
| 422 | (assoc-ref %outputs "locales") |
| 423 | "/share/locale") |
| 424 | |
| 425 | |
| 426 | (string-append "--with-headers=" |
| 427 | (assoc-ref %build-inputs "linux-headers") |
| 428 | "/include") |
| 429 | |
| 430 | ;; The default is to assume a 2.4 Linux interface, but we'll |
| 431 | ;; always use something newer. See "kernel-features.h" in the |
| 432 | ;; GNU libc for details. |
| 433 | "--enable-kernel=2.6.30" |
| 434 | |
| 435 | ;; Use our Bash instead of /bin/sh. |
| 436 | (string-append "BASH_SHELL=" |
| 437 | (assoc-ref %build-inputs "bash") |
| 438 | "/bin/bash") |
| 439 | |
| 440 | ;; XXX: Work around "undefined reference to `__stack_chk_guard'". |
| 441 | "libc_cv_ssp=no") |
| 442 | |
| 443 | #:tests? #f ; XXX |
| 444 | #:phases (alist-cons-before |
| 445 | 'configure 'pre-configure |
| 446 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 447 | (let* ((out (assoc-ref outputs "out")) |
| 448 | (bin (string-append out "/bin"))) |
| 449 | ;; Use `pwd', not `/bin/pwd'. |
| 450 | (substitute* "configure" |
| 451 | (("/bin/pwd") "pwd")) |
| 452 | |
| 453 | ;; Install the rpc data base file under `$out/etc/rpc'. |
| 454 | ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ]; |
| 455 | (substitute* "sunrpc/Makefile" |
| 456 | (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix) |
| 457 | (string-append out "/etc/rpc" suffix "\n")) |
| 458 | (("^install-others =.*$") |
| 459 | (string-append "install-others = " out "/etc/rpc\n"))) |
| 460 | |
| 461 | (substitute* "Makeconfig" |
| 462 | ;; According to |
| 463 | ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>, |
| 464 | ;; linking against libgcc_s is not needed with GCC |
| 465 | ;; 4.7.1. |
| 466 | ((" -lgcc_s") "")) |
| 467 | |
| 468 | ;; Copy a statically-linked Bash in the output, with |
| 469 | ;; no references to other store paths. |
| 470 | (mkdir-p bin) |
| 471 | (copy-file (string-append (assoc-ref inputs "static-bash") |
| 472 | "/bin/bash") |
| 473 | (string-append bin "/bash")) |
| 474 | (remove-store-references (string-append bin "/bash")) |
| 475 | (chmod (string-append bin "/bash") #o555) |
| 476 | |
| 477 | ;; Keep a symlink, for `patch-shebang' resolution. |
| 478 | (with-directory-excursion bin |
| 479 | (symlink "bash" "sh")) |
| 480 | |
| 481 | ;; Have `system' use that Bash. |
| 482 | (substitute* "sysdeps/posix/system.c" |
| 483 | (("#define[[:blank:]]+SHELL_PATH.*$") |
| 484 | (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" |
| 485 | out))) |
| 486 | |
| 487 | ;; Same for `popen'. |
| 488 | (substitute* "libio/iopopen.c" |
| 489 | (("/bin/sh") |
| 490 | (string-append out "/bin/bash"))))) |
| 491 | (alist-cons-after |
| 492 | 'install 'install-locales |
| 493 | (lambda _ |
| 494 | (zero? (system* "make" "localedata/install-locales"))) |
| 495 | %standard-phases)))) |
| 496 | |
| 497 | (inputs `(("patch/ld.so.cache" |
| 498 | ,(search-patch "glibc-no-ld-so-cache.patch")) |
| 499 | ("static-bash" ,(static-package bash-light)))) |
| 500 | (synopsis "The GNU C Library") |
| 501 | (description |
| 502 | "Any Unix-like operating system needs a C library: the library which |
| 503 | defines the \"system calls\" and other basic facilities such as open, malloc, |
| 504 | printf, exit... |
| 505 | |
| 506 | The GNU C library is used as the C library in the GNU system and most systems |
| 507 | with the Linux kernel.") |
| 508 | (license lgpl2.0+) |
| 509 | (home-page "http://www.gnu.org/software/libc/"))) |
| 510 | |
| 511 | (define-public tzdata |
| 512 | (package |
| 513 | (name "tzdata") |
| 514 | (version "2013d") |
| 515 | (source (origin |
| 516 | (method url-fetch) |
| 517 | (uri (string-append |
| 518 | "http://www.iana.org/time-zones/repository/releases/tzdata" |
| 519 | version ".tar.gz")) |
| 520 | (sha256 |
| 521 | (base32 |
| 522 | "011v63ppr73vhjgxv00inkn5pc7z48i8lhbapkpdq3kfczq9c76d")))) |
| 523 | (build-system gnu-build-system) |
| 524 | (arguments |
| 525 | '(#:tests? #f |
| 526 | #:make-flags (let ((out (assoc-ref %outputs "out")) |
| 527 | (tmp (getenv "TMPDIR"))) |
| 528 | (list (string-append "TOPDIR=" out) |
| 529 | (string-append "TZDIR=" out "/share/zoneinfo") |
| 530 | |
| 531 | ;; Discard zic, dump, and tzselect, already |
| 532 | ;; provided by glibc. |
| 533 | (string-append "ETCDIR=" tmp "/etc") |
| 534 | |
| 535 | ;; Likewise for the C library routines. |
| 536 | (string-append "LIBDIR=" tmp "/lib") |
| 537 | (string-append "MANDIR=" tmp "/man") |
| 538 | |
| 539 | "AWK=awk" |
| 540 | "CC=gcc")) |
| 541 | #:modules ((guix build utils) |
| 542 | (guix build gnu-build-system) |
| 543 | (srfi srfi-1)) |
| 544 | #:phases |
| 545 | (alist-replace |
| 546 | 'unpack |
| 547 | (lambda* (#:key inputs #:allow-other-keys) |
| 548 | (and (zero? (system* "tar" "xvf" (assoc-ref inputs "source"))) |
| 549 | (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode"))))) |
| 550 | (alist-cons-after |
| 551 | 'install 'post-install |
| 552 | (lambda* (#:key outputs #:allow-other-keys) |
| 553 | ;; Move data in the right place. |
| 554 | (let ((out (assoc-ref outputs "out"))) |
| 555 | (copy-recursively (string-append out "/share/zoneinfo-posix") |
| 556 | (string-append out "/share/zoneinfo/posix")) |
| 557 | (copy-recursively (string-append out "/share/zoneinfo-leaps") |
| 558 | (string-append out "/share/zoneinfo/right")) |
| 559 | (delete-file-recursively (string-append out "/share/zoneinfo-posix")) |
| 560 | (delete-file-recursively (string-append out "/share/zoneinfo-leaps")))) |
| 561 | (alist-delete 'configure %standard-phases))))) |
| 562 | (inputs `(("tzcode" ,(origin |
| 563 | (method url-fetch) |
| 564 | (uri (string-append |
| 565 | "http://www.iana.org/time-zones/repository/releases/tzcode" |
| 566 | version ".tar.gz")) |
| 567 | (sha256 |
| 568 | (base32 |
| 569 | "13xd30ngwhqmj7w216ghd5knvg047hzpc0xca5l297g5cwb62hza")))))) |
| 570 | (home-page "http://www.iana.org/time-zones") |
| 571 | (synopsis "Database of current and historical time zones") |
| 572 | (description "The Time Zone Database (often called tz or zoneinfo) |
| 573 | contains code and data that represent the history of local time for many |
| 574 | representative locations around the globe. It is updated periodically to |
| 575 | reflect changes made by political bodies to time zone boundaries, UTC offsets, |
| 576 | and daylight-saving rules.") |
| 577 | (license public-domain))) |
| 578 | |
| 579 | \f |
| 580 | ;;; |
| 581 | ;;; Bootstrap packages. |
| 582 | ;;; |
| 583 | |
| 584 | (define gnu-make-boot0 |
| 585 | (package-with-bootstrap-guile |
| 586 | (package (inherit gnu-make) |
| 587 | (name "make-boot0") |
| 588 | (location (source-properties->location (current-source-location))) |
| 589 | (arguments |
| 590 | `(#:guile ,%bootstrap-guile |
| 591 | #:implicit-inputs? #f |
| 592 | #:tests? #f ; cannot run "make check" |
| 593 | ,@(substitute-keyword-arguments (package-arguments gnu-make) |
| 594 | ((#:phases phases) |
| 595 | `(alist-replace |
| 596 | 'build (lambda _ |
| 597 | (zero? (system* "./build.sh"))) |
| 598 | (alist-replace |
| 599 | 'install (lambda* (#:key outputs #:allow-other-keys) |
| 600 | (let* ((out (assoc-ref outputs "out")) |
| 601 | (bin (string-append out "/bin"))) |
| 602 | (mkdir-p bin) |
| 603 | (copy-file "make" |
| 604 | (string-append bin "/make")))) |
| 605 | ,phases)))))) |
| 606 | (inputs %bootstrap-inputs)))) |
| 607 | |
| 608 | (define diffutils-boot0 |
| 609 | (package-with-bootstrap-guile |
| 610 | (let ((p (package-with-explicit-inputs diffutils |
| 611 | `(("make" ,gnu-make-boot0) |
| 612 | ,@%bootstrap-inputs) |
| 613 | #:guile %bootstrap-guile))) |
| 614 | (package (inherit p) |
| 615 | (location (source-properties->location (current-source-location))) |
| 616 | (arguments `(#:tests? #f ; the test suite needs diffutils |
| 617 | ,@(package-arguments p))))))) |
| 618 | |
| 619 | (define findutils-boot0 |
| 620 | (package-with-bootstrap-guile |
| 621 | (package-with-explicit-inputs findutils |
| 622 | `(("make" ,gnu-make-boot0) |
| 623 | ("diffutils" ,diffutils-boot0) ; for tests |
| 624 | ,@%bootstrap-inputs) |
| 625 | (current-source-location) |
| 626 | #:guile %bootstrap-guile))) |
| 627 | |
| 628 | |
| 629 | (define %boot0-inputs |
| 630 | `(("make" ,gnu-make-boot0) |
| 631 | ("diffutils" ,diffutils-boot0) |
| 632 | ("findutils" ,findutils-boot0) |
| 633 | ,@%bootstrap-inputs)) |
| 634 | |
| 635 | (define* (nix-system->gnu-triplet |
| 636 | #:optional (system (%current-system)) (vendor "unknown")) |
| 637 | "Return an a guess of the GNU triplet corresponding to Nix system |
| 638 | identifier SYSTEM." |
| 639 | (let* ((dash (string-index system #\-)) |
| 640 | (arch (substring system 0 dash)) |
| 641 | (os (substring system (+ 1 dash)))) |
| 642 | (string-append arch |
| 643 | "-" vendor "-" |
| 644 | (if (string=? os "linux") |
| 645 | "linux-gnu" |
| 646 | os)))) |
| 647 | |
| 648 | (define* (boot-triplet #:optional (system (%current-system))) |
| 649 | ;; Return the triplet used to create the cross toolchain needed in the |
| 650 | ;; first bootstrapping stage. |
| 651 | (nix-system->gnu-triplet system "guix")) |
| 652 | |
| 653 | ;; Following Linux From Scratch, build a cross-toolchain in stage 0. That |
| 654 | ;; toolchain actually targets the same OS and arch, but it has the advantage |
| 655 | ;; of being independent of the libc and tools in %BOOTSTRAP-INPUTS, since |
| 656 | ;; GCC-BOOT0 (below) is built without any reference to the target libc. |
| 657 | |
| 658 | (define binutils-boot0 |
| 659 | (package-with-bootstrap-guile |
| 660 | (package (inherit binutils) |
| 661 | (name "binutils-cross-boot0") |
| 662 | (arguments |
| 663 | `(#:guile ,%bootstrap-guile |
| 664 | #:implicit-inputs? #f |
| 665 | ,@(substitute-keyword-arguments (package-arguments binutils) |
| 666 | ((#:configure-flags cf) |
| 667 | `(cons ,(string-append "--target=" (boot-triplet)) |
| 668 | ,cf))))) |
| 669 | (inputs %boot0-inputs)))) |
| 670 | |
| 671 | (define gcc-boot0 |
| 672 | (package-with-bootstrap-guile |
| 673 | (package (inherit gcc-4.7) |
| 674 | (name "gcc-cross-boot0") |
| 675 | (arguments |
| 676 | `(#:guile ,%bootstrap-guile |
| 677 | #:implicit-inputs? #f |
| 678 | #:modules ((guix build gnu-build-system) |
| 679 | (guix build utils) |
| 680 | (ice-9 regex) |
| 681 | (srfi srfi-1) |
| 682 | (srfi srfi-26)) |
| 683 | ,@(substitute-keyword-arguments (package-arguments gcc-4.7) |
| 684 | ((#:configure-flags flags) |
| 685 | `(append (list ,(string-append "--target=" (boot-triplet)) |
| 686 | |
| 687 | ;; No libc yet. |
| 688 | "--without-headers" |
| 689 | |
| 690 | ;; Disable features not needed at this stage. |
| 691 | "--disable-shared" |
| 692 | "--enable-languages=c" |
| 693 | "--disable-libmudflap" |
| 694 | "--disable-libgomp" |
| 695 | "--disable-libssp" |
| 696 | "--disable-libquadmath" |
| 697 | "--disable-decimal-float") |
| 698 | (remove (cut string-match "--enable-languages.*" <>) |
| 699 | ,flags))) |
| 700 | ((#:phases phases) |
| 701 | `(alist-cons-after |
| 702 | 'unpack 'unpack-gmp&co |
| 703 | (lambda* (#:key inputs #:allow-other-keys) |
| 704 | (let ((gmp (assoc-ref %build-inputs "gmp-source")) |
| 705 | (mpfr (assoc-ref %build-inputs "mpfr-source")) |
| 706 | (mpc (assoc-ref %build-inputs "mpc-source"))) |
| 707 | |
| 708 | ;; To reduce the set of pre-built bootstrap inputs, build |
| 709 | ;; GMP & co. from GCC. |
| 710 | (for-each (lambda (source) |
| 711 | (or (zero? (system* "tar" "xvf" source)) |
| 712 | (error "failed to unpack tarball" |
| 713 | source))) |
| 714 | (list gmp mpfr mpc)) |
| 715 | |
| 716 | ;; Create symlinks like `gmp' -> `gmp-5.0.5'. |
| 717 | ,@(map (lambda (lib) |
| 718 | `(symlink ,(package-full-name lib) |
| 719 | ,(package-name lib))) |
| 720 | (list gmp mpfr mpc)) |
| 721 | |
| 722 | ;; MPFR headers/lib are found under $(MPFR)/src, but |
| 723 | ;; `configure' wrongfully tells MPC too look under |
| 724 | ;; $(MPFR), so fix that. |
| 725 | (substitute* "configure" |
| 726 | (("extra_mpc_mpfr_configure_flags(.+)--with-mpfr-include=([^/]+)/mpfr(.*)--with-mpfr-lib=([^ ]+)/mpfr" |
| 727 | _ equals include middle lib) |
| 728 | (string-append "extra_mpc_mpfr_configure_flags" equals |
| 729 | "--with-mpfr-include=" include |
| 730 | "/mpfr/src" middle |
| 731 | "--with-mpfr-lib=" lib |
| 732 | "/mpfr/src")) |
| 733 | (("gmpinc='-I([^ ]+)/mpfr -I([^ ]+)/mpfr" _ a b) |
| 734 | (string-append "gmpinc='-I" a "/mpfr/src " |
| 735 | "-I" b "/mpfr/src")) |
| 736 | (("gmplibs='-L([^ ]+)/mpfr" _ a) |
| 737 | (string-append "gmplibs='-L" a "/mpfr/src"))))) |
| 738 | (alist-cons-after |
| 739 | 'install 'symlink-libgcc_eh |
| 740 | (lambda* (#:key outputs #:allow-other-keys) |
| 741 | (let ((out (assoc-ref outputs "out"))) |
| 742 | ;; Glibc wants to link against libgcc_eh, so provide |
| 743 | ;; it. |
| 744 | (with-directory-excursion |
| 745 | (string-append out "/lib/gcc/" |
| 746 | ,(boot-triplet) |
| 747 | "/" ,(package-version gcc-4.7)) |
| 748 | (symlink "libgcc.a" "libgcc_eh.a")))) |
| 749 | ,phases)))))) |
| 750 | |
| 751 | (inputs `(("gmp-source" ,(package-source gmp)) |
| 752 | ("mpfr-source" ,(package-source mpfr)) |
| 753 | ("mpc-source" ,(package-source mpc)) |
| 754 | ("binutils-cross" ,binutils-boot0) |
| 755 | |
| 756 | ;; Call it differently so that the builder can check whether |
| 757 | ;; the "libc" input is #f. |
| 758 | ("libc-native" ,@(assoc-ref %boot0-inputs "libc")) |
| 759 | ,@(alist-delete "libc" %boot0-inputs))) |
| 760 | |
| 761 | ;; No need for Texinfo at this stage. |
| 762 | (native-inputs (alist-delete "texinfo" |
| 763 | (package-native-inputs gcc-4.7)))))) |
| 764 | |
| 765 | (define linux-libre-headers-boot0 |
| 766 | (package-with-bootstrap-guile |
| 767 | (package (inherit linux-libre-headers) |
| 768 | (arguments `(#:guile ,%bootstrap-guile |
| 769 | #:implicit-inputs? #f |
| 770 | ,@(package-arguments linux-libre-headers))) |
| 771 | (native-inputs |
| 772 | (let ((perl (package-with-explicit-inputs perl |
| 773 | %boot0-inputs |
| 774 | (current-source-location) |
| 775 | #:guile %bootstrap-guile))) |
| 776 | `(("perl" ,perl) |
| 777 | ,@%boot0-inputs)))))) |
| 778 | |
| 779 | (define %boot1-inputs |
| 780 | ;; 2nd stage inputs. |
| 781 | `(("gcc" ,gcc-boot0) |
| 782 | ("binutils-cross" ,binutils-boot0) |
| 783 | |
| 784 | ;; Keep "binutils" here because the cross-gcc invokes `as', not the |
| 785 | ;; cross-`as'. |
| 786 | ,@%boot0-inputs)) |
| 787 | |
| 788 | (define glibc-final-with-bootstrap-bash |
| 789 | ;; The final libc, "cross-built". If everything went well, the resulting |
| 790 | ;; store path has no dependencies. Actually, the really-final libc is |
| 791 | ;; built just below; the only difference is that this one uses the |
| 792 | ;; bootstrap Bash. |
| 793 | (package-with-bootstrap-guile |
| 794 | (package (inherit glibc) |
| 795 | (name "glibc-intermediate") |
| 796 | (arguments |
| 797 | `(#:guile ,%bootstrap-guile |
| 798 | #:implicit-inputs? #f |
| 799 | |
| 800 | ,@(substitute-keyword-arguments (package-arguments glibc) |
| 801 | ((#:configure-flags flags) |
| 802 | `(append (list ,(string-append "--host=" (boot-triplet)) |
| 803 | ,(string-append "--build=" |
| 804 | (nix-system->gnu-triplet)) |
| 805 | |
| 806 | ;; Build Sun/ONC RPC support. In particular, |
| 807 | ;; install rpc/*.h. |
| 808 | "--enable-obsolete-rpc") |
| 809 | ,flags))))) |
| 810 | (propagated-inputs `(("linux-headers" ,linux-libre-headers-boot0))) |
| 811 | (inputs |
| 812 | `( ;; A native GCC is needed to build `cross-rpcgen'. |
| 813 | ("native-gcc" ,@(assoc-ref %boot0-inputs "gcc")) |
| 814 | |
| 815 | ;; Here, we use the bootstrap Bash, which is not satisfactory |
| 816 | ;; because we don't want to depend on bootstrap tools. |
| 817 | ("static-bash" ,@(assoc-ref %boot0-inputs "bash")) |
| 818 | |
| 819 | ,@%boot1-inputs |
| 820 | ,@(alist-delete "static-bash" |
| 821 | (package-inputs glibc))))))) ; patches |
| 822 | |
| 823 | (define (cross-gcc-wrapper gcc binutils glibc bash) |
| 824 | "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC |
| 825 | that makes it available under the native tool names." |
| 826 | (package (inherit gcc-4.7) |
| 827 | (name (string-append (package-name gcc) "-wrapped")) |
| 828 | (source #f) |
| 829 | (build-system trivial-build-system) |
| 830 | (arguments |
| 831 | `(#:guile ,%bootstrap-guile |
| 832 | #:modules ((guix build utils)) |
| 833 | #:builder (begin |
| 834 | (use-modules (guix build utils)) |
| 835 | |
| 836 | (let* ((binutils (assoc-ref %build-inputs "binutils")) |
| 837 | (gcc (assoc-ref %build-inputs "gcc")) |
| 838 | (libc (assoc-ref %build-inputs "libc")) |
| 839 | (bash (assoc-ref %build-inputs "bash")) |
| 840 | (out (assoc-ref %outputs "out")) |
| 841 | (bindir (string-append out "/bin")) |
| 842 | (triplet ,(boot-triplet))) |
| 843 | (mkdir-p bindir) |
| 844 | (with-directory-excursion bindir |
| 845 | (for-each (lambda (tool) |
| 846 | (symlink (string-append binutils "/bin/" |
| 847 | triplet "-" tool) |
| 848 | tool)) |
| 849 | '("ar" "ranlib")) |
| 850 | |
| 851 | ;; GCC-BOOT0 is a libc-less cross-compiler, so it |
| 852 | ;; needs to be told where to find the crt files and |
| 853 | ;; the dynamic linker. |
| 854 | (call-with-output-file "gcc" |
| 855 | (lambda (p) |
| 856 | (format p "#!~a/bin/bash |
| 857 | exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" |
| 858 | bash |
| 859 | gcc triplet |
| 860 | libc libc |
| 861 | ,(glibc-dynamic-linker)))) |
| 862 | |
| 863 | (chmod "gcc" #o555)))))) |
| 864 | (native-inputs |
| 865 | `(("binutils" ,binutils) |
| 866 | ("gcc" ,gcc) |
| 867 | ("libc" ,glibc) |
| 868 | ("bash" ,bash))) |
| 869 | (inputs '()))) |
| 870 | |
| 871 | (define static-bash-for-glibc |
| 872 | ;; A statically-linked Bash to be embedded in GLIBC-FINAL, for use by |
| 873 | ;; system(3) & co. |
| 874 | (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 |
| 875 | glibc-final-with-bootstrap-bash |
| 876 | (car (assoc-ref %boot1-inputs "bash")))) |
| 877 | (bash (package (inherit bash-light) |
| 878 | (arguments |
| 879 | `(#:guile ,%bootstrap-guile |
| 880 | ,@(package-arguments bash-light)))))) |
| 881 | (package-with-bootstrap-guile |
| 882 | (package-with-explicit-inputs (static-package bash) |
| 883 | `(("gcc" ,gcc) |
| 884 | ("libc" ,glibc-final-with-bootstrap-bash) |
| 885 | ,@(fold alist-delete %boot1-inputs |
| 886 | '("gcc" "libc"))) |
| 887 | (current-source-location))))) |
| 888 | |
| 889 | (define-public glibc-final |
| 890 | ;; The final glibc, which embeds the statically-linked Bash built above. |
| 891 | (package (inherit glibc-final-with-bootstrap-bash) |
| 892 | (name "glibc") |
| 893 | (inputs `(("static-bash" ,static-bash-for-glibc) |
| 894 | ,@(alist-delete |
| 895 | "static-bash" |
| 896 | (package-inputs glibc-final-with-bootstrap-bash)))))) |
| 897 | |
| 898 | (define gcc-boot0-wrapped |
| 899 | ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the |
| 900 | ;; non-cross names. |
| 901 | (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final |
| 902 | (car (assoc-ref %boot1-inputs "bash")))) |
| 903 | |
| 904 | (define %boot2-inputs |
| 905 | ;; 3rd stage inputs. |
| 906 | `(("libc" ,glibc-final) |
| 907 | ("gcc" ,gcc-boot0-wrapped) |
| 908 | ,@(fold alist-delete %boot1-inputs '("libc" "gcc")))) |
| 909 | |
| 910 | (define-public binutils-final |
| 911 | (package-with-bootstrap-guile |
| 912 | (package (inherit binutils) |
| 913 | (arguments |
| 914 | `(#:guile ,%bootstrap-guile |
| 915 | #:implicit-inputs? #f |
| 916 | ,@(package-arguments binutils))) |
| 917 | (inputs %boot2-inputs)))) |
| 918 | |
| 919 | (define-public gcc-final |
| 920 | ;; The final GCC. |
| 921 | (package (inherit gcc-boot0) |
| 922 | (name "gcc") |
| 923 | (arguments |
| 924 | `(#:guile ,%bootstrap-guile |
| 925 | #:implicit-inputs? #f |
| 926 | |
| 927 | ;; Build again GMP & co. within GCC's build process, because it's hard |
| 928 | ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus |
| 929 | ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.) |
| 930 | ,@(substitute-keyword-arguments (package-arguments gcc-boot0) |
| 931 | ((#:configure-flags boot-flags) |
| 932 | (let loop ((args (package-arguments gcc-4.7))) |
| 933 | (match args |
| 934 | ((#:configure-flags normal-flags _ ...) |
| 935 | normal-flags) |
| 936 | ((_ rest ...) |
| 937 | (loop rest))))) |
| 938 | ((#:phases phases) |
| 939 | `(alist-delete 'symlink-libgcc_eh ,phases))))) |
| 940 | |
| 941 | (inputs `(("gmp-source" ,(package-source gmp)) |
| 942 | ("mpfr-source" ,(package-source mpfr)) |
| 943 | ("mpc-source" ,(package-source mpc)) |
| 944 | ("binutils" ,binutils-final) |
| 945 | ,@%boot2-inputs)))) |
| 946 | |
| 947 | (define ld-wrapper-boot3 |
| 948 | ;; A linker wrapper that uses the bootstrap Guile. |
| 949 | (package |
| 950 | (name "ld-wrapper-boot3") |
| 951 | (version "0") |
| 952 | (source #f) |
| 953 | (build-system trivial-build-system) |
| 954 | (inputs `(("binutils" ,binutils-final) |
| 955 | ("guile" ,%bootstrap-guile) |
| 956 | ("bash" ,@(assoc-ref %boot2-inputs "bash")) |
| 957 | ("wrapper" ,(search-path %load-path |
| 958 | "gnu/packages/ld-wrapper.scm")))) |
| 959 | (arguments |
| 960 | `(#:guile ,%bootstrap-guile |
| 961 | #:modules ((guix build utils)) |
| 962 | #:builder (begin |
| 963 | (use-modules (guix build utils) |
| 964 | (system base compile)) |
| 965 | |
| 966 | (let* ((out (assoc-ref %outputs "out")) |
| 967 | (bin (string-append out "/bin")) |
| 968 | (ld (string-append bin "/ld")) |
| 969 | (go (string-append bin "/ld.go"))) |
| 970 | |
| 971 | (setvbuf (current-output-port) _IOLBF) |
| 972 | (format #t "building ~s/bin/ld wrapper in ~s~%" |
| 973 | (assoc-ref %build-inputs "binutils") |
| 974 | out) |
| 975 | |
| 976 | (mkdir-p bin) |
| 977 | (copy-file (assoc-ref %build-inputs "wrapper") ld) |
| 978 | (substitute* ld |
| 979 | (("@GUILE@") |
| 980 | (string-append (assoc-ref %build-inputs "guile") |
| 981 | "/bin/guile")) |
| 982 | (("@BASH@") |
| 983 | (string-append (assoc-ref %build-inputs "bash") |
| 984 | "/bin/bash")) |
| 985 | (("@LD@") |
| 986 | (string-append (assoc-ref %build-inputs "binutils") |
| 987 | "/bin/ld"))) |
| 988 | (chmod ld #o555) |
| 989 | (compile-file ld #:output-file go))))) |
| 990 | (synopsis "The linker wrapper") |
| 991 | (description |
| 992 | "The linker wrapper (or `ld-wrapper') wraps the linker to add any |
| 993 | missing `-rpath' flags, and to detect any misuse of libraries outside of the |
| 994 | store.") |
| 995 | (home-page #f) |
| 996 | (license gpl3+))) |
| 997 | |
| 998 | (define %boot3-inputs |
| 999 | ;; 4th stage inputs. |
| 1000 | `(("gcc" ,gcc-final) |
| 1001 | ("ld-wrapper" ,ld-wrapper-boot3) |
| 1002 | ,@(alist-delete "gcc" %boot2-inputs))) |
| 1003 | |
| 1004 | (define-public bash-final |
| 1005 | ;; Link with `-static-libgcc' to make sure we don't retain a reference |
| 1006 | ;; to the bootstrap GCC. |
| 1007 | (package-with-bootstrap-guile |
| 1008 | (package-with-explicit-inputs (static-libgcc-package bash) |
| 1009 | %boot3-inputs |
| 1010 | (current-source-location) |
| 1011 | #:guile %bootstrap-guile))) |
| 1012 | |
| 1013 | (define %boot4-inputs |
| 1014 | ;; Now use the final Bash. |
| 1015 | `(("bash" ,bash-final) |
| 1016 | ,@(alist-delete "bash" %boot3-inputs))) |
| 1017 | |
| 1018 | (define-public guile-final |
| 1019 | (package-with-bootstrap-guile |
| 1020 | (package-with-explicit-inputs guile-2.0/fixed |
| 1021 | %boot4-inputs |
| 1022 | (current-source-location) |
| 1023 | #:guile %bootstrap-guile))) |
| 1024 | |
| 1025 | (define-public ld-wrapper |
| 1026 | ;; The final `ld' wrapper, which uses the final Guile. |
| 1027 | (package (inherit ld-wrapper-boot3) |
| 1028 | (name "ld-wrapper") |
| 1029 | (inputs `(("guile" ,guile-final) |
| 1030 | ("bash" ,bash-final) |
| 1031 | ,@(fold alist-delete (package-inputs ld-wrapper-boot3) |
| 1032 | '("guile" "bash")))))) |
| 1033 | |
| 1034 | (define-public %final-inputs |
| 1035 | ;; Final derivations used as implicit inputs by `gnu-build-system'. |
| 1036 | (let ((finalize (cut package-with-explicit-inputs <> %boot4-inputs |
| 1037 | (current-source-location)))) |
| 1038 | `(,@(map (match-lambda |
| 1039 | ((name package) |
| 1040 | (list name (finalize package)))) |
| 1041 | `(("tar" ,tar) |
| 1042 | ("gzip" ,gzip) |
| 1043 | ("bzip2" ,bzip2) |
| 1044 | ("xz" ,xz) |
| 1045 | ("diffutils" ,diffutils) |
| 1046 | ("patch" ,patch) |
| 1047 | ("coreutils" ,coreutils) |
| 1048 | ("sed" ,sed) |
| 1049 | ("grep" ,grep) |
| 1050 | ("findutils" ,findutils) |
| 1051 | ("gawk" ,gawk) |
| 1052 | ("make" ,gnu-make))) |
| 1053 | ("bash" ,bash-final) |
| 1054 | ("ld-wrapper" ,ld-wrapper) |
| 1055 | ("binutils" ,binutils-final) |
| 1056 | ("gcc" ,gcc-final) |
| 1057 | ("libc" ,glibc-final)))) |
| 1058 | |
| 1059 | ;;; base.scm ends here |