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