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
91 (synopsis "Print lines matching a pattern")
93 "grep is a tool for finding text inside files. Text is found by
94 matching a pattern provided by the user in one or many files. The pattern
95 may be provided as a basic or extended regular expression, or as fixed
96 strings. By default, the matching text is simply printed to the screen,
97 however the output can be greatly customized to include, for example, line
98 numbers. GNU grep offers many extensions over the standard utility,
99 including, for example, recursive directory searching.")
101 (home-page "http://www.gnu.org/software/grep/")))
109 (uri (string-append "mirror://gnu/sed/sed-" version
113 "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))
114 (patches (search-patches "sed-hurd-path-max.patch"))))
115 (build-system gnu-build-system)
116 (synopsis "Stream editor")
118 (if (%current-target-system)
120 `(#:phases (alist-cons-before
121 'patch-source-shebangs 'patch-test-suite
122 (lambda* (#:key inputs #:allow-other-keys)
123 (let ((bash (assoc-ref inputs "bash")))
124 (patch-makefile-SHELL "testsuite/Makefile.tests")
125 (substitute* '("testsuite/bsd.sh"
126 "testsuite/bug-regex9.c")
128 (string-append bash "/bin/bash")))))
131 "Sed is a non-interactive, text stream editor. It receives a text
132 input from a file or from standard input and it then applies a series of text
133 editing commands to the stream and prints its output to standard output. It
134 is often used for substituting text patterns in a stream. The GNU
135 implementation offers several extensions over the standard utility.")
137 (home-page "http://www.gnu.org/software/sed/")))
145 (uri (string-append "mirror://gnu/tar/tar-"
149 "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0"))
150 (patches (search-patches "tar-skip-unreliable-tests.patch"))))
151 (build-system gnu-build-system)
152 ;; Note: test suite requires ~1GiB of disk space.
154 '(#:phases (modify-phases %standard-phases
155 (add-before 'build 'set-shell-file-name
156 (lambda* (#:key inputs #:allow-other-keys)
157 ;; Do not use "/bin/sh" to run programs.
158 (let ((bash (assoc-ref inputs "bash")))
159 (substitute* "src/system.c"
161 (string-append bash "/bin/sh")))
164 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
165 ;; to refer to the target Bash.
166 (inputs (if (%current-target-system)
170 (synopsis "Managing tar archives")
172 "Tar provides the ability to create tar archives, as well as the
173 ability to extract, update or list files in an existing archive. It is
174 useful for combining many files into one larger file, while maintaining
175 directory structure and file information such as permissions and
176 creation/modification dates. GNU tar offers many extensions over the
179 (home-page "http://www.gnu.org/software/tar/")))
187 (uri (string-append "mirror://gnu/patch/patch-"
191 "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
192 (patches (search-patches "patch-hurd-path-max.patch"))))
193 (build-system gnu-build-system)
194 (native-inputs `(("ed" ,ed)))
195 (synopsis "Apply differences to originals, with optional backups")
197 "Patch is a program that applies changes to files based on differences
198 laid out as by the program \"diff\". The changes may be applied to one or more
199 files depending on the contents of the diff file. It accepts several
200 different diff formats. It may also be used to revert previously applied
203 (home-page "http://savannah.gnu.org/projects/patch/")))
205 (define-public diffutils
211 (uri (string-append "mirror://gnu/diffutils/diffutils-"
215 "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2"))))
216 (build-system gnu-build-system)
217 (synopsis "Comparing and merging files")
219 "GNU Diffutils is a package containing tools for finding the
220 differences between files. The \"diff\" command is used to show how two files
221 differ, while \"cmp\" shows the offsets and line numbers where they differ.
222 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
223 interactive means to merge two files.")
225 (home-page "http://www.gnu.org/software/diffutils/")))
227 (define-public findutils
233 (uri (string-append "mirror://gnu/findutils/findutils-"
237 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
238 (patches (search-patches "findutils-localstatedir.patch"
239 "findutils-test-xargs.patch"))))
240 (build-system gnu-build-system)
242 `(#:configure-flags (list
243 ;; Tell 'updatedb' to write to /var.
244 "--localstatedir=/var"
246 ;; Work around cross-compilation failure. See
247 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
248 ,@(if (%current-target-system)
249 '("gl_cv_func_wcwidth_works=yes")
251 (synopsis "Operating on files matching given criteria")
253 "Findutils supplies the basic file directory searching utilities of the
254 GNU system. It consists of two primary searching utilities: \"find\"
255 recursively searches for files in a directory according to given criteria and
256 \"locate\" lists files in a database that match a query. Two auxiliary tools
257 are included: \"updatedb\" updates the file name database and \"xargs\" may be
258 used to apply commands with arbitrarily long arguments.")
260 (home-page "http://www.gnu.org/software/findutils/")))
262 (define-public coreutils
268 (uri (string-append "mirror://gnu/coreutils/coreutils-"
272 "11yfrnb94xzmvi4lhclkcmkqsbhww64wf234ya1aacjvg82prrii"))))
273 (build-system gnu-build-system)
274 (inputs `(("acl" ,acl) ; TODO: add SELinux
275 ("gmp" ,gmp) ;bignums in 'expr', yay!
277 ;; Drop the dependency on libcap when cross-compiling since it's
278 ;; not quite cross-compilable.
279 ,@(if (%current-target-system)
281 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
283 ;; Perl is needed to run tests in native builds, and to run the bundled
284 ;; copy of help2man. However, don't pass it when cross-compiling since
285 ;; that would lead it to try to run programs to get their '--help' output
287 (if (%current-target-system)
290 (outputs '("out" "debug"))
292 `(#:parallel-build? #f ; help2man may be called too early
293 #:phases (alist-cons-before
294 'build 'patch-shell-references
295 (lambda* (#:key inputs #:allow-other-keys)
296 (let ((bash (assoc-ref inputs "bash")))
297 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
298 ;; that tests pass, since /bin/sh isn't in the chroot.
299 (setenv "SHELL" (which "sh"))
301 (substitute* (find-files "gnulib-tests" "\\.c$")
303 (format #f "~a/bin/sh" bash)))
304 (substitute* (find-files "tests" "\\.sh$")
306 (format #f "#!~a/bin/sh" bash)))))
308 (synopsis "Core GNU utilities (file, text, shell)")
310 "GNU Coreutils includes all of the basic command-line tools that are
311 expected in a POSIX system. These provide the basic file, shell and text
312 manipulation functions of the GNU system. Most of these tools offer extended
313 functionality beyond that which is outlined in the POSIX standard.")
315 (home-page "http://www.gnu.org/software/coreutils/")))
317 (define-public coreutils-minimal
318 ;; Coreutils without its optional dependencies.
321 (name "coreutils-minimal")
325 (define-public gnu-make
331 (uri (string-append "mirror://gnu/make/make-" version
335 "0pv5rvz5pp4njxiz3syf786d2xp4j7gzddwjvgw5zmz55yvf6p2f"))
336 (patches (search-patches "make-impure-dirs.patch"))))
337 (build-system gnu-build-system)
338 (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile
339 (inputs `(("guile" ,guile-2.0)))
340 (outputs '("out" "debug"))
342 '(#:phases (alist-cons-before
343 'build 'set-default-shell
344 (lambda* (#:key inputs #:allow-other-keys)
345 ;; Change the default shell from /bin/sh.
346 (let ((bash (assoc-ref inputs "bash")))
348 (("default_shell =.*$")
349 (format #f "default_shell = \"~a/bin/bash\";\n"
352 (synopsis "Remake files automatically")
354 "Make is a program that is used to control the production of
355 executables or other files from their source files. The process is
356 controlled from a Makefile, in which the developer specifies how each file is
357 generated from its source. It has powerful dependency resolution and the
358 ability to determine when files have to be regenerated after their sources
359 change. GNU make offers many powerful extensions over the standard utility.")
361 (home-page "http://www.gnu.org/software/make/")))
363 (define-public binutils
369 (uri (string-append "mirror://gnu/binutils/binutils-"
373 "08lzmhidzc16af1zbx34f8cy4z7mzrswpdbhrb8shy3xxpflmcdm"))
374 (patches (search-patches "binutils-ld-new-dtags.patch"
375 "binutils-loongson-workaround.patch"))))
376 (build-system gnu-build-system)
378 ;; TODO: Add dependency on zlib + those for Gold.
380 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
381 ;; on GCC when bootstrapping.
382 "LDFLAGS=-static-libgcc"
384 ;; Don't search under /usr/lib & co.
385 "--with-lib-path=/no-ld-lib-path"
387 ;; Glibc 2.17 has a "comparison of unsigned
388 ;; expression >= 0 is always true" in wchar.h.
391 ;; Install BFD. It ends up in a hidden directory,
393 "--enable-install-libbfd"
395 ;; Make sure 'ar' and 'ranlib' produce archives in a
396 ;; deterministic fashion.
397 "--enable-deterministic-archives")))
399 (synopsis "Binary utilities: bfd gas gprof ld")
401 "GNU Binutils is a collection of tools for working with binary files.
402 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
403 Other tools include programs to display binary profiling information, list
404 the strings in a binary file, and utilities for working with archives. The
405 \"bfd\" library for working with executable and object formats is also
408 (home-page "http://www.gnu.org/software/binutils/")))
410 (define* (make-ld-wrapper name #:key binutils
411 (guile (canonical-package guile-2.0))
412 (bash (canonical-package bash)) target
413 (guile-for-build guile))
414 "Return a package called NAME that contains a wrapper for the 'ld' program
415 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When
416 TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
417 'TARGET-ld'. The wrapper uses GUILE and BASH."
422 (build-system trivial-build-system)
423 (inputs `(("binutils" ,binutils)
426 ("wrapper" ,(search-path %load-path
427 "gnu/packages/ld-wrapper.in"))))
429 `(#:guile ,guile-for-build
430 #:modules ((guix build utils))
432 (use-modules (guix build utils)
433 (system base compile))
435 (let* ((out (assoc-ref %outputs "out"))
436 (bin (string-append out "/bin"))
438 `(string-append bin "/" ,target "-ld")
439 '(string-append bin "/ld")))
440 (go (string-append ld ".go")))
442 (setvbuf (current-output-port) _IOLBF)
443 (format #t "building ~s/bin/ld wrapper in ~s~%"
444 (assoc-ref %build-inputs "binutils")
448 (copy-file (assoc-ref %build-inputs "wrapper") ld)
453 (string-append (assoc-ref %build-inputs "guile")
456 (string-append (assoc-ref %build-inputs "bash")
459 (string-append (assoc-ref %build-inputs "binutils")
461 (string-append "/bin/"
465 (compile-file ld #:output-file go)))))
466 (synopsis "The linker wrapper")
468 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
469 missing '-rpath' flags, and to detect any misuse of libraries outside of the
471 (home-page "http://www.gnu.org/software/guix/")
474 (export make-ld-wrapper)
476 (define-public glibc/linux
482 (uri (string-append "mirror://gnu/glibc/glibc-"
486 "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))
488 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
489 ;; required on LFS distros to avoid loading the distro's libc.so
491 '(substitute* "sysdeps/unix/sysv/linux/configure"
492 (("use_ldconfig=yes")
494 (modules '((guix build utils)))
495 (patches (search-patches "glibc-ldd-x86_64.patch"
496 "glibc-versioned-locpath.patch"
497 "glibc-o-largefile.patch"))))
498 (build-system gnu-build-system)
500 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
501 ;; users should automatically pull Linux headers as well.
502 (propagated-inputs `(("kernel-headers" ,linux-libre-headers)))
504 (outputs '("out" "debug"))
507 `(#:out-of-source? #t
509 ;; In version 2.21, there a race in the 'elf' directory, see
510 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
513 ;; The libraries have an empty RUNPATH, but some, such as the versioned
514 ;; libraries (libdl-2.23.so, etc.) have ld.so marked as NEEDED. Since
515 ;; these libraries are always going to be found anyway, just skip
517 #:validate-runpath? #f
520 (list "--enable-add-ons"
523 ;; Installing a locale archive with all the locales is to
524 ;; expensive (~100 MiB), so we rely on users to install the
525 ;; locales they really want.
527 ;; Set the default locale path. In practice, $LOCPATH may be
528 ;; defined to point whatever locales users want. However, setuid
529 ;; binaries don't honor $LOCPATH, so they'll instead look into
530 ;; $libc_cv_localedir; we choose /run/current-system/locale/X.Y,
531 ;; with the idea that it is going to be populated by the sysadmin.
532 ;; The "X.Y" sub-directory is because locale data formats are
533 ;; incompatible across libc versions; see
534 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
536 ;; `--localedir' is not honored, so work around it.
537 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
538 ;; FIXME: This hack no longer works on 2.23!
539 (string-append "libc_cv_localedir=/run/current-system/locale/"
542 (string-append "--with-headers="
543 (assoc-ref ,(if (%current-target-system)
544 '%build-target-inputs
549 ;; This is the default for most architectures as of GNU libc 2.21,
550 ;; but we specify it explicitly for clarity and consistency. See
551 ;; "kernel-features.h" in the GNU libc for details.
552 "--enable-kernel=2.6.32"
554 ;; Use our Bash instead of /bin/sh.
555 (string-append "BASH_SHELL="
556 (assoc-ref %build-inputs "bash")
559 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
560 "libc_cv_ssp=no" "libc_cv_ssp_strong=no")
563 #:phases (modify-phases %standard-phases
565 'configure 'pre-configure
566 (lambda* (#:key inputs native-inputs outputs
568 (let* ((out (assoc-ref outputs "out"))
569 (bin (string-append out "/bin"))
570 ;; FIXME: Normally we would look it up only in INPUTS
571 ;; but cross-base uses it as a native input.
572 (bash (or (assoc-ref inputs "static-bash")
573 (assoc-ref native-inputs "static-bash"))))
574 ;; Install the rpc data base file under `$out/etc/rpc'.
575 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
576 (substitute* "sunrpc/Makefile"
577 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
578 (string-append out "/etc/rpc" suffix "\n"))
579 (("^install-others =.*$")
580 (string-append "install-others = " out "/etc/rpc\n")))
582 (substitute* "Makeconfig"
584 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
585 ;; linking against libgcc_s is not needed with GCC
589 ;; Have `system' use that Bash.
590 (substitute* "sysdeps/posix/system.c"
591 (("#define[[:blank:]]+SHELL_PATH.*$")
592 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
596 (substitute* "libio/iopopen.c"
598 (string-append bash "/bin/bash")))
600 ;; Same for the shell used by the 'exec' functions for
601 ;; scripts that lack a shebang.
602 (substitute* (find-files "." "^paths\\.h$")
603 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
604 (string-append "#define _PATH_BSHELL \""
605 bash "/bin/bash\"\n")))
607 ;; Nscd uses __DATE__ and __TIME__ to create a string to
608 ;; make sure the client and server come from the same
609 ;; libc. Use something deterministic instead.
610 (substitute* "nscd/nscd_stat.c"
611 (("static const char compilation\\[21\\] =.*$")
613 "static const char compilation[21] = \""
614 (string-take (basename out) 20) "\";\n")))
616 ;; Make sure we don't retain a reference to the
618 (substitute* "malloc/mtrace.pl"
620 ;; The shebang can be omitted, because there's the
621 ;; "bilingual" eval/exec magic at the top of the file.
626 (inputs `(("static-bash" ,static-bash)))
628 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
629 ;; install the message catalogs, with 'msgfmt'.
630 (native-inputs `(("texinfo" ,texinfo)
632 ("gettext" ,gnu-gettext)))
635 ;; Search path for packages that provide locale data. This is useful
636 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
637 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
639 (list (search-path-specification
640 (variable "GUIX_LOCPATH")
641 (files '("lib/locale")))))
643 (synopsis "The GNU C Library")
645 "Any Unix-like operating system needs a C library: the library which
646 defines the \"system calls\" and other basic facilities such as open, malloc,
649 The GNU C library is used as the C library in the GNU system and most systems
650 with the Linux kernel.")
652 (home-page "http://www.gnu.org/software/libc/")))
654 (define-public glibc/hurd
655 ;; The Hurd's libc variant.
656 (package (inherit glibc/linux)
661 (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-"
662 version "-hurd+libpthread-20160518" ".tar.gz"))
665 "12zmdjviybpsdb2kq4cg98rds7909f0cc96fzdahdfrzlxx1q0px"))))
667 ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
668 ;; so both should be propagated.
669 (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers)))
671 `(,@(package-native-inputs glibc/linux)
676 (substitute-keyword-arguments (package-arguments glibc/linux)
677 ((#:phases original-phases)
678 ;; Add libmachuser.so and libhurduser.so to libc.so's search path.
679 ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-07/msg00051.html>.
681 'install 'augment-libc.so
682 (lambda* (#:key outputs #:allow-other-keys)
683 (let* ((out (assoc-ref outputs "out")))
684 (substitute* (string-append out "/lib/libc.so")
685 (("/[^ ]+/lib/libc.so.0.3")
686 (string-append out "/lib/libc.so.0.3" " libmachuser.so" " libhurduser.so"))))
689 'pre-configure 'pre-configure-set-pwd
691 ;; Use the right 'pwd'.
692 (substitute* "configure"
693 (("/bin/pwd") "pwd")))
695 ((#:configure-flags original-configure-flags)
696 `(append (list "--host=i586-pc-gnu"
698 ;; We need this to get a working openpty() function.
701 ;; nscd fails to build for GNU/Hurd:
702 ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
705 (filter (lambda (flag)
706 (not (string-prefix? "--enable-kernel=" flag)))
707 ,original-configure-flags)))))
708 (synopsis "The GNU C Library (GNU Hurd variant)")
709 (supported-systems %hurd-systems)))
711 (define* (glibc-for-target #:optional
712 (target (or (%current-target-system)
714 "Return the glibc for TARGET, GLIBC/LINUX for a Linux host or
715 GLIBC/HURD for a Hurd host"
717 ((or "i586-pc-gnu" "i586-gnu") glibc/hurd)
721 (identifier-syntax (glibc-for-target)))
723 (define-public glibc-2.22
724 ;; The old libc, which we use mostly to build locale data in the old format
725 ;; (which the new libc can cope with.)
730 (inherit (package-source glibc))
731 (uri (string-append "mirror://gnu/glibc/glibc-"
735 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
736 (patches (search-patches "glibc-ldd-x86_64.patch"))))
738 (substitute-keyword-arguments (package-arguments glibc)
740 `(modify-phases ,phases
741 (add-before 'configure 'fix-pwd
743 ;; Use `pwd' instead of `/bin/pwd' for glibc-2.21
744 (substitute* "configure"
745 (("/bin/pwd") "pwd"))))))))))
747 (define-public glibc-2.21
748 ;; The old libc, which we use mostly to build locale data in the old format
749 ;; (which the new libc can cope with.)
754 (inherit (package-source glibc))
755 (uri (string-append "mirror://gnu/glibc/glibc-"
759 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
760 (patches (search-patches "glibc-ldd-x86_64.patch"))))))
762 (define-public glibc-locales
765 (name "glibc-locales")
766 (source (origin (inherit (package-source glibc))
767 (patches (cons (search-patch "glibc-locales.patch")
768 (origin-patches (package-source glibc))))))
769 (synopsis "All the locales supported by the GNU C Library")
771 "This package provides all the locales supported by the GNU C Library,
772 more than 400 in total. To use them set the 'LOCPATH' environment variable to
773 the 'share/locale' sub-directory of this package.")
774 (outputs '("out")) ;110+ MiB
775 (native-search-paths '())
777 (let ((args `(#:tests? #f #:strip-binaries? #f
778 ,@(package-arguments glibc))))
779 (substitute-keyword-arguments args
783 (lambda* (#:key outputs #:allow-other-keys)
784 (zero? (system* "make" "localedata/install-locales"
785 "-j" (number->string (parallel-job-count)))))
786 (alist-delete 'install ,phases)))
787 ((#:configure-flags flags)
789 ;; Use $(libdir)/locale/X.Y as is the case by default.
790 (list (string-append "libc_cv_complocaledir="
791 (assoc-ref %outputs "out")
793 ,(package-version glibc))))))))))
795 (define-public glibc-utf8-locales
797 (name "glibc-utf8-locales")
798 (version (package-version glibc))
800 (build-system trivial-build-system)
802 `(#:modules ((guix build utils))
804 (use-modules (srfi srfi-1)
807 (let* ((libc (assoc-ref %build-inputs "glibc"))
808 (gzip (assoc-ref %build-inputs "gzip"))
809 (out (assoc-ref %outputs "out"))
810 (localedir (string-append out "/lib/locale/"
812 ;; 'localedef' needs 'gzip'.
813 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
816 (every (lambda (locale)
818 ;; Use the "normalized codeset" by
819 ;; default--e.g., "en_US.utf8".
820 (string-append localedir "/" locale ".utf8"))
822 (and (zero? (system* "localedef" "--no-archive"
827 ;; For backward compatibility with Guix
828 ;; <= 0.8.3, add "xx_YY.UTF-8".
829 (symlink (string-append locale ".utf8")
830 (string-append localedir "/"
834 ;; These are the locales commonly used for
835 ;; tests---e.g., in Guile's i18n tests.
836 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
837 (inputs `(("glibc" ,glibc)
839 (synopsis "Small sample of UTF-8 locales")
841 "This package provides a small sample of UTF-8 locales mostly useful in
843 (home-page (package-home-page glibc))
844 (license (package-license glibc))))
852 (uri (string-append "mirror://gnu/which/which-"
856 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
857 (build-system gnu-build-system)
858 (home-page "https://gnu.org/software/which/")
859 (synopsis "Find full path of shell commands")
861 "The which program finds the location of executables in PATH, with a
862 variety of options. It is an alternative to the shell \"type\" built-in
864 (license gpl3+))) ; some files are under GPLv2+
866 (define-public glibc/hurd-headers
867 (package (inherit glibc/hurd)
868 (name "glibc-hurd-headers")
870 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
871 ("hurd-headers" ,hurd-headers)))
873 (substitute-keyword-arguments (package-arguments glibc/hurd)
874 ;; We just pass the flags really needed to build the headers.
875 ((#:configure-flags _)
876 `(list "--enable-add-ons"
878 "--enable-obsolete-rpc"))
882 (lambda* (#:key outputs #:allow-other-keys)
883 (and (zero? (system* "make" "install-headers"))
885 ;; Make an empty stubs.h to work around not being able to
886 ;; produce a valid stubs.h and causing the build to fail. See
887 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
888 (let ((out (assoc-ref outputs "out")))
891 (string-append out "/include/gnu/stubs.h"))))))
898 'configure 'pre-configure
900 ;; Use the right 'pwd'.
901 (substitute* "configure"
902 (("/bin/pwd") "pwd")))
903 %standard-phases))))))))
905 (define-public tzdata
912 "http://www.iana.org/time-zones/repository/releases/tzdata"
916 "0qb1awqrn3215zd2jikpqnmkzrxwfjf0d3dw2xmnk4c40yzws8xr"))))
917 (build-system gnu-build-system)
920 #:make-flags (let ((out (assoc-ref %outputs "out"))
921 (tmp (getenv "TMPDIR")))
922 (list (string-append "TOPDIR=" out)
923 (string-append "TZDIR=" out "/share/zoneinfo")
925 ;; Discard zic, dump, and tzselect, already
926 ;; provided by glibc.
927 (string-append "ETCDIR=" tmp "/etc")
929 ;; Likewise for the C library routines.
930 (string-append "LIBDIR=" tmp "/lib")
931 (string-append "MANDIR=" tmp "/man")
935 #:modules ((guix build utils)
936 (guix build gnu-build-system)
941 (lambda* (#:key source inputs #:allow-other-keys)
942 (and (zero? (system* "tar" "xvf" source))
943 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
945 'install 'post-install
946 (lambda* (#:key outputs #:allow-other-keys)
947 ;; Move data in the right place.
948 (let ((out (assoc-ref outputs "out")))
949 (copy-recursively (string-append out "/share/zoneinfo-posix")
950 (string-append out "/share/zoneinfo/posix"))
951 (copy-recursively (string-append out "/share/zoneinfo-leaps")
952 (string-append out "/share/zoneinfo/right"))
953 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
954 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
955 (alist-delete 'configure %standard-phases)))))
956 (inputs `(("tzcode" ,(origin
959 "http://www.iana.org/time-zones/repository/releases/tzcode"
963 "1i3y1kzjiz2j62c7vd4wf85983sqk9x9lg3473njvbdz4kph5r0q"))))))
964 (home-page "http://www.iana.org/time-zones")
965 (synopsis "Database of current and historical time zones")
966 (description "The Time Zone Database (often called tz or zoneinfo)
967 contains code and data that represent the history of local time for many
968 representative locations around the globe. It is updated periodically to
969 reflect changes made by political bodies to time zone boundaries, UTC offsets,
970 and daylight-saving rules.")
971 (license public-domain)))
973 (define-public libiconv
979 (uri (string-append "mirror://gnu/libiconv/libiconv-"
983 "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))
984 (modules '((guix build utils)))
986 ;; Work around "declared gets" error on glibc systems (fixed by
987 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
988 '(substitute* "srclib/stdio.in.h"
989 (("^#undef gets") "")
990 (("^_GL_WARN_ON_USE \\(gets.*") "")))))
991 (build-system gnu-build-system)
992 (synopsis "Character set conversion library")
994 "libiconv provides an implementation of the iconv function for systems
995 that lack it. iconv is used to convert between character encodings in a
996 program. It supports a wide variety of different encodings.")
997 (home-page "http://www.gnu.org/software/libiconv/")
1000 (define-public (canonical-package package)
1001 ;; Avoid circular dependency by lazily resolving 'commencement'.
1002 (let* ((iface (resolve-interface '(gnu packages commencement)))
1003 (proc (module-ref iface 'canonical-package)))
1006 ;;; base.scm ends here