gnu: Add tree.
[jackhill/guix/guix.git] / gnu / packages / base.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
3f11f01f 2;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
722111ab 3;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
233e7676 4;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
232010f8 5;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4c8425b7 6;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
e3ce5d70 7;;;
233e7676 8;;; This file is part of GNU Guix.
e3ce5d70 9;;;
233e7676 10;;; GNU Guix is free software; you can redistribute it and/or modify it
e3ce5d70
LC
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
233e7676 15;;; GNU Guix is distributed in the hope that it will be useful, but
e3ce5d70
LC
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
233e7676 21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
e3ce5d70 22
1ffa7090 23(define-module (gnu packages base)
c6d7e299 24 #:use-module ((guix licenses)
e789d9a8 25 #:select (gpl3+ lgpl2.0+ public-domain))
59a43334 26 #:use-module (gnu packages)
1ffa7090
LC
27 #:use-module (gnu packages acl)
28 #:use-module (gnu packages bash)
b5ef82e0 29 #:use-module (gnu packages ed)
1ffa7090
LC
30 #:use-module (gnu packages guile)
31 #:use-module (gnu packages multiprecision)
c9505f3f 32 #:use-module (gnu packages compression)
1ffa7090
LC
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages linux)
8fd6487e 35 #:use-module (gnu packages texinfo)
aa6b0d6b 36 #:use-module (gnu packages pkg-config)
aee6180c 37 #:use-module (guix utils)
e3ce5d70 38 #:use-module (guix packages)
87f5d366 39 #:use-module (guix download)
c9505f3f
LC
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system trivial))
e3ce5d70
LC
42
43;;; Commentary:
44;;;
1722d680 45;;; Base packages of the Guix-based GNU user-land software distribution.
e3ce5d70
LC
46;;;
47;;; Code:
48
49(define-public hello
50 (package
51 (name "hello")
7bcf372e 52 (version "2.10")
90c68be8 53 (source (origin
87f5d366 54 (method url-fetch)
0db342a5 55 (uri (string-append "mirror://gnu/hello/hello-" version
90c68be8 56 ".tar.gz"))
e3ce5d70 57 (sha256
7bcf372e 58 (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
e3ce5d70 59 (build-system gnu-build-system)
f50d2669 60 (synopsis "Hello, GNU world: An example GNU package")
a22dc0c4
LC
61 (description
62 "GNU Hello prints the message \"Hello, world!\" and then exits. It
63serves as an example of standard GNU coding practices. As such, it supports
64command-line arguments, multiple languages, and so on.")
45753b65 65 (home-page "http://www.gnu.org/software/hello/")
4a44e743 66 (license gpl3+)))
d7672884 67
6794b278
LC
68(define-public grep
69 (package
70 (name "grep")
c4a298c5 71 (version "2.21")
6794b278 72 (source (origin
87f5d366 73 (method url-fetch)
0db342a5 74 (uri (string-append "mirror://gnu/grep/grep-"
6794b278
LC
75 version ".tar.xz"))
76 (sha256
77 (base32
a068dba7
MW
78 "1pp5n15qwxrw1pibwjhhgsibyv5cafhamf8lwzjygs6y00fa2i2j"))
79 (patches (list (search-patch "grep-CVE-2015-1345.patch")))))
6794b278 80 (build-system gnu-build-system)
f50d2669 81 (synopsis "Print lines matching a pattern")
d45122f5 82 (description
12bcf94a 83 "grep is a tool for finding text inside files. Text is found by
a22dc0c4 84matching a pattern provided by the user in one or many files. The pattern
79c311b8
LC
85may be provided as a basic or extended regular expression, or as fixed
86strings. By default, the matching text is simply printed to the screen,
87however the output can be greatly customized to include, for example, line
88numbers. GNU grep offers many extensions over the standard utility,
89including, for example, recursive directory searching.")
4a44e743 90 (license gpl3+)
6794b278
LC
91 (home-page "http://www.gnu.org/software/grep/")))
92
8dcad9aa
LC
93(define-public sed
94 (package
95 (name "sed")
847e7725 96 (version "4.2.2")
8dcad9aa 97 (source (origin
87f5d366 98 (method url-fetch)
0db342a5 99 (uri (string-append "mirror://gnu/sed/sed-" version
8dcad9aa
LC
100 ".tar.bz2"))
101 (sha256
102 (base32
847e7725 103 "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))))
8dcad9aa 104 (build-system gnu-build-system)
f50d2669 105 (synopsis "Stream editor")
52b8e5fc 106 (arguments
c8c6bba5
LC
107 (if (%current-target-system)
108 '()
109 `(#:phases (alist-cons-before
110 'patch-source-shebangs 'patch-test-suite
111 (lambda* (#:key inputs #:allow-other-keys)
112 (let ((bash (assoc-ref inputs "bash")))
113 (patch-makefile-SHELL "testsuite/Makefile.tests")
114 (substitute* '("testsuite/bsd.sh"
115 "testsuite/bug-regex9.c")
116 (("/bin/sh")
117 (string-append bash "/bin/bash")))))
118 %standard-phases))))
d45122f5 119 (description
a22dc0c4
LC
120 "Sed is a non-interactive, text stream editor. It receives a text
121input from a file or from standard input and it then applies a series of text
122editing commands to the stream and prints its output to standard output. It
79c311b8
LC
123is often used for substituting text patterns in a stream. The GNU
124implementation offers several extensions over the standard utility.")
4a44e743 125 (license gpl3+)
8dcad9aa
LC
126 (home-page "http://www.gnu.org/software/sed/")))
127
85240322
LC
128(define-public tar
129 (package
130 (name "tar")
d6535cf1 131 (version "1.28")
85240322 132 (source (origin
87f5d366 133 (method url-fetch)
0db342a5 134 (uri (string-append "mirror://gnu/tar/tar-"
d6535cf1 135 version ".tar.xz"))
85240322
LC
136 (sha256
137 (base32
d6535cf1 138 "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4"))))
85240322 139 (build-system gnu-build-system)
f50d2669 140 (synopsis "Managing tar archives")
d45122f5 141 (description
a22dc0c4
LC
142 "Tar provides the ability to create tar archives, as well as the
143ability to extract, update or list files in an existing archive. It is
144useful for combining many files into one larger file, while maintaining
145directory structure and file information such as permissions and
79c311b8
LC
146creation/modification dates. GNU tar offers many extensions over the
147standard utility.")
4a44e743 148 (license gpl3+)
85240322
LC
149 (home-page "http://www.gnu.org/software/tar/")))
150
fbeec3d9
LC
151(define-public patch
152 (package
153 (name "patch")
f6408bc5
LC
154 (version "2.7.4")
155 (source (origin
156 (method url-fetch)
157 (uri (string-append "mirror://gnu/patch/patch-"
158 version ".tar.xz"))
159 (sha256
160 (base32
161 "02gikxjvcxysr4l65c8vivgz62xmalp0av5ypzff8vqhrq3vpb0f"))))
fbeec3d9 162 (build-system gnu-build-system)
00e79195 163 (native-inputs `(("ed", ed)))
f50d2669 164 (synopsis "Apply differences to originals, with optional backups")
d45122f5 165 (description
a22dc0c4 166 "Patch is a program that applies changes to files based on differences
79c311b8 167laid out as by the program \"diff\". The changes may be applied to one or more
a22dc0c4
LC
168files depending on the contents of the diff file. It accepts several
169different diff formats. It may also be used to revert previously applied
170differences.")
4a44e743 171 (license gpl3+)
fbeec3d9
LC
172 (home-page "http://savannah.gnu.org/projects/patch/")))
173
04a32ee5
LC
174(define-public diffutils
175 (package
176 (name "diffutils")
d83ae724 177 (version "3.3")
04a32ee5 178 (source (origin
87f5d366 179 (method url-fetch)
0db342a5 180 (uri (string-append "mirror://gnu/diffutils/diffutils-"
04a32ee5
LC
181 version ".tar.xz"))
182 (sha256
183 (base32
d83ae724 184 "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2"))))
04a32ee5 185 (build-system gnu-build-system)
f50d2669 186 (synopsis "Comparing and merging files")
d45122f5 187 (description
79c311b8
LC
188 "GNU Diffutils is a package containing tools for finding the
189differences between files. The \"diff\" command is used to show how two files
190differ, while \"cmp\" shows the offsets and line numbers where they differ.
191\"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
a22dc0c4 192interactive means to merge two files.")
4a44e743 193 (license gpl3+)
04a32ee5
LC
194 (home-page "http://www.gnu.org/software/diffutils/")))
195
af5521ca
LC
196(define-public findutils
197 (package
198 (name "findutils")
199 (version "4.4.2")
200 (source (origin
87f5d366 201 (method url-fetch)
0db342a5 202 (uri (string-append "mirror://gnu/findutils/findutils-"
af5521ca
LC
203 version ".tar.gz"))
204 (sha256
205 (base32
de80b504
LC
206 "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"))
207 (patches (list (search-patch "findutils-absolute-paths.patch")))))
af5521ca 208 (build-system gnu-build-system)
af5521ca 209 (arguments
de80b504
LC
210 ;; Work around cross-compilation failure.
211 ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
212 (if (%current-target-system)
213 '(#:configure-flags '("gl_cv_func_wcwidth_works=yes"))
214 '()))
f50d2669 215 (synopsis "Operating on files matching given criteria")
d45122f5 216 (description
a22dc0c4
LC
217 "Findutils supplies the basic file directory searching utilities of the
218GNU system. It consists of two primary searching utilities: \"find\"
219recursively searches for files in a directory according to given criteria and
220\"locate\" lists files in a database that match a query. Two auxiliary tools
79c311b8
LC
221are included: \"updatedb\" updates the file name database and \"xargs\" may be
222used to apply commands with arbitrarily long arguments.")
4a44e743 223 (license gpl3+)
af5521ca 224 (home-page "http://www.gnu.org/software/findutils/")))
2c957cd2
LC
225
226(define-public coreutils
227 (package
228 (name "coreutils")
a092cd82 229 (version "8.23")
2c957cd2 230 (source (origin
87f5d366 231 (method url-fetch)
0db342a5 232 (uri (string-append "mirror://gnu/coreutils/coreutils-"
2c957cd2
LC
233 version ".tar.xz"))
234 (sha256
235 (base32
a092cd82
MW
236 "0bdq6yggyl7nkc2pbl6pxhhyx15nyqhz3ds6rfn448n6rxdwlhzc"))
237 (patches (list (search-patch "coreutils-dummy-man.patch")))))
2c957cd2 238 (build-system gnu-build-system)
de59af4d 239 (inputs `(("acl" ,acl) ; TODO: add SELinux
2c1dea85
LC
240 ("gmp" ,gmp)))
241 (native-inputs
242 ;; Perl is needed to run tests in native builds, and to run the bundled
7f31c71c
LC
243 ;; copy of help2man. However, don't pass it when cross-compiling since
244 ;; that would lead it to try to run programs to get their '--help' output
245 ;; for help2man.
246 (if (%current-target-system)
247 '()
248 `(("perl" ,perl))))
9bf62d9b 249 (outputs '("out" "debug"))
2c957cd2 250 (arguments
8ba8aeb7
LC
251 `(#:parallel-build? #f ; help2man may be called too early
252 #:phases (alist-cons-before
253 'build 'patch-shell-references
254 (lambda* (#:key inputs #:allow-other-keys)
255 (let ((bash (assoc-ref inputs "bash")))
b47b2b52
LC
256 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
257 ;; that tests pass, since /bin/sh isn't in the chroot.
258 (setenv "SHELL" (which "sh"))
259
260 (substitute* (find-files "gnulib-tests" "\\.c$")
8ba8aeb7
LC
261 (("/bin/sh")
262 (format #f "~a/bin/sh" bash)))
263 (substitute* (find-files "tests" "\\.sh$")
264 (("#!/bin/sh")
b47b2b52 265 (format #f "#!~a/bin/sh" bash)))))
56c092ce 266 %standard-phases)))
f50d2669 267 (synopsis "Core GNU utilities (file, text, shell)")
d45122f5 268 (description
79c311b8 269 "GNU Coreutils includes all of the basic command-line tools that are
a22dc0c4
LC
270expected in a POSIX system. These provide the basic file, shell and text
271manipulation functions of the GNU system. Most of these tools offer extended
272functionality beyond that which is outlined in the POSIX standard.")
4a44e743 273 (license gpl3+)
2c957cd2 274 (home-page "http://www.gnu.org/software/coreutils/")))
af5521ca 275
ab776865
LC
276(define-public gnu-make
277 (package
278 (name "make")
6178ae9c 279 (version "4.1")
ab776865 280 (source (origin
87f5d366 281 (method url-fetch)
0db342a5 282 (uri (string-append "mirror://gnu/make/make-" version
ab776865
LC
283 ".tar.bz2"))
284 (sha256
285 (base32
6178ae9c 286 "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb"))
de80b504 287 (patches (list (search-patch "make-impure-dirs.patch")))))
ab776865 288 (build-system gnu-build-system)
aa6b0d6b 289 (native-inputs `(("pkg-config", pkg-config))) ; to detect Guile
ed41d48e 290 (inputs `(("guile" ,guile-2.0)))
9bf62d9b 291 (outputs '("out" "debug"))
ea8fbbf2 292 (arguments
de80b504 293 '(#:phases (alist-cons-before
ea8fbbf2
LC
294 'build 'set-default-shell
295 (lambda* (#:key inputs #:allow-other-keys)
296 ;; Change the default shell from /bin/sh.
297 (let ((bash (assoc-ref inputs "bash")))
298 (substitute* "job.c"
6178ae9c
MW
299 (("default_shell =.*$")
300 (format #f "default_shell = \"~a/bin/bash\";\n"
ea8fbbf2
LC
301 bash)))))
302 %standard-phases)))
f50d2669 303 (synopsis "Remake files automatically")
d45122f5 304 (description
a22dc0c4
LC
305 "Make is a program that is used to control the production of
306executables or other files from their source files. The process is
307controlled from a Makefile, in which the developer specifies how each file is
308generated from its source. It has powerful dependency resolution and the
309ability to determine when files have to be regenerated after their sources
79c311b8 310change. GNU make offers many powerful extensions over the standard utility.")
4a44e743 311 (license gpl3+)
ab776865
LC
312 (home-page "http://www.gnu.org/software/make/")))
313
8f6201a3
LC
314(define-public binutils
315 (package
316 (name "binutils")
84c84ce7 317 (version "2.25")
8f6201a3 318 (source (origin
87f5d366 319 (method url-fetch)
0db342a5 320 (uri (string-append "mirror://gnu/binutils/binutils-"
8f6201a3
LC
321 version ".tar.bz2"))
322 (sha256
323 (base32
84c84ce7 324 "08r9i26b05zcwb9zxb6zllpfdiiicdfsgbpsjlrjmvx3rxjzrpi2"))
2c1ceeac 325 (patches (list (search-patch "binutils-ld-new-dtags.patch")
6c95f363 326 (search-patch "binutils-loongson-workaround.patch")))))
8f6201a3
LC
327 (build-system gnu-build-system)
328
329 ;; TODO: Add dependency on zlib + those for Gold.
8f6201a3 330 (arguments
de80b504 331 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
01d45404
LC
332 ;; on GCC when bootstrapping.
333 "LDFLAGS=-static-libgcc"
8f6201a3 334
01d45404 335 ;; Don't search under /usr/lib & co.
444c64b0
LC
336 "--with-lib-path=/no-ld-lib-path"
337
338 ;; Glibc 2.17 has a "comparison of unsigned
339 ;; expression >= 0 is always true" in wchar.h.
6c95f363
LC
340 "--disable-werror"
341
342 ;; Install BFD. It ends up in a hidden directory,
343 ;; but it's here.
cc0a1282
LC
344 "--enable-install-libbfd"
345
346 ;; Make sure 'ar' and 'ranlib' produce archives in a
347 ;; deterministic fashion.
348 "--enable-deterministic-archives")))
8f6201a3 349
f50d2669 350 (synopsis "Binary utilities: bfd gas gprof ld")
d45122f5 351 (description
a22dc0c4 352 "GNU Binutils is a collection of tools for working with binary files.
c5779c93
LC
353Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
354Other tools include programs to display binary profiling information, list
355the strings in a binary file, and utilities for working with archives. The
356\"bfd\" library for working with executable and object formats is also
357included.")
4a44e743 358 (license gpl3+)
8f6201a3
LC
359 (home-page "http://www.gnu.org/software/binutils/")))
360
7cdeac02
LC
361(define-public glibc
362 (package
363 (name "glibc")
fdaae613 364 (version "2.21")
7cdeac02 365 (source (origin
87f5d366 366 (method url-fetch)
0db342a5 367 (uri (string-append "mirror://gnu/glibc/glibc-"
7cdeac02
LC
368 version ".tar.xz"))
369 (sha256
370 (base32
fdaae613 371 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
13990c73
LC
372 (snippet
373 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
374 ;; required on LFS distros to avoid loading the distro's libc.so
375 ;; instead of ours.
376 '(substitute* "sysdeps/unix/sysv/linux/configure"
377 (("use_ldconfig=yes")
378 "use_ldconfig=no")))
1faca892 379 (modules '((guix build utils)))
fdaae613 380 (patches (list (search-patch "glibc-ldd-x86_64.patch")))))
7cdeac02 381 (build-system gnu-build-system)
0a3da5b7
LC
382
383 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
384 ;; users should automatically pull Linux headers as well.
124b1767 385 (propagated-inputs `(("linux-headers" ,linux-libre-headers)))
0a3da5b7 386
97e11209 387 (outputs '("out" "debug"))
7f614e49 388
7cdeac02 389 (arguments
8197c978 390 `(#:out-of-source? #t
232010f8 391 #:parallel-build? #f ; There's at least one race in the build.
7cdeac02
LC
392 #:configure-flags
393 (list "--enable-add-ons"
394 "--sysconfdir=/etc"
7f614e49 395
97e11209
LC
396 ;; Installing a locale archive with all the locales is to
397 ;; expensive (~100 MiB), so we rely on users to install the
398 ;; locales they really want.
399 ;;
400 ;; Set the default locale path. In practice, $LOCPATH may be
401 ;; defined to point whatever locales users want. However, setuid
402 ;; binaries don't honor $LOCPATH, so they'll instead look into
403 ;; $libc_cv_localedir; we choose /run/current-system/locale, with
404 ;; the idea that it is going to be populated by the sysadmin.
405 ;;
7f614e49
LC
406 ;; `--localedir' is not honored, so work around it.
407 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
97e11209 408 (string-append "libc_cv_localedir=/run/current-system/locale")
7f614e49 409
7cdeac02
LC
410 (string-append "--with-headers="
411 (assoc-ref %build-inputs "linux-headers")
412 "/include")
5f456680 413
fdaae613 414 ;; This is the default for most architectures as of GNU libc 2.21,
39ccbfad
MW
415 ;; but we specify it explicitly for clarity and consistency. See
416 ;; "kernel-features.h" in the GNU libc for details.
417 "--enable-kernel=2.6.32"
5f456680 418
6e32f6c0 419 ;; Use our Bash instead of /bin/sh.
8cd8e97c 420 (string-append "BASH_SHELL="
6e32f6c0 421 (assoc-ref %build-inputs "bash")
8cd8e97c
LC
422 "/bin/bash")
423
424 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
425 "libc_cv_ssp=no")
6e32f6c0 426
7cdeac02
LC
427 #:tests? #f ; XXX
428 #:phases (alist-cons-before
429 'configure 'pre-configure
6e32f6c0
LC
430 (lambda* (#:key inputs outputs #:allow-other-keys)
431 (let* ((out (assoc-ref outputs "out"))
432 (bin (string-append out "/bin")))
7cdeac02
LC
433 ;; Use `pwd', not `/bin/pwd'.
434 (substitute* "configure"
0a3da5b7 435 (("/bin/pwd") "pwd"))
7cdeac02
LC
436
437 ;; Install the rpc data base file under `$out/etc/rpc'.
8197c978 438 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
7cdeac02
LC
439 (substitute* "sunrpc/Makefile"
440 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
441 (string-append out "/etc/rpc" suffix "\n"))
442 (("^install-others =.*$")
321b0996
LC
443 (string-append "install-others = " out "/etc/rpc\n")))
444
445 (substitute* "Makeconfig"
446 ;; According to
447 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
448 ;; linking against libgcc_s is not needed with GCC
449 ;; 4.7.1.
6e32f6c0
LC
450 ((" -lgcc_s") ""))
451
46866fad
LC
452 ;; Copy a statically-linked Bash in the output, with
453 ;; no references to other store paths.
6e32f6c0 454 (mkdir-p bin)
46866fad
LC
455 (copy-file (string-append (assoc-ref inputs "static-bash")
456 "/bin/bash")
6e32f6c0 457 (string-append bin "/bash"))
46866fad 458 (remove-store-references (string-append bin "/bash"))
6e32f6c0
LC
459 (chmod (string-append bin "/bash") #o555)
460
46866fad
LC
461 ;; Keep a symlink, for `patch-shebang' resolution.
462 (with-directory-excursion bin
463 (symlink "bash" "sh"))
464
6e32f6c0
LC
465 ;; Have `system' use that Bash.
466 (substitute* "sysdeps/posix/system.c"
467 (("#define[[:blank:]]+SHELL_PATH.*$")
468 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
469 out)))
470
471 ;; Same for `popen'.
472 (substitute* "libio/iopopen.c"
473 (("/bin/sh")
2ed6aa9e
LC
474 (string-append out "/bin/bash")))
475
476 ;; Make sure we don't retain a reference to the
477 ;; bootstrap Perl.
478 (substitute* "malloc/mtrace.pl"
479 (("^#!.*")
480 ;; The shebang can be omitted, because there's the
481 ;; "bilingual" eval/exec magic at the top of the file.
482 "")
483 (("exec @PERL@")
484 "exec perl"))))
97e11209 485 %standard-phases)))
7f614e49 486
de80b504 487 (inputs `(("static-bash" ,(static-package bash-light))))
8fd6487e
LC
488
489 ;; To build the manual, we need Texinfo and Perl.
490 (native-inputs `(("texinfo" ,texinfo)
491 ("perl" ,perl)))
492
d6718df4
LC
493 (native-search-paths
494 ;; Search path for packages that provide locale data. This is useful
495 ;; primarily in build environments.
496 (list (search-path-specification
497 (variable "LOCPATH")
8a00b930 498 (files '("lib/locale")))))
d6718df4 499
d45122f5
LC
500 (synopsis "The GNU C Library")
501 (description
7cdeac02
LC
502 "Any Unix-like operating system needs a C library: the library which
503defines the \"system calls\" and other basic facilities such as open, malloc,
504printf, exit...
505
506The GNU C library is used as the C library in the GNU system and most systems
507with the Linux kernel.")
4a44e743 508 (license lgpl2.0+)
7cdeac02
LC
509 (home-page "http://www.gnu.org/software/libc/")))
510
aee6180c
LC
511(define-public glibc-locales
512 (package
513 (inherit glibc)
514 (name "glibc-locales")
515 (source (origin (inherit (package-source glibc))
516 (patches (cons (search-patch "glibc-locales.patch")
517 (origin-patches (package-source glibc))))))
518 (synopsis "All the locales supported by the GNU C Library")
519 (description
520 "This package provides all the locales supported by the GNU C Library,
521more than 400 in total. To use them set the 'LOCPATH' environment variable to
522the 'share/locale' sub-directory of this package.")
523 (outputs '("out")) ;110+ MiB
605217be 524 (native-search-paths '())
aee6180c
LC
525 (arguments
526 (let ((args `(#:tests? #f #:strip-binaries? #f
527 ,@(package-arguments glibc))))
528 (substitute-keyword-arguments args
529 ((#:phases phases)
530 `(alist-replace
531 'build
532 (lambda* (#:key outputs #:allow-other-keys)
533 (let ((out (assoc-ref outputs "out")))
534 ;; Delete $out/bin, which contains 'bash'.
535 (delete-file-recursively (string-append out "/bin")))
536
537 (zero? (system* "make" "localedata/install-locales"
538 "-j" (number->string (parallel-job-count)))))
539 (alist-delete 'install ,phases)))
540 ((#:configure-flags flags)
541 `(append ,flags
b9e02a71 542 ;; Use $(libdir)/locale as is the case by default.
aee6180c
LC
543 (list (string-append "libc_cv_localedir="
544 (assoc-ref %outputs "out")
b9e02a71 545 "/lib/locale")))))))))
aee6180c 546
c9505f3f
LC
547(define-public glibc-utf8-locales
548 (package
549 (name "glibc-utf8-locales")
550 (version (package-version glibc))
551 (source #f)
552 (build-system trivial-build-system)
553 (arguments
554 '(#:modules ((guix build utils))
555 #:builder (begin
556 (use-modules (srfi srfi-1)
557 (guix build utils))
558
559 (let* ((libc (assoc-ref %build-inputs "glibc"))
560 (gzip (assoc-ref %build-inputs "gzip"))
561 (out (assoc-ref %outputs "out"))
562 (localedir (string-append out "/lib/locale")))
563 ;; 'localedef' needs 'gzip'.
564 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
565
566 (mkdir-p localedir)
567 (every (lambda (locale)
568 (zero? (system* "localedef" "--no-archive"
569 "--prefix" localedir "-i" locale
570 "-f" "UTF-8"
571 (string-append localedir "/"
572 locale
573 ".UTF-8"))))
574
575 ;; These are the locales commonly used for
576 ;; tests---e.g., in Guile's i18n tests.
577 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
578 (inputs `(("glibc" ,glibc)
579 ("gzip" ,gzip)))
580 (synopsis "Small sample of UTF-8 locales")
581 (description
582 "This package provides a small sample of UTF-8 locales mostly useful in
583test environments.")
584 (home-page (package-home-page glibc))
585 (license (package-license glibc))))
aee6180c 586
ce0614dd
LC
587(define-public which
588 (package
589 (name "which")
590 (version "2.20")
591 (source (origin
592 (method url-fetch)
593 (uri (string-append "mirror://gnu/which/which-"
594 version ".tar.gz"))
595 (sha256
596 (base32
597 "1y2p50zadb36izzh2zw4dm5hvdiydqf3qa88l8kav20dcmfbc5yl"))))
598 (build-system gnu-build-system)
599 (home-page "https://gnu.org/software/which/")
600 (synopsis "Find full path of shell commands")
601 (description
602 "The which program finds the location of executables in PATH, with a
603variety of options. It is an alternative to the shell \"type\" built-in
604command.")
605 (license gpl3+))) ; some files are under GPLv2+
606
e789d9a8
LC
607(define-public tzdata
608 (package
609 (name "tzdata")
4c8425b7 610 (version "2014j")
e789d9a8
LC
611 (source (origin
612 (method url-fetch)
613 (uri (string-append
614 "http://www.iana.org/time-zones/repository/releases/tzdata"
615 version ".tar.gz"))
616 (sha256
617 (base32
4c8425b7 618 "038fvj6zf51k6z9sbbxbj87ajaf69l3whal2vwshbm4l0qr71n52"))))
e789d9a8
LC
619 (build-system gnu-build-system)
620 (arguments
621 '(#:tests? #f
622 #:make-flags (let ((out (assoc-ref %outputs "out"))
623 (tmp (getenv "TMPDIR")))
624 (list (string-append "TOPDIR=" out)
625 (string-append "TZDIR=" out "/share/zoneinfo")
626
627 ;; Discard zic, dump, and tzselect, already
628 ;; provided by glibc.
629 (string-append "ETCDIR=" tmp "/etc")
630
631 ;; Likewise for the C library routines.
632 (string-append "LIBDIR=" tmp "/lib")
633 (string-append "MANDIR=" tmp "/man")
634
635 "AWK=awk"
636 "CC=gcc"))
637 #:modules ((guix build utils)
638 (guix build gnu-build-system)
639 (srfi srfi-1))
640 #:phases
641 (alist-replace
642 'unpack
c94d01ba
LC
643 (lambda* (#:key source inputs #:allow-other-keys)
644 (and (zero? (system* "tar" "xvf" source))
e789d9a8
LC
645 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
646 (alist-cons-after
647 'install 'post-install
648 (lambda* (#:key outputs #:allow-other-keys)
649 ;; Move data in the right place.
650 (let ((out (assoc-ref outputs "out")))
651 (copy-recursively (string-append out "/share/zoneinfo-posix")
652 (string-append out "/share/zoneinfo/posix"))
653 (copy-recursively (string-append out "/share/zoneinfo-leaps")
654 (string-append out "/share/zoneinfo/right"))
655 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
656 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
657 (alist-delete 'configure %standard-phases)))))
658 (inputs `(("tzcode" ,(origin
659 (method url-fetch)
660 (uri (string-append
661 "http://www.iana.org/time-zones/repository/releases/tzcode"
662 version ".tar.gz"))
663 (sha256
664 (base32
4c8425b7 665 "1qpd12imy7q5hb5fhk48mfw65s0xlrkmms0zr2gk0mj88qjn3m3z"))))))
e789d9a8
LC
666 (home-page "http://www.iana.org/time-zones")
667 (synopsis "Database of current and historical time zones")
668 (description "The Time Zone Database (often called tz or zoneinfo)
669contains code and data that represent the history of local time for many
35b9e423 670representative locations around the globe. It is updated periodically to
e789d9a8
LC
671reflect changes made by political bodies to time zone boundaries, UTC offsets,
672and daylight-saving rules.")
673 (license public-domain)))
674
bdb36958
LC
675(define-public (canonical-package package)
676 ;; Avoid circular dependency by lazily resolving 'commencement'.
677 (let* ((iface (resolve-interface '(gnu packages commencement)))
678 (proc (module-ref iface 'canonical-package)))
679 (proc package)))
571aa6cd 680
1722d680 681;;; base.scm ends here