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)
54 ;;; Base packages of the Guix-based GNU user-land software distribution.
64 (uri (string-append "mirror://gnu/hello/hello-" version
68 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
69 (build-system gnu-build-system)
70 (synopsis "Hello, GNU world: An example GNU package")
72 "GNU Hello prints the message \"Hello, world!\" and then exits. It
73 serves as an example of standard GNU coding practices. As such, it supports
74 command-line arguments, multiple languages, and so on.")
75 (home-page "https://www.gnu.org/software/hello/")
84 (uri (string-append "mirror://gnu/grep/grep-"
88 "0c38b67cnwchwzv4wq2gpz6smkhdxrac2hhssv8f0l04qnx867p2"))
89 (patches (search-patches "grep-timing-sensitive-test.patch"))))
90 (build-system gnu-build-system)
91 (native-inputs `(("perl" ,perl))) ;some of the tests require it
94 (modify-phases %standard-phases
95 (add-after 'install 'fix-egrep-and-fgrep
96 ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
97 ;; absolute file name instead of searching for it in $PATH.
98 (lambda* (#:key outputs #:allow-other-keys)
99 (let* ((out (assoc-ref outputs "out"))
100 (bin (string-append out "/bin")))
101 (substitute* (list (string-append bin "/egrep")
102 (string-append bin "/fgrep"))
104 (string-append "exec " bin "/grep")))
106 (synopsis "Print lines matching a pattern")
108 "grep is a tool for finding text inside files. Text is found by
109 matching a pattern provided by the user in one or many files. The pattern
110 may be provided as a basic or extended regular expression, or as fixed
111 strings. By default, the matching text is simply printed to the screen,
112 however the output can be greatly customized to include, for example, line
113 numbers. GNU grep offers many extensions over the standard utility,
114 including, for example, recursive directory searching.")
116 (home-page "https://www.gnu.org/software/grep/")))
124 (uri (string-append "mirror://gnu/sed/sed-" version
128 "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))
129 (patches (search-patches "sed-hurd-path-max.patch"))))
130 (build-system gnu-build-system)
131 (synopsis "Stream editor")
133 (if (%current-target-system)
135 `(#:phases (alist-cons-before
136 'patch-source-shebangs 'patch-test-suite
137 (lambda* (#:key inputs #:allow-other-keys)
138 (let ((bash (assoc-ref inputs "bash")))
139 (patch-makefile-SHELL "testsuite/Makefile.tests")
140 (substitute* '("testsuite/bsd.sh"
141 "testsuite/bug-regex9.c")
143 (string-append bash "/bin/bash")))))
146 "Sed is a non-interactive, text stream editor. It receives a text
147 input from a file or from standard input and it then applies a series of text
148 editing commands to the stream and prints its output to standard output. It
149 is often used for substituting text patterns in a stream. The GNU
150 implementation offers several extensions over the standard utility.")
152 (home-page "https://www.gnu.org/software/sed/")))
160 (uri (string-append "mirror://gnu/tar/tar-"
164 "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0"))
165 (patches (search-patches "tar-skip-unreliable-tests.patch"))))
166 (build-system gnu-build-system)
167 ;; Note: test suite requires ~1GiB of disk space.
169 '(#:phases (modify-phases %standard-phases
170 (add-before 'build 'set-shell-file-name
171 (lambda* (#:key inputs #:allow-other-keys)
172 ;; Do not use "/bin/sh" to run programs.
173 (let ((bash (assoc-ref inputs "bash")))
174 (substitute* "src/system.c"
176 (string-append bash "/bin/sh")))
179 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
180 ;; to refer to the target Bash.
181 (inputs (if (%current-target-system)
185 (synopsis "Managing tar archives")
187 "Tar provides the ability to create tar archives, as well as the
188 ability to extract, update or list files in an existing archive. It is
189 useful for combining many files into one larger file, while maintaining
190 directory structure and file information such as permissions and
191 creation/modification dates. GNU tar offers many extensions over the
194 (home-page "https://www.gnu.org/software/tar/")))
202 (uri (string-append "mirror://gnu/patch/patch-"
206 "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
207 (patches (search-patches "patch-hurd-path-max.patch"))))
208 (build-system gnu-build-system)
209 (native-inputs `(("ed" ,ed)))
210 (synopsis "Apply differences to originals, with optional backups")
212 "Patch is a program that applies changes to files based on differences
213 laid out as by the program \"diff\". The changes may be applied to one or more
214 files depending on the contents of the diff file. It accepts several
215 different diff formats. It may also be used to revert previously applied
218 (home-page "https://savannah.gnu.org/projects/patch/")))
220 (define-public diffutils
226 (uri (string-append "mirror://gnu/diffutils/diffutils-"
230 "0csmqfz8ks23kdjsq0v2ll1acqiz8lva06dj19mwmymrsp69ilys"))))
231 (build-system gnu-build-system)
232 (synopsis "Comparing and merging files")
234 "GNU Diffutils is a package containing tools for finding the
235 differences between files. The \"diff\" command is used to show how two files
236 differ, while \"cmp\" shows the offsets and line numbers where they differ.
237 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
238 interactive means to merge two files.")
240 (home-page "https://www.gnu.org/software/diffutils/")))
242 (define-public findutils
248 (uri (string-append "mirror://gnu/findutils/findutils-"
252 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
253 (patches (search-patches "findutils-localstatedir.patch"
254 "findutils-test-xargs.patch"))))
255 (build-system gnu-build-system)
257 `(#:configure-flags (list
258 ;; Tell 'updatedb' to write to /var.
259 "--localstatedir=/var"
261 ;; Work around cross-compilation failure. See
262 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
263 ,@(if (%current-target-system)
264 '("gl_cv_func_wcwidth_works=yes")
266 (synopsis "Operating on files matching given criteria")
268 "Findutils supplies the basic file directory searching utilities of the
269 GNU system. It consists of two primary searching utilities: \"find\"
270 recursively searches for files in a directory according to given criteria and
271 \"locate\" lists files in a database that match a query. Two auxiliary tools
272 are included: \"updatedb\" updates the file name database and \"xargs\" may be
273 used to apply commands with arbitrarily long arguments.")
275 (home-page "https://www.gnu.org/software/findutils/")))
277 (define-public coreutils
283 (uri (string-append "mirror://gnu/coreutils/coreutils-"
287 "11yfrnb94xzmvi4lhclkcmkqsbhww64wf234ya1aacjvg82prrii"))))
288 (build-system gnu-build-system)
289 (inputs `(("acl" ,acl) ; TODO: add SELinux
290 ("gmp" ,gmp) ;bignums in 'expr', yay!
292 ;; Drop the dependency on libcap when cross-compiling since it's
293 ;; not quite cross-compilable.
294 ,@(if (%current-target-system)
296 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
298 ;; Perl is needed to run tests in native builds, and to run the bundled
299 ;; copy of help2man. However, don't pass it when cross-compiling since
300 ;; that would lead it to try to run programs to get their '--help' output
302 (if (%current-target-system)
305 (outputs '("out" "debug"))
307 `(#:parallel-build? #f ; help2man may be called too early
308 #:phases (alist-cons-before
309 'build 'patch-shell-references
310 (lambda* (#:key inputs #:allow-other-keys)
311 (let ((bash (assoc-ref inputs "bash")))
312 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
313 ;; that tests pass, since /bin/sh isn't in the chroot.
314 (setenv "SHELL" (which "sh"))
316 (substitute* (find-files "gnulib-tests" "\\.c$")
318 (format #f "~a/bin/sh" bash)))
319 (substitute* (find-files "tests" "\\.sh$")
321 (format #f "#!~a/bin/sh" bash)))))
323 (synopsis "Core GNU utilities (file, text, shell)")
325 "GNU Coreutils includes all of the basic command-line tools that are
326 expected in a POSIX system. These provide the basic file, shell and text
327 manipulation functions of the GNU system. Most of these tools offer extended
328 functionality beyond that which is outlined in the POSIX standard.")
330 (home-page "https://www.gnu.org/software/coreutils/")))
332 (define-public coreutils-minimal
333 ;; Coreutils without its optional dependencies.
336 (name "coreutils-minimal")
340 (define-public gnu-make
346 (uri (string-append "mirror://gnu/make/make-" version
350 "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn"))
351 (patches (search-patches "make-impure-dirs.patch"))))
352 (build-system gnu-build-system)
353 (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile
354 (inputs `(("guile" ,guile-2.0)))
355 (outputs '("out" "debug"))
358 (modify-phases %standard-phases
359 (add-before 'build 'set-default-shell
360 (lambda* (#:key inputs #:allow-other-keys)
361 ;; Change the default shell from /bin/sh.
362 (let ((bash (assoc-ref inputs "bash")))
364 (("default_shell =.*$")
365 (format #f "default_shell = \"~a/bin/bash\";\n"
367 (synopsis "Remake files automatically")
369 "Make is a program that is used to control the production of
370 executables or other files from their source files. The process is
371 controlled from a Makefile, in which the developer specifies how each file is
372 generated from its source. It has powerful dependency resolution and the
373 ability to determine when files have to be regenerated after their sources
374 change. GNU make offers many powerful extensions over the standard utility.")
376 (home-page "https://www.gnu.org/software/make/")))
378 (define-public binutils
384 (uri (string-append "mirror://gnu/binutils/binutils-"
388 "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn"))
389 (patches (search-patches "binutils-ld-new-dtags.patch"
390 "binutils-loongson-workaround.patch"
391 "binutils-mips-bash-bug.patch"))))
392 (build-system gnu-build-system)
394 ;; TODO: Add dependency on zlib + those for Gold.
396 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
397 ;; on GCC when bootstrapping.
398 "LDFLAGS=-static-libgcc"
400 ;; Don't search under /usr/lib & co.
401 "--with-lib-path=/no-ld-lib-path"
403 ;; Glibc 2.17 has a "comparison of unsigned
404 ;; expression >= 0 is always true" in wchar.h.
407 ;; Install BFD. It ends up in a hidden directory,
409 "--enable-install-libbfd"
411 ;; Make sure 'ar' and 'ranlib' produce archives in a
412 ;; deterministic fashion.
413 "--enable-deterministic-archives")))
415 (synopsis "Binary utilities: bfd gas gprof ld")
417 "GNU Binutils is a collection of tools for working with binary files.
418 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
419 Other tools include programs to display binary profiling information, list
420 the strings in a binary file, and utilities for working with archives. The
421 \"bfd\" library for working with executable and object formats is also
424 (home-page "https://www.gnu.org/software/binutils/")))
426 (define* (make-ld-wrapper name #:key
429 (guile (canonical-package guile-2.0))
430 (bash (canonical-package bash))
431 (guile-for-build guile))
432 "Return a package called NAME that contains a wrapper for the 'ld' program
433 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
434 wrapper uses GUILE and BASH.
436 TARGET must be a one-argument procedure that, given a system type, returns a
437 cross-compilation target triplet or #f. When the result is not #f, make a
438 wrapper for the cross-linker for that target, called 'TARGET-ld'."
439 ;; Note: #:system->target-triplet is a procedure so that the evaluation of
440 ;; its result can be delayed until the 'arguments' field is evaluated, thus
441 ;; in a context where '%current-system' is accurate.
446 (build-system trivial-build-system)
447 (inputs `(("binutils" ,binutils)
450 ("wrapper" ,(search-path %load-path
451 "gnu/packages/ld-wrapper.in"))))
453 (let ((target (target (%current-system))))
454 `(#:guile ,guile-for-build
455 #:modules ((guix build utils))
457 (use-modules (guix build utils)
458 (system base compile))
460 (let* ((out (assoc-ref %outputs "out"))
461 (bin (string-append out "/bin"))
463 `(string-append bin "/" ,target "-ld")
464 '(string-append bin "/ld")))
465 (go (string-append ld ".go")))
467 (setvbuf (current-output-port) _IOLBF)
468 (format #t "building ~s/bin/ld wrapper in ~s~%"
469 (assoc-ref %build-inputs "binutils")
473 (copy-file (assoc-ref %build-inputs "wrapper") ld)
478 (string-append (assoc-ref %build-inputs "guile")
481 (string-append (assoc-ref %build-inputs "bash")
484 (string-append (assoc-ref %build-inputs "binutils")
486 (string-append "/bin/"
490 (compile-file ld #:output-file go))))))
491 (synopsis "The linker wrapper")
493 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
494 missing '-rpath' flags, and to detect any misuse of libraries outside of the
496 (home-page "https://www.gnu.org/software/guix//")
499 (export make-ld-wrapper)
501 (define-public glibc/linux
507 (uri (string-append "mirror://gnu/glibc/glibc-"
511 "1lxmprg9gm73gvafxd503x70z32phwjzcy74i0adfi6ixzla7m4r"))
513 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
514 ;; required on LFS distros to avoid loading the distro's libc.so
516 '(substitute* "sysdeps/unix/sysv/linux/configure"
517 (("use_ldconfig=yes")
519 (modules '((guix build utils)))
520 (patches (search-patches "glibc-ldd-x86_64.patch"
521 "glibc-versioned-locpath.patch"
522 "glibc-o-largefile.patch"))))
523 (build-system gnu-build-system)
525 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
526 ;; users should automatically pull Linux headers as well.
527 (propagated-inputs `(("kernel-headers" ,linux-libre-headers)))
529 (outputs '("out" "debug"))
532 `(#:out-of-source? #t
534 ;; In version 2.21, there a race in the 'elf' directory, see
535 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
538 ;; The libraries have an empty RUNPATH, but some, such as the versioned
539 ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since
540 ;; these libraries are always going to be found anyway, just skip
542 #:validate-runpath? #f
545 (list "--enable-add-ons"
548 ;; Installing a locale archive with all the locales is to
549 ;; expensive (~100 MiB), so we rely on users to install the
550 ;; locales they really want.
552 ;; Set the default locale path. In practice, $LOCPATH may be
553 ;; defined to point whatever locales users want. However, setuid
554 ;; binaries don't honor $LOCPATH, so they'll instead look into
555 ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y,
556 ;; with the idea that it is going to be populated by the sysadmin.
557 ;; The "X.Y" sub-directory is because locale data formats are
558 ;; incompatible across libc versions; see
559 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
561 ;; `--localedir' is not honored, so work around it.
562 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
563 (string-append "libc_cv_complocaledir=/run/current-system/locale/"
566 (string-append "--with-headers="
567 (assoc-ref ,(if (%current-target-system)
568 '%build-target-inputs
573 ;; This is the default for most architectures as of GNU libc 2.21,
574 ;; but we specify it explicitly for clarity and consistency. See
575 ;; "kernel-features.h" in the GNU libc for details.
576 "--enable-kernel=2.6.32"
578 ;; Use our Bash instead of /bin/sh.
579 (string-append "BASH_SHELL="
580 (assoc-ref %build-inputs "bash")
583 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
584 "libc_cv_ssp=no" "libc_cv_ssp_strong=no")
587 #:phases (modify-phases %standard-phases
589 'configure 'pre-configure
590 (lambda* (#:key inputs native-inputs outputs
592 (let* ((out (assoc-ref outputs "out"))
593 (bin (string-append out "/bin"))
594 ;; FIXME: Normally we would look it up only in INPUTS
595 ;; but cross-base uses it as a native input.
596 (bash (or (assoc-ref inputs "static-bash")
597 (assoc-ref native-inputs "static-bash"))))
598 ;; Install the rpc data base file under `$out/etc/rpc'.
599 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
600 (substitute* "sunrpc/Makefile"
601 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
602 (string-append out "/etc/rpc" suffix "\n"))
603 (("^install-others =.*$")
604 (string-append "install-others = " out "/etc/rpc\n")))
606 (substitute* "Makeconfig"
608 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
609 ;; linking against libgcc_s is not needed with GCC
613 ;; Have `system' use that Bash.
614 (substitute* "sysdeps/posix/system.c"
615 (("#define[[:blank:]]+SHELL_PATH.*$")
616 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
620 (substitute* "libio/iopopen.c"
622 (string-append bash "/bin/bash")))
624 ;; Same for the shell used by the 'exec' functions for
625 ;; scripts that lack a shebang.
626 (substitute* (find-files "." "^paths\\.h$")
627 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
628 (string-append "#define _PATH_BSHELL \""
629 bash "/bin/bash\"\n")))
631 ;; Nscd uses __DATE__ and __TIME__ to create a string to
632 ;; make sure the client and server come from the same
633 ;; libc. Use something deterministic instead.
634 (substitute* "nscd/nscd_stat.c"
635 (("static const char compilation\\[21\\] =.*$")
637 "static const char compilation[21] = \""
638 (string-take (basename out) 20) "\";\n")))
640 ;; Make sure we don't retain a reference to the
642 (substitute* "malloc/mtrace.pl"
644 ;; The shebang can be omitted, because there's the
645 ;; "bilingual" eval/exec magic at the top of the file.
650 (inputs `(("static-bash" ,static-bash)))
652 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
653 ;; install the message catalogs, with 'msgfmt'.
654 (native-inputs `(("texinfo" ,texinfo)
656 ("gettext" ,gettext-minimal)))
659 ;; Search path for packages that provide locale data. This is useful
660 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
661 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
663 (list (search-path-specification
664 (variable "GUIX_LOCPATH")
665 (files '("lib/locale")))))
667 (synopsis "The GNU C Library")
669 "Any Unix-like operating system needs a C library: the library which
670 defines the \"system calls\" and other basic facilities such as open, malloc,
673 The GNU C library is used as the C library in the GNU system and most systems
674 with the Linux kernel.")
676 (home-page "https://www.gnu.org/software/libc/")))
678 (define-public glibc/hurd
679 ;; The Hurd's libc variant.
680 (package (inherit glibc/linux)
685 (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-"
686 version "-hurd+libpthread-20161218" ".tar.gz"))
689 "0vpdv05j6j3ria5bw8gp468i64gij94cslxkxj9xkfgi6p615b8p"))))
691 ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
692 ;; so both should be propagated.
693 (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers)))
695 `(,@(package-native-inputs glibc/linux)
700 (substitute-keyword-arguments (package-arguments glibc/linux)
701 ((#:phases original-phases)
702 ;; Add libmachuser.so and libhurduser.so to libc.so's search path.
703 ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-07/msg00051.html>.
705 'install 'augment-libc.so
706 (lambda* (#:key outputs #:allow-other-keys)
707 (let* ((out (assoc-ref outputs "out")))
708 (substitute* (string-append out "/lib/libc.so")
709 (("/[^ ]+/lib/libc.so.0.3")
710 (string-append out "/lib/libc.so.0.3" " libmachuser.so" " libhurduser.so"))))
713 'pre-configure 'pre-configure-set-pwd
715 ;; Use the right 'pwd'.
716 (substitute* "configure"
717 (("/bin/pwd") "pwd")))
719 ((#:configure-flags original-configure-flags)
720 `(append (list "--host=i586-pc-gnu"
722 ;; We need this to get a working openpty() function.
725 ;; <https://lists.gnu.org/archive/html/bug-hurd/2016-10/msg00033.html>
728 ;; nscd fails to build for GNU/Hurd:
729 ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
732 (filter (lambda (flag)
733 (not (string-prefix? "--enable-kernel=" flag)))
734 ,original-configure-flags)))))
735 (synopsis "The GNU C Library (GNU Hurd variant)")
736 (supported-systems %hurd-systems)))
738 (define* (glibc-for-target #:optional
739 (target (or (%current-target-system)
741 "Return the glibc for TARGET, GLIBC/LINUX for a Linux host or
742 GLIBC/HURD for a Hurd host"
744 ((or "i586-pc-gnu" "i586-gnu") glibc/hurd)
748 (identifier-syntax (glibc-for-target)))
750 ;; Below are old libc versions, which we use mostly to build locale data in
751 ;; the old format (which the new libc cannot cope with.)
753 (define-public glibc-2.23
758 (inherit (package-source glibc))
759 (uri (string-append "mirror://gnu/glibc/glibc-"
763 "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))))))
765 (define-public glibc-2.22
770 (inherit (package-source glibc))
771 (uri (string-append "mirror://gnu/glibc/glibc-"
775 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
776 (patches (search-patches "glibc-ldd-x86_64.patch"))))
778 (substitute-keyword-arguments (package-arguments glibc)
780 `(modify-phases ,phases
781 (add-before 'configure 'fix-pwd
783 ;; Use `pwd' instead of `/bin/pwd' for glibc-2.21
784 (substitute* "configure"
785 (("/bin/pwd") "pwd"))))))))))
787 (define-public glibc-2.21
792 (inherit (package-source glibc))
793 (uri (string-append "mirror://gnu/glibc/glibc-"
797 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
798 (patches (search-patches "glibc-ldd-x86_64.patch"))))))
800 (define-public glibc-locales
803 (name "glibc-locales")
804 (source (origin (inherit (package-source glibc))
805 (patches (cons (search-patch "glibc-locales.patch")
806 (origin-patches (package-source glibc))))))
807 (synopsis "All the locales supported by the GNU C Library")
809 "This package provides all the locales supported by the GNU C Library,
810 more than 400 in total. To use them set the 'LOCPATH' environment variable to
811 the 'share/locale' sub-directory of this package.")
812 (outputs '("out")) ;110+ MiB
813 (native-search-paths '())
815 (let ((args `(#:tests? #f #:strip-binaries? #f
816 ,@(package-arguments glibc))))
817 (substitute-keyword-arguments args
821 (lambda* (#:key outputs #:allow-other-keys)
822 (zero? (system* "make" "localedata/install-locales"
823 "-j" (number->string (parallel-job-count)))))
824 (alist-delete 'install ,phases)))
825 ((#:configure-flags flags)
827 ;; Use $(libdir)/locale/X.Y as is the case by default.
828 (list (string-append "libc_cv_complocaledir="
829 (assoc-ref %outputs "out")
831 ,(package-version glibc))))))))))
833 (define-public glibc-utf8-locales
835 (name "glibc-utf8-locales")
836 (version (package-version glibc))
838 (build-system trivial-build-system)
840 `(#:modules ((guix build utils))
842 (use-modules (srfi srfi-1)
845 (let* ((libc (assoc-ref %build-inputs "glibc"))
846 (gzip (assoc-ref %build-inputs "gzip"))
847 (out (assoc-ref %outputs "out"))
848 (localedir (string-append out "/lib/locale/"
850 ;; 'localedef' needs 'gzip'.
851 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
854 (every (lambda (locale)
856 ;; Use the "normalized codeset" by
857 ;; default--e.g., "en_US.utf8".
858 (string-append localedir "/" locale ".utf8"))
860 (and (zero? (system* "localedef" "--no-archive"
865 ;; For backward compatibility with Guix
866 ;; <= 0.8.3, add "xx_YY.UTF-8".
867 (symlink (string-append locale ".utf8")
868 (string-append localedir "/"
872 ;; These are the locales commonly used for
873 ;; tests---e.g., in Guile's i18n tests.
874 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
875 (inputs `(("glibc" ,glibc)
877 (synopsis "Small sample of UTF-8 locales")
879 "This package provides a small sample of UTF-8 locales mostly useful in
881 (home-page (package-home-page glibc))
882 (license (package-license glibc))))
890 (uri (string-append "mirror://gnu/which/which-"
894 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
895 (build-system gnu-build-system)
896 (home-page "https://gnu.org/software/which/")
897 (synopsis "Find full path of shell commands")
899 "The which program finds the location of executables in PATH, with a
900 variety of options. It is an alternative to the shell \"type\" built-in
902 (license gpl3+))) ; some files are under GPLv2+
904 (define-public glibc/hurd-headers
905 (package (inherit glibc/hurd)
906 (name "glibc-hurd-headers")
908 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
909 ("hurd-headers" ,hurd-headers)))
911 (substitute-keyword-arguments (package-arguments glibc/hurd)
912 ;; We just pass the flags really needed to build the headers.
913 ((#:configure-flags _)
914 `(list "--enable-add-ons"
916 "--enable-obsolete-rpc"))
920 (lambda* (#:key outputs #:allow-other-keys)
921 (and (zero? (system* "make" "install-headers"))
923 ;; Make an empty stubs.h to work around not being able to
924 ;; produce a valid stubs.h and causing the build to fail. See
925 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
926 (let ((out (assoc-ref outputs "out")))
929 (string-append out "/include/gnu/stubs.h"))))))
936 'configure 'pre-configure
938 ;; Use the right 'pwd'.
939 (substitute* "configure"
940 (("/bin/pwd") "pwd")))
941 %standard-phases))))))))
943 (define-public tzdata
950 "https://www.iana.org/time-zones/repository/releases/tzdata"
954 "1j4xycpwhs57qnkcxwh3np8wnf3km69n3cf4w6p2yv2z247lxvpm"))))
955 (build-system gnu-build-system)
958 #:make-flags (let ((out (assoc-ref %outputs "out"))
959 (tmp (getenv "TMPDIR")))
960 (list (string-append "TOPDIR=" out)
961 (string-append "TZDIR=" out "/share/zoneinfo")
963 ;; Discard zic, dump, and tzselect, already
964 ;; provided by glibc.
965 (string-append "ETCDIR=" tmp "/etc")
967 ;; Likewise for the C library routines.
968 (string-append "LIBDIR=" tmp "/lib")
969 (string-append "MANDIR=" tmp "/man")
973 #:modules ((guix build utils)
974 (guix build gnu-build-system)
977 (modify-phases %standard-phases
979 (lambda* (#:key source inputs #:allow-other-keys)
980 (and (zero? (system* "tar" "xvf" source))
981 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode"))))))
982 (add-after 'install 'post-install
983 (lambda* (#:key outputs #:allow-other-keys)
984 ;; Move data in the right place.
985 (let ((out (assoc-ref outputs "out")))
986 (symlink (string-append out "/share/zoneinfo")
987 (string-append out "/share/zoneinfo/posix"))
988 (delete-file-recursively
989 (string-append out "/share/zoneinfo-posix"))
990 (copy-recursively (string-append out "/share/zoneinfo-leaps")
991 (string-append out "/share/zoneinfo/right"))
992 (delete-file-recursively
993 (string-append out "/share/zoneinfo-leaps")))))
994 (delete 'configure))))
995 (inputs `(("tzcode" ,(origin
998 "http://www.iana.org/time-zones/repository/releases/tzcode"
1002 "1dxhrk4z0n2di8p0yd6q00pa6bwyz5xqbrfbasiz8785ni7zrvxr"))))))
1003 (home-page "https://www.iana.org/time-zones")
1004 (synopsis "Database of current and historical time zones")
1005 (description "The Time Zone Database (often called tz or zoneinfo)
1006 contains code and data that represent the history of local time for many
1007 representative locations around the globe. It is updated periodically to
1008 reflect changes made by political bodies to time zone boundaries, UTC offsets,
1009 and daylight-saving rules.")
1010 (license public-domain)))
1012 (define-public libiconv
1018 (uri (string-append "mirror://gnu/libiconv/libiconv-"
1022 "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))
1023 (modules '((guix build utils)))
1025 ;; Work around "declared gets" error on glibc systems (fixed by
1026 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
1027 '(substitute* "srclib/stdio.in.h"
1028 (("^#undef gets") "")
1029 (("^_GL_WARN_ON_USE \\(gets.*") "")))))
1030 (build-system gnu-build-system)
1031 (synopsis "Character set conversion library")
1033 "libiconv provides an implementation of the iconv function for systems
1034 that lack it. iconv is used to convert between character encodings in a
1035 program. It supports a wide variety of different encodings.")
1036 (home-page "https://www.gnu.org/software/libiconv/")
1039 (define* (libiconv-if-needed #:optional (target (%current-target-system)))
1040 "Return either a libiconv package specification to include in a dependency
1041 list for platforms that have an incomplete libc, or the empty list. If a
1042 package needs iconv ,@(libiconv-if-needed) should be added."
1043 ;; POSIX C libraries provide iconv. Platforms with an incomplete libc
1044 ;; without iconv, such as MinGW, must return the then clause.
1045 (if (target-mingw? target)
1046 `(("libiconv" ,libiconv))
1049 (define-public (canonical-package package)
1050 ;; Avoid circular dependency by lazily resolving 'commencement'.
1051 (let* ((iface (resolve-interface '(gnu packages commencement)))
1052 (proc (module-ref iface 'canonical-package)))
1055 (define-public (%final-inputs)
1056 "Return the list of \"final inputs\"."
1057 ;; Avoid circular dependency by lazily resolving 'commencement'.
1058 (let ((iface (resolve-interface '(gnu packages commencement))))
1059 (module-ref iface '%final-inputs)))
1061 ;;; base.scm ends here