gnu: ncurses: Install terminfo files when cross-compiling.
[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")
266d26df 154 (version "2.7.5")
f6408bc5
LC
155 (source (origin
156 (method url-fetch)
157 (uri (string-append "mirror://gnu/patch/patch-"
158 version ".tar.xz"))
159 (sha256
160 (base32
266d26df 161 "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))))
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
211db2f6
LC
391
392 ;; In version 2.21, there a race in the 'elf' directory, see
393 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
394 #:parallel-build? #f
395
112da588
LC
396 ;; The libraries have an empty RUNPATH, but some, such as the versioned
397 ;; libraries (libdl-2.21.so, etc.) have ld.so marked as NEEDED. Since
398 ;; these libraries are always going to be found anyway, just skip
399 ;; RUNPATH checks.
400 #:validate-runpath? #f
401
7cdeac02
LC
402 #:configure-flags
403 (list "--enable-add-ons"
404 "--sysconfdir=/etc"
7f614e49 405
97e11209
LC
406 ;; Installing a locale archive with all the locales is to
407 ;; expensive (~100 MiB), so we rely on users to install the
408 ;; locales they really want.
409 ;;
410 ;; Set the default locale path. In practice, $LOCPATH may be
411 ;; defined to point whatever locales users want. However, setuid
412 ;; binaries don't honor $LOCPATH, so they'll instead look into
413 ;; $libc_cv_localedir; we choose /run/current-system/locale, with
414 ;; the idea that it is going to be populated by the sysadmin.
415 ;;
7f614e49
LC
416 ;; `--localedir' is not honored, so work around it.
417 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
97e11209 418 (string-append "libc_cv_localedir=/run/current-system/locale")
7f614e49 419
7cdeac02
LC
420 (string-append "--with-headers="
421 (assoc-ref %build-inputs "linux-headers")
422 "/include")
5f456680 423
fdaae613 424 ;; This is the default for most architectures as of GNU libc 2.21,
39ccbfad
MW
425 ;; but we specify it explicitly for clarity and consistency. See
426 ;; "kernel-features.h" in the GNU libc for details.
427 "--enable-kernel=2.6.32"
5f456680 428
6e32f6c0 429 ;; Use our Bash instead of /bin/sh.
8cd8e97c 430 (string-append "BASH_SHELL="
6e32f6c0 431 (assoc-ref %build-inputs "bash")
8cd8e97c
LC
432 "/bin/bash")
433
434 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
435 "libc_cv_ssp=no")
6e32f6c0 436
7cdeac02
LC
437 #:tests? #f ; XXX
438 #:phases (alist-cons-before
439 'configure 'pre-configure
6170834d
LC
440 (lambda* (#:key inputs native-inputs outputs
441 #:allow-other-keys)
6e32f6c0
LC
442 (let* ((out (assoc-ref outputs "out"))
443 (bin (string-append out "/bin")))
7cdeac02
LC
444 ;; Use `pwd', not `/bin/pwd'.
445 (substitute* "configure"
0a3da5b7 446 (("/bin/pwd") "pwd"))
7cdeac02
LC
447
448 ;; Install the rpc data base file under `$out/etc/rpc'.
8197c978 449 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
7cdeac02
LC
450 (substitute* "sunrpc/Makefile"
451 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
452 (string-append out "/etc/rpc" suffix "\n"))
453 (("^install-others =.*$")
321b0996
LC
454 (string-append "install-others = " out "/etc/rpc\n")))
455
456 (substitute* "Makeconfig"
457 ;; According to
458 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
459 ;; linking against libgcc_s is not needed with GCC
460 ;; 4.7.1.
6e32f6c0
LC
461 ((" -lgcc_s") ""))
462
46866fad
LC
463 ;; Copy a statically-linked Bash in the output, with
464 ;; no references to other store paths.
6170834d
LC
465 ;; FIXME: Normally we would look it up only in INPUTS but
466 ;; cross-base uses it as a native input.
6e32f6c0 467 (mkdir-p bin)
6170834d
LC
468 (copy-file (string-append (or (assoc-ref inputs
469 "static-bash")
470 (assoc-ref native-inputs
471 "static-bash"))
46866fad 472 "/bin/bash")
6e32f6c0 473 (string-append bin "/bash"))
46866fad 474 (remove-store-references (string-append bin "/bash"))
6e32f6c0
LC
475 (chmod (string-append bin "/bash") #o555)
476
46866fad
LC
477 ;; Keep a symlink, for `patch-shebang' resolution.
478 (with-directory-excursion bin
479 (symlink "bash" "sh"))
480
6e32f6c0
LC
481 ;; Have `system' use that Bash.
482 (substitute* "sysdeps/posix/system.c"
483 (("#define[[:blank:]]+SHELL_PATH.*$")
484 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
485 out)))
486
487 ;; Same for `popen'.
488 (substitute* "libio/iopopen.c"
489 (("/bin/sh")
2ed6aa9e
LC
490 (string-append out "/bin/bash")))
491
492 ;; Make sure we don't retain a reference to the
493 ;; bootstrap Perl.
494 (substitute* "malloc/mtrace.pl"
495 (("^#!.*")
496 ;; The shebang can be omitted, because there's the
497 ;; "bilingual" eval/exec magic at the top of the file.
498 "")
499 (("exec @PERL@")
500 "exec perl"))))
97e11209 501 %standard-phases)))
7f614e49 502
de80b504 503 (inputs `(("static-bash" ,(static-package bash-light))))
8fd6487e
LC
504
505 ;; To build the manual, we need Texinfo and Perl.
506 (native-inputs `(("texinfo" ,texinfo)
507 ("perl" ,perl)))
508
d6718df4
LC
509 (native-search-paths
510 ;; Search path for packages that provide locale data. This is useful
511 ;; primarily in build environments.
512 (list (search-path-specification
513 (variable "LOCPATH")
8a00b930 514 (files '("lib/locale")))))
d6718df4 515
d45122f5
LC
516 (synopsis "The GNU C Library")
517 (description
7cdeac02
LC
518 "Any Unix-like operating system needs a C library: the library which
519defines the \"system calls\" and other basic facilities such as open, malloc,
520printf, exit...
521
522The GNU C library is used as the C library in the GNU system and most systems
523with the Linux kernel.")
4a44e743 524 (license lgpl2.0+)
7cdeac02
LC
525 (home-page "http://www.gnu.org/software/libc/")))
526
aee6180c
LC
527(define-public glibc-locales
528 (package
529 (inherit glibc)
530 (name "glibc-locales")
531 (source (origin (inherit (package-source glibc))
532 (patches (cons (search-patch "glibc-locales.patch")
533 (origin-patches (package-source glibc))))))
534 (synopsis "All the locales supported by the GNU C Library")
535 (description
536 "This package provides all the locales supported by the GNU C Library,
537more than 400 in total. To use them set the 'LOCPATH' environment variable to
538the 'share/locale' sub-directory of this package.")
539 (outputs '("out")) ;110+ MiB
605217be 540 (native-search-paths '())
aee6180c
LC
541 (arguments
542 (let ((args `(#:tests? #f #:strip-binaries? #f
543 ,@(package-arguments glibc))))
544 (substitute-keyword-arguments args
545 ((#:phases phases)
546 `(alist-replace
547 'build
548 (lambda* (#:key outputs #:allow-other-keys)
549 (let ((out (assoc-ref outputs "out")))
550 ;; Delete $out/bin, which contains 'bash'.
551 (delete-file-recursively (string-append out "/bin")))
552
553 (zero? (system* "make" "localedata/install-locales"
554 "-j" (number->string (parallel-job-count)))))
555 (alist-delete 'install ,phases)))
556 ((#:configure-flags flags)
557 `(append ,flags
b9e02a71 558 ;; Use $(libdir)/locale as is the case by default.
aee6180c
LC
559 (list (string-append "libc_cv_localedir="
560 (assoc-ref %outputs "out")
b9e02a71 561 "/lib/locale")))))))))
aee6180c 562
c9505f3f
LC
563(define-public glibc-utf8-locales
564 (package
565 (name "glibc-utf8-locales")
566 (version (package-version glibc))
567 (source #f)
568 (build-system trivial-build-system)
569 (arguments
570 '(#:modules ((guix build utils))
571 #:builder (begin
572 (use-modules (srfi srfi-1)
573 (guix build utils))
574
575 (let* ((libc (assoc-ref %build-inputs "glibc"))
576 (gzip (assoc-ref %build-inputs "gzip"))
577 (out (assoc-ref %outputs "out"))
578 (localedir (string-append out "/lib/locale")))
579 ;; 'localedef' needs 'gzip'.
580 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
581
582 (mkdir-p localedir)
583 (every (lambda (locale)
584 (zero? (system* "localedef" "--no-archive"
585 "--prefix" localedir "-i" locale
586 "-f" "UTF-8"
587 (string-append localedir "/"
588 locale
589 ".UTF-8"))))
590
591 ;; These are the locales commonly used for
592 ;; tests---e.g., in Guile's i18n tests.
593 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
594 (inputs `(("glibc" ,glibc)
595 ("gzip" ,gzip)))
596 (synopsis "Small sample of UTF-8 locales")
597 (description
598 "This package provides a small sample of UTF-8 locales mostly useful in
599test environments.")
600 (home-page (package-home-page glibc))
601 (license (package-license glibc))))
aee6180c 602
ce0614dd
LC
603(define-public which
604 (package
605 (name "which")
606 (version "2.20")
607 (source (origin
608 (method url-fetch)
609 (uri (string-append "mirror://gnu/which/which-"
610 version ".tar.gz"))
611 (sha256
612 (base32
613 "1y2p50zadb36izzh2zw4dm5hvdiydqf3qa88l8kav20dcmfbc5yl"))))
614 (build-system gnu-build-system)
615 (home-page "https://gnu.org/software/which/")
616 (synopsis "Find full path of shell commands")
617 (description
618 "The which program finds the location of executables in PATH, with a
619variety of options. It is an alternative to the shell \"type\" built-in
620command.")
621 (license gpl3+))) ; some files are under GPLv2+
622
e789d9a8
LC
623(define-public tzdata
624 (package
625 (name "tzdata")
a06af9f5 626 (version "2015b")
e789d9a8
LC
627 (source (origin
628 (method url-fetch)
629 (uri (string-append
630 "http://www.iana.org/time-zones/repository/releases/tzdata"
631 version ".tar.gz"))
632 (sha256
633 (base32
a06af9f5 634 "0qmdr1yqqn94b5a54axwszfzimyxg27i6xsfmp0sswd3nfjw2sjm"))))
e789d9a8
LC
635 (build-system gnu-build-system)
636 (arguments
637 '(#:tests? #f
638 #:make-flags (let ((out (assoc-ref %outputs "out"))
639 (tmp (getenv "TMPDIR")))
640 (list (string-append "TOPDIR=" out)
641 (string-append "TZDIR=" out "/share/zoneinfo")
642
643 ;; Discard zic, dump, and tzselect, already
644 ;; provided by glibc.
645 (string-append "ETCDIR=" tmp "/etc")
646
647 ;; Likewise for the C library routines.
648 (string-append "LIBDIR=" tmp "/lib")
649 (string-append "MANDIR=" tmp "/man")
650
651 "AWK=awk"
652 "CC=gcc"))
653 #:modules ((guix build utils)
654 (guix build gnu-build-system)
655 (srfi srfi-1))
656 #:phases
657 (alist-replace
658 'unpack
c94d01ba
LC
659 (lambda* (#:key source inputs #:allow-other-keys)
660 (and (zero? (system* "tar" "xvf" source))
e789d9a8
LC
661 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
662 (alist-cons-after
663 'install 'post-install
664 (lambda* (#:key outputs #:allow-other-keys)
665 ;; Move data in the right place.
666 (let ((out (assoc-ref outputs "out")))
667 (copy-recursively (string-append out "/share/zoneinfo-posix")
668 (string-append out "/share/zoneinfo/posix"))
669 (copy-recursively (string-append out "/share/zoneinfo-leaps")
670 (string-append out "/share/zoneinfo/right"))
671 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
672 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
673 (alist-delete 'configure %standard-phases)))))
674 (inputs `(("tzcode" ,(origin
675 (method url-fetch)
676 (uri (string-append
677 "http://www.iana.org/time-zones/repository/releases/tzcode"
678 version ".tar.gz"))
679 (sha256
680 (base32
a06af9f5 681 "0xjxlgzva13y8qi3vfbb3nq5pii8ax9wi4yc7vj9134rbciz2s76"))))))
e789d9a8
LC
682 (home-page "http://www.iana.org/time-zones")
683 (synopsis "Database of current and historical time zones")
684 (description "The Time Zone Database (often called tz or zoneinfo)
685contains code and data that represent the history of local time for many
35b9e423 686representative locations around the globe. It is updated periodically to
e789d9a8
LC
687reflect changes made by political bodies to time zone boundaries, UTC offsets,
688and daylight-saving rules.")
689 (license public-domain)))
690
bdb36958
LC
691(define-public (canonical-package package)
692 ;; Avoid circular dependency by lazily resolving 'commencement'.
693 (let* ((iface (resolve-interface '(gnu packages commencement)))
694 (proc (module-ref iface 'canonical-package)))
695 (proc package)))
571aa6cd 696
1722d680 697;;; base.scm ends here