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