1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
7 ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
8 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages base)
27 #:use-module ((guix licenses)
28 #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
29 #:use-module (gnu packages)
30 #:use-module (gnu packages acl)
31 #:use-module (gnu packages bash)
32 #:use-module (gnu packages ed)
33 #:use-module (gnu packages guile)
34 #:use-module (gnu packages multiprecision)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages linux)
38 #:use-module (gnu packages texinfo)
39 #:use-module (gnu packages hurd)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages gettext)
42 #:use-module (guix utils)
43 #:use-module (guix packages)
44 #:use-module (guix download)
45 #:use-module (guix git-download)
46 #:use-module (guix build-system gnu)
47 #:use-module (guix build-system trivial)
48 #:use-module (ice-9 match)
53 ;;; Base packages of the Guix-based GNU user-land software distribution.
63 (uri (string-append "mirror://gnu/hello/hello-" version
67 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
68 (build-system gnu-build-system)
69 (synopsis "Hello, GNU world: An example GNU package")
71 "GNU Hello prints the message \"Hello, world!\" and then exits. It
72 serves as an example of standard GNU coding practices. As such, it supports
73 command-line arguments, multiple languages, and so on.")
74 (home-page "http://www.gnu.org/software/hello/")
83 (uri (string-append "mirror://gnu/grep/grep-"
87 "0c38b67cnwchwzv4wq2gpz6smkhdxrac2hhssv8f0l04qnx867p2"))
88 (patches (search-patches "grep-timing-sensitive-test.patch"))))
89 (build-system gnu-build-system)
90 (native-inputs `(("perl" ,perl))) ;some of the tests require it
93 (modify-phases %standard-phases
94 (add-after 'install 'fix-egrep-and-fgrep
95 ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
96 ;; absolute file name instead of searching for it in $PATH.
97 (lambda* (#:key outputs #:allow-other-keys)
98 (let* ((out (assoc-ref outputs "out"))
99 (bin (string-append out "/bin")))
100 (substitute* (list (string-append bin "/egrep")
101 (string-append bin "/fgrep"))
103 (string-append "exec " bin "/grep")))
105 (synopsis "Print lines matching a pattern")
107 "grep is a tool for finding text inside files. Text is found by
108 matching a pattern provided by the user in one or many files. The pattern
109 may be provided as a basic or extended regular expression, or as fixed
110 strings. By default, the matching text is simply printed to the screen,
111 however the output can be greatly customized to include, for example, line
112 numbers. GNU grep offers many extensions over the standard utility,
113 including, for example, recursive directory searching.")
115 (home-page "http://www.gnu.org/software/grep/")))
123 (uri (string-append "mirror://gnu/sed/sed-" version
127 "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))
128 (patches (search-patches "sed-hurd-path-max.patch"))))
129 (build-system gnu-build-system)
130 (synopsis "Stream editor")
132 (if (%current-target-system)
134 `(#:phases (alist-cons-before
135 'patch-source-shebangs 'patch-test-suite
136 (lambda* (#:key inputs #:allow-other-keys)
137 (let ((bash (assoc-ref inputs "bash")))
138 (patch-makefile-SHELL "testsuite/Makefile.tests")
139 (substitute* '("testsuite/bsd.sh"
140 "testsuite/bug-regex9.c")
142 (string-append bash "/bin/bash")))))
145 "Sed is a non-interactive, text stream editor. It receives a text
146 input from a file or from standard input and it then applies a series of text
147 editing commands to the stream and prints its output to standard output. It
148 is often used for substituting text patterns in a stream. The GNU
149 implementation offers several extensions over the standard utility.")
151 (home-page "http://www.gnu.org/software/sed/")))
159 (uri (string-append "mirror://gnu/tar/tar-"
163 "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0"))
164 (patches (search-patches "tar-skip-unreliable-tests.patch"))))
165 (build-system gnu-build-system)
166 ;; Note: test suite requires ~1GiB of disk space.
168 '(#:phases (modify-phases %standard-phases
169 (add-before 'build 'set-shell-file-name
170 (lambda* (#:key inputs #:allow-other-keys)
171 ;; Do not use "/bin/sh" to run programs.
172 (let ((bash (assoc-ref inputs "bash")))
173 (substitute* "src/system.c"
175 (string-append bash "/bin/sh")))
178 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
179 ;; to refer to the target Bash.
180 (inputs (if (%current-target-system)
184 (synopsis "Managing tar archives")
186 "Tar provides the ability to create tar archives, as well as the
187 ability to extract, update or list files in an existing archive. It is
188 useful for combining many files into one larger file, while maintaining
189 directory structure and file information such as permissions and
190 creation/modification dates. GNU tar offers many extensions over the
193 (home-page "http://www.gnu.org/software/tar/")))
201 (uri (string-append "mirror://gnu/patch/patch-"
205 "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
206 (patches (search-patches "patch-hurd-path-max.patch"))))
207 (build-system gnu-build-system)
208 (native-inputs `(("ed" ,ed)))
209 (synopsis "Apply differences to originals, with optional backups")
211 "Patch is a program that applies changes to files based on differences
212 laid out as by the program \"diff\". The changes may be applied to one or more
213 files depending on the contents of the diff file. It accepts several
214 different diff formats. It may also be used to revert previously applied
217 (home-page "http://savannah.gnu.org/projects/patch/")))
219 (define-public diffutils
225 (uri (string-append "mirror://gnu/diffutils/diffutils-"
229 "0csmqfz8ks23kdjsq0v2ll1acqiz8lva06dj19mwmymrsp69ilys"))))
230 (build-system gnu-build-system)
231 (synopsis "Comparing and merging files")
233 "GNU Diffutils is a package containing tools for finding the
234 differences between files. The \"diff\" command is used to show how two files
235 differ, while \"cmp\" shows the offsets and line numbers where they differ.
236 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
237 interactive means to merge two files.")
239 (home-page "http://www.gnu.org/software/diffutils/")))
241 (define-public findutils
247 (uri (string-append "mirror://gnu/findutils/findutils-"
251 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
252 (patches (search-patches "findutils-localstatedir.patch"
253 "findutils-test-xargs.patch"))))
254 (build-system gnu-build-system)
256 `(#:configure-flags (list
257 ;; Tell 'updatedb' to write to /var.
258 "--localstatedir=/var"
260 ;; Work around cross-compilation failure. See
261 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
262 ,@(if (%current-target-system)
263 '("gl_cv_func_wcwidth_works=yes")
265 (synopsis "Operating on files matching given criteria")
267 "Findutils supplies the basic file directory searching utilities of the
268 GNU system. It consists of two primary searching utilities: \"find\"
269 recursively searches for files in a directory according to given criteria and
270 \"locate\" lists files in a database that match a query. Two auxiliary tools
271 are included: \"updatedb\" updates the file name database and \"xargs\" may be
272 used to apply commands with arbitrarily long arguments.")
274 (home-page "http://www.gnu.org/software/findutils/")))
276 (define-public coreutils
282 (uri (string-append "mirror://gnu/coreutils/coreutils-"
286 "11yfrnb94xzmvi4lhclkcmkqsbhww64wf234ya1aacjvg82prrii"))))
287 (build-system gnu-build-system)
288 (inputs `(("acl" ,acl) ; TODO: add SELinux
289 ("gmp" ,gmp) ;bignums in 'expr', yay!
291 ;; Drop the dependency on libcap when cross-compiling since it's
292 ;; not quite cross-compilable.
293 ,@(if (%current-target-system)
295 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
297 ;; Perl is needed to run tests in native builds, and to run the bundled
298 ;; copy of help2man. However, don't pass it when cross-compiling since
299 ;; that would lead it to try to run programs to get their '--help' output
301 (if (%current-target-system)
304 (outputs '("out" "debug"))
306 `(#:parallel-build? #f ; help2man may be called too early
307 #:phases (alist-cons-before
308 'build 'patch-shell-references
309 (lambda* (#:key inputs #:allow-other-keys)
310 (let ((bash (assoc-ref inputs "bash")))
311 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
312 ;; that tests pass, since /bin/sh isn't in the chroot.
313 (setenv "SHELL" (which "sh"))
315 (substitute* (find-files "gnulib-tests" "\\.c$")
317 (format #f "~a/bin/sh" bash)))
318 (substitute* (find-files "tests" "\\.sh$")
320 (format #f "#!~a/bin/sh" bash)))))
322 (synopsis "Core GNU utilities (file, text, shell)")
324 "GNU Coreutils includes all of the basic command-line tools that are
325 expected in a POSIX system. These provide the basic file, shell and text
326 manipulation functions of the GNU system. Most of these tools offer extended
327 functionality beyond that which is outlined in the POSIX standard.")
329 (home-page "http://www.gnu.org/software/coreutils/")))
331 (define-public coreutils-minimal
332 ;; Coreutils without its optional dependencies.
335 (name "coreutils-minimal")
339 (define-public gnu-make
345 (uri (string-append "mirror://gnu/make/make-" version
349 "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn"))
350 (patches (search-patches "make-impure-dirs.patch"))))
351 (build-system gnu-build-system)
352 (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile
353 (inputs `(("guile" ,guile-2.0)))
354 (outputs '("out" "debug"))
357 (modify-phases %standard-phases
358 (add-before 'build 'set-default-shell
359 (lambda* (#:key inputs #:allow-other-keys)
360 ;; Change the default shell from /bin/sh.
361 (let ((bash (assoc-ref inputs "bash")))
363 (("default_shell =.*$")
364 (format #f "default_shell = \"~a/bin/bash\";\n"
366 (synopsis "Remake files automatically")
368 "Make is a program that is used to control the production of
369 executables or other files from their source files. The process is
370 controlled from a Makefile, in which the developer specifies how each file is
371 generated from its source. It has powerful dependency resolution and the
372 ability to determine when files have to be regenerated after their sources
373 change. GNU make offers many powerful extensions over the standard utility.")
375 (home-page "http://www.gnu.org/software/make/")))
377 (define-public binutils
383 (uri (string-append "mirror://gnu/binutils/binutils-"
387 "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn"))
388 (patches (search-patches "binutils-ld-new-dtags.patch"
389 "binutils-loongson-workaround.patch"))))
390 (build-system gnu-build-system)
392 ;; TODO: Add dependency on zlib + those for Gold.
394 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
395 ;; on GCC when bootstrapping.
396 "LDFLAGS=-static-libgcc"
398 ;; Don't search under /usr/lib & co.
399 "--with-lib-path=/no-ld-lib-path"
401 ;; Glibc 2.17 has a "comparison of unsigned
402 ;; expression >= 0 is always true" in wchar.h.
405 ;; Install BFD. It ends up in a hidden directory,
407 "--enable-install-libbfd"
409 ;; Make sure 'ar' and 'ranlib' produce archives in a
410 ;; deterministic fashion.
411 "--enable-deterministic-archives")))
413 (synopsis "Binary utilities: bfd gas gprof ld")
415 "GNU Binutils is a collection of tools for working with binary files.
416 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
417 Other tools include programs to display binary profiling information, list
418 the strings in a binary file, and utilities for working with archives. The
419 \"bfd\" library for working with executable and object formats is also
422 (home-page "http://www.gnu.org/software/binutils/")))
424 (define* (make-ld-wrapper name #:key binutils
425 (guile (canonical-package guile-2.0))
426 (bash (canonical-package bash)) target
427 (guile-for-build guile))
428 "Return a package called NAME that contains a wrapper for the 'ld' program
429 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When
430 TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
431 'TARGET-ld'. The wrapper uses GUILE and BASH."
436 (build-system trivial-build-system)
437 (inputs `(("binutils" ,binutils)
440 ("wrapper" ,(search-path %load-path
441 "gnu/packages/ld-wrapper.in"))))
443 `(#:guile ,guile-for-build
444 #:modules ((guix build utils))
446 (use-modules (guix build utils)
447 (system base compile))
449 (let* ((out (assoc-ref %outputs "out"))
450 (bin (string-append out "/bin"))
452 `(string-append bin "/" ,target "-ld")
453 '(string-append bin "/ld")))
454 (go (string-append ld ".go")))
456 (setvbuf (current-output-port) _IOLBF)
457 (format #t "building ~s/bin/ld wrapper in ~s~%"
458 (assoc-ref %build-inputs "binutils")
462 (copy-file (assoc-ref %build-inputs "wrapper") ld)
467 (string-append (assoc-ref %build-inputs "guile")
470 (string-append (assoc-ref %build-inputs "bash")
473 (string-append (assoc-ref %build-inputs "binutils")
475 (string-append "/bin/"
479 (compile-file ld #:output-file go)))))
480 (synopsis "The linker wrapper")
482 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
483 missing '-rpath' flags, and to detect any misuse of libraries outside of the
485 (home-page "http://www.gnu.org/software/guix/")
488 (export make-ld-wrapper)
490 (define-public glibc/linux
496 (uri (string-append "mirror://gnu/glibc/glibc-"
500 "1lxmprg9gm73gvafxd503x70z32phwjzcy74i0adfi6ixzla7m4r"))
502 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
503 ;; required on LFS distros to avoid loading the distro's libc.so
505 '(substitute* "sysdeps/unix/sysv/linux/configure"
506 (("use_ldconfig=yes")
508 (modules '((guix build utils)))
509 (patches (search-patches "glibc-ldd-x86_64.patch"
510 "glibc-versioned-locpath.patch"
511 "glibc-o-largefile.patch"))))
512 (build-system gnu-build-system)
514 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
515 ;; users should automatically pull Linux headers as well.
516 (propagated-inputs `(("kernel-headers" ,linux-libre-headers)))
518 (outputs '("out" "debug"))
521 `(#:out-of-source? #t
523 ;; In version 2.21, there a race in the 'elf' directory, see
524 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
527 ;; The libraries have an empty RUNPATH, but some, such as the versioned
528 ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since
529 ;; these libraries are always going to be found anyway, just skip
531 #:validate-runpath? #f
534 (list "--enable-add-ons"
537 ;; Installing a locale archive with all the locales is to
538 ;; expensive (~100 MiB), so we rely on users to install the
539 ;; locales they really want.
541 ;; Set the default locale path. In practice, $LOCPATH may be
542 ;; defined to point whatever locales users want. However, setuid
543 ;; binaries don't honor $LOCPATH, so they'll instead look into
544 ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y,
545 ;; with the idea that it is going to be populated by the sysadmin.
546 ;; The "X.Y" sub-directory is because locale data formats are
547 ;; incompatible across libc versions; see
548 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
550 ;; `--localedir' is not honored, so work around it.
551 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
552 (string-append "libc_cv_complocaledir=/run/current-system/locale/"
555 (string-append "--with-headers="
556 (assoc-ref ,(if (%current-target-system)
557 '%build-target-inputs
562 ;; This is the default for most architectures as of GNU libc 2.21,
563 ;; but we specify it explicitly for clarity and consistency. See
564 ;; "kernel-features.h" in the GNU libc for details.
565 "--enable-kernel=2.6.32"
567 ;; Use our Bash instead of /bin/sh.
568 (string-append "BASH_SHELL="
569 (assoc-ref %build-inputs "bash")
572 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
573 "libc_cv_ssp=no" "libc_cv_ssp_strong=no")
576 #:phases (modify-phases %standard-phases
578 'configure 'pre-configure
579 (lambda* (#:key inputs native-inputs outputs
581 (let* ((out (assoc-ref outputs "out"))
582 (bin (string-append out "/bin"))
583 ;; FIXME: Normally we would look it up only in INPUTS
584 ;; but cross-base uses it as a native input.
585 (bash (or (assoc-ref inputs "static-bash")
586 (assoc-ref native-inputs "static-bash"))))
587 ;; Install the rpc data base file under `$out/etc/rpc'.
588 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
589 (substitute* "sunrpc/Makefile"
590 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
591 (string-append out "/etc/rpc" suffix "\n"))
592 (("^install-others =.*$")
593 (string-append "install-others = " out "/etc/rpc\n")))
595 (substitute* "Makeconfig"
597 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
598 ;; linking against libgcc_s is not needed with GCC
602 ;; Have `system' use that Bash.
603 (substitute* "sysdeps/posix/system.c"
604 (("#define[[:blank:]]+SHELL_PATH.*$")
605 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
609 (substitute* "libio/iopopen.c"
611 (string-append bash "/bin/bash")))
613 ;; Same for the shell used by the 'exec' functions for
614 ;; scripts that lack a shebang.
615 (substitute* (find-files "." "^paths\\.h$")
616 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
617 (string-append "#define _PATH_BSHELL \""
618 bash "/bin/bash\"\n")))
620 ;; Nscd uses __DATE__ and __TIME__ to create a string to
621 ;; make sure the client and server come from the same
622 ;; libc. Use something deterministic instead.
623 (substitute* "nscd/nscd_stat.c"
624 (("static const char compilation\\[21\\] =.*$")
626 "static const char compilation[21] = \""
627 (string-take (basename out) 20) "\";\n")))
629 ;; Make sure we don't retain a reference to the
631 (substitute* "malloc/mtrace.pl"
633 ;; The shebang can be omitted, because there's the
634 ;; "bilingual" eval/exec magic at the top of the file.
639 (inputs `(("static-bash" ,static-bash)))
641 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
642 ;; install the message catalogs, with 'msgfmt'.
643 (native-inputs `(("texinfo" ,texinfo)
645 ("gettext" ,gnu-gettext)))
648 ;; Search path for packages that provide locale data. This is useful
649 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
650 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
652 (list (search-path-specification
653 (variable "GUIX_LOCPATH")
654 (files '("lib/locale")))))
656 (synopsis "The GNU C Library")
658 "Any Unix-like operating system needs a C library: the library which
659 defines the \"system calls\" and other basic facilities such as open, malloc,
662 The GNU C library is used as the C library in the GNU system and most systems
663 with the Linux kernel.")
665 (home-page "http://www.gnu.org/software/libc/")))
667 (define-public glibc/hurd
668 ;; The Hurd's libc variant.
669 (package (inherit glibc/linux)
674 (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-"
675 version "-hurd+libpthread-20160518" ".tar.gz"))
678 "12zmdjviybpsdb2kq4cg98rds7909f0cc96fzdahdfrzlxx1q0px"))))
680 ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
681 ;; so both should be propagated.
682 (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers)))
684 `(,@(package-native-inputs glibc/linux)
689 (substitute-keyword-arguments (package-arguments glibc/linux)
690 ((#:phases original-phases)
691 ;; Add libmachuser.so and libhurduser.so to libc.so's search path.
692 ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-07/msg00051.html>.
694 'install 'augment-libc.so
695 (lambda* (#:key outputs #:allow-other-keys)
696 (let* ((out (assoc-ref outputs "out")))
697 (substitute* (string-append out "/lib/libc.so")
698 (("/[^ ]+/lib/libc.so.0.3")
699 (string-append out "/lib/libc.so.0.3" " libmachuser.so" " libhurduser.so"))))
702 'pre-configure 'pre-configure-set-pwd
704 ;; Use the right 'pwd'.
705 (substitute* "configure"
706 (("/bin/pwd") "pwd")))
708 ((#:configure-flags original-configure-flags)
709 `(append (list "--host=i586-pc-gnu"
711 ;; We need this to get a working openpty() function.
714 ;; nscd fails to build for GNU/Hurd:
715 ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
718 (filter (lambda (flag)
719 (not (string-prefix? "--enable-kernel=" flag)))
720 ,original-configure-flags)))))
721 (synopsis "The GNU C Library (GNU Hurd variant)")
722 (supported-systems %hurd-systems)))
724 (define* (glibc-for-target #:optional
725 (target (or (%current-target-system)
727 "Return the glibc for TARGET, GLIBC/LINUX for a Linux host or
728 GLIBC/HURD for a Hurd host"
730 ((or "i586-pc-gnu" "i586-gnu") glibc/hurd)
734 (identifier-syntax (glibc-for-target)))
736 (define-public glibc-2.22
737 ;; The old libc, which we use mostly to build locale data in the old format
738 ;; (which the new libc can cope with.)
743 (inherit (package-source glibc))
744 (uri (string-append "mirror://gnu/glibc/glibc-"
748 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
749 (patches (search-patches "glibc-ldd-x86_64.patch"))))
751 (substitute-keyword-arguments (package-arguments glibc)
753 `(modify-phases ,phases
754 (add-before 'configure 'fix-pwd
756 ;; Use `pwd' instead of `/bin/pwd' for glibc-2.21
757 (substitute* "configure"
758 (("/bin/pwd") "pwd"))))))))))
760 (define-public glibc-2.21
761 ;; The old libc, which we use mostly to build locale data in the old format
762 ;; (which the new libc can cope with.)
767 (inherit (package-source glibc))
768 (uri (string-append "mirror://gnu/glibc/glibc-"
772 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
773 (patches (search-patches "glibc-ldd-x86_64.patch"))))))
775 (define-public glibc-locales
778 (name "glibc-locales")
779 (source (origin (inherit (package-source glibc))
780 (patches (cons (search-patch "glibc-locales.patch")
781 (origin-patches (package-source glibc))))))
782 (synopsis "All the locales supported by the GNU C Library")
784 "This package provides all the locales supported by the GNU C Library,
785 more than 400 in total. To use them set the 'LOCPATH' environment variable to
786 the 'share/locale' sub-directory of this package.")
787 (outputs '("out")) ;110+ MiB
788 (native-search-paths '())
790 (let ((args `(#:tests? #f #:strip-binaries? #f
791 ,@(package-arguments glibc))))
792 (substitute-keyword-arguments args
796 (lambda* (#:key outputs #:allow-other-keys)
797 (zero? (system* "make" "localedata/install-locales"
798 "-j" (number->string (parallel-job-count)))))
799 (alist-delete 'install ,phases)))
800 ((#:configure-flags flags)
802 ;; Use $(libdir)/locale/X.Y as is the case by default.
803 (list (string-append "libc_cv_complocaledir="
804 (assoc-ref %outputs "out")
806 ,(package-version glibc))))))))))
808 (define-public glibc-utf8-locales
810 (name "glibc-utf8-locales")
811 (version (package-version glibc))
813 (build-system trivial-build-system)
815 `(#:modules ((guix build utils))
817 (use-modules (srfi srfi-1)
820 (let* ((libc (assoc-ref %build-inputs "glibc"))
821 (gzip (assoc-ref %build-inputs "gzip"))
822 (out (assoc-ref %outputs "out"))
823 (localedir (string-append out "/lib/locale/"
825 ;; 'localedef' needs 'gzip'.
826 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
829 (every (lambda (locale)
831 ;; Use the "normalized codeset" by
832 ;; default--e.g., "en_US.utf8".
833 (string-append localedir "/" locale ".utf8"))
835 (and (zero? (system* "localedef" "--no-archive"
840 ;; For backward compatibility with Guix
841 ;; <= 0.8.3, add "xx_YY.UTF-8".
842 (symlink (string-append locale ".utf8")
843 (string-append localedir "/"
847 ;; These are the locales commonly used for
848 ;; tests---e.g., in Guile's i18n tests.
849 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
850 (inputs `(("glibc" ,glibc)
852 (synopsis "Small sample of UTF-8 locales")
854 "This package provides a small sample of UTF-8 locales mostly useful in
856 (home-page (package-home-page glibc))
857 (license (package-license glibc))))
865 (uri (string-append "mirror://gnu/which/which-"
869 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
870 (build-system gnu-build-system)
871 (home-page "https://gnu.org/software/which/")
872 (synopsis "Find full path of shell commands")
874 "The which program finds the location of executables in PATH, with a
875 variety of options. It is an alternative to the shell \"type\" built-in
877 (license gpl3+))) ; some files are under GPLv2+
879 (define-public glibc/hurd-headers
880 (package (inherit glibc/hurd)
881 (name "glibc-hurd-headers")
883 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
884 ("hurd-headers" ,hurd-headers)))
886 (substitute-keyword-arguments (package-arguments glibc/hurd)
887 ;; We just pass the flags really needed to build the headers.
888 ((#:configure-flags _)
889 `(list "--enable-add-ons"
891 "--enable-obsolete-rpc"))
895 (lambda* (#:key outputs #:allow-other-keys)
896 (and (zero? (system* "make" "install-headers"))
898 ;; Make an empty stubs.h to work around not being able to
899 ;; produce a valid stubs.h and causing the build to fail. See
900 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
901 (let ((out (assoc-ref outputs "out")))
904 (string-append out "/include/gnu/stubs.h"))))))
911 'configure 'pre-configure
913 ;; Use the right 'pwd'.
914 (substitute* "configure"
915 (("/bin/pwd") "pwd")))
916 %standard-phases))))))))
918 (define-public tzdata
925 "http://www.iana.org/time-zones/repository/releases/tzdata"
929 "1c024mg4gy572vgdj9rk4dqnb33iap06zs8ibasisbyi1089b37d"))))
930 (build-system gnu-build-system)
933 #:make-flags (let ((out (assoc-ref %outputs "out"))
934 (tmp (getenv "TMPDIR")))
935 (list (string-append "TOPDIR=" out)
936 (string-append "TZDIR=" out "/share/zoneinfo")
938 ;; Discard zic, dump, and tzselect, already
939 ;; provided by glibc.
940 (string-append "ETCDIR=" tmp "/etc")
942 ;; Likewise for the C library routines.
943 (string-append "LIBDIR=" tmp "/lib")
944 (string-append "MANDIR=" tmp "/man")
948 #:modules ((guix build utils)
949 (guix build gnu-build-system)
954 (lambda* (#:key source inputs #:allow-other-keys)
955 (and (zero? (system* "tar" "xvf" source))
956 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
958 'install 'post-install
959 (lambda* (#:key outputs #:allow-other-keys)
960 ;; Move data in the right place.
961 (let ((out (assoc-ref outputs "out")))
962 (copy-recursively (string-append out "/share/zoneinfo-posix")
963 (string-append out "/share/zoneinfo/posix"))
964 (copy-recursively (string-append out "/share/zoneinfo-leaps")
965 (string-append out "/share/zoneinfo/right"))
966 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
967 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
968 (alist-delete 'configure %standard-phases)))))
969 (inputs `(("tzcode" ,(origin
972 "http://www.iana.org/time-zones/repository/releases/tzcode"
976 "1vb6n29ik7dzhffzzcnskbhmn6h1dxzan3zanbp118wh8hw5yckj"))))))
977 (home-page "http://www.iana.org/time-zones")
978 (synopsis "Database of current and historical time zones")
979 (description "The Time Zone Database (often called tz or zoneinfo)
980 contains code and data that represent the history of local time for many
981 representative locations around the globe. It is updated periodically to
982 reflect changes made by political bodies to time zone boundaries, UTC offsets,
983 and daylight-saving rules.")
984 (license public-domain)))
986 (define-public libiconv
992 (uri (string-append "mirror://gnu/libiconv/libiconv-"
996 "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))
997 (modules '((guix build utils)))
999 ;; Work around "declared gets" error on glibc systems (fixed by
1000 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
1001 '(substitute* "srclib/stdio.in.h"
1002 (("^#undef gets") "")
1003 (("^_GL_WARN_ON_USE \\(gets.*") "")))))
1004 (build-system gnu-build-system)
1005 (synopsis "Character set conversion library")
1007 "libiconv provides an implementation of the iconv function for systems
1008 that lack it. iconv is used to convert between character encodings in a
1009 program. It supports a wide variety of different encodings.")
1010 (home-page "http://www.gnu.org/software/libiconv/")
1013 (define-public (canonical-package package)
1014 ;; Avoid circular dependency by lazily resolving 'commencement'.
1015 (let* ((iface (resolve-interface '(gnu packages commencement)))
1016 (proc (module-ref iface 'canonical-package)))
1019 ;;; base.scm ends here