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