gnu: guix: Update to 0.10.0.
[jackhill/guix/guix.git] / gnu / packages / base.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
7 ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
8 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages base)
26 #:use-module ((guix licenses)
27 #:select (gpl3+ lgpl2.0+ public-domain))
28 #:use-module (gnu packages)
29 #:use-module (gnu packages acl)
30 #:use-module (gnu packages bash)
31 #:use-module (gnu packages ed)
32 #:use-module (gnu packages guile)
33 #:use-module (gnu packages multiprecision)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages texinfo)
38 #:use-module (gnu packages hurd)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages gettext)
41 #:use-module (guix utils)
42 #:use-module (guix packages)
43 #:use-module (guix download)
44 #:use-module (guix git-download)
45 #:use-module (guix build-system gnu)
46 #:use-module (guix build-system trivial))
47
48 ;;; Commentary:
49 ;;;
50 ;;; Base packages of the Guix-based GNU user-land software distribution.
51 ;;;
52 ;;; Code:
53
54 (define-public hello
55 (package
56 (name "hello")
57 (version "2.10")
58 (source (origin
59 (method url-fetch)
60 (uri (string-append "mirror://gnu/hello/hello-" version
61 ".tar.gz"))
62 (sha256
63 (base32
64 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
65 (build-system gnu-build-system)
66 (synopsis "Hello, GNU world: An example GNU package")
67 (description
68 "GNU Hello prints the message \"Hello, world!\" and then exits. It
69 serves as an example of standard GNU coding practices. As such, it supports
70 command-line arguments, multiple languages, and so on.")
71 (home-page "http://www.gnu.org/software/hello/")
72 (license gpl3+)))
73
74 (define-public grep
75 (package
76 (name "grep")
77 (version "2.22")
78 (source (origin
79 (method url-fetch)
80 (uri (string-append "mirror://gnu/grep/grep-"
81 version ".tar.xz"))
82 (sha256
83 (base32
84 "1srn321x7whlhs5ks36zlcrrmj4iahll8fxwsh1vbz3v04px54fa"))
85 (patches
86 (list (search-patch "grep-timing-sensitive-test.patch")))))
87 (build-system gnu-build-system)
88 (native-inputs `(("perl" ,perl))) ;some of the tests require it
89 (synopsis "Print lines matching a pattern")
90 (description
91 "grep is a tool for finding text inside files. Text is found by
92 matching a pattern provided by the user in one or many files. The pattern
93 may be provided as a basic or extended regular expression, or as fixed
94 strings. By default, the matching text is simply printed to the screen,
95 however the output can be greatly customized to include, for example, line
96 numbers. GNU grep offers many extensions over the standard utility,
97 including, for example, recursive directory searching.")
98 (license gpl3+)
99 (home-page "http://www.gnu.org/software/grep/")))
100
101 (define-public sed
102 (package
103 (name "sed")
104 (version "4.2.2")
105 (source (origin
106 (method url-fetch)
107 (uri (string-append "mirror://gnu/sed/sed-" version
108 ".tar.bz2"))
109 (sha256
110 (base32
111 "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))
112 (patches (list (search-patch "sed-hurd-path-max.patch")))))
113 (build-system gnu-build-system)
114 (synopsis "Stream editor")
115 (arguments
116 (if (%current-target-system)
117 '()
118 `(#:phases (alist-cons-before
119 'patch-source-shebangs 'patch-test-suite
120 (lambda* (#:key inputs #:allow-other-keys)
121 (let ((bash (assoc-ref inputs "bash")))
122 (patch-makefile-SHELL "testsuite/Makefile.tests")
123 (substitute* '("testsuite/bsd.sh"
124 "testsuite/bug-regex9.c")
125 (("/bin/sh")
126 (string-append bash "/bin/bash")))))
127 %standard-phases))))
128 (description
129 "Sed is a non-interactive, text stream editor. It receives a text
130 input from a file or from standard input and it then applies a series of text
131 editing commands to the stream and prints its output to standard output. It
132 is often used for substituting text patterns in a stream. The GNU
133 implementation offers several extensions over the standard utility.")
134 (license gpl3+)
135 (home-page "http://www.gnu.org/software/sed/")))
136
137 (define-public tar
138 (package
139 (name "tar")
140 (version "1.28")
141 (source (origin
142 (method url-fetch)
143 (uri (string-append "mirror://gnu/tar/tar-"
144 version ".tar.xz"))
145 (sha256
146 (base32
147 "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4"))
148 (patches (map search-patch
149 '("tar-d_ino_in_dirent-fix.patch"
150 "tar-skip-unreliable-tests.patch")))))
151 (build-system gnu-build-system)
152 (synopsis "Managing tar archives")
153 (description
154 "Tar provides the ability to create tar archives, as well as the
155 ability to extract, update or list files in an existing archive. It is
156 useful for combining many files into one larger file, while maintaining
157 directory structure and file information such as permissions and
158 creation/modification dates. GNU tar offers many extensions over the
159 standard utility.")
160 (license gpl3+)
161 (home-page "http://www.gnu.org/software/tar/")))
162
163 (define-public patch
164 (package
165 (name "patch")
166 (version "2.7.5")
167 (source (origin
168 (method url-fetch)
169 (uri (string-append "mirror://gnu/patch/patch-"
170 version ".tar.xz"))
171 (sha256
172 (base32
173 "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
174 (patches (list (search-patch "patch-hurd-path-max.patch")))))
175 (build-system gnu-build-system)
176 (native-inputs `(("ed" ,ed)))
177 (synopsis "Apply differences to originals, with optional backups")
178 (description
179 "Patch is a program that applies changes to files based on differences
180 laid out as by the program \"diff\". The changes may be applied to one or more
181 files depending on the contents of the diff file. It accepts several
182 different diff formats. It may also be used to revert previously applied
183 differences.")
184 (license gpl3+)
185 (home-page "http://savannah.gnu.org/projects/patch/")))
186
187 (define-public diffutils
188 (package
189 (name "diffutils")
190 (version "3.3")
191 (source (origin
192 (method url-fetch)
193 (uri (string-append "mirror://gnu/diffutils/diffutils-"
194 version ".tar.xz"))
195 (sha256
196 (base32
197 "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2"))))
198 (build-system gnu-build-system)
199 (synopsis "Comparing and merging files")
200 (description
201 "GNU Diffutils is a package containing tools for finding the
202 differences between files. The \"diff\" command is used to show how two files
203 differ, while \"cmp\" shows the offsets and line numbers where they differ.
204 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
205 interactive means to merge two files.")
206 (license gpl3+)
207 (home-page "http://www.gnu.org/software/diffutils/")))
208
209 (define-public findutils
210 (package
211 (name "findutils")
212 (version "4.6.0")
213 (source (origin
214 (method url-fetch)
215 (uri (string-append "mirror://gnu/findutils/findutils-"
216 version ".tar.gz"))
217 (sha256
218 (base32
219 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
220 (patches (map search-patch
221 '("findutils-localstatedir.patch"
222 "findutils-test-xargs.patch")))))
223 (build-system gnu-build-system)
224 (arguments
225 `(#:configure-flags (list
226 ;; Tell 'updatedb' to write to /var.
227 "--localstatedir=/var"
228
229 ;; Work around cross-compilation failure. See
230 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
231 ,@(if (%current-target-system)
232 '("gl_cv_func_wcwidth_works=yes")
233 '()))))
234 (synopsis "Operating on files matching given criteria")
235 (description
236 "Findutils supplies the basic file directory searching utilities of the
237 GNU system. It consists of two primary searching utilities: \"find\"
238 recursively searches for files in a directory according to given criteria and
239 \"locate\" lists files in a database that match a query. Two auxiliary tools
240 are included: \"updatedb\" updates the file name database and \"xargs\" may be
241 used to apply commands with arbitrarily long arguments.")
242 (license gpl3+)
243 (home-page "http://www.gnu.org/software/findutils/")))
244
245 (define-public coreutils
246 (package
247 (name "coreutils")
248 (version "8.24")
249 (source (origin
250 (method url-fetch)
251 (uri (string-append "mirror://gnu/coreutils/coreutils-"
252 version ".tar.xz"))
253 (sha256
254 (base32
255 "0w11jw3fb5sslf0f72kxy7llxgk1ia3a6bcw0c9kmvxrlj355mx2"))
256 (patches
257 (list (origin
258 (method url-fetch)
259 (uri "http://git.savannah.gnu.org/cgit/coreutils.git/\
260 patch/?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0")
261 (sha256
262 (base32
263 "1dnlszhc8lihhg801i9sz896mlrgfsjfcz62636prb27k5hmixqz"))
264 (file-name "coreutils-tail-inotify-race.patch"))))))
265 (build-system gnu-build-system)
266 (inputs `(("acl" ,acl) ; TODO: add SELinux
267 ("gmp" ,gmp) ;bignums in 'expr', yay!
268
269 ;; Drop the dependency on libcap when cross-compiling since it's
270 ;; not quite cross-compilable.
271 ,@(if (%current-target-system)
272 '()
273 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
274 (native-inputs
275 ;; Perl is needed to run tests in native builds, and to run the bundled
276 ;; copy of help2man. However, don't pass it when cross-compiling since
277 ;; that would lead it to try to run programs to get their '--help' output
278 ;; for help2man.
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 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
290 ;; that tests pass, since /bin/sh isn't in the chroot.
291 (setenv "SHELL" (which "sh"))
292
293 (substitute* (find-files "gnulib-tests" "\\.c$")
294 (("/bin/sh")
295 (format #f "~a/bin/sh" bash)))
296 (substitute* (find-files "tests" "\\.sh$")
297 (("#!/bin/sh")
298 (format #f "#!~a/bin/sh" bash)))))
299 %standard-phases)))
300 (synopsis "Core GNU utilities (file, text, shell)")
301 (description
302 "GNU Coreutils includes all of the basic command-line tools that are
303 expected in a POSIX system. These provide the basic file, shell and text
304 manipulation functions of the GNU system. Most of these tools offer extended
305 functionality beyond that which is outlined in the POSIX standard.")
306 (license gpl3+)
307 (home-page "http://www.gnu.org/software/coreutils/")))
308
309 (define-public coreutils-minimal
310 ;; Coreutils without its optional dependencies.
311 (package
312 (inherit coreutils)
313 (name "coreutils-minimal")
314 (outputs '("out"))
315 (inputs '())))
316
317 (define-public gnu-make
318 (package
319 (name "make")
320 (version "4.1")
321 (source (origin
322 (method url-fetch)
323 (uri (string-append "mirror://gnu/make/make-" version
324 ".tar.bz2"))
325 (sha256
326 (base32
327 "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb"))
328 (patches (list (search-patch "make-impure-dirs.patch")))))
329 (build-system gnu-build-system)
330 (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile
331 (inputs `(("guile" ,guile-2.0)))
332 (outputs '("out" "debug"))
333 (arguments
334 '(#:phases (alist-cons-before
335 'build 'set-default-shell
336 (lambda* (#:key inputs #:allow-other-keys)
337 ;; Change the default shell from /bin/sh.
338 (let ((bash (assoc-ref inputs "bash")))
339 (substitute* "job.c"
340 (("default_shell =.*$")
341 (format #f "default_shell = \"~a/bin/bash\";\n"
342 bash)))))
343 %standard-phases)))
344 (synopsis "Remake files automatically")
345 (description
346 "Make is a program that is used to control the production of
347 executables or other files from their source files. The process is
348 controlled from a Makefile, in which the developer specifies how each file is
349 generated from its source. It has powerful dependency resolution and the
350 ability to determine when files have to be regenerated after their sources
351 change. GNU make offers many powerful extensions over the standard utility.")
352 (license gpl3+)
353 (home-page "http://www.gnu.org/software/make/")))
354
355 (define-public binutils
356 (package
357 (name "binutils")
358 (version "2.25.1")
359 (source (origin
360 (method url-fetch)
361 (uri (string-append "mirror://gnu/binutils/binutils-"
362 version ".tar.bz2"))
363 (sha256
364 (base32
365 "08lzmhidzc16af1zbx34f8cy4z7mzrswpdbhrb8shy3xxpflmcdm"))
366 (patches (list (search-patch "binutils-ld-new-dtags.patch")
367 (search-patch "binutils-loongson-workaround.patch")))))
368 (build-system gnu-build-system)
369
370 ;; TODO: Add dependency on zlib + those for Gold.
371 (arguments
372 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
373 ;; on GCC when bootstrapping.
374 "LDFLAGS=-static-libgcc"
375
376 ;; Don't search under /usr/lib & co.
377 "--with-lib-path=/no-ld-lib-path"
378
379 ;; Glibc 2.17 has a "comparison of unsigned
380 ;; expression >= 0 is always true" in wchar.h.
381 "--disable-werror"
382
383 ;; Install BFD. It ends up in a hidden directory,
384 ;; but it's here.
385 "--enable-install-libbfd"
386
387 ;; Make sure 'ar' and 'ranlib' produce archives in a
388 ;; deterministic fashion.
389 "--enable-deterministic-archives")))
390
391 (synopsis "Binary utilities: bfd gas gprof ld")
392 (description
393 "GNU Binutils is a collection of tools for working with binary files.
394 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
395 Other tools include programs to display binary profiling information, list
396 the strings in a binary file, and utilities for working with archives. The
397 \"bfd\" library for working with executable and object formats is also
398 included.")
399 (license gpl3+)
400 (home-page "http://www.gnu.org/software/binutils/")))
401
402 (define* (make-ld-wrapper name #:key binutils
403 (guile (canonical-package guile-2.0))
404 (bash (canonical-package bash)) target
405 (guile-for-build guile))
406 "Return a package called NAME that contains a wrapper for the 'ld' program
407 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When
408 TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
409 'TARGET-ld'. The wrapper uses GUILE and BASH."
410 (package
411 (name name)
412 (version "0")
413 (source #f)
414 (build-system trivial-build-system)
415 (inputs `(("binutils" ,binutils)
416 ("guile" ,guile)
417 ("bash" ,bash)
418 ("wrapper" ,(search-path %load-path
419 "gnu/packages/ld-wrapper.in"))))
420 (arguments
421 `(#:guile ,guile-for-build
422 #:modules ((guix build utils))
423 #:builder (begin
424 (use-modules (guix build utils)
425 (system base compile))
426
427 (let* ((out (assoc-ref %outputs "out"))
428 (bin (string-append out "/bin"))
429 (ld ,(if target
430 `(string-append bin "/" ,target "-ld")
431 '(string-append bin "/ld")))
432 (go (string-append ld ".go")))
433
434 (setvbuf (current-output-port) _IOLBF)
435 (format #t "building ~s/bin/ld wrapper in ~s~%"
436 (assoc-ref %build-inputs "binutils")
437 out)
438
439 (mkdir-p bin)
440 (copy-file (assoc-ref %build-inputs "wrapper") ld)
441 (substitute* ld
442 (("@SELF@")
443 ld)
444 (("@GUILE@")
445 (string-append (assoc-ref %build-inputs "guile")
446 "/bin/guile"))
447 (("@BASH@")
448 (string-append (assoc-ref %build-inputs "bash")
449 "/bin/bash"))
450 (("@LD@")
451 (string-append (assoc-ref %build-inputs "binutils")
452 ,(if target
453 (string-append "/bin/"
454 target "-ld")
455 "/bin/ld"))))
456 (chmod ld #o555)
457 (compile-file ld #:output-file go)))))
458 (synopsis "The linker wrapper")
459 (description
460 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
461 missing '-rpath' flags, and to detect any misuse of libraries outside of the
462 store.")
463 (home-page "http://www.gnu.org/software/guix/")
464 (license gpl3+)))
465
466 (export make-ld-wrapper)
467
468 (define-public glibc
469 (package
470 (name "glibc")
471 (version "2.22")
472 (source (origin
473 (method url-fetch)
474 (uri (string-append "mirror://gnu/glibc/glibc-"
475 version ".tar.xz"))
476 (sha256
477 (base32
478 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
479 (snippet
480 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
481 ;; required on LFS distros to avoid loading the distro's libc.so
482 ;; instead of ours.
483 '(substitute* "sysdeps/unix/sysv/linux/configure"
484 (("use_ldconfig=yes")
485 "use_ldconfig=no")))
486 (modules '((guix build utils)))
487 (patches (map search-patch
488 '("glibc-ldd-x86_64.patch"
489 "glibc-locale-incompatibility.patch"
490 "glibc-versioned-locpath.patch"
491 "glibc-o-largefile.patch"
492 "glibc-CVE-2015-7547.patch")))))
493 (build-system gnu-build-system)
494
495 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
496 ;; users should automatically pull Linux headers as well.
497 (propagated-inputs `(("linux-headers" ,linux-libre-headers)))
498
499 (outputs '("out" "debug"))
500
501 (arguments
502 `(#:out-of-source? #t
503
504 ;; In version 2.21, there a race in the 'elf' directory, see
505 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
506 #:parallel-build? #f
507
508 ;; The libraries have an empty RUNPATH, but some, such as the versioned
509 ;; libraries (libdl-2.22.so, etc.) have ld.so marked as NEEDED. Since
510 ;; these libraries are always going to be found anyway, just skip
511 ;; RUNPATH checks.
512 #:validate-runpath? #f
513
514 #:configure-flags
515 (list "--enable-add-ons"
516 "--sysconfdir=/etc"
517
518 ;; Installing a locale archive with all the locales is to
519 ;; expensive (~100 MiB), so we rely on users to install the
520 ;; locales they really want.
521 ;;
522 ;; Set the default locale path. In practice, $LOCPATH may be
523 ;; defined to point whatever locales users want. However, setuid
524 ;; binaries don't honor $LOCPATH, so they'll instead look into
525 ;; $libc_cv_localedir; we choose /run/current-system/locale/X.Y,
526 ;; with the idea that it is going to be populated by the sysadmin.
527 ;; The "X.Y" sub-directory is because locale data formats are
528 ;; incompatible across libc versions; see
529 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
530 ;;
531 ;; `--localedir' is not honored, so work around it.
532 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
533 (string-append "libc_cv_localedir=/run/current-system/locale/"
534 ,version)
535
536 (string-append "--with-headers="
537 (assoc-ref %build-inputs "linux-headers")
538 "/include")
539
540 ;; This is the default for most architectures as of GNU libc 2.21,
541 ;; but we specify it explicitly for clarity and consistency. See
542 ;; "kernel-features.h" in the GNU libc for details.
543 "--enable-kernel=2.6.32"
544
545 ;; Use our Bash instead of /bin/sh.
546 (string-append "BASH_SHELL="
547 (assoc-ref %build-inputs "bash")
548 "/bin/bash")
549
550 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
551 "libc_cv_ssp=no")
552
553 #:tests? #f ; XXX
554 #:phases (modify-phases %standard-phases
555 (add-before
556 'configure 'pre-configure
557 (lambda* (#:key inputs native-inputs outputs
558 #:allow-other-keys)
559 (let* ((out (assoc-ref outputs "out"))
560 (bin (string-append out "/bin"))
561 ;; FIXME: Normally we would look it up only in INPUTS
562 ;; but cross-base uses it as a native input.
563 (bash (or (assoc-ref inputs "static-bash")
564 (assoc-ref native-inputs "static-bash"))))
565 ;; Use `pwd', not `/bin/pwd'.
566 (substitute* "configure"
567 (("/bin/pwd") "pwd"))
568
569 ;; Install the rpc data base file under `$out/etc/rpc'.
570 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
571 (substitute* "sunrpc/Makefile"
572 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
573 (string-append out "/etc/rpc" suffix "\n"))
574 (("^install-others =.*$")
575 (string-append "install-others = " out "/etc/rpc\n")))
576
577 (substitute* "Makeconfig"
578 ;; According to
579 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
580 ;; linking against libgcc_s is not needed with GCC
581 ;; 4.7.1.
582 ((" -lgcc_s") ""))
583
584 ;; Have `system' use that Bash.
585 (substitute* "sysdeps/posix/system.c"
586 (("#define[[:blank:]]+SHELL_PATH.*$")
587 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
588 bash)))
589
590 ;; Same for `popen'.
591 (substitute* "libio/iopopen.c"
592 (("/bin/sh")
593 (string-append bash "/bin/bash")))
594
595 ;; Same for the shell used by the 'exec' functions for
596 ;; scripts that lack a shebang.
597 (substitute* (find-files "." "^paths\\.h$")
598 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
599 (string-append "#define _PATH_BSHELL \""
600 bash "/bin/bash\"\n")))
601
602 ;; Nscd uses __DATE__ and __TIME__ to create a string to
603 ;; make sure the client and server come from the same
604 ;; libc. Use something deterministic instead.
605 (substitute* "nscd/nscd_stat.c"
606 (("static const char compilation\\[21\\] =.*$")
607 (string-append
608 "static const char compilation[21] = \""
609 (string-take (basename out) 20) "\";\n")))
610
611 ;; Make sure we don't retain a reference to the
612 ;; bootstrap Perl.
613 (substitute* "malloc/mtrace.pl"
614 (("^#!.*")
615 ;; The shebang can be omitted, because there's the
616 ;; "bilingual" eval/exec magic at the top of the file.
617 "")
618 (("exec @PERL@")
619 "exec perl"))))))))
620
621 (inputs `(("static-bash" ,static-bash)))
622
623 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
624 ;; install the message catalogs, with 'msgfmt'.
625 (native-inputs `(("texinfo" ,texinfo)
626 ("perl" ,perl)
627 ("gettext" ,gnu-gettext)))
628
629 (native-search-paths
630 ;; Search path for packages that provide locale data. This is useful
631 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
632 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
633 ;; distros.
634 (list (search-path-specification
635 (variable "GUIX_LOCPATH")
636 (files '("lib/locale")))))
637
638 (synopsis "The GNU C Library")
639 (description
640 "Any Unix-like operating system needs a C library: the library which
641 defines the \"system calls\" and other basic facilities such as open, malloc,
642 printf, exit...
643
644 The GNU C library is used as the C library in the GNU system and most systems
645 with the Linux kernel.")
646 (license lgpl2.0+)
647 (home-page "http://www.gnu.org/software/libc/")))
648
649 (define-public glibc-2.21
650 ;; The old libc, which we use mostly to build locale data in the old format
651 ;; (which the new libc can cope with.)
652 (package
653 (inherit glibc)
654 (version "2.21")
655 (source (origin
656 (inherit (package-source glibc))
657 (uri (string-append "mirror://gnu/glibc/glibc-"
658 version ".tar.xz"))
659 (sha256
660 (base32
661 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
662 (patches (list (search-patch "glibc-ldd-x86_64.patch")))))))
663
664 (define-public glibc-locales
665 (package
666 (inherit glibc)
667 (name "glibc-locales")
668 (source (origin (inherit (package-source glibc))
669 (patches (cons (search-patch "glibc-locales.patch")
670 (origin-patches (package-source glibc))))))
671 (synopsis "All the locales supported by the GNU C Library")
672 (description
673 "This package provides all the locales supported by the GNU C Library,
674 more than 400 in total. To use them set the 'LOCPATH' environment variable to
675 the 'share/locale' sub-directory of this package.")
676 (outputs '("out")) ;110+ MiB
677 (native-search-paths '())
678 (arguments
679 (let ((args `(#:tests? #f #:strip-binaries? #f
680 ,@(package-arguments glibc))))
681 (substitute-keyword-arguments args
682 ((#:phases phases)
683 `(alist-replace
684 'build
685 (lambda* (#:key outputs #:allow-other-keys)
686 (zero? (system* "make" "localedata/install-locales"
687 "-j" (number->string (parallel-job-count)))))
688 (alist-delete 'install ,phases)))
689 ((#:configure-flags flags)
690 `(append ,flags
691 ;; Use $(libdir)/locale/X.Y as is the case by default.
692 (list (string-append "libc_cv_localedir="
693 (assoc-ref %outputs "out")
694 "/lib/locale/"
695 ,(package-version glibc))))))))))
696
697 (define-public glibc-utf8-locales
698 (package
699 (name "glibc-utf8-locales")
700 (version (package-version glibc))
701 (source #f)
702 (build-system trivial-build-system)
703 (arguments
704 `(#:modules ((guix build utils))
705 #:builder (begin
706 (use-modules (srfi srfi-1)
707 (guix build utils))
708
709 (let* ((libc (assoc-ref %build-inputs "glibc"))
710 (gzip (assoc-ref %build-inputs "gzip"))
711 (out (assoc-ref %outputs "out"))
712 (localedir (string-append out "/lib/locale/"
713 ,version)))
714 ;; 'localedef' needs 'gzip'.
715 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
716
717 (mkdir-p localedir)
718 (every (lambda (locale)
719 (define file
720 ;; Use the "normalized codeset" by
721 ;; default--e.g., "en_US.utf8".
722 (string-append localedir "/" locale ".utf8"))
723
724 (and (zero? (system* "localedef" "--no-archive"
725 "--prefix" localedir
726 "-i" locale
727 "-f" "UTF-8" file))
728 (begin
729 ;; For backward compatibility with Guix
730 ;; <= 0.8.3, add "xx_YY.UTF-8".
731 (symlink (string-append locale ".utf8")
732 (string-append localedir "/"
733 locale ".UTF-8"))
734 #t)))
735
736 ;; These are the locales commonly used for
737 ;; tests---e.g., in Guile's i18n tests.
738 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
739 (inputs `(("glibc" ,glibc)
740 ("gzip" ,gzip)))
741 (synopsis "Small sample of UTF-8 locales")
742 (description
743 "This package provides a small sample of UTF-8 locales mostly useful in
744 test environments.")
745 (home-page (package-home-page glibc))
746 (license (package-license glibc))))
747
748 (define-public which
749 (package
750 (name "which")
751 (version "2.21")
752 (source (origin
753 (method url-fetch)
754 (uri (string-append "mirror://gnu/which/which-"
755 version ".tar.gz"))
756 (sha256
757 (base32
758 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
759 (build-system gnu-build-system)
760 (home-page "https://gnu.org/software/which/")
761 (synopsis "Find full path of shell commands")
762 (description
763 "The which program finds the location of executables in PATH, with a
764 variety of options. It is an alternative to the shell \"type\" built-in
765 command.")
766 (license gpl3+))) ; some files are under GPLv2+
767
768 (define-public glibc/hurd
769 ;; The Hurd's libc variant.
770 (package (inherit glibc)
771 (name "glibc-hurd")
772 (version "2.18")
773 (source (origin
774 (method git-fetch)
775 (uri (git-reference
776 (url "git://git.sv.gnu.org/hurd/glibc")
777 (commit "cc94b3cfe65523f980359e5f0e93a26196bda1d3")))
778 (sha256
779 (base32
780 "17gsh0kaz0zyvghjmx861mi2p65m9901lngi179x61zm6v2v3xc4"))
781 (file-name (string-append name "-" version))
782 (patches (map search-patch
783 '("glibc-hurd-extern-inline.patch")))))
784
785 ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
786 ;; so both should be propagated.
787 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
788 ("hurd-headers" ,hurd-headers)
789 ("hurd-minimal" ,hurd-minimal)))
790 (native-inputs
791 `(,@(package-native-inputs glibc)
792 ("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
793 ("mig" ,mig)
794 ("perl" ,perl)
795 ("libpthread" ,(origin
796 (method git-fetch)
797 (uri (git-reference
798 (url "git://git.sv.gnu.org/hurd/libpthread")
799 (commit "0ef7b75c4ba91b6660f0d3d8b51d14d25e3d5bfb")))
800 (sha256
801 (base32
802 "031py18fls15z0wprni33mf762kg6fx8xqijppimhp83yp6ky3l3"))
803 (file-name "libpthread")))))
804
805 (arguments
806 (substitute-keyword-arguments (package-arguments glibc)
807 ((#:configure-flags original-configure-flags)
808 `(append (list "--host=i686-pc-gnu"
809
810 ;; nscd fails to build for GNU/Hurd:
811 ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
812 ;; Disable it.
813 "--disable-nscd")
814 (filter (lambda (flag)
815 (not (or (string-prefix? "--with-headers=" flag)
816 (string-prefix? "--enable-kernel=" flag))))
817 ;; Evaluate 'original-configure-flags' in a
818 ;; lexical environment that has a dummy
819 ;; "linux-headers" input, to prevent errors.
820 (let ((%build-inputs `(("linux-headers" . "@DUMMY@")
821 ,@%build-inputs)))
822 ,original-configure-flags))))
823 ((#:phases phases)
824 `(alist-cons-after
825 'unpack 'prepare-libpthread
826 (lambda* (#:key inputs #:allow-other-keys)
827 (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
828
829 (system* "patch" "--force" "-p1" "-i"
830 (assoc-ref inputs "patch/libpthread-patch"))
831 #t)
832 ,phases))))
833 (synopsis "The GNU C Library (GNU Hurd variant)")
834 (supported-systems %hurd-systems)))
835
836 (define-public glibc/hurd-headers
837 (package (inherit glibc/hurd)
838 (name "glibc-hurd-headers")
839 (outputs '("out"))
840 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
841 ("hurd-headers" ,hurd-headers)))
842 (arguments
843 (substitute-keyword-arguments (package-arguments glibc/hurd)
844 ;; We just pass the flags really needed to build the headers.
845 ((#:configure-flags _)
846 `(list "--enable-add-ons"
847 "--host=i686-pc-gnu"
848 "--enable-obsolete-rpc"))
849 ((#:phases _)
850 '(alist-replace
851 'install
852 (lambda* (#:key outputs #:allow-other-keys)
853 (and (zero? (system* "make" "install-headers"))
854
855 ;; Make an empty stubs.h to work around not being able to
856 ;; produce a valid stubs.h and causing the build to fail. See
857 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
858 (let ((out (assoc-ref outputs "out")))
859 (close-port
860 (open-output-file
861 (string-append out "/include/gnu/stubs.h"))))))
862
863 ;; Nothing to build.
864 (alist-delete
865 'build
866
867 (alist-cons-before
868 'configure 'pre-configure
869 (lambda _
870 ;; Use the right 'pwd'.
871 (substitute* "configure"
872 (("/bin/pwd") "pwd")))
873 %standard-phases))))))))
874
875 (define-public tzdata
876 (package
877 (name "tzdata")
878 (version "2015g")
879 (source (origin
880 (method url-fetch)
881 (uri (string-append
882 "http://www.iana.org/time-zones/repository/releases/tzdata"
883 version ".tar.gz"))
884 (sha256
885 (base32
886 "0qb1awqrn3215zd2jikpqnmkzrxwfjf0d3dw2xmnk4c40yzws8xr"))))
887 (build-system gnu-build-system)
888 (arguments
889 '(#:tests? #f
890 #:make-flags (let ((out (assoc-ref %outputs "out"))
891 (tmp (getenv "TMPDIR")))
892 (list (string-append "TOPDIR=" out)
893 (string-append "TZDIR=" out "/share/zoneinfo")
894
895 ;; Discard zic, dump, and tzselect, already
896 ;; provided by glibc.
897 (string-append "ETCDIR=" tmp "/etc")
898
899 ;; Likewise for the C library routines.
900 (string-append "LIBDIR=" tmp "/lib")
901 (string-append "MANDIR=" tmp "/man")
902
903 "AWK=awk"
904 "CC=gcc"))
905 #:modules ((guix build utils)
906 (guix build gnu-build-system)
907 (srfi srfi-1))
908 #:phases
909 (alist-replace
910 'unpack
911 (lambda* (#:key source inputs #:allow-other-keys)
912 (and (zero? (system* "tar" "xvf" source))
913 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
914 (alist-cons-after
915 'install 'post-install
916 (lambda* (#:key outputs #:allow-other-keys)
917 ;; Move data in the right place.
918 (let ((out (assoc-ref outputs "out")))
919 (copy-recursively (string-append out "/share/zoneinfo-posix")
920 (string-append out "/share/zoneinfo/posix"))
921 (copy-recursively (string-append out "/share/zoneinfo-leaps")
922 (string-append out "/share/zoneinfo/right"))
923 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
924 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
925 (alist-delete 'configure %standard-phases)))))
926 (inputs `(("tzcode" ,(origin
927 (method url-fetch)
928 (uri (string-append
929 "http://www.iana.org/time-zones/repository/releases/tzcode"
930 version ".tar.gz"))
931 (sha256
932 (base32
933 "1i3y1kzjiz2j62c7vd4wf85983sqk9x9lg3473njvbdz4kph5r0q"))))))
934 (home-page "http://www.iana.org/time-zones")
935 (synopsis "Database of current and historical time zones")
936 (description "The Time Zone Database (often called tz or zoneinfo)
937 contains code and data that represent the history of local time for many
938 representative locations around the globe. It is updated periodically to
939 reflect changes made by political bodies to time zone boundaries, UTC offsets,
940 and daylight-saving rules.")
941 (license public-domain)))
942
943 (define-public (canonical-package package)
944 ;; Avoid circular dependency by lazily resolving 'commencement'.
945 (let* ((iface (resolve-interface '(gnu packages commencement)))
946 (proc (module-ref iface 'canonical-package)))
947 (proc package)))
948
949 ;;; base.scm ends here