1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 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>
10 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages base)
28 #:use-module ((guix licenses)
29 #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
30 #:use-module (gnu packages)
31 #:use-module (gnu packages acl)
32 #:use-module (gnu packages bash)
33 #:use-module (gnu packages ed)
34 #:use-module (gnu packages guile)
35 #:use-module (gnu packages multiprecision)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages texinfo)
40 #:use-module (gnu packages hurd)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages gettext)
43 #:use-module (guix utils)
44 #:use-module (guix packages)
45 #:use-module (guix download)
46 #:use-module (guix git-download)
47 #:use-module (guix build-system gnu)
48 #:use-module (guix build-system trivial)
49 #:use-module (ice-9 match)
55 ;;; Base packages of the Guix-based GNU user-land software distribution.
65 (uri (string-append "mirror://gnu/hello/hello-" version
69 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
70 (build-system gnu-build-system)
71 (synopsis "Hello, GNU world: An example GNU package")
73 "GNU Hello prints the message \"Hello, world!\" and then exits. It
74 serves as an example of standard GNU coding practices. As such, it supports
75 command-line arguments, multiple languages, and so on.")
76 (home-page "https://www.gnu.org/software/hello/")
85 (uri (string-append "mirror://gnu/grep/grep-"
89 "1dcasjp3a578nrvzrcn38mpizb8w1q6mvfzhjmcqqgkf0nsivj72"))
90 (patches (search-patches "grep-timing-sensitive-test.patch"
91 "grep-gnulib-lock.patch"))))
92 (build-system gnu-build-system)
93 (native-inputs `(("perl" ,perl))) ;some of the tests require it
96 (modify-phases %standard-phases
97 (add-after 'install 'fix-egrep-and-fgrep
98 ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
99 ;; absolute file name instead of searching for it in $PATH.
100 (lambda* (#:key outputs #:allow-other-keys)
101 (let* ((out (assoc-ref outputs "out"))
102 (bin (string-append out "/bin")))
103 (substitute* (list (string-append bin "/egrep")
104 (string-append bin "/fgrep"))
106 (string-append "exec " bin "/grep")))
108 (synopsis "Print lines matching a pattern")
110 "grep is a tool for finding text inside files. Text is found by
111 matching a pattern provided by the user in one or many files. The pattern
112 may be provided as a basic or extended regular expression, or as fixed
113 strings. By default, the matching text is simply printed to the screen,
114 however the output can be greatly customized to include, for example, line
115 numbers. GNU grep offers many extensions over the standard utility,
116 including, for example, recursive directory searching.")
118 (home-page "https://www.gnu.org/software/grep/")))
126 (uri (string-append "mirror://gnu/sed/sed-" version
130 "0fv88bcnraixc8jvpacvxshi30p5x9m7yb8ns1hfv07hmb2ypmnb"))))
131 (build-system gnu-build-system)
132 (synopsis "Stream editor")
135 (modify-phases %standard-phases
136 (add-after 'unpack 'dont-rebuild-sed.1
138 ;; Make sure we do not attempt to rebuild 'doc/sed.1', which does
139 ;; not work when cross-compiling because we cannot run 'sed'.
140 ;; This is fixed upstream as commit a0a25e3.
141 (substitute* "Makefile.in"
145 (add-before 'patch-source-shebangs 'patch-test-suite
146 (lambda* (#:key inputs #:allow-other-keys)
147 (patch-makefile-SHELL "testsuite/Makefile.tests")
148 (substitute* '("testsuite/bsd.sh"
149 "testsuite/bug-regex9.c")
154 "Sed is a non-interactive, text stream editor. It receives a text
155 input from a file or from standard input and it then applies a series of text
156 editing commands to the stream and prints its output to standard output. It
157 is often used for substituting text patterns in a stream. The GNU
158 implementation offers several extensions over the standard utility.")
160 (home-page "https://www.gnu.org/software/sed/")))
168 (uri (string-append "mirror://gnu/tar/tar-"
172 "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0"))
173 (patches (search-patches "tar-CVE-2016-6321.patch"
174 "tar-skip-unreliable-tests.patch"))))
175 (build-system gnu-build-system)
176 ;; Note: test suite requires ~1GiB of disk space.
178 '(#:phases (modify-phases %standard-phases
179 (add-before 'build 'set-shell-file-name
180 (lambda* (#:key inputs #:allow-other-keys)
181 ;; Do not use "/bin/sh" to run programs.
182 (let ((bash (assoc-ref inputs "bash")))
183 (substitute* "src/system.c"
185 (string-append bash "/bin/sh")))
188 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
189 ;; to refer to the target Bash.
190 (inputs (if (%current-target-system)
194 (synopsis "Managing tar archives")
196 "Tar provides the ability to create tar archives, as well as the
197 ability to extract, update or list files in an existing archive. It is
198 useful for combining many files into one larger file, while maintaining
199 directory structure and file information such as permissions and
200 creation/modification dates. GNU tar offers many extensions over the
203 (home-page "https://www.gnu.org/software/tar/")))
211 (uri (string-append "mirror://gnu/patch/patch-"
215 "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
216 (patches (search-patches "patch-hurd-path-max.patch"))))
217 (build-system gnu-build-system)
218 (native-inputs `(("ed" ,ed)))
219 (synopsis "Apply differences to originals, with optional backups")
221 "Patch is a program that applies changes to files based on differences
222 laid out as by the program \"diff\". The changes may be applied to one or more
223 files depending on the contents of the diff file. It accepts several
224 different diff formats. It may also be used to revert previously applied
227 (home-page "https://savannah.gnu.org/projects/patch/")))
229 (define-public diffutils
235 (uri (string-append "mirror://gnu/diffutils/diffutils-"
239 "0csmqfz8ks23kdjsq0v2ll1acqiz8lva06dj19mwmymrsp69ilys"))))
240 (build-system gnu-build-system)
241 (synopsis "Comparing and merging files")
243 "GNU Diffutils is a package containing tools for finding the
244 differences between files. The \"diff\" command is used to show how two files
245 differ, while \"cmp\" shows the offsets and line numbers where they differ.
246 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
247 interactive means to merge two files.")
249 (home-page "https://www.gnu.org/software/diffutils/")))
251 (define-public findutils
257 (uri (string-append "mirror://gnu/findutils/findutils-"
261 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
262 (patches (search-patches "findutils-localstatedir.patch"
263 "findutils-test-xargs.patch"))))
264 (build-system gnu-build-system)
266 `(#:configure-flags (list
267 ;; Tell 'updatedb' to write to /var.
268 "--localstatedir=/var"
270 ;; Work around cross-compilation failure. See
271 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
272 ,@(if (%current-target-system)
273 '("gl_cv_func_wcwidth_works=yes")
275 (synopsis "Operating on files matching given criteria")
277 "Findutils supplies the basic file directory searching utilities of the
278 GNU system. It consists of two primary searching utilities: \"find\"
279 recursively searches for files in a directory according to given criteria and
280 \"locate\" lists files in a database that match a query. Two auxiliary tools
281 are included: \"updatedb\" updates the file name database and \"xargs\" may be
282 used to apply commands with arbitrarily long arguments.")
284 (home-page "https://www.gnu.org/software/findutils/")))
286 (define-public coreutils
292 (uri (string-append "mirror://gnu/coreutils/coreutils-"
296 "13lspazc7xkviy93qz7ks9jv4sldvgmwpq36ghrbrqpq93br8phm"))
297 (patches (search-patches "coreutils-fix-cross-compilation.patch"))))
298 (build-system gnu-build-system)
299 (inputs `(("acl" ,acl) ; TODO: add SELinux
300 ("gmp" ,gmp) ;bignums in 'expr', yay!
302 ;; Drop the dependency on libcap when cross-compiling since it's
303 ;; not quite cross-compilable.
304 ,@(if (%current-target-system)
306 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
308 ;; Perl is needed to run tests in native builds, and to run the bundled
309 ;; copy of help2man. However, don't pass it when cross-compiling since
310 ;; that would lead it to try to run programs to get their '--help' output
312 `(,@(if (%current-target-system)
316 ;; Apply this patch only on ARM to avoid a full rebuild.
317 ;; TODO: Move to 'patches' in the next update cycle.
318 ,@(if (string-prefix? "arm" (or (%current-target-system)
321 ,(search-patch "coreutils-cut-huge-range-test.patch")))
323 (outputs '("out" "debug"))
325 `(#:parallel-build? #f ; help2man may be called too early
326 #:parallel-tests? #f ; race condition fixed after 8.26
327 #:phases (alist-cons-before
328 'build 'patch-shell-references
329 (lambda* (#:key inputs #:allow-other-keys)
330 (let ((bash (assoc-ref inputs "bash")))
331 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
332 ;; that tests pass, since /bin/sh isn't in the chroot.
333 (setenv "SHELL" (which "sh"))
335 (substitute* (find-files "gnulib-tests" "\\.c$")
337 (format #f "~a/bin/sh" bash)))
338 (substitute* (find-files "tests" "\\.sh$")
340 (format #f "#!~a/bin/sh" bash)))))
342 ,@(if (string-prefix? "arm" (or (%current-target-system)
345 'build 'patch-cut-test
346 (lambda* (#:key inputs native-inputs
348 (let ((patch (or (assoc-ref inputs
350 (assoc-ref native-inputs
353 (system* "patch" "-p1" "--force"
356 '(%standard-phases)))))
357 (synopsis "Core GNU utilities (file, text, shell)")
359 "GNU Coreutils includes all of the basic command-line tools that are
360 expected in a POSIX system. These provide the basic file, shell and text
361 manipulation functions of the GNU system. Most of these tools offer extended
362 functionality beyond that which is outlined in the POSIX standard.")
364 (home-page "https://www.gnu.org/software/coreutils/")))
366 (define-public coreutils-minimal
367 ;; Coreutils without its optional dependencies.
370 (name "coreutils-minimal")
374 (define-public gnu-make
380 (uri (string-append "mirror://gnu/make/make-" version
384 "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn"))
385 (patches (search-patches "make-impure-dirs.patch"))))
386 (build-system gnu-build-system)
387 (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile
388 (inputs `(("guile" ,guile-2.0)))
389 (outputs '("out" "debug"))
392 (modify-phases %standard-phases
393 (add-before 'build 'set-default-shell
394 (lambda* (#:key inputs #:allow-other-keys)
395 ;; Change the default shell from /bin/sh.
396 (let ((bash (assoc-ref inputs "bash")))
398 (("default_shell =.*$")
399 (format #f "default_shell = \"~a/bin/sh\";\n"
401 (synopsis "Remake files automatically")
403 "Make is a program that is used to control the production of
404 executables or other files from their source files. The process is
405 controlled from a Makefile, in which the developer specifies how each file is
406 generated from its source. It has powerful dependency resolution and the
407 ability to determine when files have to be regenerated after their sources
408 change. GNU make offers many powerful extensions over the standard utility.")
410 (home-page "https://www.gnu.org/software/make/")))
412 (define-public binutils
418 (uri (string-append "mirror://gnu/binutils/binutils-"
422 "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn"))
423 (patches (search-patches "binutils-ld-new-dtags.patch"
424 "binutils-loongson-workaround.patch"
425 "binutils-mips-bash-bug.patch"))))
426 (build-system gnu-build-system)
428 ;; TODO: Add dependency on zlib + those for Gold.
430 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
431 ;; on GCC when bootstrapping.
432 "LDFLAGS=-static-libgcc"
434 ;; Don't search under /usr/lib & co.
435 "--with-lib-path=/no-ld-lib-path"
437 ;; Glibc 2.17 has a "comparison of unsigned
438 ;; expression >= 0 is always true" in wchar.h.
441 ;; Install BFD. It ends up in a hidden directory,
443 "--enable-install-libbfd"
445 ;; Make sure 'ar' and 'ranlib' produce archives in a
446 ;; deterministic fashion.
447 "--enable-deterministic-archives")))
449 (synopsis "Binary utilities: bfd gas gprof ld")
451 "GNU Binutils is a collection of tools for working with binary files.
452 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
453 Other tools include programs to display binary profiling information, list
454 the strings in a binary file, and utilities for working with archives. The
455 \"bfd\" library for working with executable and object formats is also
458 (home-page "https://www.gnu.org/software/binutils/")))
460 (define* (make-ld-wrapper name #:key
463 (guile (canonical-package guile-2.0))
464 (bash (canonical-package bash))
465 (guile-for-build guile))
466 "Return a package called NAME that contains a wrapper for the 'ld' program
467 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
468 wrapper uses GUILE and BASH.
470 TARGET must be a one-argument procedure that, given a system type, returns a
471 cross-compilation target triplet or #f. When the result is not #f, make a
472 wrapper for the cross-linker for that target, called 'TARGET-ld'."
473 ;; Note: #:system->target-triplet is a procedure so that the evaluation of
474 ;; its result can be delayed until the 'arguments' field is evaluated, thus
475 ;; in a context where '%current-system' is accurate.
480 (build-system trivial-build-system)
481 (inputs `(("binutils" ,binutils)
484 ("wrapper" ,(search-path %load-path
485 "gnu/packages/ld-wrapper.in"))))
487 (let ((target (target (%current-system))))
488 `(#:guile ,guile-for-build
489 #:modules ((guix build utils))
491 (use-modules (guix build utils)
492 (system base compile))
494 (let* ((out (assoc-ref %outputs "out"))
495 (bin (string-append out "/bin"))
497 `(string-append bin "/" ,target "-ld")
498 '(string-append bin "/ld")))
499 (go (string-append ld ".go")))
501 (setvbuf (current-output-port) _IOLBF)
502 (format #t "building ~s/bin/ld wrapper in ~s~%"
503 (assoc-ref %build-inputs "binutils")
507 (copy-file (assoc-ref %build-inputs "wrapper") ld)
512 (string-append (assoc-ref %build-inputs "guile")
515 (string-append (assoc-ref %build-inputs "bash")
518 (string-append (assoc-ref %build-inputs "binutils")
520 (string-append "/bin/"
524 (compile-file ld #:output-file go))))))
525 (synopsis "The linker wrapper")
527 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
528 missing '-rpath' flags, and to detect any misuse of libraries outside of the
530 (home-page "https://www.gnu.org/software/guix//")
533 (export make-ld-wrapper)
535 (define-public glibc/linux
541 (uri (string-append "mirror://gnu/glibc/glibc-"
545 "1813dzkgw6v8q8q1m4v96yfis7vjqc9pslqib6j9mrwh6fxxjyq6"))
547 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
548 ;; required on LFS distros to avoid loading the distro's libc.so
550 '(substitute* "sysdeps/unix/sysv/linux/configure"
551 (("use_ldconfig=yes")
553 (modules '((guix build utils)))
554 (patches (search-patches "glibc-ldd-x86_64.patch"
555 "glibc-versioned-locpath.patch"
556 "glibc-o-largefile.patch"))))
557 (build-system gnu-build-system)
559 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
560 ;; users should automatically pull Linux headers as well.
561 (propagated-inputs `(("kernel-headers" ,linux-libre-headers)))
563 (outputs '("out" "debug"))
566 `(#:out-of-source? #t
568 ;; In version 2.21, there a race in the 'elf' directory, see
569 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
572 ;; The libraries have an empty RUNPATH, but some, such as the versioned
573 ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since
574 ;; these libraries are always going to be found anyway, just skip
576 #:validate-runpath? #f
579 (list "--enable-add-ons"
582 ;; Installing a locale archive with all the locales is to
583 ;; expensive (~100 MiB), so we rely on users to install the
584 ;; locales they really want.
586 ;; Set the default locale path. In practice, $LOCPATH may be
587 ;; defined to point whatever locales users want. However, setuid
588 ;; binaries don't honor $LOCPATH, so they'll instead look into
589 ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y,
590 ;; with the idea that it is going to be populated by the sysadmin.
591 ;; The "X.Y" sub-directory is because locale data formats are
592 ;; incompatible across libc versions; see
593 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
595 ;; `--localedir' is not honored, so work around it.
596 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
597 (string-append "libc_cv_complocaledir=/run/current-system/locale/"
600 (string-append "--with-headers="
601 (assoc-ref ,(if (%current-target-system)
602 '%build-target-inputs
607 ;; This is the default for most architectures as of GNU libc 2.21,
608 ;; but we specify it explicitly for clarity and consistency. See
609 ;; "kernel-features.h" in the GNU libc for details.
610 "--enable-kernel=2.6.32"
612 ;; Use our Bash instead of /bin/sh.
613 (string-append "BASH_SHELL="
614 (assoc-ref %build-inputs "bash")
617 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
618 "libc_cv_ssp=no" "libc_cv_ssp_strong=no")
621 #:phases (modify-phases %standard-phases
623 'configure 'pre-configure
624 (lambda* (#:key inputs native-inputs outputs
626 (let* ((out (assoc-ref outputs "out"))
627 (bin (string-append out "/bin"))
628 ;; FIXME: Normally we would look it up only in INPUTS
629 ;; but cross-base uses it as a native input.
630 (bash (or (assoc-ref inputs "static-bash")
631 (assoc-ref native-inputs "static-bash"))))
632 ;; Install the rpc data base file under `$out/etc/rpc'.
633 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
634 (substitute* "sunrpc/Makefile"
635 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
636 (string-append out "/etc/rpc" suffix "\n"))
637 (("^install-others =.*$")
638 (string-append "install-others = " out "/etc/rpc\n")))
640 (substitute* "Makeconfig"
642 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
643 ;; linking against libgcc_s is not needed with GCC
647 ;; Have `system' use that Bash.
648 (substitute* "sysdeps/posix/system.c"
649 (("#define[[:blank:]]+SHELL_PATH.*$")
650 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
654 (substitute* "libio/iopopen.c"
656 (string-append bash "/bin/sh")))
658 ;; Same for the shell used by the 'exec' functions for
659 ;; scripts that lack a shebang.
660 (substitute* (find-files "." "^paths\\.h$")
661 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
662 (string-append "#define _PATH_BSHELL \""
663 bash "/bin/sh\"\n")))
665 ;; Nscd uses __DATE__ and __TIME__ to create a string to
666 ;; make sure the client and server come from the same
667 ;; libc. Use something deterministic instead.
668 (substitute* "nscd/nscd_stat.c"
669 (("static const char compilation\\[21\\] =.*$")
671 "static const char compilation[21] = \""
672 (string-take (basename out) 20) "\";\n")))
674 ;; Make sure we don't retain a reference to the
676 (substitute* "malloc/mtrace.pl"
678 ;; The shebang can be omitted, because there's the
679 ;; "bilingual" eval/exec magic at the top of the file.
684 (inputs `(("static-bash" ,static-bash)))
686 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
687 ;; install the message catalogs, with 'msgfmt'.
688 (native-inputs `(("texinfo" ,texinfo)
690 ("gettext" ,gettext-minimal)))
693 ;; Search path for packages that provide locale data. This is useful
694 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
695 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
697 (list (search-path-specification
698 (variable "GUIX_LOCPATH")
699 (files '("lib/locale")))))
701 (synopsis "The GNU C Library")
703 "Any Unix-like operating system needs a C library: the library which
704 defines the \"system calls\" and other basic facilities such as open, malloc,
707 The GNU C library is used as the C library in the GNU system and most systems
708 with the Linux kernel.")
710 (home-page "https://www.gnu.org/software/libc/")))
712 (define-public glibc/hurd
713 ;; The Hurd's libc variant.
714 (package (inherit glibc/linux)
719 (uri (string-append "http://alpha.gnu.org/gnu/hurd/glibc-"
720 version "-hurd+libpthread-20161218" ".tar.gz"))
723 "0vpdv05j6j3ria5bw8gp468i64gij94cslxkxj9xkfgi6p615b8p"))))
725 ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
726 ;; so both should be propagated.
727 (propagated-inputs `(("hurd-core-headers" ,hurd-core-headers)))
729 `(,@(package-native-inputs glibc/linux)
734 (substitute-keyword-arguments (package-arguments glibc/linux)
735 ((#:phases original-phases)
736 ;; Add libmachuser.so and libhurduser.so to libc.so's search path.
737 ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-07/msg00051.html>.
739 'install 'augment-libc.so
740 (lambda* (#:key outputs #:allow-other-keys)
741 (let* ((out (assoc-ref outputs "out")))
742 (substitute* (string-append out "/lib/libc.so")
743 (("/[^ ]+/lib/libc.so.0.3")
744 (string-append out "/lib/libc.so.0.3" " libmachuser.so" " libhurduser.so"))))
747 'pre-configure 'pre-configure-set-pwd
749 ;; Use the right 'pwd'.
750 (substitute* "configure"
751 (("/bin/pwd") "pwd")))
755 ;; Force mach/hurd/libpthread subdirs to build first in order to avoid
757 ;; See <https://lists.gnu.org/archive/html/bug-hurd/2016-11/msg00045.html>
758 (let ((-j (list "-j" (number->string (parallel-job-count)))))
759 (let-syntax ((make (syntax-rules ()
761 (zero? (apply system* "make" target -j))))))
762 (and (make "mach/subdir_lib")
763 (make "hurd/subdir_lib")
764 (make "libpthread/subdir_lib")
765 (zero? (apply system* "make" -j))))))
767 ((#:configure-flags original-configure-flags)
768 `(append (list "--host=i586-pc-gnu"
770 ;; We need this to get a working openpty() function.
773 ;; <https://lists.gnu.org/archive/html/bug-hurd/2016-10/msg00033.html>
776 ;; nscd fails to build for GNU/Hurd:
777 ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
780 (filter (lambda (flag)
781 (not (string-prefix? "--enable-kernel=" flag)))
782 ,original-configure-flags)))))
783 (synopsis "The GNU C Library (GNU Hurd variant)")
784 (supported-systems %hurd-systems)))
786 (define* (glibc-for-target #:optional
787 (target (or (%current-target-system)
789 "Return the glibc for TARGET, GLIBC/LINUX for a Linux host or
790 GLIBC/HURD for a Hurd host"
792 ((or "i586-pc-gnu" "i586-gnu") glibc/hurd)
796 (identifier-syntax (glibc-for-target)))
798 ;; Below are old libc versions, which we use mostly to build locale data in
799 ;; the old format (which the new libc cannot cope with.)
801 (define-public glibc-2.24
806 (inherit (package-source glibc))
807 (uri (string-append "mirror://gnu/glibc/glibc-"
811 "1lxmprg9gm73gvafxd503x70z32phwjzcy74i0adfi6ixzla7m4r"))))))
813 (define-public glibc-2.23
818 (inherit (package-source glibc))
819 (uri (string-append "mirror://gnu/glibc/glibc-"
823 "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))))))
825 (define-public glibc-2.22
830 (inherit (package-source glibc))
831 (uri (string-append "mirror://gnu/glibc/glibc-"
835 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
836 (patches (search-patches "glibc-ldd-x86_64.patch"))))
838 (substitute-keyword-arguments (package-arguments glibc)
840 `(modify-phases ,phases
841 (add-before 'configure 'fix-pwd
843 ;; Use `pwd' instead of `/bin/pwd' for glibc-2.21
844 (substitute* "configure"
845 (("/bin/pwd") "pwd"))))))))))
847 (define-public glibc-2.21
852 (inherit (package-source glibc))
853 (uri (string-append "mirror://gnu/glibc/glibc-"
857 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
858 (patches (search-patches "glibc-ldd-x86_64.patch"))))))
860 (define-public glibc-locales
863 (name "glibc-locales")
864 (source (origin (inherit (package-source glibc))
865 (patches (cons (search-patch "glibc-locales.patch")
866 (origin-patches (package-source glibc))))))
867 (synopsis "All the locales supported by the GNU C Library")
869 "This package provides all the locales supported by the GNU C Library,
870 more than 400 in total. To use them set the 'LOCPATH' environment variable to
871 the 'share/locale' sub-directory of this package.")
872 (outputs '("out")) ;110+ MiB
873 (native-search-paths '())
875 (let ((args `(#:tests? #f #:strip-binaries? #f
876 ,@(package-arguments glibc))))
877 (substitute-keyword-arguments args
881 (lambda* (#:key outputs #:allow-other-keys)
882 (zero? (system* "make" "localedata/install-locales"
883 "-j" (number->string (parallel-job-count)))))
884 (alist-delete 'install ,phases)))
885 ((#:configure-flags flags)
887 ;; Use $(libdir)/locale/X.Y as is the case by default.
888 (list (string-append "libc_cv_complocaledir="
889 (assoc-ref %outputs "out")
891 ,(package-version glibc))))))))))
893 (define-public glibc-utf8-locales
895 (name "glibc-utf8-locales")
896 (version (package-version glibc))
898 (build-system trivial-build-system)
900 `(#:modules ((guix build utils))
902 (use-modules (srfi srfi-1)
905 (let* ((libc (assoc-ref %build-inputs "glibc"))
906 (gzip (assoc-ref %build-inputs "gzip"))
907 (out (assoc-ref %outputs "out"))
908 (localedir (string-append out "/lib/locale/"
910 ;; 'localedef' needs 'gzip'.
911 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
914 (every (lambda (locale)
916 ;; Use the "normalized codeset" by
917 ;; default--e.g., "en_US.utf8".
918 (string-append localedir "/" locale ".utf8"))
920 (and (zero? (system* "localedef" "--no-archive"
925 ;; For backward compatibility with Guix
926 ;; <= 0.8.3, add "xx_YY.UTF-8".
927 (symlink (string-append locale ".utf8")
928 (string-append localedir "/"
932 ;; These are the locales commonly used for
933 ;; tests---e.g., in Guile's i18n tests.
934 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
935 (inputs `(("glibc" ,glibc)
937 (synopsis "Small sample of UTF-8 locales")
939 "This package provides a small sample of UTF-8 locales mostly useful in
941 (home-page (package-home-page glibc))
942 (license (package-license glibc))))
950 (uri (string-append "mirror://gnu/which/which-"
954 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
955 (build-system gnu-build-system)
956 (home-page "https://gnu.org/software/which/")
957 (synopsis "Find full path of shell commands")
959 "The which program finds the location of executables in PATH, with a
960 variety of options. It is an alternative to the shell \"type\" built-in
962 (license gpl3+))) ; some files are under GPLv2+
964 (define-public glibc/hurd-headers
965 (package (inherit glibc/hurd)
966 (name "glibc-hurd-headers")
968 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
969 ("hurd-headers" ,hurd-headers)))
971 (substitute-keyword-arguments (package-arguments glibc/hurd)
972 ;; We just pass the flags really needed to build the headers.
973 ((#:configure-flags _)
974 `(list "--enable-add-ons"
976 "--enable-obsolete-rpc"))
980 (lambda* (#:key outputs #:allow-other-keys)
981 (and (zero? (system* "make" "install-headers"))
983 ;; Make an empty stubs.h to work around not being able to
984 ;; produce a valid stubs.h and causing the build to fail. See
985 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
986 (let ((out (assoc-ref outputs "out")))
989 (string-append out "/include/gnu/stubs.h"))))))
996 'configure 'pre-configure
998 ;; Use the right 'pwd'.
999 (substitute* "configure"
1000 (("/bin/pwd") "pwd")))
1001 %standard-phases))))))))
1003 (define-public tzdata
1010 "https://www.iana.org/time-zones/repository/releases/tzdata"
1014 "1mmv4rvcs12lrvgghw4fidczvb69yv69cmzknghcvw1c196mqfnz"))))
1015 (build-system gnu-build-system)
1018 #:make-flags (let ((out (assoc-ref %outputs "out"))
1019 (tmp (getenv "TMPDIR")))
1020 (list (string-append "TOPDIR=" out)
1021 (string-append "TZDIR=" out "/share/zoneinfo")
1023 ;; Discard zic, dump, and tzselect, already
1024 ;; provided by glibc.
1025 (string-append "ETCDIR=" tmp "/etc")
1027 ;; Likewise for the C library routines.
1028 (string-append "LIBDIR=" tmp "/lib")
1029 (string-append "MANDIR=" tmp "/man")
1033 #:modules ((guix build utils)
1034 (guix build gnu-build-system)
1037 (modify-phases %standard-phases
1039 (lambda* (#:key source inputs #:allow-other-keys)
1040 (and (zero? (system* "tar" "xvf" source))
1041 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode"))))))
1042 (add-after 'install 'post-install
1043 (lambda* (#:key outputs #:allow-other-keys)
1044 ;; Move data in the right place.
1045 (let ((out (assoc-ref outputs "out")))
1046 (symlink (string-append out "/share/zoneinfo")
1047 (string-append out "/share/zoneinfo/posix"))
1048 (delete-file-recursively
1049 (string-append out "/share/zoneinfo-posix"))
1050 (copy-recursively (string-append out "/share/zoneinfo-leaps")
1051 (string-append out "/share/zoneinfo/right"))
1052 (delete-file-recursively
1053 (string-append out "/share/zoneinfo-leaps")))))
1054 (delete 'configure))))
1055 (inputs `(("tzcode" ,(origin
1058 "http://www.iana.org/time-zones/repository/releases/tzcode"
1062 "1b1q7gnlsh5hjgs5065pvajd37rmbc3k9b8cgzad1vcrifswdwh2"))))))
1063 (home-page "https://www.iana.org/time-zones")
1064 (synopsis "Database of current and historical time zones")
1065 (description "The Time Zone Database (often called tz or zoneinfo)
1066 contains code and data that represent the history of local time for many
1067 representative locations around the globe. It is updated periodically to
1068 reflect changes made by political bodies to time zone boundaries, UTC offsets,
1069 and daylight-saving rules.")
1070 (license public-domain)))
1072 ;;; A "fixed" version of tzdata, which is used in the test suites of
1073 ;;; glib and R. We can update this whenever we are able to rebuild
1074 ;;; thousands of packages (for example, in a core-updates rebuild).
1075 (define-public tzdata-2017a
1082 (uri (string-append "https://www.iana.org/time-zones/repository"
1083 "/releases/tzdata" version ".tar.gz"))
1086 "1mmv4rvcs12lrvgghw4fidczvb69yv69cmzknghcvw1c196mqfnz"))))
1087 (inputs `(("tzcode" ,(origin
1090 "http://www.iana.org/time-zones/repository/releases/tzcode"
1094 "1b1q7gnlsh5hjgs5065pvajd37rmbc3k9b8cgzad1vcrifswdwh2"))))))))
1097 (define-public libiconv
1103 (uri (string-append "mirror://gnu/libiconv/libiconv-"
1107 "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))
1108 (modules '((guix build utils)))
1110 ;; Work around "declared gets" error on glibc systems (fixed by
1111 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
1112 '(substitute* "srclib/stdio.in.h"
1113 (("^#undef gets") "")
1114 (("^_GL_WARN_ON_USE \\(gets.*") "")))))
1115 (build-system gnu-build-system)
1116 (synopsis "Character set conversion library")
1118 "libiconv provides an implementation of the iconv function for systems
1119 that lack it. iconv is used to convert between character encodings in a
1120 program. It supports a wide variety of different encodings.")
1121 (home-page "https://www.gnu.org/software/libiconv/")
1124 (define* (libiconv-if-needed #:optional (target (%current-target-system)))
1125 "Return either a libiconv package specification to include in a dependency
1126 list for platforms that have an incomplete libc, or the empty list. If a
1127 package needs iconv ,@(libiconv-if-needed) should be added."
1128 ;; POSIX C libraries provide iconv. Platforms with an incomplete libc
1129 ;; without iconv, such as MinGW, must return the then clause.
1130 (if (target-mingw? target)
1131 `(("libiconv" ,libiconv))
1134 (define-public (canonical-package package)
1135 ;; Avoid circular dependency by lazily resolving 'commencement'.
1136 (let* ((iface (resolve-interface '(gnu packages commencement)))
1137 (proc (module-ref iface 'canonical-package)))
1140 (define-public (%final-inputs)
1141 "Return the list of \"final inputs\"."
1142 ;; Avoid circular dependency by lazily resolving 'commencement'.
1143 (let ((iface (resolve-interface '(gnu packages commencement))))
1144 (module-ref iface '%final-inputs)))
1146 ;;; base.scm ends here