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