gnu: tar: Update to 1.31.
[jackhill/guix/guix.git] / gnu / packages / base.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 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, 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 Ricardo Wurmus <rekado@elephly.net>
17 ;;;
18 ;;; This file is part of GNU Guix.
19 ;;;
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.
24 ;;;
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.
29 ;;;
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/>.
32
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 bash)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages ed)
41 #:use-module (gnu packages guile)
42 #:use-module (gnu packages multiprecision)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages pcre)
47 #:use-module (gnu packages texinfo)
48 #:use-module (gnu packages hurd)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages gettext)
51 #:use-module (guix utils)
52 #:use-module (guix packages)
53 #:use-module (guix download)
54 #:use-module (guix git-download)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix build-system trivial)
57 #:use-module (ice-9 match)
58 #:export (glibc
59 libiconv-if-needed))
60
61 ;;; Commentary:
62 ;;;
63 ;;; Base packages of the Guix-based GNU user-land software distribution.
64 ;;;
65 ;;; Code:
66
67 (define-public hello
68 (package
69 (name "hello")
70 (version "2.10")
71 (source (origin
72 (method url-fetch)
73 (uri (string-append "mirror://gnu/hello/hello-" version
74 ".tar.gz"))
75 (sha256
76 (base32
77 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
78 (build-system gnu-build-system)
79 (synopsis "Hello, GNU world: An example GNU package")
80 (description
81 "GNU Hello prints the message \"Hello, world!\" and then exits. It
82 serves as an example of standard GNU coding practices. As such, it supports
83 command-line arguments, multiple languages, and so on.")
84 (home-page "https://www.gnu.org/software/hello/")
85 (license gpl3+)))
86
87 (define-public grep
88 (package
89 (name "grep")
90 (version "3.3")
91 (source (origin
92 (method url-fetch)
93 (uri (string-append "mirror://gnu/grep/grep-"
94 version ".tar.xz"))
95 (sha256
96 (base32
97 "055mqp6vrd0brkygmygb2673qwz409a7kyp1mzbfy6cn94f58q5r"))
98 (patches (search-patches "grep-timing-sensitive-test.patch"))))
99 (build-system gnu-build-system)
100 (native-inputs `(("perl" ,perl))) ;some of the tests require it
101 (inputs `(("pcre" ,pcre)))
102 (arguments
103 `(#:phases
104 (modify-phases %standard-phases
105 (add-after 'install 'fix-egrep-and-fgrep
106 ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
107 ;; absolute file name instead of searching for it in $PATH.
108 (lambda* (#:key outputs #:allow-other-keys)
109 (let* ((out (assoc-ref outputs "out"))
110 (bin (string-append out "/bin")))
111 (substitute* (list (string-append bin "/egrep")
112 (string-append bin "/fgrep"))
113 (("^exec grep")
114 (string-append "exec " bin "/grep")))
115 #t))))))
116 (synopsis "Print lines matching a pattern")
117 (description
118 "grep is a tool for finding text inside files. Text is found by
119 matching a pattern provided by the user in one or many files. The pattern
120 may be provided as a basic or extended regular expression, or as fixed
121 strings. By default, the matching text is simply printed to the screen,
122 however the output can be greatly customized to include, for example, line
123 numbers. GNU grep offers many extensions over the standard utility,
124 including, for example, recursive directory searching.")
125 (license gpl3+)
126 (home-page "https://www.gnu.org/software/grep/")))
127
128 (define-public sed
129 (package
130 (name "sed")
131 (version "4.7")
132 (source (origin
133 (method url-fetch)
134 (uri (string-append "mirror://gnu/sed/sed-" version
135 ".tar.xz"))
136 (sha256
137 (base32
138 "0smxcx66vx29djzb542nxcynl7qnzxqa5032ibazi7x2s267d198"))))
139 (build-system gnu-build-system)
140 (synopsis "Stream editor")
141 (native-inputs
142 `(("perl" ,perl))) ;for tests
143 (description
144 "Sed is a non-interactive, text stream editor. It receives a text
145 input from a file or from standard input and it then applies a series of text
146 editing commands to the stream and prints its output to standard output. It
147 is often used for substituting text patterns in a stream. The GNU
148 implementation offers several extensions over the standard utility.")
149 (license gpl3+)
150 (home-page "https://www.gnu.org/software/sed/")))
151
152 (define-public tar
153 (package
154 (name "tar")
155 (version "1.31")
156 (source (origin
157 (method url-fetch)
158 (uri (string-append "mirror://gnu/tar/tar-"
159 version ".tar.xz"))
160 (sha256
161 (base32
162 "1h9dxhjhz1jnyhmh6jfhqw1g1sxqbg3cd32vpwg7x2xxxqffzwrp"))
163 (patches (search-patches "tar-skip-unreliable-tests.patch"
164 "tar-remove-wholesparse-check.patch"))))
165 (build-system gnu-build-system)
166 ;; Note: test suite requires ~1GiB of disk space.
167 (arguments
168 `(#:phases (modify-phases %standard-phases
169 (add-before 'build 'set-shell-file-name
170 (lambda* (#:key inputs #:allow-other-keys)
171 ;; Do not use "/bin/sh" to run programs.
172 (let ((bash (assoc-ref inputs "bash")))
173 (substitute* "src/system.c"
174 (("/bin/sh")
175 (string-append bash "/bin/sh")))
176 #t))))
177
178 ;; Work around a cross-compilation bug whereby libgnu.a would provide
179 ;; '__mktime_internal', which conflicts with the one in libc.a.
180 ,@(if (%current-target-system)
181 `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
182 '())
183
184 ;; Test #92 "link mismatch" expects "a/z: Not linked to a/y" but gets
185 ;; "a/y: Not linked to a/z" and fails, presumably due to differences in
186 ;; the order in which 'diff' traverses directories. That leads to a
187 ;; test failure even though conceptually the test passes. Skip it.
188 ;; Test 117 and 118 are prone to race conditions too, particularly
189 ;; when cross-compiling, so we skip those as well. All issues have
190 ;; been fixed upstream in these commits:
191 ;; <https://git.savannah.gnu.org/cgit/tar.git/commit/?id=847a36f>
192 ;; <https://git.savannah.gnu.org/cgit/tar.git/commit/?id=64b43fd>
193 #:make-flags (list (string-append
194 "TESTSUITEFLAGS= -k '!link mismatch,"
195 "!directory removed before reading,"
196 "!explicitly named directory removed before reading'"))))
197
198 ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
199 ;; to refer to the target Bash.
200 (inputs (if (%current-target-system)
201 `(("bash" ,bash))
202 '()))
203
204 (synopsis "Managing tar archives")
205 (description
206 "Tar provides the ability to create tar archives, as well as the
207 ability to extract, update or list files in an existing archive. It is
208 useful for combining many files into one larger file, while maintaining
209 directory structure and file information such as permissions and
210 creation/modification dates. GNU tar offers many extensions over the
211 standard utility.")
212 (license gpl3+)
213 (home-page "https://www.gnu.org/software/tar/")))
214
215 (define-public patch
216 (package
217 (name "patch")
218 (version "2.7.6")
219 (source (origin
220 (method url-fetch)
221 (uri (string-append "mirror://gnu/patch/patch-"
222 version ".tar.xz"))
223 (sha256
224 (base32
225 "1zfqy4rdcy279vwn2z1kbv19dcfw25d2aqy9nzvdkq5bjzd0nqdc"))
226 (patches (search-patches "patch-hurd-path-max.patch"))))
227 (build-system gnu-build-system)
228 (arguments
229 ;; Work around a cross-compilation bug whereby libpatch.a would provide
230 ;; '__mktime_internal', which conflicts with the one in libc.a.
231 (if (%current-target-system)
232 `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
233 '()))
234 (native-inputs `(("ed" ,ed)))
235 (synopsis "Apply differences to originals, with optional backups")
236 (description
237 "Patch is a program that applies changes to files based on differences
238 laid out as by the program \"diff\". The changes may be applied to one or more
239 files depending on the contents of the diff file. It accepts several
240 different diff formats. It may also be used to revert previously applied
241 differences.")
242 (license gpl3+)
243 (home-page "https://savannah.gnu.org/projects/patch/")))
244
245 (define-public diffutils
246 (package
247 (name "diffutils")
248 (version "3.6")
249 (source (origin
250 (method url-fetch)
251 (uri (string-append "mirror://gnu/diffutils/diffutils-"
252 version ".tar.xz"))
253 (sha256
254 (base32
255 "1mivg0fy3a6fcn535ln8nkgfj6vxh5hsxxs5h6692wxmsjyyh8fn"))
256 (patches (search-patches "diffutils-getopt.patch"))))
257 (build-system gnu-build-system)
258 (synopsis "Comparing and merging files")
259 (description
260 "GNU Diffutils is a package containing tools for finding the
261 differences between files. The \"diff\" command is used to show how two files
262 differ, while \"cmp\" shows the offsets and line numbers where they differ.
263 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
264 interactive means to merge two files.")
265 (license gpl3+)
266 (home-page "https://www.gnu.org/software/diffutils/")))
267
268 (define-public findutils
269 (package
270 (name "findutils")
271 (version "4.6.0")
272 (source (origin
273 (method url-fetch)
274 (uri (string-append "mirror://gnu/findutils/findutils-"
275 version ".tar.gz"))
276 (sha256
277 (base32
278 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
279 (patches (search-patches
280 "findutils-gnulib-libio.patch"
281 "findutils-localstatedir.patch"
282 "findutils-makedev.patch"
283 "findutils-test-xargs.patch"))
284 (modules '((guix build utils)))
285 (snippet
286 '(begin
287 ;; The gnulib test-lock test is prone to writer starvation
288 ;; with our glibc@2.25, which prefers readers, so disable it.
289 ;; The gnulib commit b20e8afb0b2 should fix this once
290 ;; incorporated here.
291 (substitute* "tests/Makefile.in"
292 (("test-lock\\$\\(EXEEXT\\) ") ""))
293 #t))))
294 (build-system gnu-build-system)
295 (arguments
296 `(#:configure-flags (list
297 ;; Tell 'updatedb' to write to /var.
298 "--localstatedir=/var"
299
300 ;; Work around cross-compilation failure. See
301 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
302 ,@(if (%current-target-system)
303 '("gl_cv_func_wcwidth_works=yes")
304 '()))))
305 (synopsis "Operating on files matching given criteria")
306 (description
307 "Findutils supplies the basic file directory searching utilities of the
308 GNU system. It consists of two primary searching utilities: \"find\"
309 recursively searches for files in a directory according to given criteria and
310 \"locate\" lists files in a database that match a query. Two auxiliary tools
311 are included: \"updatedb\" updates the file name database and \"xargs\" may be
312 used to apply commands with arbitrarily long arguments.")
313 (license gpl3+)
314 (home-page "https://www.gnu.org/software/findutils/")))
315
316 (define-public coreutils
317 (package
318 (name "coreutils")
319 (version "8.30")
320 (source (origin
321 (method url-fetch)
322 (uri (string-append "mirror://gnu/coreutils/coreutils-"
323 version ".tar.xz"))
324 (sha256
325 (base32
326 "0mxhw43d4wpqmvg0l4znk1vm10fy92biyh90lzdnqjcic2lb6cg8"))))
327 (build-system gnu-build-system)
328 (inputs `(("acl" ,acl) ; TODO: add SELinux
329 ("gmp" ,gmp) ;bignums in 'expr', yay!
330
331 ;; Drop the dependency on libcap when cross-compiling since it's
332 ;; not quite cross-compilable.
333 ,@(if (%current-target-system)
334 '()
335 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
336 (native-inputs
337 ;; Perl is needed to run tests in native builds, and to run the bundled
338 ;; copy of help2man. However, don't pass it when cross-compiling since
339 ;; that would lead it to try to run programs to get their '--help' output
340 ;; for help2man.
341 (if (%current-target-system)
342 '()
343 `(("perl" ,perl))))
344 (outputs '("out" "debug"))
345 (arguments
346 `(#:parallel-build? #f ; help2man may be called too early
347 #:phases (modify-phases %standard-phases
348 (add-before 'build 'patch-shell-references
349 (lambda _
350 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
351 ;; that tests pass, since /bin/sh isn't in the chroot.
352 (setenv "SHELL" (which "sh"))
353
354 (substitute* (find-files "gnulib-tests" "\\.c$")
355 (("/bin/sh") (which "sh")))
356 (substitute* (find-files "tests" "\\.sh$")
357 (("#!/bin/sh") (string-append "#!" (which "sh"))))
358 #t))
359 (add-before 'check 'disable-broken-test
360 (lambda _
361 ;; This test hits the 127 character shebang limit in the build
362 ;; environment due to the way "env -S" splits arguments into
363 ;; shebangs. Note that "env-S-script.sh" works around this
364 ;; specific issue, but "env-S.pl" is not adjusted for build
365 ;; environments with long prefixes (/tmp/guix-build-...).
366 (substitute* "Makefile"
367 (("^.*tests/misc/env-S.pl.*$") ""))
368 #t)))
369
370 ;; Work around a cross-compilation bug whereby libcoreutils.a would
371 ;; provide '__mktime_internal', which conflicts with the one in libc.a.
372 ,@(if (%current-target-system)
373 `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
374 '())))
375 (synopsis "Core GNU utilities (file, text, shell)")
376 (description
377 "GNU Coreutils includes all of the basic command-line tools that are
378 expected in a POSIX system. These provide the basic file, shell and text
379 manipulation functions of the GNU system. Most of these tools offer extended
380 functionality beyond that which is outlined in the POSIX standard.")
381 (license gpl3+)
382 (home-page "https://www.gnu.org/software/coreutils/")))
383
384 (define-public coreutils-minimal
385 ;; Coreutils without its optional dependencies.
386 (package
387 (inherit coreutils)
388 (name "coreutils-minimal")
389 (outputs '("out"))
390 (inputs '())))
391
392 (define-public gnu-make
393 (package
394 (name "make")
395 (version "4.2.1")
396 (source (origin
397 (method url-fetch)
398 (uri (string-append "mirror://gnu/make/make-" version
399 ".tar.bz2"))
400 (sha256
401 (base32
402 "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn"))
403 (patches (search-patches "make-impure-dirs.patch"
404 "make-glibc-compat.patch"))))
405 (build-system gnu-build-system)
406 (native-inputs `(("pkg-config" ,pkg-config))) ; to detect Guile
407 (inputs `(("guile" ,guile-2.0)))
408 (outputs '("out" "debug"))
409 (arguments
410 '(;; Work around faulty glob detection with glibc 2.27. See
411 ;; <https://lists.nongnu.org/archive/html/bug-make/2017-11/msg00027.html>.
412 #:configure-flags '("make_cv_sys_gnu_glob=yes")
413 #:phases
414 (modify-phases %standard-phases
415 (add-before 'build 'set-default-shell
416 (lambda* (#:key inputs #:allow-other-keys)
417 ;; Change the default shell from /bin/sh.
418 (let ((bash (assoc-ref inputs "bash")))
419 (substitute* "job.c"
420 (("default_shell =.*$")
421 (format #f "default_shell = \"~a/bin/sh\";\n"
422 bash)))
423 #t))))))
424 (synopsis "Remake files automatically")
425 (description
426 "Make is a program that is used to control the production of
427 executables or other files from their source files. The process is
428 controlled from a Makefile, in which the developer specifies how each file is
429 generated from its source. It has powerful dependency resolution and the
430 ability to determine when files have to be regenerated after their sources
431 change. GNU make offers many powerful extensions over the standard utility.")
432 (license gpl3+)
433 (home-page "https://www.gnu.org/software/make/")))
434
435 (define-public binutils
436 (package
437 (name "binutils")
438 (version "2.31.1")
439 (source (origin
440 (method url-fetch)
441 (uri (string-append "mirror://gnu/binutils/binutils-"
442 version ".tar.bz2"))
443 (sha256
444 (base32
445 "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"))
446 (patches (search-patches "binutils-loongson-workaround.patch"))))
447 (build-system gnu-build-system)
448
449 ;; TODO: Add dependency on zlib + those for Gold.
450 (arguments
451 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
452 ;; on GCC when bootstrapping.
453 "LDFLAGS=-static-libgcc"
454
455 ;; Turn on --enable-new-dtags by default to make the
456 ;; linker set RUNPATH instead of RPATH on binaries.
457 ;; This is important because RUNPATH can be overriden
458 ;; using LD_LIBRARY_PATH at runtime.
459 "--enable-new-dtags"
460
461 ;; Don't search under /usr/lib & co.
462 "--with-lib-path=/no-ld-lib-path"
463
464 ;; Install BFD. It ends up in a hidden directory,
465 ;; but it's here.
466 "--enable-install-libbfd"
467
468 ;; Make sure 'ar' and 'ranlib' produce archives in a
469 ;; deterministic fashion.
470 "--enable-deterministic-archives")))
471
472 (synopsis "Binary utilities: bfd gas gprof ld")
473 (description
474 "GNU Binutils is a collection of tools for working with binary files.
475 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
476 Other tools include programs to display binary profiling information, list
477 the strings in a binary file, and utilities for working with archives. The
478 \"bfd\" library for working with executable and object formats is also
479 included.")
480 (license gpl3+)
481 (home-page "https://www.gnu.org/software/binutils/")))
482
483 (define* (make-ld-wrapper name #:key
484 (target (const #f))
485 binutils
486 (guile (canonical-package guile-2.2))
487 (bash (canonical-package bash))
488 (guile-for-build guile))
489 "Return a package called NAME that contains a wrapper for the 'ld' program
490 of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
491 wrapper uses GUILE and BASH.
492
493 TARGET must be a one-argument procedure that, given a system type, returns a
494 cross-compilation target triplet or #f. When the result is not #f, make a
495 wrapper for the cross-linker for that target, called 'TARGET-ld'."
496 ;; Note: #:system->target-triplet is a procedure so that the evaluation of
497 ;; its result can be delayed until the 'arguments' field is evaluated, thus
498 ;; in a context where '%current-system' is accurate.
499 (package
500 (name name)
501 (version "0")
502 (source #f)
503 (build-system trivial-build-system)
504 (inputs `(("binutils" ,binutils)
505 ("guile" ,guile)
506 ("bash" ,bash)
507 ("wrapper" ,(search-path %load-path
508 "gnu/packages/ld-wrapper.in"))))
509 (arguments
510 (let ((target (target (%current-system))))
511 `(#:guile ,guile-for-build
512 #:modules ((guix build utils))
513 #:builder (begin
514 (use-modules (guix build utils)
515 (system base compile))
516
517 (let* ((out (assoc-ref %outputs "out"))
518 (bin (string-append out "/bin"))
519 (ld ,(if target
520 `(string-append bin "/" ,target "-ld")
521 '(string-append bin "/ld")))
522 (go (string-append ld ".go")))
523
524 (setvbuf (current-output-port) _IOLBF)
525 (format #t "building ~s/bin/ld wrapper in ~s~%"
526 (assoc-ref %build-inputs "binutils")
527 out)
528
529 (mkdir-p bin)
530 (copy-file (assoc-ref %build-inputs "wrapper") ld)
531 (substitute* ld
532 (("@SELF@")
533 ld)
534 (("@GUILE@")
535 (string-append (assoc-ref %build-inputs "guile")
536 "/bin/guile"))
537 (("@BASH@")
538 (string-append (assoc-ref %build-inputs "bash")
539 "/bin/bash"))
540 (("@LD@")
541 (string-append (assoc-ref %build-inputs "binutils")
542 ,(if target
543 (string-append "/bin/"
544 target "-ld")
545 "/bin/ld"))))
546 (chmod ld #o555)
547 (compile-file ld #:output-file go)
548 #t)))))
549 (synopsis "The linker wrapper")
550 (description
551 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
552 missing '-rpath' flags, and to detect any misuse of libraries outside of the
553 store.")
554 (home-page "https://www.gnu.org/software/guix//")
555 (license gpl3+)))
556
557 (export make-ld-wrapper)
558
559 (define-public glibc
560 ;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to
561 ;; version 2.28, GNU/Hurd used a different glibc branch.
562 (package
563 (name "glibc")
564 ;; Note: Always use a dot after the minor version since various places rely
565 ;; on "version-major+minor" to determine where locales are found.
566 (version "2.28")
567 (source (origin
568 (method url-fetch)
569 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
570 (sha256
571 (base32
572 "10iha5ynvdj5m62vgpgqbq4cwvc2yhyl2w9yyyjgfxmdmx8h145i"))
573 (snippet
574 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
575 ;; required on LFS distros to avoid loading the distro's libc.so
576 ;; instead of ours.
577 '(begin
578 (substitute* "sysdeps/unix/sysv/linux/configure"
579 (("use_ldconfig=yes")
580 "use_ldconfig=no"))
581 #t))
582 (modules '((guix build utils)))
583 (patches (search-patches "glibc-ldd-x86_64.patch"
584 "glibc-2.28-git-fixes.patch"
585 "glibc-hidden-visibility-ldconfig.patch"
586 "glibc-versioned-locpath.patch"
587 "glibc-allow-kernel-2.6.32.patch"
588 "glibc-reinstate-prlimit64-fallback.patch"
589 "glibc-hurd-magic-pid.patch"
590 "glibc-supported-locales.patch"))))
591 (build-system gnu-build-system)
592
593 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
594 ;; users should automatically pull Linux headers as well. On GNU/Hurd,
595 ;; libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
596 ;; so both should be propagated.
597 (propagated-inputs
598 (if (hurd-target?)
599 `(("hurd-core-headers" ,hurd-core-headers))
600 `(("kernel-headers" ,linux-libre-headers))))
601
602 (outputs '("out" "debug"
603 "static")) ;9 MiB of .a files
604
605 (arguments
606 `(#:out-of-source? #t
607
608 ;; The libraries have an empty RUNPATH, but some, such as the versioned
609 ;; libraries (libdl-2.24.so, etc.) have ld.so marked as NEEDED. Since
610 ;; these libraries are always going to be found anyway, just skip
611 ;; RUNPATH checks.
612 #:validate-runpath? #f
613
614 #:modules ((ice-9 ftw)
615 (srfi srfi-26)
616 (guix build utils)
617 (guix build gnu-build-system))
618
619 #:configure-flags
620 (list "--sysconfdir=/etc"
621
622 ;; Installing a locale archive with all the locales is to
623 ;; expensive (~100 MiB), so we rely on users to install the
624 ;; locales they really want.
625 ;;
626 ;; Set the default locale path. In practice, $LOCPATH may be
627 ;; defined to point whatever locales users want. However, setuid
628 ;; binaries don't honor $LOCPATH, so they'll instead look into
629 ;; $libc_cv_complocaledir; we choose /run/current-system/locale/X.Y,
630 ;; with the idea that it is going to be populated by the sysadmin.
631 ;; The "X.Y" sub-directory is because locale data formats are
632 ;; incompatible across libc versions; see
633 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
634 ;;
635 ;; `--localedir' is not honored, so work around it.
636 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
637 (string-append "libc_cv_complocaledir=/run/current-system/locale/"
638 ,(version-major+minor version))
639
640 (string-append "--with-headers="
641 (assoc-ref ,(if (%current-target-system)
642 '%build-target-inputs
643 '%build-inputs)
644 "kernel-headers")
645 "/include")
646
647 ;; This is the default for most architectures as of GNU libc 2.26,
648 ;; but we specify it explicitly for clarity and consistency. See
649 ;; "kernel-features.h" in the GNU libc for details.
650 "--enable-kernel=3.2.0"
651
652 ;; Use our Bash instead of /bin/sh.
653 (string-append "BASH_SHELL="
654 (assoc-ref %build-inputs "bash")
655 "/bin/bash")
656
657 ;; On GNU/Hurd we get discarded-qualifiers warnings for
658 ;; 'device_write_inband' among other things. Ignore them.
659 ,@(if (hurd-target?)
660 '("--disable-werror")
661 '()))
662
663 #:tests? #f ; XXX
664 #:phases (modify-phases %standard-phases
665 (add-before
666 'configure 'pre-configure
667 (lambda* (#:key inputs native-inputs outputs
668 #:allow-other-keys)
669 (let* ((out (assoc-ref outputs "out"))
670 (bin (string-append out "/bin"))
671 ;; FIXME: Normally we would look it up only in INPUTS
672 ;; but cross-base uses it as a native input.
673 (bash (or (assoc-ref inputs "static-bash")
674 (assoc-ref native-inputs "static-bash"))))
675 ;; Install the rpc data base file under `$out/etc/rpc'.
676 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
677 (substitute* "sunrpc/Makefile"
678 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
679 (string-append out "/etc/rpc" suffix "\n"))
680 (("^install-others =.*$")
681 (string-append "install-others = " out "/etc/rpc\n")))
682
683 (substitute* "Makeconfig"
684 ;; According to
685 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
686 ;; linking against libgcc_s is not needed with GCC
687 ;; 4.7.1.
688 ((" -lgcc_s") ""))
689
690 ;; Have `system' use that Bash.
691 (substitute* "sysdeps/posix/system.c"
692 (("#define[[:blank:]]+SHELL_PATH.*$")
693 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
694 bash)))
695
696 ;; Same for `popen'.
697 (substitute* "libio/iopopen.c"
698 (("/bin/sh")
699 (string-append bash "/bin/sh")))
700
701 ;; Same for the shell used by the 'exec' functions for
702 ;; scripts that lack a shebang.
703 (substitute* (find-files "." "^paths\\.h$")
704 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
705 (string-append "#define _PATH_BSHELL \""
706 bash "/bin/sh\"\n")))
707
708 ;; Nscd uses __DATE__ and __TIME__ to create a string to
709 ;; make sure the client and server come from the same
710 ;; libc. Use something deterministic instead.
711 (substitute* "nscd/nscd_stat.c"
712 (("static const char compilation\\[21\\] =.*$")
713 (string-append
714 "static const char compilation[21] = \""
715 (string-take (basename out) 20) "\";\n")))
716
717 ;; Make sure we don't retain a reference to the
718 ;; bootstrap Perl.
719 (substitute* "malloc/mtrace.pl"
720 (("^#!.*")
721 ;; The shebang can be omitted, because there's the
722 ;; "bilingual" eval/exec magic at the top of the file.
723 "")
724 (("exec @PERL@")
725 "exec perl"))
726
727 #t)))
728
729 (add-after 'install 'move-static-libs
730 (lambda* (#:key outputs #:allow-other-keys)
731 ;; Move static libraries to the "static" output.
732 (define (static-library? file)
733 ;; Return true if FILE is a static library. The
734 ;; "_nonshared.a" files are referred to by libc.so,
735 ;; libpthread.so, etc., which are in fact linker
736 ;; scripts.
737 (and (string-suffix? ".a" file)
738 (not (string-contains file "_nonshared"))))
739
740 (define (linker-script? file)
741 ;; Guess whether FILE, a ".a" file, is actually a
742 ;; linker script.
743 (and (not (ar-file? file))
744 (not (elf-file? file))))
745
746 (let* ((out (assoc-ref outputs "out"))
747 (lib (string-append out "/lib"))
748 (files (scandir lib static-library?))
749 (static (assoc-ref outputs "static"))
750 (slib (string-append static "/lib")))
751 (mkdir-p slib)
752 (for-each (lambda (base)
753 (rename-file (string-append lib "/" base)
754 (string-append slib "/" base)))
755 files)
756
757 ;; Usually libm.a is a linker script so we need to
758 ;; change the file names in there to refer to STATIC
759 ;; instead of OUT.
760 (for-each (lambda (ld-script)
761 (substitute* ld-script
762 ((out) static)))
763 (filter linker-script?
764 (map (cut string-append slib "/" <>)
765 files)))
766 #t)))
767
768 ,@(if (hurd-target?)
769 '((add-after 'install 'augment-libc.so
770 (lambda* (#:key outputs #:allow-other-keys)
771 (let* ((out (assoc-ref outputs "out")))
772 (substitute* (string-append out "/lib/libc.so")
773 (("/[^ ]+/lib/libc.so.0.3")
774 (string-append out "/lib/libc.so.0.3"
775 " libmachuser.so libhurduser.so"))))
776 #t)))
777 '()))))
778
779 (inputs `(("static-bash" ,static-bash)))
780
781 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
782 ;; install the message catalogs, with 'msgfmt'.
783 (native-inputs `(("texinfo" ,texinfo)
784 ("perl" ,perl)
785 ("bison" ,bison)
786 ("gettext" ,gettext-minimal)
787
788 ,@(if (hurd-target?)
789 `(("mig" ,mig)
790 ("perl" ,perl))
791 '())))
792
793 (native-search-paths
794 ;; Search path for packages that provide locale data. This is useful
795 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
796 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
797 ;; distros.
798 (list (search-path-specification
799 (variable "GUIX_LOCPATH")
800 (files '("lib/locale")))))
801
802 (synopsis "The GNU C Library")
803 (description
804 "Any Unix-like operating system needs a C library: the library which
805 defines the \"system calls\" and other basic facilities such as open, malloc,
806 printf, exit...
807
808 The GNU C library is used as the C library in the GNU system and most systems
809 with the Linux kernel.")
810 (license lgpl2.0+)
811 (home-page "https://www.gnu.org/software/libc/")))
812
813 ;; Below are old libc versions, which we use mostly to build locale data in
814 ;; the old format (which the new libc cannot cope with.)
815
816 (define-public glibc-2.27
817 (package
818 (inherit glibc)
819 (version "2.27")
820 (source (origin
821 (inherit (package-source glibc))
822 (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
823 (sha256
824 (base32
825 "0wpwq7gsm7sd6ysidv0z575ckqdg13cr2njyfgrbgh4f65adwwji"))
826 (patches (search-patches "glibc-ldd-x86_64.patch"
827 "glibc-2.27-git-fixes.patch"
828 "glibc-hidden-visibility-ldconfig.patch"
829 "glibc-versioned-locpath.patch"
830 "glibc-allow-kernel-2.6.32.patch"
831 "glibc-reinstate-prlimit64-fallback.patch"
832 "glibc-supported-locales.patch"))))))
833
834 (define-public glibc-2.26
835 (package
836 (inherit glibc)
837 ;; This version number corresponds to the output of `git describe` and the
838 ;; archive can be generated by checking out the commit ID and running:
839 ;; git archive --prefix=$(git describe)/ HEAD | xz > $(git describe).tar.xz
840 ;; See <https://bugs.gnu.org/29406> for why this was necessary.
841 (version "2.26.105-g0890d5379c")
842 (source (origin
843 (inherit (package-source glibc))
844 (uri (string-append "https://alpha.gnu.org/gnu/guix/mirror/"
845 "glibc-" (version-major+minor version) "-"
846 (caddr (string-split version #\.)) ".tar.xz"))
847 (sha256
848 (base32
849 "1jck0c1i248sn02rvsfjykk77qncma34bjq89dyy2irwm50d7s3g"))
850 (patches (search-patches "glibc-ldd-x86_64.patch"
851 "glibc-versioned-locpath.patch"
852 "glibc-allow-kernel-2.6.32.patch"))))))
853
854 (define-public glibc-2.25
855 (package
856 (inherit glibc)
857 (version "2.25")
858 (source (origin
859 (inherit (package-source glibc))
860 (uri (string-append "mirror://gnu/glibc/glibc-"
861 version ".tar.xz"))
862 (sha256
863 (base32
864 "1813dzkgw6v8q8q1m4v96yfis7vjqc9pslqib6j9mrwh6fxxjyq6"))
865 (patches (search-patches "glibc-ldd-x86_64.patch"
866 "glibc-versioned-locpath.patch"
867 "glibc-vectorized-strcspn-guards.patch"
868 "glibc-CVE-2017-1000366-pt1.patch"
869 "glibc-CVE-2017-1000366-pt2.patch"
870 "glibc-CVE-2017-1000366-pt3.patch"))))))
871
872 (define-public glibc-2.24
873 (package
874 (inherit glibc)
875 (version "2.24")
876 (source (origin
877 (inherit (package-source glibc))
878 (uri (string-append "mirror://gnu/glibc/glibc-"
879 version ".tar.xz"))
880 (sha256
881 (base32
882 "1lxmprg9gm73gvafxd503x70z32phwjzcy74i0adfi6ixzla7m4r"))
883 (patches (search-patches "glibc-ldd-x86_64.patch"
884 "glibc-versioned-locpath.patch"
885 "glibc-vectorized-strcspn-guards.patch"
886 "glibc-CVE-2015-5180.patch"
887 "glibc-CVE-2017-1000366-pt1.patch"
888 "glibc-CVE-2017-1000366-pt2.patch"
889 "glibc-CVE-2017-1000366-pt3.patch"))))))
890
891 (define-public glibc-2.23
892 (package
893 (inherit glibc)
894 (version "2.23")
895 (source (origin
896 (inherit (package-source glibc))
897 (uri (string-append "mirror://gnu/glibc/glibc-"
898 version ".tar.xz"))
899 (sha256
900 (base32
901 "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))
902 (patches (search-patches "glibc-ldd-x86_64.patch"
903 "glibc-versioned-locpath.patch"
904 "glibc-vectorized-strcspn-guards.patch"
905 "glibc-CVE-2015-5180.patch"
906 "glibc-CVE-2016-3075.patch"
907 "glibc-CVE-2016-3706.patch"
908 "glibc-CVE-2016-4429.patch"
909 "glibc-CVE-2017-1000366-pt1.patch"
910 "glibc-CVE-2017-1000366-pt2.patch"
911 "glibc-CVE-2017-1000366-pt3.patch"))))))
912
913 (define-public glibc-2.22
914 (package
915 (inherit glibc)
916 (version "2.22")
917 (source (origin
918 (inherit (package-source glibc))
919 (uri (string-append "mirror://gnu/glibc/glibc-"
920 version ".tar.xz"))
921 (sha256
922 (base32
923 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
924 (patches (search-patches "glibc-ldd-x86_64.patch"
925 "glibc-o-largefile.patch"
926 "glibc-vectorized-strcspn-guards.patch"
927 "glibc-CVE-2015-5180.patch"
928 "glibc-CVE-2015-7547.patch"
929 "glibc-CVE-2016-3075.patch"
930 "glibc-CVE-2016-3706.patch"
931 "glibc-CVE-2016-4429.patch"
932 "glibc-CVE-2017-1000366-pt1.patch"
933 "glibc-CVE-2017-1000366-pt2.patch"
934 "glibc-CVE-2017-1000366-pt3.patch"))))
935 (arguments
936 (substitute-keyword-arguments (package-arguments glibc)
937 ((#:phases phases)
938 `(modify-phases ,phases
939 (add-before 'configure 'fix-pwd
940 (lambda _
941 ;; Use `pwd' instead of `/bin/pwd' for glibc-2.22.
942 (substitute* "configure"
943 (("/bin/pwd") "pwd"))
944 #t))))))))
945
946 (define-public glibc-locales
947 (package
948 (inherit glibc)
949 (name "glibc-locales")
950 (source (origin (inherit (package-source glibc))
951 (patches (cons (search-patch "glibc-locales.patch")
952 (origin-patches (package-source glibc))))))
953 (synopsis "All the locales supported by the GNU C Library")
954 (description
955 "This package provides all the locales supported by the GNU C Library,
956 more than 400 in total. To use them set the 'LOCPATH' environment variable to
957 the 'share/locale' sub-directory of this package.")
958 (outputs '("out")) ;110+ MiB
959 (native-search-paths '())
960 (arguments
961 (let ((args `(#:tests? #f #:strip-binaries? #f
962 ,@(package-arguments glibc))))
963 (substitute-keyword-arguments args
964 ((#:phases phases)
965 `(modify-phases ,phases
966 (replace 'build
967 (lambda _
968 (invoke "make" "localedata/install-locales"
969 "-j" (number->string (parallel-job-count)))))
970 (delete 'install)
971 (delete 'move-static-libs)))
972 ((#:configure-flags flags)
973 `(append ,flags
974 ;; Use $(libdir)/locale/X.Y as is the case by default.
975 (list (string-append "libc_cv_complocaledir="
976 (assoc-ref %outputs "out")
977 "/lib/locale/"
978 ,(version-major+minor
979 (package-version glibc)))))))))))
980
981 (define-public glibc-utf8-locales
982 (package
983 (name "glibc-utf8-locales")
984 (version (package-version glibc))
985 (source #f)
986 (build-system trivial-build-system)
987 (arguments
988 `(#:modules ((guix build utils))
989 #:builder (begin
990 (use-modules (guix build utils))
991
992 (let* ((libc (assoc-ref %build-inputs "glibc"))
993 (gzip (assoc-ref %build-inputs "gzip"))
994 (out (assoc-ref %outputs "out"))
995 (localedir (string-append out "/lib/locale/"
996 ,(version-major+minor version))))
997 ;; 'localedef' needs 'gzip'.
998 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
999
1000 (mkdir-p localedir)
1001 (for-each (lambda (locale)
1002 (define file
1003 ;; Use the "normalized codeset" by
1004 ;; default--e.g., "en_US.utf8".
1005 (string-append localedir "/" locale ".utf8"))
1006
1007 (invoke "localedef" "--no-archive"
1008 "--prefix" localedir
1009 "-i" locale
1010 "-f" "UTF-8" file)
1011
1012 ;; For backward compatibility with Guix
1013 ;; <= 0.8.3, add "xx_YY.UTF-8".
1014 (symlink (string-append locale ".utf8")
1015 (string-append localedir "/"
1016 locale ".UTF-8")))
1017
1018 ;; These are the locales commonly used for
1019 ;; tests---e.g., in Guile's i18n tests.
1020 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
1021 #t))))
1022 (inputs `(("glibc" ,glibc)
1023 ("gzip" ,gzip)))
1024 (synopsis "Small sample of UTF-8 locales")
1025 (description
1026 "This package provides a small sample of UTF-8 locales mostly useful in
1027 test environments.")
1028 (home-page (package-home-page glibc))
1029 (license (package-license glibc))))
1030
1031 (define-public which
1032 (package
1033 (name "which")
1034 (version "2.21")
1035 (source (origin
1036 (method url-fetch)
1037 (uri (string-append "mirror://gnu/which/which-"
1038 version ".tar.gz"))
1039 (sha256
1040 (base32
1041 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
1042 (build-system gnu-build-system)
1043 (home-page "https://gnu.org/software/which/")
1044 (synopsis "Find full path of shell commands")
1045 (description
1046 "The which program finds the location of executables in PATH, with a
1047 variety of options. It is an alternative to the shell \"type\" built-in
1048 command.")
1049 (license gpl3+))) ; some files are under GPLv2+
1050
1051 (define-public glibc/hurd-headers
1052 (package (inherit glibc)
1053 (name "glibc-hurd-headers")
1054 (outputs '("out"))
1055 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
1056 ("hurd-headers" ,hurd-headers)))
1057 (arguments
1058 (substitute-keyword-arguments (package-arguments glibc)
1059 ;; We just pass the flags really needed to build the headers.
1060 ((#:configure-flags _)
1061 `(list "--enable-add-ons"
1062 "--host=i586-pc-gnu"))
1063 ((#:phases _)
1064 '(modify-phases %standard-phases
1065 (replace 'install
1066 (lambda* (#:key outputs #:allow-other-keys)
1067 (invoke "make" "install-headers")
1068
1069 ;; Make an empty stubs.h to work around not being able to
1070 ;; produce a valid stubs.h and causing the build to fail. See
1071 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
1072 (let ((out (assoc-ref outputs "out")))
1073 (close-port
1074 (open-output-file
1075 (string-append out "/include/gnu/stubs.h"))))
1076 #t))
1077 (delete 'build))))))) ; nothing to build
1078
1079 (define-public tzdata
1080 (package
1081 (name "tzdata")
1082 (version "2018e")
1083 (source (origin
1084 (method url-fetch)
1085 (uri (string-append
1086 "https://www.iana.org/time-zones/repository/releases/tzdata"
1087 version ".tar.gz"))
1088 (sha256
1089 (base32
1090 "0bk97fv2i5ns42prpmlaadsswdjwv0ifi7whj2s4q6l44rcqwa3b"))))
1091 (build-system gnu-build-system)
1092 (arguments
1093 '(#:tests? #f
1094 #:make-flags (let ((out (assoc-ref %outputs "out"))
1095 (tmp (getenv "TMPDIR")))
1096 (list (string-append "TOPDIR=" out)
1097 (string-append "TZDIR=" out "/share/zoneinfo")
1098 (string-append "TZDEFAULT=" out
1099 "/share/zoneinfo/localtime")
1100
1101 ;; Likewise for the C library routines.
1102 (string-append "LIBDIR=" tmp "/lib")
1103 (string-append "MANDIR=" tmp "/man")
1104
1105 "AWK=awk"
1106 "CC=gcc"))
1107 #:modules ((guix build utils)
1108 (guix build gnu-build-system)
1109 (srfi srfi-1))
1110 #:phases
1111 (modify-phases %standard-phases
1112 (replace 'unpack
1113 (lambda* (#:key source inputs #:allow-other-keys)
1114 (invoke "tar" "xvf" source)
1115 (invoke "tar" "xvf" (assoc-ref inputs "tzcode"))))
1116 (add-after 'install 'post-install
1117 (lambda* (#:key outputs #:allow-other-keys)
1118 ;; Move data in the right place.
1119 (let ((out (assoc-ref outputs "out")))
1120 ;; Discard zic, dump, and tzselect, already
1121 ;; provided by glibc.
1122 (delete-file-recursively (string-append out "/usr"))
1123 (symlink (string-append out "/share/zoneinfo")
1124 (string-append out "/share/zoneinfo/posix"))
1125 (delete-file-recursively
1126 (string-append out "/share/zoneinfo-posix"))
1127 (copy-recursively (string-append out "/share/zoneinfo-leaps")
1128 (string-append out "/share/zoneinfo/right"))
1129 (delete-file-recursively
1130 (string-append out "/share/zoneinfo-leaps"))
1131 #t)))
1132 (delete 'configure))))
1133 (inputs `(("tzcode" ,(origin
1134 (method url-fetch)
1135 (uri (string-append
1136 "http://www.iana.org/time-zones/repository/releases/tzcode"
1137 version ".tar.gz"))
1138 (sha256
1139 (base32
1140 "1kpb02631s58i068mwq63xlamcv1ffj4p6y4wpb9kdl01vr0qd6a"))))))
1141 (home-page "https://www.iana.org/time-zones")
1142 (synopsis "Database of current and historical time zones")
1143 (description "The Time Zone Database (often called tz or zoneinfo)
1144 contains code and data that represent the history of local time for many
1145 representative locations around the globe. It is updated periodically to
1146 reflect changes made by political bodies to time zone boundaries, UTC offsets,
1147 and daylight-saving rules.")
1148 (license public-domain)))
1149
1150 ;;; A "fixed" version of tzdata, which is used in the test suites of glib and R
1151 ;;; and a few other places. We can update this whenever we are able to rebuild
1152 ;;; thousands of packages (for example, in a core-updates rebuild). This package
1153 ;;; will typically be obsolete and should never be referred to by a built
1154 ;;; package.
1155 (define-public tzdata-for-tests
1156 (hidden-package
1157 (package
1158 (inherit tzdata)
1159 (version "2018d")
1160 (source (origin
1161 (method url-fetch)
1162 (uri (string-append "https://www.iana.org/time-zones/repository"
1163 "/releases/tzdata" version ".tar.gz"))
1164 (sha256
1165 (base32
1166 "0m6020dnk9r40z7k36jp13fa06xip3hn0fdx3nly66jzxgffs1ji"))))
1167 (inputs `(("tzcode" ,(origin
1168 (method url-fetch)
1169 (uri (string-append
1170 "http://www.iana.org/time-zones/repository/releases/tzcode"
1171 version ".tar.gz"))
1172 (sha256
1173 (base32
1174 "1nd882yhsazmcfqmcqyfig3axycryl30gmizgqhqsx5dpa2lxr3x")))))))))
1175
1176 (define-public libiconv
1177 (package
1178 (name "libiconv")
1179 (version "1.15")
1180 (source (origin
1181 (method url-fetch)
1182 (uri (string-append "mirror://gnu/libiconv/libiconv-"
1183 version ".tar.gz"))
1184 (sha256
1185 (base32
1186 "0y1ij745r4p48mxq84rax40p10ln7fc7m243p8k8sia519i3dxfc"))
1187 (modules '((guix build utils)))
1188 (snippet
1189 ;; Work around "declared gets" error on glibc systems (fixed by
1190 ;; Gnulib commit 66712c23388e93e5c518ebc8515140fa0c807348.)
1191 '(begin
1192 (substitute* "srclib/stdio.in.h"
1193 (("^#undef gets") "")
1194 (("^_GL_WARN_ON_USE \\(gets.*") ""))
1195 #t))))
1196 (build-system gnu-build-system)
1197 (synopsis "Character set conversion library")
1198 (description
1199 "libiconv provides an implementation of the iconv function for systems
1200 that lack it. iconv is used to convert between character encodings in a
1201 program. It supports a wide variety of different encodings.")
1202 (home-page "https://www.gnu.org/software/libiconv/")
1203 (license lgpl3+)))
1204
1205 (define* (libiconv-if-needed #:optional (target (%current-target-system)))
1206 "Return either a libiconv package specification to include in a dependency
1207 list for platforms that have an incomplete libc, or the empty list. If a
1208 package needs iconv ,@(libiconv-if-needed) should be added."
1209 ;; POSIX C libraries provide iconv. Platforms with an incomplete libc
1210 ;; without iconv, such as MinGW, must return the then clause.
1211 (if (target-mingw? target)
1212 `(("libiconv" ,libiconv))
1213 '()))
1214
1215 (define-public (canonical-package package)
1216 ;; Avoid circular dependency by lazily resolving 'commencement'.
1217 (let* ((iface (resolve-interface '(gnu packages commencement)))
1218 (proc (module-ref iface 'canonical-package)))
1219 (proc package)))
1220
1221 (define-public (%final-inputs)
1222 "Return the list of \"final inputs\"."
1223 ;; Avoid circular dependency by lazily resolving 'commencement'.
1224 (let ((iface (resolve-interface '(gnu packages commencement))))
1225 (module-ref iface '%final-inputs)))
1226
1227 ;;; base.scm ends here