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