1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2019 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015, 2016, 2018 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, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
10 ;;; Copyright © 2016, 2018 Alex Vong <alexvong1995@gmail.com>
11 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
12 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
13 ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
14 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
15 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
16 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
18 ;;; This file is part of GNU Guix.
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33 (define-module (gnu packages base)
34 #:use-module ((guix licenses)
35 #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
36 #:use-module (gnu packages)
37 #:use-module (gnu packages acl)
38 #:use-module (gnu packages algebra)
39 #:use-module (gnu packages bash)
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages ed)
42 #:use-module (gnu packages gcc)
43 #:use-module (gnu packages guile)
44 #:use-module (gnu packages multiprecision)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages linux)
48 #:use-module (gnu packages pcre)
49 #:use-module (gnu packages texinfo)
50 #:use-module (gnu packages hurd)
51 #:use-module (gnu packages pkg-config)
52 #:use-module (gnu packages gettext)
53 #:use-module (guix utils)
54 #:use-module (guix packages)
55 #:use-module (guix download)
56 #:use-module (guix git-download)
57 #:use-module (guix build-system gnu)
58 #:use-module (guix build-system trivial)
59 #:use-module (ice-9 match)
60 #:use-module (srfi srfi-1)
61 #:use-module (srfi srfi-26)
67 ;;; Base packages of the Guix-based GNU user-land software distribution.
77 (uri (string-append "mirror://gnu/hello/hello-" version
81 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
82 (build-system gnu-build-system)
83 (synopsis "Hello, GNU world: An example GNU package")
85 "GNU Hello prints the message \"Hello, world!\" and then exits. It
86 serves as an example of standard GNU coding practices. As such, it supports
87 command-line arguments, multiple languages, and so on.")
88 (home-page "https://www.gnu.org/software/hello/")
97 (uri (string-append "mirror://gnu/grep/grep-"
101 "055mqp6vrd0brkygmygb2673qwz409a7kyp1mzbfy6cn94f58q5r"))
102 (patches (search-patches "grep-timing-sensitive-test.patch"))))
103 (build-system gnu-build-system)
104 (native-inputs `(("perl" ,perl))) ;some of the tests require it
105 (inputs `(("pcre" ,pcre)))
108 (modify-phases %standard-phases
109 (add-after 'install 'fix-egrep-and-fgrep
110 ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
111 ;; absolute file name instead of searching for it in $PATH.
112 (lambda* (#:key outputs #:allow-other-keys)
113 (let* ((out (assoc-ref outputs "out"))
114 (bin (string-append out "/bin")))
115 (substitute* (list (string-append bin "/egrep")
116 (string-append bin "/fgrep"))
118 (string-append "exec " bin "/grep")))
120 (synopsis "Print lines matching a pattern")
122 "grep is a tool for finding text inside files. Text is found by
123 matching a pattern provided by the user in one or many files. The pattern
124 may be provided as a basic or extended regular expression, or as fixed
125 strings. By default, the matching text is simply printed to the screen,
126 however the output can be greatly customized to include, for example, line
127 numbers. GNU grep offers many extensions over the standard utility,
128 including, for example, recursive directory searching.")
130 (home-page "https://www.gnu.org/software/grep/")))
138 (uri (string-append "mirror://gnu/sed/sed-" version
142 "0smxcx66vx29djzb542nxcynl7qnzxqa5032ibazi7x2s267d198"))))
143 (build-system gnu-build-system)
144 (synopsis "Stream editor")
146 `(("perl" ,perl))) ;for tests
148 "Sed is a non-interactive, text stream editor. It receives a text
149 input from a file or from standard input and it then applies a series of text
150 editing commands to the stream and prints its output to standard output. It
151 is often used for substituting text patterns in a stream. The GNU
152 implementation offers several extensions over the standard utility.")
154 (home-page "https://www.gnu.org/software/sed/")))
162 (uri (string-append "mirror://gnu/tar/tar-"
166 "1n7xy657ii0sa42zx6944v2m4v9qrh6sqgmw17l3nch3y43sxlyh"))
167 (patches (search-patches "tar-skip-unreliable-tests.patch"
168 "tar-remove-wholesparse-check.patch"))))
169 (build-system gnu-build-system)
170 ;; Note: test suite requires ~1GiB of disk space.
172 `(#:phases (modify-phases %standard-phases
173 (add-before 'build 'set-shell-file-name
174 (lambda* (#:key inputs #:allow-other-keys)
175 ;; Do not use "/bin/sh" to run programs.
176 (let ((bash (assoc-ref inputs "bash")))
177 (substitute* "src/system.c"
179 (string-append bash "/bin/sh")))
182 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
183 ;; to refer to the target Bash.
184 (inputs (if (%current-target-system)
188 (synopsis "Managing tar archives")
190 "Tar provides the ability to create tar archives, as well as the
191 ability to extract, update or list files in an existing archive. It is
192 useful for combining many files into one larger file, while maintaining
193 directory structure and file information such as permissions and
194 creation/modification dates. GNU tar offers many extensions over the
197 (home-page "https://www.gnu.org/software/tar/")))
205 (uri (string-append "mirror://gnu/patch/patch-"
209 "1zfqy4rdcy279vwn2z1kbv19dcfw25d2aqy9nzvdkq5bjzd0nqdc"))
210 (patches (search-patches "patch-hurd-path-max.patch"))))
211 (build-system gnu-build-system)
213 ;; Work around a cross-compilation bug whereby libpatch.a would provide
214 ;; '__mktime_internal', which conflicts with the one in libc.a.
215 (if (%current-target-system)
216 `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
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 "09isrg0isjinv8c535nxsi1s86wfdfzml80dbw41dj9x3hiad9xk"))))
240 (build-system gnu-build-system)
241 (native-inputs `(("perl" ,perl)))
242 (synopsis "Comparing and merging files")
244 "GNU Diffutils is a package containing tools for finding the
245 differences between files. The \"diff\" command is used to show how two files
246 differ, while \"cmp\" shows the offsets and line numbers where they differ.
247 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
248 interactive means to merge two files.")
250 (home-page "https://www.gnu.org/software/diffutils/")))
252 (define-public findutils
258 (uri (string-append "mirror://gnu/findutils/findutils-"
262 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
263 (patches (search-patches
264 "findutils-gnulib-libio.patch"
265 "findutils-localstatedir.patch"
266 "findutils-makedev.patch"
267 "findutils-test-xargs.patch"))
268 (modules '((guix build utils)))
271 ;; The gnulib test-lock test is prone to writer starvation
272 ;; with our glibc@2.25, which prefers readers, so disable it.
273 ;; The gnulib commit b20e8afb0b2 should fix this once
274 ;; incorporated here.
275 (substitute* "tests/Makefile.in"
276 (("test-lock\\$\\(EXEEXT\\) ") ""))
278 (build-system gnu-build-system)
280 `(#:configure-flags (list
281 ;; Tell 'updatedb' to write to /var.
282 "--localstatedir=/var"
284 ;; Work around cross-compilation failure. See
285 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
286 ,@(if (%current-target-system)
287 '("gl_cv_func_wcwidth_works=yes")
289 (synopsis "Operating on files matching given criteria")
291 "Findutils supplies the basic file directory searching utilities of the
292 GNU system. It consists of two primary searching utilities: \"find\"
293 recursively searches for files in a directory according to given criteria and
294 \"locate\" lists files in a database that match a query. Two auxiliary tools
295 are included: \"updatedb\" updates the file name database and \"xargs\" may be
296 used to apply commands with arbitrarily long arguments.")
298 (home-page "https://www.gnu.org/software/findutils/")))
300 (define-public coreutils
306 (uri (string-append "mirror://gnu/coreutils/coreutils-"
310 "1zg9m79x1i2nifj4kb0waf9x3i5h6ydkypkjnbsb9rnwis8rqypz"))))
311 (build-system gnu-build-system)
312 (inputs `(("acl" ,acl) ; TODO: add SELinux
313 ("gmp" ,gmp) ;bignums in 'expr', yay!
315 ;; Drop the dependency on libcap when cross-compiling since it's
316 ;; not quite cross-compilable.
317 ,@(if (%current-target-system)
319 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
321 ;; Perl is needed to run tests in native builds, and to run the bundled
322 ;; copy of help2man. However, don't pass it when cross-compiling since
323 ;; that would lead it to try to run programs to get their '--help' output
325 (if (%current-target-system)
328 (outputs '("out" "debug"))
330 `(#:parallel-build? #f ; help2man may be called too early
331 #:phases (modify-phases %standard-phases
332 (add-before 'build 'patch-shell-references
334 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
335 ;; that tests pass, since /bin/sh isn't in the chroot.
336 (setenv "SHELL" (which "sh"))
338 (substitute* (find-files "gnulib-tests" "\\.c$")
339 (("/bin/sh") (which "sh")))
340 (substitute* (find-files "tests" "\\.sh$")
341 (("#!/bin/sh") (string-append "#!" (which "sh"))))
343 (add-before 'check 'disable-broken-test
345 ;; This test hits the 127 character shebang limit in the build
346 ;; environment due to the way "env -S" splits arguments into
347 ;; shebangs. Note that "env-S-script.sh" works around this
348 ;; specific issue, but "env-S.pl" is not adjusted for build
349 ;; environments with long prefixes (/tmp/guix-build-...).
350 (substitute* "Makefile"
351 (("^.*tests/misc/env-S.pl.*$") ""))
353 (synopsis "Core GNU utilities (file, text, shell)")
355 "GNU Coreutils includes all of the basic command-line tools that are
356 expected in a POSIX system. These provide the basic file, shell and text
357 manipulation functions of the GNU system. Most of these tools offer extended
358 functionality beyond that which is outlined in the POSIX standard.")
360 (home-page "https://www.gnu.org/software/coreutils/")))
362 (define-public coreutils-minimal
363 ;; Coreutils without its optional dependencies.
366 (name "coreutils-minimal")
370 (define-public gnu-make
376 (uri (string-append "mirror://gnu/make/make-" version
380 "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn"))
381 (patches (search-patches "make-impure-dirs.patch"
382 "make-glibc-compat.patch"))))
383 (build-system gnu-build-system)
384 (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile
385 (inputs `(("guile" ,guile-2.0)))
386 (outputs '("out" "debug"))
388 '(;; Work around faulty glob detection with glibc 2.27. See
389 ;; <https://lists.nongnu.org/archive/html/bug-make/2017-11/msg00027.html>.
390 #:configure-flags '("make_cv_sys_gnu_glob=yes")
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"
402 (synopsis "Remake files automatically")
404 "Make is a program that is used to control the production of
405 executables or other files from their source files. The process is
406 controlled from a Makefile, in which the developer specifies how each file is
407 generated from its source. It has powerful dependency resolution and the
408 ability to determine when files have to be regenerated after their sources
409 change. GNU make offers many powerful extensions over the standard utility.")
411 (home-page "https://www.gnu.org/software/make/")))
413 (define-public binutils
419 (uri (string-append "mirror://gnu/binutils/binutils-"
423 "0b8767nyal1bc4cyzg5h9iis8kpkln1i3wkamig75cifj1fb2f6y"))
424 (patches (search-patches "binutils-loongson-workaround.patch"))))
425 (build-system gnu-build-system)
427 ;; TODO: Add dependency on zlib + those for Gold.
429 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
430 ;; on GCC when bootstrapping.
431 "LDFLAGS=-static-libgcc"
433 ;; Turn on --enable-new-dtags by default to make the
434 ;; linker set RUNPATH instead of RPATH on binaries.
435 ;; This is important because RUNPATH can be overriden
436 ;; using LD_LIBRARY_PATH at runtime.
439 ;; Don't search under /usr/lib & co.
440 "--with-lib-path=/no-ld-lib-path"
442 ;; Install BFD. It ends up in a hidden directory,
444 "--enable-install-libbfd"
446 ;; Make sure 'ar' and 'ranlib' produce archives in a
447 ;; deterministic fashion.
448 "--enable-deterministic-archives")))
450 (synopsis "Binary utilities: bfd gas gprof ld")
452 "GNU Binutils is a collection of tools for working with binary files.
453 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
454 Other tools include programs to display binary profiling information, list
455 the strings in a binary file, and utilities for working with archives. The
456 \"bfd\" library for working with executable and object formats is also
459 (home-page "https://www.gnu.org/software/binutils/")))
461 (define-public binutils-gold
464 (name "binutils-gold")
467 (modify-phases %standard-phases
468 (add-after 'patch-source-shebangs 'patch-more-shebangs
470 (substitute* "gold/Makefile.in"
471 (("/bin/sh") (which "sh")))
473 ,@(substitute-keyword-arguments (package-arguments binutils)
474 ; Upstream is aware of unrelocatable test failures on arm*.
476 (if (any (cute string-prefix? <> (or (%current-target-system)
480 ((#:configure-flags flags)
481 `(cons* "--enable-gold=default"
482 (delete "LDFLAGS=-static-libgcc" ,flags))))))
486 `(("gcc:lib" ,gcc "lib")))))
488 (define* (make-ld-wrapper name #:key
491 (guile (canonical-package guile-2.2))
492 (bash (canonical-package bash))
493 (guile-for-build guile))
494 "Return a package called NAME that contains a wrapper for the 'ld' program
495 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
496 wrapper uses GUILE and BASH.
498 TARGET must be a one-argument procedure that, given a system type, returns a
499 cross-compilation target triplet or #f. When the result is not #f, make a
500 wrapper for the cross-linker for that target, called 'TARGET-ld'."
501 ;; Note: #:system->target-triplet is a procedure so that the evaluation of
502 ;; its result can be delayed until the 'arguments' field is evaluated, thus
503 ;; in a context where '%current-system' is accurate.
508 (build-system trivial-build-system)
509 (inputs `(("binutils" ,binutils)
512 ("wrapper" ,(search-path %load-path
513 "gnu/packages/ld-wrapper.in"))))
515 (let ((target (target (%current-system))))
516 `(#:guile ,guile-for-build
517 #:modules ((guix build utils))
519 (use-modules (guix build utils)
520 (system base compile))
522 (let* ((out (assoc-ref %outputs "out"))
523 (bin (string-append out "/bin"))
525 `(string-append bin "/" ,target "-ld")
526 '(string-append bin "/ld")))
527 (go (string-append ld ".go")))
529 (setvbuf (current-output-port) _IOLBF)
530 (format #t "building ~s/bin/ld wrapper in ~s~%"
531 (assoc-ref %build-inputs "binutils")
535 (copy-file (assoc-ref %build-inputs "wrapper") ld)
540 (string-append (assoc-ref %build-inputs "guile")
543 (string-append (assoc-ref %build-inputs "bash")
546 (string-append (assoc-ref %build-inputs "binutils")
548 (string-append "/bin/"
552 (compile-file ld #:output-file go)
554 (synopsis "The linker wrapper")
556 "The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any
557 missing @code{-rpath} flags, and to detect any misuse of libraries outside of
559 (home-page "https://www.gnu.org/software/guix//")
562 (export make-ld-wrapper)
565 ;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to
566 ;; version 2.28, GNU/Hurd used a different glibc branch.
569 ;; Note: Always use a dot after the minor version since various places rely
570 ;; on "version-major+minor" to determine where locales are found.
574 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
577 "10iha5ynvdj5m62vgpgqbq4cwvc2yhyl2w9yyyjgfxmdmx8h145i"))
579 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
580 ;; required on LFS distros to avoid loading the distro's libc.so
583 (substitute* "sysdeps/unix/sysv/linux/configure"
584 (("use_ldconfig=yes")
587 (modules '((guix build utils)))
588 (patches (search-patches "glibc-ldd-x86_64.patch"
589 "glibc-2.28-git-fixes.patch"
590 "glibc-hidden-visibility-ldconfig.patch"
591 "glibc-versioned-locpath.patch"
592 "glibc-allow-kernel-2.6.32.patch"
593 "glibc-reinstate-prlimit64-fallback.patch"
594 "glibc-hurd-magic-pid.patch"
595 "glibc-supported-locales.patch"))))
596 (build-system gnu-build-system)
598 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
599 ;; users should automatically pull Linux headers as well. On GNU/Hurd,
600 ;; libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
601 ;; so both should be propagated.
604 `(("hurd-core-headers" ,hurd-core-headers))
605 `(("kernel-headers" ,linux-libre-headers))))
607 (outputs '("out" "debug"
608 "static")) ;9 MiB of .a files
611 `(#:out-of-source? #t
613 ;; The libraries have an empty RUNPATH, but some, such as the versioned
614 ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since
615 ;; these libraries are always going to be found anyway, just skip
617 #:validate-runpath? #f
619 #:modules ((ice-9 ftw)
622 (guix build gnu-build-system))
625 (list "--sysconfdir=/etc"
627 ;; Installing a locale archive with all the locales is to
628 ;; expensive (~100 MiB), so we rely on users to install the
629 ;; locales they really want.
631 ;; Set the default locale path. In practice, $LOCPATH may be
632 ;; defined to point whatever locales users want. However, setuid
633 ;; binaries don't honor $LOCPATH, so they'll instead look into
634 ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y,
635 ;; with the idea that it is going to be populated by the sysadmin.
636 ;; The "X.Y" sub-directory is because locale data formats are
637 ;; incompatible across libc versions; see
638 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
640 ;; `--localedir' is not honored, so work around it.
641 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
642 (string-append "libc_cv_complocaledir=/run/current-system/locale/"
643 ,(version-major+minor version))
645 (string-append "--with-headers="
646 (assoc-ref ,(if (%current-target-system)
647 '%build-target-inputs
652 ;; This is the default for most architectures as of GNU libc 2.26,
653 ;; but we specify it explicitly for clarity and consistency. See
654 ;; "kernel-features.h" in the GNU libc for details.
655 "--enable-kernel=3.2.0"
657 ;; Use our Bash instead of /bin/sh.
658 (string-append "BASH_SHELL="
659 (assoc-ref %build-inputs "bash")
662 ;; On GNU/Hurd we get discarded-qualifiers warnings for
663 ;; 'device_write_inband' among other things. Ignore them.
665 '("--disable-werror")
669 #:phases (modify-phases %standard-phases
671 'configure 'pre-configure
672 (lambda* (#:key inputs native-inputs outputs
674 (let* ((out (assoc-ref outputs "out"))
675 (bin (string-append out "/bin"))
676 ;; FIXME: Normally we would look it up only in INPUTS
677 ;; but cross-base uses it as a native input.
678 (bash (or (assoc-ref inputs "static-bash")
679 (assoc-ref native-inputs "static-bash"))))
680 ;; Install the rpc data base file under `$out/etc/rpc'.
681 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
682 (substitute* "sunrpc/Makefile"
683 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
684 (string-append out "/etc/rpc" suffix "\n"))
685 (("^install-others =.*$")
686 (string-append "install-others = " out "/etc/rpc\n")))
688 (substitute* "Makeconfig"
690 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
691 ;; linking against libgcc_s is not needed with GCC
695 ;; Have `system' use that Bash.
696 (substitute* "sysdeps/posix/system.c"
697 (("#define[[:blank:]]+SHELL_PATH.*$")
698 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
702 (substitute* "libio/iopopen.c"
704 (string-append bash "/bin/sh")))
706 ;; Same for the shell used by the 'exec' functions for
707 ;; scripts that lack a shebang.
708 (substitute* (find-files "." "^paths\\.h$")
709 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
710 (string-append "#define _PATH_BSHELL \""
711 bash "/bin/sh\"\n")))
713 ;; Nscd uses __DATE__ and __TIME__ to create a string to
714 ;; make sure the client and server come from the same
715 ;; libc. Use something deterministic instead.
716 (substitute* "nscd/nscd_stat.c"
717 (("static const char compilation\\[21\\] =.*$")
719 "static const char compilation[21] = \""
720 (string-take (basename out) 20) "\";\n")))
722 ;; Make sure we don't retain a reference to the
724 (substitute* "malloc/mtrace.pl"
726 ;; The shebang can be omitted, because there's the
727 ;; "bilingual" eval/exec magic at the top of the file.
734 (add-after 'install 'move-static-libs
735 (lambda* (#:key outputs #:allow-other-keys)
736 ;; Move static libraries to the "static" output.
737 (define (static-library? file)
738 ;; Return true if FILE is a static library. The
739 ;; "_nonshared.a" files are referred to by libc.so,
740 ;; libpthread.so, etc., which are in fact linker
742 (and (string-suffix? ".a" file)
743 (not (string-contains file "_nonshared"))))
745 (define (linker-script? file)
746 ;; Guess whether FILE, a ".a" file, is actually a
748 (and (not (ar-file? file))
749 (not (elf-file? file))))
751 (let* ((out (assoc-ref outputs "out"))
752 (lib (string-append out "/lib"))
753 (files (scandir lib static-library?))
754 (static (assoc-ref outputs "static"))
755 (slib (string-append static "/lib")))
757 (for-each (lambda (base)
758 (rename-file (string-append lib "/" base)
759 (string-append slib "/" base)))
762 ;; Usually libm.a is a linker script so we need to
763 ;; change the file names in there to refer to STATIC
765 (for-each (lambda (ld-script)
766 (substitute* ld-script
768 (filter linker-script?
769 (map (cut string-append slib "/" <>)
774 '((add-after 'install 'augment-libc.so
775 (lambda* (#:key outputs #:allow-other-keys)
776 (let* ((out (assoc-ref outputs "out")))
777 (substitute* (string-append out "/lib/libc.so")
778 (("/[^ ]+/lib/libc.so.0.3")
779 (string-append out "/lib/libc.so.0.3"
780 " libmachuser.so libhurduser.so"))))
784 (inputs `(("static-bash" ,static-bash)))
786 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
787 ;; install the message catalogs, with 'msgfmt'.
788 (native-inputs `(("texinfo" ,texinfo)
791 ("gettext" ,gettext-minimal)
799 ;; Search path for packages that provide locale data. This is useful
800 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
801 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
803 (list (search-path-specification
804 (variable "GUIX_LOCPATH")
805 (files '("lib/locale")))))
807 (synopsis "The GNU C Library")
809 "Any Unix-like operating system needs a C library: the library which
810 defines the \"system calls\" and other basic facilities such as open, malloc,
813 The GNU C library is used as the C library in the GNU system and most systems
814 with the Linux kernel.")
816 (home-page "https://www.gnu.org/software/libc/")))
818 ;; Below are old libc versions, which we use mostly to build locale data in
819 ;; the old format (which the new libc cannot cope with.)
821 (define-public glibc-2.27
826 (inherit (package-source glibc))
827 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
830 "0wpwq7gsm7sd6ysidv0z575ckqdg13cr2njyfgrbgh4f65adwwji"))
831 (patches (search-patches "glibc-ldd-x86_64.patch"
832 "glibc-2.27-git-fixes.patch"
833 "glibc-hidden-visibility-ldconfig.patch"
834 "glibc-versioned-locpath.patch"
835 "glibc-allow-kernel-2.6.32.patch"
836 "glibc-reinstate-prlimit64-fallback.patch"
837 "glibc-supported-locales.patch"
838 "glibc-CVE-2018-11236.patch"
839 "glibc-CVE-2018-11237.patch"))))
840 (properties `((lint-hidden-cve . ("CVE-2017-18269")))))) ; glibc-2.27-git-fixes
842 (define-public glibc-2.26
845 ;; This version number corresponds to the output of `git describe` and the
846 ;; archive can be generated by checking out the commit ID and running:
847 ;; git archive --prefix=$(git describe)/ HEAD | xz > $(git describe).tar.xz
848 ;; See <https://bugs.gnu.org/29406> for why this was necessary.
849 (version "2.26.105-g0890d5379c")
851 (inherit (package-source glibc))
852 (uri (string-append "https://alpha.gnu.org/gnu/guix/mirror/"
853 "glibc-" (version-major+minor version) "-"
854 (caddr (string-split version #\.)) ".tar.xz"))
857 "1jck0c1i248sn02rvsfjykk77qncma34bjq89dyy2irwm50d7s3g"))
858 (patches (search-patches "glibc-ldd-x86_64.patch"
859 "glibc-versioned-locpath.patch"
860 "glibc-allow-kernel-2.6.32.patch"))))))
862 (define-public glibc-2.25
867 (inherit (package-source glibc))
868 (uri (string-append "mirror://gnu/glibc/glibc-"
872 "1813dzkgw6v8q8q1m4v96yfis7vjqc9pslqib6j9mrwh6fxxjyq6"))
873 (patches (search-patches "glibc-ldd-x86_64.patch"
874 "glibc-versioned-locpath.patch"
875 "glibc-vectorized-strcspn-guards.patch"
876 "glibc-CVE-2017-1000366-pt1.patch"
877 "glibc-CVE-2017-1000366-pt2.patch"
878 "glibc-CVE-2017-1000366-pt3.patch"))))))
880 (define-public glibc-2.24
885 (inherit (package-source glibc))
886 (uri (string-append "mirror://gnu/glibc/glibc-"
890 "1lxmprg9gm73gvafxd503x70z32phwjzcy74i0adfi6ixzla7m4r"))
891 (patches (search-patches "glibc-ldd-x86_64.patch"
892 "glibc-versioned-locpath.patch"
893 "glibc-vectorized-strcspn-guards.patch"
894 "glibc-CVE-2015-5180.patch"
895 "glibc-CVE-2017-1000366-pt1.patch"
896 "glibc-CVE-2017-1000366-pt2.patch"
897 "glibc-CVE-2017-1000366-pt3.patch"))))))
899 (define-public glibc-2.23
904 (inherit (package-source glibc))
905 (uri (string-append "mirror://gnu/glibc/glibc-"
909 "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))
910 (patches (search-patches "glibc-ldd-x86_64.patch"
911 "glibc-versioned-locpath.patch"
912 "glibc-vectorized-strcspn-guards.patch"
913 "glibc-CVE-2015-5180.patch"
914 "glibc-CVE-2016-3075.patch"
915 "glibc-CVE-2016-3706.patch"
916 "glibc-CVE-2016-4429.patch"
917 "glibc-CVE-2017-1000366-pt1.patch"
918 "glibc-CVE-2017-1000366-pt2.patch"
919 "glibc-CVE-2017-1000366-pt3.patch"))))))
921 (define-public glibc-2.22
926 (inherit (package-source glibc))
927 (uri (string-append "mirror://gnu/glibc/glibc-"
931 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
932 (patches (search-patches "glibc-ldd-x86_64.patch"
933 "glibc-o-largefile.patch"
934 "glibc-vectorized-strcspn-guards.patch"
935 "glibc-CVE-2015-5180.patch"
936 "glibc-CVE-2015-7547.patch"
937 "glibc-CVE-2016-3075.patch"
938 "glibc-CVE-2016-3706.patch"
939 "glibc-CVE-2016-4429.patch"
940 "glibc-CVE-2017-1000366-pt1.patch"
941 "glibc-CVE-2017-1000366-pt2.patch"
942 "glibc-CVE-2017-1000366-pt3.patch"))))
944 (substitute-keyword-arguments (package-arguments glibc)
946 `(modify-phases ,phases
947 (add-before 'configure 'fix-pwd
949 ;; Use `pwd' instead of `/bin/pwd' for glibc-2.22.
950 (substitute* "configure"
951 (("/bin/pwd") "pwd"))
954 (define (make-gcc-libc base-gcc libc)
955 "Return a GCC that targets LIBC."
956 (package (inherit base-gcc)
957 (name (string-append (package-name base-gcc) "-"
958 (package-name libc) "-"
959 (package-version libc)))
961 (substitute-keyword-arguments
962 (ensure-keyword-arguments (package-arguments base-gcc)
963 '(#:implicit-inputs? #f))
964 ((#:make-flags flags)
965 `(let ((libc (assoc-ref %build-inputs "libc")))
966 ;; FLAGS_FOR_TARGET are needed for the target libraries to receive
967 ;; the -Bxxx for the startfiles.
968 (cons (string-append "FLAGS_FOR_TARGET=-B" libc "/lib")
972 ("libc:static" ,libc "static")
973 ,@(append (package-inputs base-gcc)
974 (fold alist-delete (%final-inputs) '("libc" "libc:static")))))
977 (define-public (make-glibc-locales glibc)
980 (name "glibc-locales")
981 (source (origin (inherit (package-source glibc))
982 (patches (cons (search-patch "glibc-locales.patch")
983 (origin-patches (package-source glibc))))))
984 (synopsis "All the locales supported by the GNU C Library")
986 "This package provides all the locales supported by the GNU C Library,
987 more than 400 in total. To use them set the @code{LOCPATH} environment variable
988 to the @code{share/locale} sub-directory of this package.")
989 (outputs '("out")) ;110+ MiB
990 (native-search-paths '())
992 (let ((args `(#:tests? #f #:strip-binaries? #f
993 ,@(package-arguments glibc))))
994 (substitute-keyword-arguments args
995 ((#:modules modules '((guix build utils)
996 (guix build gnu-build-system)))
1000 ((#:imported-modules modules '())
1001 `((gnu build locale)
1002 ,@%gnu-build-system-modules))
1004 `(modify-phases ,phases
1007 (invoke "make" "localedata/install-locales"
1008 "-j" (number->string (parallel-job-count)))))
1009 (add-after 'build 'symlink-normalized-codesets
1010 (lambda* (#:key outputs #:allow-other-keys)
1011 ;; The above phase does not install locales with names using
1012 ;; the "normalized codeset." Thus, create symlinks like:
1013 ;; en_US.utf8 -> en_US.UTF-8
1014 (define (locale-directory? file stat)
1015 (and (file-is-directory? file)
1016 (string-index (basename file) #\_)
1017 (string-rindex (basename file) #\.)))
1019 (let* ((out (assoc-ref outputs "out"))
1020 (locales (find-files out locale-directory?
1021 #:directories? #t)))
1022 (for-each (lambda (directory)
1023 (let*-values (((base)
1024 (basename directory))
1026 (locale->name+codeset base))
1028 (normalize-codeset codeset)))
1029 (unless (string=? codeset normalized)
1031 (string-append (dirname directory)
1037 (delete 'move-static-libs)))
1038 ((#:configure-flags flags)
1040 ;; Use $(libdir)/locale/X.Y as is the case by default.
1041 (list (string-append "libc_cv_complocaledir="
1042 (assoc-ref %outputs "out")
1044 ,(version-major+minor
1045 (package-version glibc)))))))))))
1047 (define-public (make-glibc-utf8-locales glibc)
1049 (name "glibc-utf8-locales")
1050 (version (package-version glibc))
1052 (build-system trivial-build-system)
1054 `(#:modules ((guix build utils))
1056 (use-modules (guix build utils))
1058 (let* ((libc (assoc-ref %build-inputs "glibc"))
1059 (gzip (assoc-ref %build-inputs "gzip"))
1060 (out (assoc-ref %outputs "out"))
1061 (localedir (string-append out "/lib/locale/"
1062 ,(version-major+minor version))))
1063 ;; 'localedef' needs 'gzip'.
1064 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
1067 (for-each (lambda (locale)
1069 ;; Use the "normalized codeset" by
1070 ;; default--e.g., "en_US.utf8".
1071 (string-append localedir "/" locale ".utf8"))
1073 (invoke "localedef" "--no-archive"
1074 "--prefix" localedir
1078 ;; For backward compatibility with Guix
1079 ;; <= 0.8.3, add "xx_YY.UTF-8".
1080 (symlink (string-append locale ".utf8")
1081 (string-append localedir "/"
1084 ;; These are the locales commonly used for
1085 ;; tests---e.g., in Guile's i18n tests.
1086 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
1088 (inputs `(("glibc" ,glibc)
1090 (synopsis "Small sample of UTF-8 locales")
1092 "This package provides a small sample of UTF-8 locales mostly useful in
1093 test environments.")
1094 (home-page (package-home-page glibc))
1095 (license (package-license glibc))))
1097 (define-public glibc-locales
1098 (make-glibc-locales glibc))
1099 (define-public glibc-utf8-locales
1100 (make-glibc-utf8-locales glibc))
1102 (define-public glibc-locales-2.27
1103 (package (inherit (make-glibc-locales glibc-2.27))
1104 (name "glibc-locales-2.27")))
1105 (define-public glibc-utf8-locales-2.27
1106 (package (inherit (make-glibc-utf8-locales glibc-2.27))
1107 (name "glibc-utf8-locales-2.27")))
1109 (define-public which
1115 (uri (string-append "mirror://gnu/which/which-"
1119 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
1120 (build-system gnu-build-system)
1121 (home-page "https://gnu.org/software/which/")
1122 (synopsis "Find full path of shell commands")
1124 "The which program finds the location of executables in PATH, with a
1125 variety of options. It is an alternative to the shell \"type\" built-in
1127 (license gpl3+))) ; some files are under GPLv2+
1129 (define-public glibc/hurd-headers
1130 (package (inherit glibc)
1131 (name "glibc-hurd-headers")
1133 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
1134 ("hurd-headers" ,hurd-headers)))
1136 (substitute-keyword-arguments (package-arguments glibc)
1137 ;; We just pass the flags really needed to build the headers.
1138 ((#:configure-flags _)
1139 `(list "--enable-add-ons"
1140 "--host=i586-pc-gnu"))
1142 '(modify-phases %standard-phases
1144 (lambda* (#:key outputs #:allow-other-keys)
1145 (invoke "make" "install-headers")
1147 ;; Make an empty stubs.h to work around not being able to
1148 ;; produce a valid stubs.h and causing the build to fail. See
1149 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
1150 (let ((out (assoc-ref outputs "out")))
1153 (string-append out "/include/gnu/stubs.h"))))
1155 (delete 'build))))))) ; nothing to build
1157 (define-public tzdata
1164 "https://www.iana.org/time-zones/repository/releases/tzdata"
1168 "0wlpqm4asvi0waaz24xj20iq40gqfypmb4nldjhkfgm09bgnsdlh"))))
1169 (build-system gnu-build-system)
1172 #:make-flags (let ((out (assoc-ref %outputs "out"))
1173 (tmp (getenv "TMPDIR")))
1174 (list (string-append "TOPDIR=" out)
1175 (string-append "TZDIR=" out "/share/zoneinfo")
1176 (string-append "TZDEFAULT=" out
1177 "/share/zoneinfo/localtime")
1179 ;; Likewise for the C library routines.
1180 (string-append "LIBDIR=" tmp "/lib")
1181 (string-append "MANDIR=" tmp "/man")
1185 #:modules ((guix build utils)
1186 (guix build gnu-build-system)
1189 (modify-phases %standard-phases
1191 (lambda* (#:key source inputs #:allow-other-keys)
1192 (invoke "tar" "xvf" source)
1193 (invoke "tar" "xvf" (assoc-ref inputs "tzcode"))))
1194 (add-after 'install 'post-install
1195 (lambda* (#:key outputs #:allow-other-keys)
1196 ;; Move data in the right place.
1197 (let ((out (assoc-ref outputs "out")))
1198 ;; Discard zic, dump, and tzselect, already
1199 ;; provided by glibc.
1200 (delete-file-recursively (string-append out "/usr"))
1201 (symlink (string-append out "/share/zoneinfo")
1202 (string-append out "/share/zoneinfo/posix"))
1203 (delete-file-recursively
1204 (string-append out "/share/zoneinfo-posix"))
1205 (copy-recursively (string-append out "/share/zoneinfo-leaps")
1206 (string-append out "/share/zoneinfo/right"))
1207 (delete-file-recursively
1208 (string-append out "/share/zoneinfo-leaps"))
1210 (delete 'configure))))
1211 (inputs `(("tzcode" ,(origin
1214 "http://www.iana.org/time-zones/repository/releases/tzcode"
1218 "1x9z8fpgnhzlsnps0hamb54ymaskjab7ys9m4i4gpk9hpiig2fc7"))))))
1219 (home-page "https://www.iana.org/time-zones")
1220 (synopsis "Database of current and historical time zones")
1221 (description "The Time Zone Database (often called tz or zoneinfo)
1222 contains code and data that represent the history of local time for many
1223 representative locations around the globe. It is updated periodically to
1224 reflect changes made by political bodies to time zone boundaries, UTC offsets,
1225 and daylight-saving rules.")
1226 (license public-domain)))
1228 ;;; A "fixed" version of tzdata, which is used in the test suites of glib and R
1229 ;;; and a few other places. We can update this whenever we are able to rebuild
1230 ;;; thousands of packages (for example, in a core-updates rebuild). This package
1231 ;;; will typically be obsolete and should never be referred to by a built
1233 (define-public tzdata-for-tests
1241 "https://www.iana.org/time-zones/repository/releases/tzdata"
1245 "05kayi3w9pvhj6ljx1hvwd0r8mxfzn436fjmwhx53xkj919xxpq2"))))
1247 `(("tzcode" ,(origin
1250 "http://www.iana.org/time-zones/repository/releases/tzcode"
1254 "09y44fzcdq3c06saa8iqqa0a59cyw6ni3p31ps0j1w3hcpxz8lxa")))))))))
1256 (define-public libiconv
1262 (uri (string-append "mirror://gnu/libiconv/libiconv-"
1266 "0y1ij745r4p48mxq84rax40p10ln7fc7m243p8k8sia519i3dxfc"))
1267 (modules '((guix build utils)))
1269 ;; Work around "declared gets" error on glibc systems (fixed by
1270 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
1272 (substitute* "srclib/stdio.in.h"
1273 (("^#undef gets") "")
1274 (("^_GL_WARN_ON_USE \\(gets.*") ""))
1276 (build-system gnu-build-system)
1277 (synopsis "Character set conversion library")
1279 "libiconv provides an implementation of the iconv function for systems
1280 that lack it. iconv is used to convert between character encodings in a
1281 program. It supports a wide variety of different encodings.")
1282 (home-page "https://www.gnu.org/software/libiconv/")
1285 (define* (libiconv-if-needed #:optional (target (%current-target-system)))
1286 "Return either a libiconv package specification to include in a dependency
1287 list for platforms that have an incomplete libc, or the empty list. If a
1288 package needs iconv ,@(libiconv-if-needed) should be added."
1289 ;; POSIX C libraries provide iconv. Platforms with an incomplete libc
1290 ;; without iconv, such as MinGW, must return the then clause.
1291 (if (target-mingw? target)
1292 `(("libiconv" ,libiconv))
1295 (define-public (canonical-package package)
1296 ;; Avoid circular dependency by lazily resolving 'commencement'.
1297 (let* ((iface (resolve-interface '(gnu packages commencement)))
1298 (proc (module-ref iface 'canonical-package)))
1301 (define-public (%final-inputs)
1302 "Return the list of \"final inputs\"."
1303 ;; Avoid circular dependency by lazily resolving 'commencement'.
1304 (let ((iface (resolve-interface '(gnu packages commencement))))
1305 (module-ref iface '%final-inputs)))
1307 ;;; base.scm ends here