Revert "gnu: glibc: Honor 'GUIX_LOCPATH'."
[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")
c4a298c5 76 (version "2.21")
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
a068dba7
MW
83 "1pp5n15qwxrw1pibwjhhgsibyv5cafhamf8lwzjygs6y00fa2i2j"))
84 (patches (list (search-patch "grep-CVE-2015-1345.patch")))))
6794b278 85 (build-system gnu-build-system)
f50d2669 86 (synopsis "Print lines matching a pattern")
d45122f5 87 (description
12bcf94a 88 "grep is a tool for finding text inside files. Text is found by
a22dc0c4 89matching a pattern provided by the user in one or many files. The pattern
79c311b8
LC
90may be provided as a basic or extended regular expression, or as fixed
91strings. By default, the matching text is simply printed to the screen,
92however the output can be greatly customized to include, for example, line
93numbers. GNU grep offers many extensions over the standard utility,
94including, for example, recursive directory searching.")
4a44e743 95 (license gpl3+)
6794b278
LC
96 (home-page "http://www.gnu.org/software/grep/")))
97
8dcad9aa
LC
98(define-public sed
99 (package
100 (name "sed")
847e7725 101 (version "4.2.2")
8dcad9aa 102 (source (origin
87f5d366 103 (method url-fetch)
0db342a5 104 (uri (string-append "mirror://gnu/sed/sed-" version
8dcad9aa
LC
105 ".tar.bz2"))
106 (sha256
107 (base32
56eba3d1
MR
108 "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))
109 (patches (list (search-patch "sed-hurd-path-max.patch")))))
8dcad9aa 110 (build-system gnu-build-system)
f50d2669 111 (synopsis "Stream editor")
52b8e5fc 112 (arguments
c8c6bba5
LC
113 (if (%current-target-system)
114 '()
115 `(#:phases (alist-cons-before
116 'patch-source-shebangs 'patch-test-suite
117 (lambda* (#:key inputs #:allow-other-keys)
118 (let ((bash (assoc-ref inputs "bash")))
119 (patch-makefile-SHELL "testsuite/Makefile.tests")
120 (substitute* '("testsuite/bsd.sh"
121 "testsuite/bug-regex9.c")
122 (("/bin/sh")
123 (string-append bash "/bin/bash")))))
124 %standard-phases))))
d45122f5 125 (description
a22dc0c4
LC
126 "Sed is a non-interactive, text stream editor. It receives a text
127input from a file or from standard input and it then applies a series of text
128editing commands to the stream and prints its output to standard output. It
79c311b8
LC
129is often used for substituting text patterns in a stream. The GNU
130implementation offers several extensions over the standard utility.")
4a44e743 131 (license gpl3+)
8dcad9aa
LC
132 (home-page "http://www.gnu.org/software/sed/")))
133
85240322
LC
134(define-public tar
135 (package
136 (name "tar")
d6535cf1 137 (version "1.28")
85240322 138 (source (origin
87f5d366 139 (method url-fetch)
0db342a5 140 (uri (string-append "mirror://gnu/tar/tar-"
d6535cf1 141 version ".tar.xz"))
85240322
LC
142 (sha256
143 (base32
94d915d0 144 "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4"))
d3b4c135
LC
145 (patches (map search-patch
146 '("tar-d_ino_in_dirent-fix.patch"
147 "tar-skip-unreliable-tests.patch")))))
85240322 148 (build-system gnu-build-system)
f50d2669 149 (synopsis "Managing tar archives")
d45122f5 150 (description
a22dc0c4
LC
151 "Tar provides the ability to create tar archives, as well as the
152ability to extract, update or list files in an existing archive. It is
153useful for combining many files into one larger file, while maintaining
154directory structure and file information such as permissions and
79c311b8
LC
155creation/modification dates. GNU tar offers many extensions over the
156standard utility.")
4a44e743 157 (license gpl3+)
85240322
LC
158 (home-page "http://www.gnu.org/software/tar/")))
159
fbeec3d9
LC
160(define-public patch
161 (package
162 (name "patch")
266d26df 163 (version "2.7.5")
f6408bc5
LC
164 (source (origin
165 (method url-fetch)
166 (uri (string-append "mirror://gnu/patch/patch-"
167 version ".tar.xz"))
168 (sha256
169 (base32
16cae799
MR
170 "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
171 (patches (list (search-patch "patch-hurd-path-max.patch")))))
fbeec3d9 172 (build-system gnu-build-system)
00e79195 173 (native-inputs `(("ed", ed)))
f50d2669 174 (synopsis "Apply differences to originals, with optional backups")
d45122f5 175 (description
a22dc0c4 176 "Patch is a program that applies changes to files based on differences
79c311b8 177laid out as by the program \"diff\". The changes may be applied to one or more
a22dc0c4
LC
178files depending on the contents of the diff file. It accepts several
179different diff formats. It may also be used to revert previously applied
180differences.")
4a44e743 181 (license gpl3+)
fbeec3d9
LC
182 (home-page "http://savannah.gnu.org/projects/patch/")))
183
04a32ee5
LC
184(define-public diffutils
185 (package
186 (name "diffutils")
d83ae724 187 (version "3.3")
04a32ee5 188 (source (origin
87f5d366 189 (method url-fetch)
0db342a5 190 (uri (string-append "mirror://gnu/diffutils/diffutils-"
04a32ee5
LC
191 version ".tar.xz"))
192 (sha256
193 (base32
d83ae724 194 "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2"))))
04a32ee5 195 (build-system gnu-build-system)
f50d2669 196 (synopsis "Comparing and merging files")
d45122f5 197 (description
79c311b8
LC
198 "GNU Diffutils is a package containing tools for finding the
199differences between files. The \"diff\" command is used to show how two files
e881752c 200differ, while \"cmp\" shows the offsets and line numbers where they differ.
79c311b8 201\"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
a22dc0c4 202interactive means to merge two files.")
4a44e743 203 (license gpl3+)
04a32ee5
LC
204 (home-page "http://www.gnu.org/software/diffutils/")))
205
af5521ca
LC
206(define-public findutils
207 (package
208 (name "findutils")
209 (version "4.4.2")
210 (source (origin
87f5d366 211 (method url-fetch)
0db342a5 212 (uri (string-append "mirror://gnu/findutils/findutils-"
af5521ca
LC
213 version ".tar.gz"))
214 (sha256
215 (base32
de80b504 216 "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"))
67dfa198
LC
217 (patches (map search-patch
218 '("findutils-absolute-paths.patch"
219 "findutils-localstatedir.patch")))))
af5521ca 220 (build-system gnu-build-system)
af5521ca 221 (arguments
67dfa198
LC
222 `(#:configure-flags (list
223 ;; Tell 'updatedb' to write to /var.
224 "--localstatedir=/var"
225
226 ;; Work around cross-compilation failure. See
227 ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
228 ,@(if (%current-target-system)
229 '("gl_cv_func_wcwidth_works=yes")
230 '()))))
f50d2669 231 (synopsis "Operating on files matching given criteria")
d45122f5 232 (description
a22dc0c4
LC
233 "Findutils supplies the basic file directory searching utilities of the
234GNU system. It consists of two primary searching utilities: \"find\"
235recursively searches for files in a directory according to given criteria and
236\"locate\" lists files in a database that match a query. Two auxiliary tools
79c311b8
LC
237are included: \"updatedb\" updates the file name database and \"xargs\" may be
238used to apply commands with arbitrarily long arguments.")
4a44e743 239 (license gpl3+)
af5521ca 240 (home-page "http://www.gnu.org/software/findutils/")))
2c957cd2
LC
241
242(define-public coreutils
243 (package
244 (name "coreutils")
c2ba49ef 245 (version "8.24")
2c957cd2 246 (source (origin
87f5d366 247 (method url-fetch)
0db342a5 248 (uri (string-append "mirror://gnu/coreutils/coreutils-"
2c957cd2
LC
249 version ".tar.xz"))
250 (sha256
251 (base32
895067ff
LC
252 "0w11jw3fb5sslf0f72kxy7llxgk1ia3a6bcw0c9kmvxrlj355mx2"))
253 (patches
e3935861
LC
254 (list (origin
255 (method url-fetch)
256 (uri "http://git.savannah.gnu.org/cgit/coreutils.git/\
257patch/?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0")
258 (sha256
259 (base32
260 "1dnlszhc8lihhg801i9sz896mlrgfsjfcz62636prb27k5hmixqz"))
261 (file-name "coreutils-tail-inotify-race.patch"))))))
2c957cd2 262 (build-system gnu-build-system)
de59af4d 263 (inputs `(("acl" ,acl) ; TODO: add SELinux
09cc7729 264 ("gmp" ,gmp) ;bignums in 'expr', yay!
62ea8865
LC
265
266 ;; Drop the dependency on libcap when cross-compiling since it's
267 ;; not quite cross-compilable.
268 ,@(if (%current-target-system)
269 '()
270 `(("libcap" ,libcap))))) ;capability support is 'ls', etc.
2c1dea85
LC
271 (native-inputs
272 ;; Perl is needed to run tests in native builds, and to run the bundled
7f31c71c
LC
273 ;; copy of help2man. However, don't pass it when cross-compiling since
274 ;; that would lead it to try to run programs to get their '--help' output
275 ;; for help2man.
276 (if (%current-target-system)
277 '()
278 `(("perl" ,perl))))
9bf62d9b 279 (outputs '("out" "debug"))
2c957cd2 280 (arguments
8ba8aeb7
LC
281 `(#:parallel-build? #f ; help2man may be called too early
282 #:phases (alist-cons-before
283 'build 'patch-shell-references
284 (lambda* (#:key inputs #:allow-other-keys)
285 (let ((bash (assoc-ref inputs "bash")))
b47b2b52
LC
286 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
287 ;; that tests pass, since /bin/sh isn't in the chroot.
288 (setenv "SHELL" (which "sh"))
289
290 (substitute* (find-files "gnulib-tests" "\\.c$")
8ba8aeb7
LC
291 (("/bin/sh")
292 (format #f "~a/bin/sh" bash)))
293 (substitute* (find-files "tests" "\\.sh$")
294 (("#!/bin/sh")
b47b2b52 295 (format #f "#!~a/bin/sh" bash)))))
56c092ce 296 %standard-phases)))
f50d2669 297 (synopsis "Core GNU utilities (file, text, shell)")
d45122f5 298 (description
79c311b8 299 "GNU Coreutils includes all of the basic command-line tools that are
a22dc0c4
LC
300expected in a POSIX system. These provide the basic file, shell and text
301manipulation functions of the GNU system. Most of these tools offer extended
302functionality beyond that which is outlined in the POSIX standard.")
4a44e743 303 (license gpl3+)
2c957cd2 304 (home-page "http://www.gnu.org/software/coreutils/")))
af5521ca 305
d0f74308 306(define-public coreutils-minimal
28cbc587
LC
307 ;; Coreutils without its optional dependencies.
308 (package
309 (inherit coreutils)
d0f74308 310 (name "coreutils-minimal")
28cbc587
LC
311 (outputs '("out"))
312 (inputs '())))
313
ab776865
LC
314(define-public gnu-make
315 (package
316 (name "make")
6178ae9c 317 (version "4.1")
ab776865 318 (source (origin
87f5d366 319 (method url-fetch)
0db342a5 320 (uri (string-append "mirror://gnu/make/make-" version
ab776865
LC
321 ".tar.bz2"))
322 (sha256
323 (base32
6178ae9c 324 "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb"))
de80b504 325 (patches (list (search-patch "make-impure-dirs.patch")))))
ab776865 326 (build-system gnu-build-system)
aa6b0d6b 327 (native-inputs `(("pkg-config", pkg-config))) ; to detect Guile
ed41d48e 328 (inputs `(("guile" ,guile-2.0)))
9bf62d9b 329 (outputs '("out" "debug"))
ea8fbbf2 330 (arguments
de80b504 331 '(#:phases (alist-cons-before
ea8fbbf2
LC
332 'build 'set-default-shell
333 (lambda* (#:key inputs #:allow-other-keys)
334 ;; Change the default shell from /bin/sh.
335 (let ((bash (assoc-ref inputs "bash")))
336 (substitute* "job.c"
6178ae9c
MW
337 (("default_shell =.*$")
338 (format #f "default_shell = \"~a/bin/bash\";\n"
ea8fbbf2
LC
339 bash)))))
340 %standard-phases)))
f50d2669 341 (synopsis "Remake files automatically")
d45122f5 342 (description
a22dc0c4
LC
343 "Make is a program that is used to control the production of
344executables or other files from their source files. The process is
345controlled from a Makefile, in which the developer specifies how each file is
346generated from its source. It has powerful dependency resolution and the
347ability to determine when files have to be regenerated after their sources
79c311b8 348change. GNU make offers many powerful extensions over the standard utility.")
4a44e743 349 (license gpl3+)
ab776865
LC
350 (home-page "http://www.gnu.org/software/make/")))
351
8f6201a3
LC
352(define-public binutils
353 (package
354 (name "binutils")
f02c902c 355 (version "2.25.1")
8f6201a3 356 (source (origin
87f5d366 357 (method url-fetch)
0db342a5 358 (uri (string-append "mirror://gnu/binutils/binutils-"
8f6201a3
LC
359 version ".tar.bz2"))
360 (sha256
361 (base32
f02c902c 362 "08lzmhidzc16af1zbx34f8cy4z7mzrswpdbhrb8shy3xxpflmcdm"))
2c1ceeac 363 (patches (list (search-patch "binutils-ld-new-dtags.patch")
6c95f363 364 (search-patch "binutils-loongson-workaround.patch")))))
8f6201a3
LC
365 (build-system gnu-build-system)
366
367 ;; TODO: Add dependency on zlib + those for Gold.
8f6201a3 368 (arguments
de80b504 369 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
01d45404
LC
370 ;; on GCC when bootstrapping.
371 "LDFLAGS=-static-libgcc"
8f6201a3 372
01d45404 373 ;; Don't search under /usr/lib & co.
444c64b0
LC
374 "--with-lib-path=/no-ld-lib-path"
375
376 ;; Glibc 2.17 has a "comparison of unsigned
377 ;; expression >= 0 is always true" in wchar.h.
6c95f363
LC
378 "--disable-werror"
379
380 ;; Install BFD. It ends up in a hidden directory,
381 ;; but it's here.
cc0a1282
LC
382 "--enable-install-libbfd"
383
384 ;; Make sure 'ar' and 'ranlib' produce archives in a
385 ;; deterministic fashion.
386 "--enable-deterministic-archives")))
8f6201a3 387
f50d2669 388 (synopsis "Binary utilities: bfd gas gprof ld")
d45122f5 389 (description
a22dc0c4 390 "GNU Binutils is a collection of tools for working with binary files.
c5779c93
LC
391Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
392Other tools include programs to display binary profiling information, list
393the strings in a binary file, and utilities for working with archives. The
394\"bfd\" library for working with executable and object formats is also
395included.")
4a44e743 396 (license gpl3+)
8f6201a3
LC
397 (home-page "http://www.gnu.org/software/binutils/")))
398
4a740d0f
LC
399(define* (make-ld-wrapper name #:key binutils
400 (guile (canonical-package guile-2.0))
401 (bash (canonical-package bash)) target
8fdd4101
LC
402 (guile-for-build guile))
403 "Return a package called NAME that contains a wrapper for the 'ld' program
4a740d0f
LC
404of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When
405TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
406'TARGET-ld'. The wrapper uses GUILE and BASH."
8fdd4101
LC
407 (package
408 (name name)
409 (version "0")
410 (source #f)
411 (build-system trivial-build-system)
412 (inputs `(("binutils" ,binutils)
413 ("guile" ,guile)
414 ("bash" ,bash)
415 ("wrapper" ,(search-path %load-path
c8bfa5b4 416 "gnu/packages/ld-wrapper.in"))))
8fdd4101
LC
417 (arguments
418 `(#:guile ,guile-for-build
419 #:modules ((guix build utils))
420 #:builder (begin
421 (use-modules (guix build utils)
422 (system base compile))
423
424 (let* ((out (assoc-ref %outputs "out"))
425 (bin (string-append out "/bin"))
4a740d0f
LC
426 (ld ,(if target
427 `(string-append bin "/" ,target "-ld")
428 '(string-append bin "/ld")))
429 (go (string-append ld ".go")))
8fdd4101
LC
430
431 (setvbuf (current-output-port) _IOLBF)
432 (format #t "building ~s/bin/ld wrapper in ~s~%"
433 (assoc-ref %build-inputs "binutils")
434 out)
435
436 (mkdir-p bin)
437 (copy-file (assoc-ref %build-inputs "wrapper") ld)
438 (substitute* ld
9bab6bea
LC
439 (("@SELF@")
440 ld)
8fdd4101
LC
441 (("@GUILE@")
442 (string-append (assoc-ref %build-inputs "guile")
443 "/bin/guile"))
444 (("@BASH@")
445 (string-append (assoc-ref %build-inputs "bash")
446 "/bin/bash"))
447 (("@LD@")
448 (string-append (assoc-ref %build-inputs "binutils")
4a740d0f
LC
449 ,(if target
450 (string-append "/bin/"
451 target "-ld")
452 "/bin/ld"))))
8fdd4101
LC
453 (chmod ld #o555)
454 (compile-file ld #:output-file go)))))
455 (synopsis "The linker wrapper")
456 (description
457 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
458missing '-rpath' flags, and to detect any misuse of libraries outside of the
459store.")
460 (home-page "http://www.gnu.org/software/guix/")
461 (license gpl3+)))
462
463(export make-ld-wrapper)
464
7cdeac02
LC
465(define-public glibc
466 (package
467 (name "glibc")
28cbc587 468 (version "2.22")
7cdeac02 469 (source (origin
87f5d366 470 (method url-fetch)
0db342a5 471 (uri (string-append "mirror://gnu/glibc/glibc-"
7cdeac02
LC
472 version ".tar.xz"))
473 (sha256
474 (base32
28cbc587 475 "0j49682pm2nh4qbdw35bas82p1pgfnz4d2l7iwfyzvrvj0318wzb"))
13990c73
LC
476 (snippet
477 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
478 ;; required on LFS distros to avoid loading the distro's libc.so
479 ;; instead of ours.
480 '(substitute* "sysdeps/unix/sysv/linux/configure"
481 (("use_ldconfig=yes")
482 "use_ldconfig=no")))
1faca892 483 (modules '((guix build utils)))
c5d8e688
LC
484 (patches (map search-patch
485 '("glibc-ldd-x86_64.patch"
2ae71b74 486 "glibc-locale-incompatibility.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
f211b2af 617 ;; primarily in build environments.
d6718df4 618 (list (search-path-specification
fbb909ac 619 (variable "GUIX_LOCPATH")
f211b2af 620 (files '("lib/locale")))))
d6718df4 621
d45122f5
LC
622 (synopsis "The GNU C Library")
623 (description
7cdeac02
LC
624 "Any Unix-like operating system needs a C library: the library which
625defines the \"system calls\" and other basic facilities such as open, malloc,
626printf, exit...
627
628The GNU C library is used as the C library in the GNU system and most systems
629with the Linux kernel.")
4a44e743 630 (license lgpl2.0+)
7cdeac02
LC
631 (home-page "http://www.gnu.org/software/libc/")))
632
aee6180c
LC
633(define-public glibc-locales
634 (package
635 (inherit glibc)
636 (name "glibc-locales")
637 (source (origin (inherit (package-source glibc))
638 (patches (cons (search-patch "glibc-locales.patch")
639 (origin-patches (package-source glibc))))))
640 (synopsis "All the locales supported by the GNU C Library")
641 (description
642 "This package provides all the locales supported by the GNU C Library,
643more than 400 in total. To use them set the 'LOCPATH' environment variable to
644the 'share/locale' sub-directory of this package.")
645 (outputs '("out")) ;110+ MiB
605217be 646 (native-search-paths '())
aee6180c
LC
647 (arguments
648 (let ((args `(#:tests? #f #:strip-binaries? #f
649 ,@(package-arguments glibc))))
650 (substitute-keyword-arguments args
651 ((#:phases phases)
652 `(alist-replace
653 'build
654 (lambda* (#:key outputs #:allow-other-keys)
aee6180c
LC
655 (zero? (system* "make" "localedata/install-locales"
656 "-j" (number->string (parallel-job-count)))))
657 (alist-delete 'install ,phases)))
658 ((#:configure-flags flags)
659 `(append ,flags
b9e02a71 660 ;; Use $(libdir)/locale as is the case by default.
aee6180c
LC
661 (list (string-append "libc_cv_localedir="
662 (assoc-ref %outputs "out")
f2d7bbb5
LC
663 "/lib/locale/"
664 ,(package-version glibc))))))))))
aee6180c 665
c9505f3f
LC
666(define-public glibc-utf8-locales
667 (package
668 (name "glibc-utf8-locales")
669 (version (package-version glibc))
670 (source #f)
671 (build-system trivial-build-system)
672 (arguments
f2d7bbb5 673 `(#:modules ((guix build utils))
c9505f3f
LC
674 #:builder (begin
675 (use-modules (srfi srfi-1)
676 (guix build utils))
677
678 (let* ((libc (assoc-ref %build-inputs "glibc"))
679 (gzip (assoc-ref %build-inputs "gzip"))
680 (out (assoc-ref %outputs "out"))
f2d7bbb5
LC
681 (localedir (string-append out "/lib/locale/"
682 ,version)))
c9505f3f
LC
683 ;; 'localedef' needs 'gzip'.
684 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
685
686 (mkdir-p localedir)
687 (every (lambda (locale)
8a55e217
LC
688 (define file
689 ;; Use the "normalized codeset" by
690 ;; default--e.g., "en_US.utf8".
691 (string-append localedir "/" locale ".utf8"))
692
693 (and (zero? (system* "localedef" "--no-archive"
694 "--prefix" localedir
695 "-i" locale
696 "-f" "UTF-8" file))
697 (begin
698 ;; For backward compatibility with Guix
699 ;; <= 0.8.3, add "xx_YY.UTF-8".
700 (symlink (string-append locale ".utf8")
c9505f3f 701 (string-append localedir "/"
8a55e217
LC
702 locale ".UTF-8"))
703 #t)))
c9505f3f
LC
704
705 ;; These are the locales commonly used for
706 ;; tests---e.g., in Guile's i18n tests.
707 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
708 (inputs `(("glibc" ,glibc)
709 ("gzip" ,gzip)))
710 (synopsis "Small sample of UTF-8 locales")
711 (description
712 "This package provides a small sample of UTF-8 locales mostly useful in
713test environments.")
714 (home-page (package-home-page glibc))
715 (license (package-license glibc))))
aee6180c 716
ce0614dd
LC
717(define-public which
718 (package
719 (name "which")
70ca2e94 720 (version "2.21")
ce0614dd
LC
721 (source (origin
722 (method url-fetch)
723 (uri (string-append "mirror://gnu/which/which-"
724 version ".tar.gz"))
725 (sha256
726 (base32
70ca2e94 727 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
ce0614dd
LC
728 (build-system gnu-build-system)
729 (home-page "https://gnu.org/software/which/")
730 (synopsis "Find full path of shell commands")
731 (description
732 "The which program finds the location of executables in PATH, with a
733variety of options. It is an alternative to the shell \"type\" built-in
734command.")
735 (license gpl3+))) ; some files are under GPLv2+
736
21a8fe1b
MR
737(define-public glibc/hurd
738 ;; The Hurd's libc variant.
739 (package (inherit glibc)
740 (name "glibc-hurd")
741 (version "2.18")
742 (source (origin
743 (method git-fetch)
744 (uri (git-reference
745 (url "git://git.sv.gnu.org/hurd/glibc")
746 (commit "cc94b3cfe65523f980359e5f0e93a26196bda1d3")))
747 (sha256
748 (base32
749 "17gsh0kaz0zyvghjmx861mi2p65m9901lngi179x61zm6v2v3xc4"))
750 (file-name (string-append name "-" version))
751 (patches (map search-patch
752 '("glibc-hurd-extern-inline.patch")))))
753
754 ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
755 ;; so both should be propagated.
756 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
757 ("hurd-headers" ,hurd-headers)
758 ("hurd-minimal" ,hurd-minimal)))
759 (native-inputs
760 `(,@(package-native-inputs glibc)
761 ("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
762 ("mig" ,mig)
763 ("perl" ,perl)
764 ("libpthread" ,(origin
765 (method git-fetch)
766 (uri (git-reference
767 (url "git://git.sv.gnu.org/hurd/libpthread")
768 (commit "0ef7b75c4ba91b6660f0d3d8b51d14d25e3d5bfb")))
769 (sha256
770 (base32
771 "031py18fls15z0wprni33mf762kg6fx8xqijppimhp83yp6ky3l3"))
772 (file-name "libpthread")))))
773
774 (arguments
775 (substitute-keyword-arguments (package-arguments glibc)
776 ((#:configure-flags original-configure-flags)
777 `(append (list "--host=i686-pc-gnu"
778
779 ;; nscd fails to build for GNU/Hurd:
780 ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
781 ;; Disable it.
782 "--disable-nscd")
783 (filter (lambda (flag)
784 (not (or (string-prefix? "--with-headers=" flag)
785 (string-prefix? "--enable-kernel=" flag))))
786 ;; Evaluate 'original-configure-flags' in a
787 ;; lexical environment that has a dummy
788 ;; "linux-headers" input, to prevent errors.
789 (let ((%build-inputs `(("linux-headers" . "@DUMMY@")
790 ,@%build-inputs)))
791 ,original-configure-flags))))
792 ((#:phases phases)
793 `(alist-cons-after
794 'unpack 'prepare-libpthread
795 (lambda* (#:key inputs #:allow-other-keys)
796 (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
797
798 (system* "patch" "--force" "-p1" "-i"
799 (assoc-ref inputs "patch/libpthread-patch"))
800 #t)
801 ,phases))))
802 (synopsis "The GNU C Library (GNU Hurd variant)")
803 (supported-systems %hurd-systems)))
804
805(define-public glibc/hurd-headers
806 (package (inherit glibc/hurd)
807 (name "glibc-hurd-headers")
808 (outputs '("out"))
809 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
810 ("hurd-headers" ,hurd-headers)))
811 (arguments
812 (substitute-keyword-arguments (package-arguments glibc/hurd)
813 ;; We just pass the flags really needed to build the headers.
814 ((#:configure-flags _)
815 `(list "--enable-add-ons"
816 "--host=i686-pc-gnu"
817 "--enable-obsolete-rpc"))
818 ((#:phases _)
819 '(alist-replace
820 'install
821 (lambda* (#:key outputs #:allow-other-keys)
822 (and (zero? (system* "make" "install-headers"))
823
824 ;; Make an empty stubs.h to work around not being able to
825 ;; produce a valid stubs.h and causing the build to fail. See
826 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
827 (let ((out (assoc-ref outputs "out")))
828 (close-port
829 (open-output-file
830 (string-append out "/include/gnu/stubs.h"))))))
831
832 ;; Nothing to build.
833 (alist-delete
834 'build
835
836 (alist-cons-before
837 'configure 'pre-configure
838 (lambda _
839 ;; Use the right 'pwd'.
840 (substitute* "configure"
841 (("/bin/pwd") "pwd")))
842 %standard-phases))))))))
843
e789d9a8
LC
844(define-public tzdata
845 (package
846 (name "tzdata")
d8d6d096 847 (version "2015c")
e789d9a8
LC
848 (source (origin
849 (method url-fetch)
850 (uri (string-append
851 "http://www.iana.org/time-zones/repository/releases/tzdata"
852 version ".tar.gz"))
853 (sha256
854 (base32
d8d6d096 855 "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6"))))
e789d9a8
LC
856 (build-system gnu-build-system)
857 (arguments
858 '(#:tests? #f
859 #:make-flags (let ((out (assoc-ref %outputs "out"))
860 (tmp (getenv "TMPDIR")))
861 (list (string-append "TOPDIR=" out)
862 (string-append "TZDIR=" out "/share/zoneinfo")
863
864 ;; Discard zic, dump, and tzselect, already
865 ;; provided by glibc.
866 (string-append "ETCDIR=" tmp "/etc")
867
868 ;; Likewise for the C library routines.
869 (string-append "LIBDIR=" tmp "/lib")
870 (string-append "MANDIR=" tmp "/man")
871
872 "AWK=awk"
873 "CC=gcc"))
874 #:modules ((guix build utils)
875 (guix build gnu-build-system)
876 (srfi srfi-1))
877 #:phases
878 (alist-replace
879 'unpack
c94d01ba
LC
880 (lambda* (#:key source inputs #:allow-other-keys)
881 (and (zero? (system* "tar" "xvf" source))
e789d9a8
LC
882 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
883 (alist-cons-after
884 'install 'post-install
885 (lambda* (#:key outputs #:allow-other-keys)
886 ;; Move data in the right place.
887 (let ((out (assoc-ref outputs "out")))
888 (copy-recursively (string-append out "/share/zoneinfo-posix")
889 (string-append out "/share/zoneinfo/posix"))
890 (copy-recursively (string-append out "/share/zoneinfo-leaps")
891 (string-append out "/share/zoneinfo/right"))
892 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
893 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
894 (alist-delete 'configure %standard-phases)))))
895 (inputs `(("tzcode" ,(origin
896 (method url-fetch)
897 (uri (string-append
898 "http://www.iana.org/time-zones/repository/releases/tzcode"
899 version ".tar.gz"))
900 (sha256
901 (base32
d8d6d096 902 "0bplibiy70dvlrhwqzkzxgmg81j6d2kklvjgi2f1g2zz1nkb3vkz"))))))
e789d9a8
LC
903 (home-page "http://www.iana.org/time-zones")
904 (synopsis "Database of current and historical time zones")
905 (description "The Time Zone Database (often called tz or zoneinfo)
906contains code and data that represent the history of local time for many
35b9e423 907representative locations around the globe. It is updated periodically to
e789d9a8
LC
908reflect changes made by political bodies to time zone boundaries, UTC offsets,
909and daylight-saving rules.")
910 (license public-domain)))
911
bdb36958
LC
912(define-public (canonical-package package)
913 ;; Avoid circular dependency by lazily resolving 'commencement'.
914 (let* ((iface (resolve-interface '(gnu packages commencement)))
915 (proc (module-ref iface 'canonical-package)))
916 (proc package)))
571aa6cd 917
1722d680 918;;; base.scm ends here