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