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