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