1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 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, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
10 ;;; Copyright © 2016, 2018 Alex Vong <alexvong1995@gmail.com>
11 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
12 ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
13 ;;; Copyright © 2017, 2018, 2020 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, 2022 Ricardo Wurmus <rekado@elephly.net>
17 ;;; Copyright © 2020 Vitaliy Shatrov <D0dyBo0D0dyBo0@protonmail.com>
18 ;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
19 ;;; Copyright © 2021 Leo Le Bouter <lle-bout@zaclys.net>
20 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
21 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
22 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
24 ;;; This file is part of GNU Guix.
26 ;;; GNU Guix is free software; you can redistribute it and/or modify it
27 ;;; under the terms of the GNU General Public License as published by
28 ;;; the Free Software Foundation; either version 3 of the License, or (at
29 ;;; your option) any later version.
31 ;;; GNU Guix is distributed in the hope that it will be useful, but
32 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
33 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 ;;; GNU General Public License for more details.
36 ;;; You should have received a copy of the GNU General Public License
37 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
39 (define-module (gnu packages base)
40 #:use-module ((guix licenses)
41 #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
42 #:use-module (gnu packages)
43 #:use-module (gnu packages acl)
44 #:use-module (gnu packages algebra)
45 #:use-module (gnu packages attr)
46 #:use-module (gnu packages bash)
47 #:use-module (gnu packages bison)
48 #:use-module (gnu packages ed)
49 #:use-module (gnu packages gawk)
50 #:use-module (gnu packages gcc)
51 #:use-module (gnu packages guile)
52 #:use-module (gnu packages multiprecision)
53 #:use-module (gnu packages compression)
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages linux)
56 #:use-module (gnu packages pcre)
57 #:use-module (gnu packages texinfo)
58 #:use-module (gnu packages hurd)
59 #:use-module (gnu packages pkg-config)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages gettext)
62 #:use-module (guix i18n)
63 #:use-module (guix utils)
64 #:use-module (guix gexp)
65 #:use-module (guix packages)
66 #:use-module (guix download)
67 #:use-module (guix git-download)
68 #:use-module (guix build-system gnu)
69 #:use-module (guix build-system trivial)
70 #:use-module (ice-9 format)
71 #:use-module (ice-9 match)
72 #:use-module (ice-9 optargs)
73 #:use-module (srfi srfi-1)
74 #:use-module (srfi srfi-26)
81 ;;; Base packages of the Guix-based GNU user-land software distribution.
91 (uri (string-append "mirror://gnu/hello/hello-" version
95 "086vqwk2wl8zfs47sq2xpjc9k066ilmb8z6dn0q6ymwjzlm196cd"))))
96 (build-system gnu-build-system)
97 (synopsis "Hello, GNU world: An example GNU package")
99 "GNU Hello prints the message \"Hello, world!\" and then exits. It
100 serves as an example of standard GNU coding practices. As such, it supports
101 command-line arguments, multiple languages, and so on.")
102 (home-page "https://www.gnu.org/software/hello/")
111 (uri (string-append "mirror://gnu/grep/grep-"
115 "0gipv6bzkm1aihj0ncqpyh164xrzgcxcv9r1kwzyk2g1mzl1azk6"))
116 (patches (search-patches "grep-timing-sensitive-test.patch"))))
117 (build-system gnu-build-system)
118 (native-inputs (list perl)) ;some of the tests require it
122 (modify-phases %standard-phases
123 (add-after 'install 'fix-egrep-and-fgrep
124 ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
125 ;; absolute file name instead of searching for it in $PATH.
126 (lambda* (#:key outputs #:allow-other-keys)
127 (let* ((out (assoc-ref outputs "out"))
128 (bin (string-append out "/bin")))
129 (substitute* (list (string-append bin "/egrep")
130 (string-append bin "/fgrep"))
132 (string-append "exec " bin "/grep")))))))))
133 (synopsis "Print lines matching a pattern")
135 "grep is a tool for finding text inside files. Text is found by
136 matching a pattern provided by the user in one or many files. The pattern
137 may be provided as a basic or extended regular expression, or as fixed
138 strings. By default, the matching text is simply printed to the screen,
139 however the output can be greatly customized to include, for example, line
140 numbers. GNU grep offers many extensions over the standard utility,
141 including, for example, recursive directory searching.")
143 (home-page "https://www.gnu.org/software/grep/")))
151 (uri (string-append "mirror://gnu/sed/sed-" version
155 "0alqagh0nliymz23kfjg6g9w3cr086k0sfni56gi8fhzqwa3xksk"))
156 (patches (search-patches "coreutils-gnulib-tests.patch"))
158 ;; Remove this snippet once upstream releases a fixed version.
159 ;; This snippet changes Makefile.in, even though the upstream
160 ;; patch changes testsuite/local.mk, since we build sed from a
161 ;; release tarball. See: https://bugs.gnu.org/36150
164 (substitute* "Makefile.in"
165 (("^ abs_srcdir='\\$\\(abs_srcdir\\)'.*" previous-line)
168 " CONFIG_HEADER='$(CONFIG_HEADER)'\t\t\\\n")))))
169 (modules '((guix build utils)))))
170 (build-system gnu-build-system)
171 (synopsis "Stream editor")
172 (native-inputs (list perl)) ;for tests
174 "Sed is a non-interactive, text stream editor. It receives a text
175 input from a file or from standard input and it then applies a series of text
176 editing commands to the stream and prints its output to standard output. It
177 is often used for substituting text patterns in a stream. The GNU
178 implementation offers several extensions over the standard utility.")
180 (home-page "https://www.gnu.org/software/sed/")))
188 (uri (string-append "mirror://gnu/tar/tar-"
192 "0a0x87anh9chbi2cgcyy7pmnm5hzk4yd1w2j8gm1wplwhwkbvgk3"))
193 (patches (search-patches "tar-skip-unreliable-tests.patch"
194 "tar-remove-wholesparse-check.patch"))))
195 (build-system gnu-build-system)
196 ;; Note: test suite requires ~1GiB of disk space.
198 `(,@(if (hurd-target?)
201 "TESTSUITEFLAGS= -k '"
203 ",!renamed dirs in incrementals"
204 ",!--exclude-tag option in incremental pass"
205 ",!incremental dumps with -C"
206 ",!incremental dumps of nested directories"
207 ",!incremental restores with -C"
208 ",!concatenated incremental archives (renames)"
209 ",!renamed directory containing subdirectories"
210 ",!renamed subdirectories"
213 #:phases (modify-phases %standard-phases
214 (add-before 'build 'set-shell-file-name
215 (lambda* (#:key inputs #:allow-other-keys)
216 ;; Do not use "/bin/sh" to run programs.
217 (let ((bash (assoc-ref inputs "bash")))
218 (substitute* "src/system.c"
220 (string-append bash "/bin/sh")))))))))
222 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
223 ;; to refer to the target Bash.
224 (inputs (if (%current-target-system)
228 (synopsis "Managing tar archives")
230 "Tar provides the ability to create tar archives, as well as the
231 ability to extract, update or list files in an existing archive. It is
232 useful for combining many files into one larger file, while maintaining
233 directory structure and file information such as permissions and
234 creation/modification dates. GNU tar offers many extensions over the
237 (home-page "https://www.gnu.org/software/tar/")))
245 (uri (string-append "mirror://gnu/patch/patch-"
249 "1zfqy4rdcy279vwn2z1kbv19dcfw25d2aqy9nzvdkq5bjzd0nqdc"))
250 (patches (search-patches "patch-hurd-path-max.patch"))))
251 (build-system gnu-build-system)
253 ;; Work around a cross-compilation bug whereby libpatch.a would provide
254 ;; '__mktime_internal', which conflicts with the one in libc.a.
255 (if (%current-target-system)
256 `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
258 (native-inputs (list ed))
259 (synopsis "Apply differences to originals, with optional backups")
261 "Patch is a program that applies changes to files based on differences
262 laid out as by the program \"diff\". The changes may be applied to one or more
263 files depending on the contents of the diff file. It accepts several
264 different diff formats. It may also be used to revert previously applied
267 (home-page "https://savannah.gnu.org/projects/patch/")))
269 (define-public diffutils
275 (uri (string-append "mirror://gnu/diffutils/diffutils-"
279 "1v4g8gi0lgakqa7iix8s4fq7lq6l92vw3rjd9wfd2rhjng8xggd6"))
280 (patches (search-patches "diffutils-fix-signal-processing.patch"))))
281 (build-system gnu-build-system)
282 (native-inputs (list perl))
283 (synopsis "Comparing and merging files")
285 "GNU Diffutils is a package containing tools for finding the
286 differences between files. The \"diff\" command is used to show how two files
287 differ, while \"cmp\" shows the offsets and line numbers where they differ.
288 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
289 interactive means to merge two files.")
291 (home-page "https://www.gnu.org/software/diffutils/")))
293 (define-public findutils
299 (uri (string-append "mirror://gnu/findutils/findutils-"
303 "0r3i72hnw0a30khlczi9k2c51aamaj6kfmp5mk3844nrjxz7n4jp"))
304 (patches (search-patches "findutils-localstatedir.patch"))))
305 (build-system gnu-build-system)
307 `(#:configure-flags (list
308 ;; Tell 'updatedb' to write to /var.
309 "--localstatedir=/var")
310 #:phases (modify-phases %standard-phases
311 (add-before 'check 'adjust-test-shebangs
313 (substitute* '("tests/xargs/verbose-quote.sh"
314 "tests/find/exec-plus-last-file.sh")
316 (string-append "#!" (which "sh")))))))))
317 (synopsis "Operating on files matching given criteria")
319 "Findutils supplies the basic file directory searching utilities of the
320 GNU system. It consists of two primary searching utilities: \"find\"
321 recursively searches for files in a directory according to given criteria and
322 \"locate\" lists files in a database that match a query. Two auxiliary tools
323 are included: \"updatedb\" updates the file name database and \"xargs\" may be
324 used to apply commands with arbitrarily long arguments.")
326 (home-page "https://www.gnu.org/software/findutils/")))
328 (define-public coreutils
334 (uri (string-append "mirror://gnu/coreutils/coreutils-"
338 "1yjcrh5hw70c0yn8zw55pd6j51dj90anpq8mmg649ps9g3gdhn24"))
339 (patches (search-patches "coreutils-ls.patch"
340 "coreutils-gnulib-tests.patch"))))
341 (build-system gnu-build-system)
342 (inputs `(,acl ;TODO: add SELinux
343 ,attr ;for xattrs in ls, mv, etc
344 ,gmp ;bignums in 'expr', yay!
346 ;; Do not use libcap when cross-compiling since it's not quite
347 ;; cross-compilable; and use it only for supported systems.
348 ,@(if (and (not (%current-target-system))
349 (member (%current-system)
350 (package-supported-systems libcap)))
351 `(,libcap) ;capability support in 'ls', etc.
354 ;; Perl is needed to run tests in native builds, and to run the bundled
355 ;; copy of help2man. However, don't pass it when cross-compiling since
356 ;; that would lead it to try to run programs to get their '--help' output
358 (if (%current-target-system)
361 (outputs '("out" "debug"))
363 `(#:parallel-build? #f ; help2man may be called too early
365 '(#:make-flags ; these tests fail deterministically
366 (list (string-append "XFAIL_TESTS=tests/misc/env-S.pl"
367 " tests/misc/kill.sh"
368 " tests/misc/nice.sh"
369 " tests/misc/pwd-long.sh"
370 " tests/split/fail.sh"
379 #:phases (modify-phases %standard-phases
380 (add-before 'build 'patch-shell-references
382 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
383 ;; that tests pass, since /bin/sh isn't in the chroot.
384 (setenv "SHELL" (which "sh"))
386 (substitute* (find-files "gnulib-tests" "\\.c$")
387 (("/bin/sh") (which "sh")))
388 (substitute* (find-files "tests" "\\.sh$")
389 (("#!/bin/sh") (string-append "#!" (which "sh"))))))
390 (add-after 'unpack 'remove-tests
393 '((substitute* "Makefile.in"
395 (("^ *tests/misc/timeout-group.sh.*") "")))
397 (substitute* "Makefile.in"
398 ;; fails on filesystems where inotify cannot be used,
399 ;; more info in #47935
400 (("^ *tests/tail-2/inotify-dir-recreate.sh.*") "")))))))
401 (synopsis "Core GNU utilities (file, text, shell)")
403 "GNU Coreutils package includes all of the basic command-line tools that
404 are expected in a POSIX system, excluding shell. This package is the union of
405 the GNU fileutils, sh-utils, and textutils packages. Most of these tools
406 offer extended functionality beyond that which is outlined in the POSIX
409 (home-page "https://www.gnu.org/software/coreutils/")))
411 (define-public coreutils-minimal
412 ;; Coreutils without its optional dependencies.
415 (name "coreutils-minimal")
420 (define-public coreutils-8.30
421 ;; XXX: This version is kept just so we can run PRoot tests.
424 (inherit coreutils-minimal)
428 (uri (string-append "mirror://gnu/coreutils/coreutils-"
432 "0mxhw43d4wpqmvg0l4znk1vm10fy92biyh90lzdnqjcic2lb6cg8"))))
434 (substitute-keyword-arguments (package-arguments coreutils-minimal)
435 ((#:phases phases '%standard-phases)
436 `(modify-phases ,phases
437 (add-before 'check 'disable-broken-test
439 ;; This test hits the 127 character shebang limit in the build
440 ;; environment due to the way "env -S" splits arguments into
441 ;; shebangs. Note that "env-S-script.sh" works around this
442 ;; specific issue, but "env-S.pl" is not adjusted for build
443 ;; environments with long prefixes (/tmp/guix-build-...).
444 (substitute* "Makefile"
445 (("^.*tests/misc/env-S.pl.*$") "")))))))))))
447 (define-public gnu-make
453 (uri (string-append "mirror://gnu/make/make-" version
457 "06cfqzpqsvdnsxbysl5p2fgdgxgl9y4p7scpnrfa8z2zgkjdspz0"))
458 (patches (search-patches "make-impure-dirs.patch"))))
459 (build-system gnu-build-system)
460 (native-inputs (list pkg-config)) ;to detect Guile
461 (inputs (list guile-3.0))
462 (outputs '("out" "debug"))
464 `(,@(if (hurd-target?)
465 '(#:configure-flags '("CFLAGS=-D__alloca=alloca"
466 "ac_cv_func_posix_spawn=no"))
469 (modify-phases %standard-phases
470 (add-before 'build 'set-default-shell
471 (lambda* (#:key inputs #:allow-other-keys)
472 ;; Change the default shell from /bin/sh.
473 (let ((bash (assoc-ref inputs "bash")))
474 (substitute* "src/job.c"
475 (("default_shell =.*$")
476 (format #f "default_shell = \"~a/bin/sh\";\n"
478 (synopsis "Remake files automatically")
480 "Make is a program that is used to control the production of
481 executables or other files from their source files. The process is
482 controlled from a Makefile, in which the developer specifies how each file is
483 generated from its source. It has powerful dependency resolution and the
484 ability to determine when files have to be regenerated after their sources
485 change. GNU make offers many powerful extensions over the standard utility.")
487 (home-page "https://www.gnu.org/software/make/")))
489 (define-public gnu-make-4.2
495 (uri (string-append "mirror://gnu/make/make-" version
499 "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn"))))
501 `(#:configure-flags '("CFLAGS=-D__alloca=alloca -D__stat=stat")
503 (modify-phases %standard-phases
504 (add-before 'build 'set-default-shell
505 (lambda* (#:key inputs #:allow-other-keys)
506 ;; Change the default shell from /bin/sh.
507 (let ((bash (assoc-ref inputs "bash")))
509 (("default_shell =.*$")
510 (format #f "default_shell = \"~a/bin/sh\";\n"
513 (define-public binutils
520 (uri (string-append "mirror://gnu/binutils/binutils-"
523 (base32 "1m3b2rdfv1dmdpd0bzg1hy7i8a2qng53szc6livyi3nh6101mz37"))
524 (patches (search-patches "binutils-loongson-workaround.patch"
525 "binutils-2.37-file-descriptor-leak.patch"
526 "binutils-CVE-2021-45078.patch"))))
527 (build-system gnu-build-system)
529 `(#:out-of-source? #t ;recommended in the README
530 #:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
531 ;; on GCC when bootstrapping.
532 "LDFLAGS=-static-libgcc"
534 ;; Turn on --enable-new-dtags by default to make the
535 ;; linker set RUNPATH instead of RPATH on binaries.
536 ;; This is important because RUNPATH can be overriden
537 ;; using LD_LIBRARY_PATH at runtime.
540 ;; Don't search under /usr/lib & co.
541 "--with-lib-path=/no-ld-lib-path"
543 ;; Install BFD. It ends up in a hidden directory,
545 "--enable-install-libbfd"
547 ;; Make sure 'ar' and 'ranlib' produce archives in a
548 ;; deterministic fashion.
549 "--enable-deterministic-archives"
551 "--enable-64-bit-bfd"
552 "--enable-compressed-debug-sections=all"
554 "--enable-separate-code"
555 "--enable-threads")))
557 (synopsis "Binary utilities: bfd gas gprof ld")
559 "GNU Binutils is a collection of tools for working with binary files.
560 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
561 Other tools include programs to display binary profiling information, list
562 the strings in a binary file, and utilities for working with archives. The
563 \"bfd\" library for working with executable and object formats is also
566 (home-page "https://www.gnu.org/software/binutils/")))
568 ;; FIXME: ath9k-firmware-htc-binutils.patch do not apply on 2.34 because of a
569 ;; big refactoring of xtensa-modules.c (commit 567607c11fbf7105 upstream).
570 ;; Keep this version around until the patch is updated.
571 (define-public binutils-2.33
576 (inherit (package-source binutils))
577 (uri (string-append "mirror://gnu/binutils/binutils-"
581 "1cmd0riv37bqy9mwbg6n3523qgr8b3bbm5kwj19sjrasl4yq9d0c"))
584 (substitute-keyword-arguments (package-arguments binutils)
585 ((#:make-flags _ ''()) ''())))
588 (define-public binutils-gold
589 (package/inherit binutils
590 (name "binutils-gold")
592 (substitute-keyword-arguments (package-arguments binutils)
593 ((#:configure-flags flags)
594 `(cons* "--enable-gold=default"
595 (delete "LDFLAGS=-static-libgcc" ,flags)))
596 ((#:phases phases '%standard-phases)
597 `(modify-phases ,phases
598 (add-after 'patch-source-shebangs 'patch-more-shebangs
600 (substitute* "gold/Makefile.in"
601 (("/bin/sh") (which "sh")))))
602 ;; Multiple failing tests on some architectures in the gold testsuite.
603 ,@(if (or (target-arm?)
605 '((add-after 'unpack 'skip-gold-testsuite
607 (substitute* "gold/Makefile.in"
608 ((" testsuite") " ")))))
613 (define* (make-ld-wrapper name #:key
617 (guile (canonical-package guile-3.0))
618 (bash (canonical-package bash))
619 (guile-for-build guile))
620 "Return a package called NAME that contains a wrapper for the 'ld' program
621 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
622 wrapper uses GUILE and BASH.
624 TARGET must be a one-argument procedure that, given a system type, returns a
625 cross-compilation target triplet or #f. When the result is not #f, make a
626 wrapper for the cross-linker for that target, called 'TARGET-ld'. To use a
627 different linker than the default \"ld\", such as \"ld.gold\" the linker name
628 can be provided via the LINKER argument."
629 ;; Note: #:system->target-triplet is a procedure so that the evaluation of
630 ;; its result can be delayed until the 'arguments' field is evaluated, thus
631 ;; in a context where '%current-system' is accurate.
636 (build-system trivial-build-system)
637 (inputs `(("binutils" ,binutils)
640 ("wrapper" ,(search-path %load-path
641 "gnu/packages/ld-wrapper.in"))))
643 (let ((target (target (%current-system))))
644 `(#:guile ,guile-for-build
645 #:modules ((guix build utils))
647 (use-modules (guix build utils)
648 (system base compile))
650 (let* ((out (assoc-ref %outputs "out"))
651 (bin (string-append out "/bin"))
653 `(string-append bin "/" ,target "-"
655 `(string-append bin "/" ,linker)))
656 (go (string-append ld ".go")))
658 (setvbuf (current-output-port)
659 (cond-expand (guile-2.0 _IOLBF)
661 (format #t "building ~s/bin/ld wrapper in ~s~%"
662 (assoc-ref %build-inputs "binutils")
666 (copy-file (assoc-ref %build-inputs "wrapper") ld)
671 (string-append (assoc-ref %build-inputs "guile")
674 (string-append (assoc-ref %build-inputs "bash")
677 (string-append (assoc-ref %build-inputs "binutils")
679 (string-append "/bin/"
681 (string-append "/bin/" linker)))))
683 (compile-file ld #:output-file go))))))
684 (synopsis "The linker wrapper")
686 "The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any
687 missing @code{-rpath} flags, and to detect any misuse of libraries outside of
689 (home-page "https://www.gnu.org/software/guix//")
693 ;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to
694 ;; version 2.28, GNU/Hurd used a different glibc branch.
700 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
703 "1zvp0qdfbdyqrzydz18d9zg3n5ygy8ps7cmny1bvsp8h1q05c99f"))
704 (patches (search-patches "glibc-ldd-powerpc.patch"
705 "glibc-ldd-x86_64.patch"
706 "glibc-dl-cache.patch"
707 "glibc-versioned-locpath.patch"
708 "glibc-allow-kernel-2.6.32.patch"
709 "glibc-reinstate-prlimit64-fallback.patch"
710 "glibc-supported-locales.patch"
711 "glibc-cross-objdump.patch"
712 "glibc-cross-objcopy.patch" ;must come 2nd
713 "glibc-hurd-clock_t_centiseconds.patch"
714 "glibc-hurd-clock_gettime_monotonic.patch"
715 "glibc-hurd-mach-print.patch"
716 "glibc-hurd-gettyent.patch"))))
717 (build-system gnu-build-system)
719 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
720 ;; users should automatically pull Linux headers as well. On GNU/Hurd,
721 ;; libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
722 ;; so both should be propagated.
725 `(("hurd-core-headers" ,hurd-core-headers))
726 `(("kernel-headers" ,linux-libre-headers))))
728 (outputs '("out" "debug"
729 "static")) ;9 MiB of .a files
732 `(#:out-of-source? #t
734 ;; The libraries have an empty RUNPATH, but some, such as the versioned
735 ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since
736 ;; these libraries are always going to be found anyway, just skip
738 #:validate-runpath? #f
740 #:modules ((ice-9 ftw)
743 (guix build gnu-build-system))
746 (list "--sysconfdir=/etc"
748 ;; Installing a locale archive with all the locales is to
749 ;; expensive (~100 MiB), so we rely on users to install the
750 ;; locales they really want.
752 ;; Set the default locale path. In practice, $LOCPATH may be
753 ;; defined to point whatever locales users want. However, setuid
754 ;; binaries don't honor $LOCPATH, so they'll instead look into
755 ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y,
756 ;; with the idea that it is going to be populated by the sysadmin.
757 ;; The "X.Y" sub-directory is because locale data formats are
758 ;; incompatible across libc versions; see
759 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
761 ;; `--localedir' is not honored, so work around it.
762 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
763 (string-append "libc_cv_complocaledir=/run/current-system/locale/"
764 ,(version-major+minor version))
766 (string-append "--with-headers="
767 (assoc-ref ,(if (%current-target-system)
768 '%build-target-inputs
773 ;; This is the default for most architectures as of GNU libc 2.26,
774 ;; but we specify it explicitly for clarity and consistency. See
775 ;; "kernel-features.h" in the GNU libc for details.
776 "--enable-kernel=3.2.0"
778 ;; Use our Bash instead of /bin/sh.
779 (string-append "BASH_SHELL="
780 (assoc-ref %build-inputs "bash")
783 ;; On GNU/Hurd we get discarded-qualifiers warnings for
784 ;; 'device_write_inband' among other things. Ignore them.
786 '("--disable-werror")
790 #:phases (modify-phases %standard-phases
792 'configure 'pre-configure
793 (lambda* (#:key inputs native-inputs outputs
795 (let* ((out (assoc-ref outputs "out"))
796 (bin (string-append out "/bin"))
797 ;; FIXME: Normally we would look it up only in INPUTS
798 ;; but cross-base uses it as a native input.
799 (bash (or (assoc-ref inputs "static-bash")
800 (assoc-ref native-inputs "static-bash"))))
801 ;; Install the rpc data base file under `$out/etc/rpc'.
802 (substitute* "inet/Makefile"
803 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
804 (string-append out "/etc/rpc" suffix "\n"))
805 (("^install-others =.*$")
806 (string-append "install-others = " out "/etc/rpc\n")))
808 (substitute* "Makeconfig"
810 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
811 ;; linking against libgcc_s is not needed with GCC
815 ;; Tell the ld.so cache code where the store is.
816 (substitute* "elf/dl-cache.c"
817 (("@STORE_DIRECTORY@")
818 (string-append "\"" (%store-directory) "\"")))
820 ;; Have `system' use that Bash.
821 (substitute* "sysdeps/posix/system.c"
822 (("#define[[:blank:]]+SHELL_PATH.*$")
823 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
827 (substitute* "libio/iopopen.c"
829 (string-append bash "/bin/sh")))
831 ;; Same for the shell used by the 'exec' functions for
832 ;; scripts that lack a shebang.
833 (substitute* (find-files "." "^paths\\.h$")
834 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
835 (string-append "#define _PATH_BSHELL \""
836 bash "/bin/sh\"\n")))
838 ;; Make sure we don't retain a reference to the
840 (substitute* "malloc/mtrace.pl"
842 ;; The shebang can be omitted, because there's the
843 ;; "bilingual" eval/exec magic at the top of the file.
848 (add-after 'install 'move-static-libs
849 (lambda* (#:key outputs #:allow-other-keys)
850 ;; Move static libraries to the "static" output.
851 (define (static-library? file)
852 ;; Return true if FILE is a static library. The
853 ;; "_nonshared.a" files are referred to by libc.so,
854 ;; libpthread.so, etc., which are in fact linker
856 (and (string-suffix? ".a" file)
857 (not (string-contains file "_nonshared"))))
859 (define (linker-script? file)
860 ;; Guess whether FILE, a ".a" file, is actually a
862 (and (not (ar-file? file))
863 (not (elf-file? file))))
865 (let* ((out (assoc-ref outputs "out"))
866 (lib (string-append out "/lib"))
867 (files (scandir lib static-library?))
868 (static (assoc-ref outputs "static"))
869 (slib (string-append static "/lib")))
871 (for-each (lambda (base)
872 (rename-file (string-append lib "/" base)
873 (string-append slib "/" base)))
876 ;; Usually libm.a is a linker script so we need to
877 ;; change the file names in there to refer to STATIC
879 (for-each (lambda (ld-script)
880 (substitute* ld-script
882 (filter linker-script?
883 (map (cut string-append slib "/" <>)
887 '((add-after 'install 'augment-libc.so
888 (lambda* (#:key outputs #:allow-other-keys)
889 (let* ((out (assoc-ref outputs "out")))
890 (substitute* (string-append out "/lib/libc.so")
891 (("/[^ ]+/lib/libc.so.0.3")
892 (string-append out "/lib/libc.so.0.3"
893 " libmachuser.so libhurduser.so")))))))
896 (inputs `(("static-bash" ,static-bash)))
898 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
899 ;; install the message catalogs, with 'msgfmt'.
900 (native-inputs `(("texinfo" ,texinfo)
903 ("gettext" ,gettext-minimal)
904 ("python" ,python-minimal)
912 ;; Search path for packages that provide locale data. This is useful
913 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
914 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
916 (list (search-path-specification
917 (variable "GUIX_LOCPATH")
918 (files '("lib/locale")))))
920 (synopsis "The GNU C Library")
922 "Any Unix-like operating system needs a C library: the library which
923 defines the \"system calls\" and other basic facilities such as open, malloc,
926 The GNU C library is used as the C library in the GNU system and most systems
927 with the Linux kernel.")
929 (home-page "https://www.gnu.org/software/libc/")))
931 ;; Below are old libc versions, which we use mostly to build locale data in
932 ;; the old format (which the new libc cannot cope with.)
933 (define-public glibc-2.32
938 (inherit (package-source glibc))
939 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
942 "0di848ibffrnwq7g2dvgqrnn4xqhj3h96csn69q4da51ymafl9qn"))
943 (patches (search-patches
944 "glibc-skip-c++.patch"
945 "glibc-ldd-powerpc.patch"
946 "glibc-ldd-x86_64.patch"
947 "glibc-dl-cache.patch"
948 "glibc-hidden-visibility-ldconfig.patch"
949 "glibc-versioned-locpath.patch"
950 "glibc-allow-kernel-2.6.32.patch"
951 "glibc-reinstate-prlimit64-fallback.patch"
952 "glibc-supported-locales.patch"
953 "glibc-hurd-clock_t_centiseconds.patch"
954 "glibc-2.31-hurd-clock_gettime_monotonic.patch"
955 "glibc-hurd-signal-sa-siginfo.patch"
956 "glibc-hurd-mach-print.patch"
957 "glibc-hurd-gettyent.patch"))
959 (patches (search-patches "glibc-ldd-x86_64.patch"
960 "glibc-hidden-visibility-ldconfig.patch"
961 "glibc-versioned-locpath.patch"
962 "glibc-allow-kernel-2.6.32.patch"
963 "glibc-reinstate-prlimit64-fallback.patch"
964 "glibc-supported-locales.patch"
965 "glibc-hurd-clock_t_centiseconds.patch"
966 "glibc-hurd-clock_gettime_monotonic.patch"
967 "glibc-hurd-signal-sa-siginfo.patch"))))
970 (substitute-keyword-arguments (package-arguments glibc)
971 ((#:make-flags flags '())
972 ;; Arrange so that /etc/rpc & co. go to $out/etc.
973 `(list (string-append "sysconfdir="
974 (assoc-ref %outputs "out")
977 `(modify-phases ,phases
978 (add-before 'configure 'set-etc-rpc-installation-directory
979 (lambda* (#:key outputs #:allow-other-keys)
980 ;; Install the rpc data base file under `$out/etc/rpc'.
981 (let ((out (assoc-ref outputs "out")))
982 (substitute* "sunrpc/Makefile"
983 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
984 (string-append out "/etc/rpc" suffix "\n"))
985 (("^install-others =.*$")
986 (string-append "install-others = " out "/etc/rpc\n"))))))))))))
988 (define-public glibc-2.31
993 (inherit (package-source glibc))
994 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
997 "05zxkyz9bv3j9h0xyid1rhvh3klhsmrpkf3bcs6frvlgyr2gwilj"))
998 (patches (search-patches
999 "glibc-skip-c++.patch"
1000 "glibc-ldd-powerpc.patch"
1001 "glibc-ldd-x86_64.patch"
1002 "glibc-dl-cache.patch"
1003 "glibc-hidden-visibility-ldconfig.patch"
1004 "glibc-versioned-locpath.patch"
1005 "glibc-allow-kernel-2.6.32.patch"
1006 "glibc-reinstate-prlimit64-fallback.patch"
1007 "glibc-supported-locales.patch"
1008 "glibc-hurd-clock_t_centiseconds.patch"
1009 "glibc-2.31-hurd-clock_gettime_monotonic.patch"
1010 "glibc-hurd-signal-sa-siginfo.patch"
1011 "glibc-hurd-mach-print.patch"
1012 "glibc-hurd-gettyent.patch"))))
1014 (substitute-keyword-arguments (package-arguments glibc)
1016 `(modify-phases ,phases
1017 (add-before 'configure 'set-etc-rpc-installation-directory
1018 (lambda* (#:key outputs #:allow-other-keys)
1019 ;; Install the rpc data base file under `$out/etc/rpc'.
1020 (let ((out (assoc-ref outputs "out")))
1021 (substitute* "sunrpc/Makefile"
1022 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
1023 (string-append out "/etc/rpc" suffix "\n"))
1024 (("^install-others =.*$")
1025 (string-append "install-others = " out "/etc/rpc\n"))))))))))))
1027 (define-public glibc-2.30
1029 (inherit glibc-2.31)
1032 ;; This fails with a build error in libc-tls.c when using GCC 10. Use an
1034 (modify-inputs (package-native-inputs glibc)
1037 (inherit (package-source glibc))
1038 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
1041 "1bxqpg91d02qnaz837a5kamm0f43pr1il4r9pknygywsar713i72"))
1042 (patches (search-patches "glibc-skip-c++.patch"
1043 "glibc-ldd-x86_64.patch"
1044 "glibc-CVE-2019-19126.patch"
1045 "glibc-hidden-visibility-ldconfig.patch"
1046 "glibc-versioned-locpath.patch"
1047 "glibc-allow-kernel-2.6.32.patch"
1048 "glibc-reinstate-prlimit64-fallback.patch"
1049 "glibc-2.29-supported-locales.patch"))))))
1051 (define-public glibc-2.29
1053 (inherit glibc-2.30)
1056 (inherit (package-source glibc))
1057 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
1060 "0jzh58728flfh939a8k9pi1zdyalfzlxmwra7k0rzji5gvavivpk"))
1061 (patches (search-patches "glibc-skip-c++.patch"
1062 "glibc-ldd-x86_64.patch"
1063 "glibc-CVE-2019-7309.patch"
1064 "glibc-CVE-2019-9169.patch"
1065 "glibc-2.29-git-updates.patch"
1066 "glibc-hidden-visibility-ldconfig.patch"
1067 "glibc-versioned-locpath.patch"
1068 "glibc-allow-kernel-2.6.32.patch"
1069 "glibc-reinstate-prlimit64-fallback.patch"
1070 "glibc-2.29-supported-locales.patch"))))))
1072 (define-public (make-gcc-libc base-gcc libc)
1073 "Return a GCC that targets LIBC."
1074 (package (inherit base-gcc)
1075 (name (string-append (package-name base-gcc) "-"
1076 (package-name libc) "-"
1077 (package-version libc)))
1079 (ensure-keyword-arguments (package-arguments base-gcc)
1080 '(#:implicit-inputs? #f)))
1082 `(,@(package-native-inputs base-gcc)
1083 ,@(append (fold alist-delete (%final-inputs) '("libc" "libc:static")))
1085 ("libc:static" ,libc "static")))))
1087 (define-public (make-glibc-locales glibc)
1090 (name "glibc-locales")
1091 (source (origin (inherit (package-source glibc))
1092 ;; The patch for glibc 2.28 and earlier replaces the same
1093 ;; content, but the context in the patch is different
1094 ;; enough to fail to merge.
1095 (patches (cons (search-patch
1096 (if (version>=? (package-version glibc)
1098 "glibc-locales.patch"
1099 "glibc-locales-2.28.patch"))
1100 (origin-patches (package-source glibc))))))
1101 (synopsis "All the locales supported by the GNU C Library")
1103 "This package provides all the locales supported by the GNU C Library,
1104 more than 400 in total. To use them set the @code{LOCPATH} environment variable
1105 to the @code{share/locale} sub-directory of this package.")
1106 (outputs '("out")) ;110+ MiB
1107 (native-search-paths '())
1109 (let ((args `(#:tests? #f #:strip-binaries? #f
1110 ,@(package-arguments glibc))))
1111 (substitute-keyword-arguments args
1112 ((#:modules modules '((guix build utils)
1113 (guix build gnu-build-system)))
1117 ((#:imported-modules modules '())
1118 `((gnu build locale)
1119 ,@%gnu-build-system-modules))
1121 `(modify-phases ,phases
1124 (invoke "make" "localedata/install-locales"
1125 "-j" (number->string (parallel-job-count)))))
1126 (add-after 'build 'symlink-normalized-codesets
1127 (lambda* (#:key outputs #:allow-other-keys)
1128 ;; The above phase does not install locales with names using
1129 ;; the "normalized codeset." Thus, create symlinks like:
1130 ;; en_US.utf8 -> en_US.UTF-8
1131 (define (locale-directory? file stat)
1132 (and (file-is-directory? file)
1133 (string-index (basename file) #\_)
1134 (string-rindex (basename file) #\.)))
1136 (let* ((out (assoc-ref outputs "out"))
1137 (locales (find-files out locale-directory?
1138 #:directories? #t)))
1139 (for-each (lambda (directory)
1140 (let*-values (((base)
1141 (basename directory))
1143 (locale->name+codeset base))
1145 (normalize-codeset codeset)))
1146 (unless (string=? codeset normalized)
1148 (string-append (dirname directory)
1153 (delete 'move-static-libs)))
1154 ((#:configure-flags flags)
1156 ;; Use $(libdir)/locale/X.Y as is the case by default.
1157 (list (string-append "libc_cv_complocaledir="
1158 (assoc-ref %outputs "out")
1160 ,(version-major+minor
1161 (package-version glibc)))))))))
1162 (properties `((upstream-name . "glibc")))))
1164 (define %default-utf8-locales
1165 ;; These are the locales commonly used for tests---e.g., in Guile's i18n
1167 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
1168 (define*-public (make-glibc-utf8-locales glibc #:key
1169 (locales %default-utf8-locales)
1170 (name "glibc-utf8-locales"))
1171 (define default-locales? (equal? locales %default-utf8-locales))
1174 (version (package-version glibc))
1176 (build-system trivial-build-system)
1178 `(#:modules ((guix build utils))
1180 (use-modules (guix build utils))
1182 (let* ((libc (assoc-ref %build-inputs "glibc"))
1183 (gzip (assoc-ref %build-inputs "gzip"))
1184 (out (assoc-ref %outputs "out"))
1185 (localedir (string-append out "/lib/locale/"
1186 ,(version-major+minor version))))
1187 ;; 'localedef' needs 'gzip'.
1188 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
1191 (for-each (lambda (locale)
1193 ;; Use the "normalized codeset" by
1194 ;; default--e.g., "en_US.utf8".
1195 (string-append localedir "/" locale ".utf8"))
1197 (invoke "localedef" "--no-archive"
1198 "--prefix" localedir
1202 ;; For backward compatibility with Guix
1203 ;; <= 0.8.3, add "xx_YY.UTF-8".
1204 (symlink (string-append locale ".utf8")
1205 (string-append localedir "/"
1209 (native-inputs (list glibc gzip))
1210 (synopsis (if default-locales?
1211 (P_ "Small sample of UTF-8 locales")
1212 (P_ "Customized sample of UTF-8 locales")))
1214 (if default-locales?
1215 (P_ "This package provides a small sample of UTF-8 locales mostly useful in
1216 test environments.")
1217 (format #f (P_ "This package provides the following UTF-8 locales:
1222 (home-page (package-home-page glibc))
1223 (license (package-license glibc))))
1225 (define-public glibc-locales
1226 (make-glibc-locales glibc))
1227 (define-public glibc-utf8-locales
1229 (make-glibc-utf8-locales glibc)))
1231 ;; Packages provided to ease use of binaries linked against the previous libc.
1232 (define-public glibc-locales-2.32
1233 (package (inherit (make-glibc-locales glibc-2.32))
1234 (name "glibc-locales-2.32")))
1235 (define-public glibc-locales-2.31
1236 (package (inherit (make-glibc-locales glibc-2.31))
1237 (name "glibc-locales-2.31")))
1238 (define-public glibc-locales-2.30
1239 (package (inherit (make-glibc-locales glibc-2.30))
1240 (name "glibc-locales-2.30")))
1241 (define-public glibc-locales-2.29
1242 (package (inherit (make-glibc-locales glibc-2.29))
1243 (name "glibc-locales-2.29")))
1244 (define-public glibc-utf8-locales-2.29
1245 (package (inherit (make-glibc-utf8-locales glibc-2.29))
1246 (name "glibc-utf8-locales-2.29")))
1248 (define-public which
1254 (uri (string-append "mirror://gnu/which/which-"
1258 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
1259 (build-system gnu-build-system)
1260 (home-page "https://gnu.org/software/which/")
1261 (synopsis "Find full path of shell commands")
1263 "The which program finds the location of executables in PATH, with a
1264 variety of options. It is an alternative to the shell \"type\" built-in
1266 (license gpl3+))) ; some files are under GPLv2+
1268 (define-public glibc/hurd-headers
1269 (package (inherit glibc)
1270 (name "glibc-hurd-headers")
1272 (propagated-inputs (list gnumach-headers hurd-headers))
1274 (modify-inputs (package-native-inputs glibc)
1275 (prepend (if (%current-target-system)
1276 ;; XXX: When targeting i586-pc-gnu, we need a 32-bit MiG,
1278 (package (inherit mig)
1279 (arguments `(#:system "i686-linux")))
1282 (substitute-keyword-arguments (package-arguments glibc)
1283 ;; We just pass the flags really needed to build the headers.
1284 ((#:configure-flags _)
1285 `(list "--enable-add-ons"
1286 "--host=i586-pc-gnu"))
1288 '(modify-phases %standard-phases
1290 (lambda* (#:key outputs #:allow-other-keys)
1291 (invoke "make" "install-headers")
1293 ;; Make an empty stubs.h to work around not being able to
1294 ;; produce a valid stubs.h and causing the build to fail. See
1295 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
1296 (let ((out (assoc-ref outputs "out")))
1299 (string-append out "/include/gnu/stubs.h"))))))
1300 (delete 'build))))))) ; nothing to build
1302 (define-public tzdata
1305 ;; This package should be kept in sync with python-pytz in (gnu packages
1311 "https://data.iana.org/time-zones/releases/tzdata"
1315 "0r0nhwpk9nyxj5kkvjy58nr5d85568m04dcb69c4y3zmykczyzzg"))))
1316 (build-system gnu-build-system)
1320 ;; This consists purely of (architecture-independent) data, so
1321 ;; ‘cross-compilation’ is pointless here! (The binaries zic,
1322 ;; dump, and tzselect are deleted in the post-install phase.)
1326 #~(let ((out #$output)
1327 (tmp (getenv "TMPDIR")))
1328 (list (string-append "TOPDIR=" out)
1329 (string-append "TZDIR=" out "/share/zoneinfo")
1330 (string-append "TZDEFAULT=" out
1331 "/share/zoneinfo/localtime")
1333 ;; Likewise for the C library routines.
1334 (string-append "LIBDIR=" tmp "/lib")
1335 (string-append "MANDIR=" tmp "/man")
1337 ;; XXX: tzdata 2020b changed the on-disk format
1338 ;; of the time zone files from 'fat' to 'slim'.
1339 ;; Many packages (particularly evolution-data-server)
1340 ;; can not yet handle the latter, so we stick with
1342 #$@(if (version>=? (package-version this-package)
1344 '("CPPFLAGS=-DZIC_BLOAT_DEFAULT='\"fat\"'")
1349 #:modules '((guix build utils)
1350 (guix build gnu-build-system)
1353 #~(modify-phases %standard-phases
1355 (lambda* (#:key source inputs #:allow-other-keys)
1356 (invoke "tar" "xvf" source)
1358 #$(match (package-inputs this-package)
1359 (((_ tzcode)) tzcode)))))
1360 (add-after 'install 'post-install
1361 (lambda* (#:key outputs #:allow-other-keys)
1362 ;; Move data in the right place.
1363 (let ((out (assoc-ref outputs "out")))
1364 ;; Discard zic, dump, and tzselect, already
1365 ;; provided by glibc.
1366 (delete-file-recursively (string-append out "/usr"))
1367 (symlink (string-append out "/share/zoneinfo")
1368 (string-append out "/share/zoneinfo/posix"))
1369 (delete-file-recursively
1370 (string-append out "/share/zoneinfo-posix"))
1371 (copy-recursively (string-append out "/share/zoneinfo-leaps")
1372 (string-append out "/share/zoneinfo/right"))
1373 (delete-file-recursively
1374 (string-append out "/share/zoneinfo-leaps")))))
1375 (delete 'configure))))
1376 (inputs (list (origin
1379 "https://data.iana.org/time-zones/releases/tzcode"
1383 "1iysv8fdkm79k8wh8jizmjmq075q4qjhk090vxjy57my6dz5wmzq")))))
1384 (home-page "https://www.iana.org/time-zones")
1385 (synopsis "Database of current and historical time zones")
1386 (description "The Time Zone Database (often called tz or zoneinfo)
1387 contains code and data that represent the history of local time for many
1388 representative locations around the globe. It is updated periodically to
1389 reflect changes made by political bodies to time zone boundaries, UTC offsets,
1390 and daylight-saving rules.")
1391 (license public-domain)))
1393 ;;; A "fixed" version of tzdata, which is used in the test suites of glib and R
1394 ;;; and a few other places. We can update this whenever we are able to rebuild
1395 ;;; thousands of packages (for example, in a core-updates rebuild). This package
1396 ;;; will typically be obsolete and should never be referred to by a built
1399 ;;; Please make this a hidden-package if it is different from the primary tzdata
1401 (define-public tzdata-for-tests tzdata)
1403 (define-public libiconv
1409 (uri (string-append "mirror://gnu/libiconv/libiconv-"
1413 "0y1ij745r4p48mxq84rax40p10ln7fc7m243p8k8sia519i3dxfc"))
1414 (modules '((guix build utils)))
1416 ;; Work around "declared gets" error on glibc systems (fixed by
1417 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
1418 '(substitute* "srclib/stdio.in.h"
1419 (("^#undef gets") "")
1420 (("^_GL_WARN_ON_USE \\(gets.*") "")))))
1421 (build-system gnu-build-system)
1422 (synopsis "Character set conversion library")
1424 "libiconv provides an implementation of the iconv function for systems
1425 that lack it. iconv is used to convert between character encodings in a
1426 program. It supports a wide variety of different encodings.")
1427 (home-page "https://www.gnu.org/software/libiconv/")
1430 (define* (libiconv-if-needed #:optional (target (%current-target-system)))
1431 "Return either a libiconv package specification to include in a dependency
1432 list for platforms that have an incomplete libc, or the empty list. If a
1433 package needs iconv ,@(libiconv-if-needed) should be added."
1434 ;; POSIX C libraries provide iconv. Platforms with an incomplete libc
1435 ;; without iconv, such as MinGW, must return the then clause.
1436 (if (target-mingw? target)
1437 `(("libiconv" ,libiconv))
1440 (define-public (canonical-package package)
1441 ;; Avoid circular dependency by lazily resolving 'commencement'.
1442 (let* ((iface (resolve-interface '(gnu packages commencement)))
1443 (proc (module-ref iface 'canonical-package)))
1446 (define-public (%final-inputs)
1447 "Return the list of \"final inputs\"."
1448 ;; Avoid circular dependency by lazily resolving 'commencement'.
1449 (let ((iface (resolve-interface '(gnu packages commencement))))
1450 (module-ref iface '%final-inputs)))
1452 ;;; base.scm ends here