gnu: pkg-config: Update to 0.29.
[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>
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)
304e4f51 85 (native-inputs `(("perl" ,perl))) ;some of the tests require it
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")
e80d2555 209 (version "4.6.0")
af5521ca 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
e80d2555 216 "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y"))
67dfa198 217 (patches (map search-patch
e80d2555
LC
218 '("findutils-localstatedir.patch"
219 "findutils-test-xargs.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"
85e57214 487 "glibc-versioned-locpath.patch"
c5d8e688 488 "glibc-o-largefile.patch")))))
7cdeac02 489 (build-system gnu-build-system)
0a3da5b7
LC
490
491 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
492 ;; users should automatically pull Linux headers as well.
124b1767 493 (propagated-inputs `(("linux-headers" ,linux-libre-headers)))
0a3da5b7 494
97e11209 495 (outputs '("out" "debug"))
7f614e49 496
7cdeac02 497 (arguments
8197c978 498 `(#:out-of-source? #t
211db2f6
LC
499
500 ;; In version 2.21, there a race in the 'elf' directory, see
501 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
502 #:parallel-build? #f
503
112da588 504 ;; The libraries have an empty RUNPATH, but some, such as the versioned
28cbc587 505 ;; libraries (libdl-2.22.so, etc.) have ld.so marked as NEEDED. Since
112da588
LC
506 ;; these libraries are always going to be found anyway, just skip
507 ;; RUNPATH checks.
508 #:validate-runpath? #f
509
7cdeac02
LC
510 #:configure-flags
511 (list "--enable-add-ons"
512 "--sysconfdir=/etc"
7f614e49 513
97e11209
LC
514 ;; Installing a locale archive with all the locales is to
515 ;; expensive (~100 MiB), so we rely on users to install the
516 ;; locales they really want.
517 ;;
518 ;; Set the default locale path. In practice, $LOCPATH may be
519 ;; defined to point whatever locales users want. However, setuid
520 ;; binaries don't honor $LOCPATH, so they'll instead look into
46bd6edd
LC
521 ;; $libc_cv_localedir; we choose /run/current-system/locale/X.Y,
522 ;; with the idea that it is going to be populated by the sysadmin.
523 ;; The "X.Y" sub-directory is because locale data formats are
524 ;; incompatible across libc versions; see
525 ;; <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
97e11209 526 ;;
7f614e49
LC
527 ;; `--localedir' is not honored, so work around it.
528 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
46bd6edd
LC
529 (string-append "libc_cv_localedir=/run/current-system/locale/"
530 ,version)
7f614e49 531
7cdeac02
LC
532 (string-append "--with-headers="
533 (assoc-ref %build-inputs "linux-headers")
534 "/include")
5f456680 535
fdaae613 536 ;; This is the default for most architectures as of GNU libc 2.21,
39ccbfad
MW
537 ;; but we specify it explicitly for clarity and consistency. See
538 ;; "kernel-features.h" in the GNU libc for details.
539 "--enable-kernel=2.6.32"
5f456680 540
6e32f6c0 541 ;; Use our Bash instead of /bin/sh.
8cd8e97c 542 (string-append "BASH_SHELL="
6e32f6c0 543 (assoc-ref %build-inputs "bash")
8cd8e97c
LC
544 "/bin/bash")
545
546 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
547 "libc_cv_ssp=no")
6e32f6c0 548
7cdeac02 549 #:tests? #f ; XXX
57f65bcc
LC
550 #:phases (modify-phases %standard-phases
551 (add-before
552 'configure 'pre-configure
553 (lambda* (#:key inputs native-inputs outputs
554 #:allow-other-keys)
555 (let* ((out (assoc-ref outputs "out"))
556 (bin (string-append out "/bin"))
557 ;; FIXME: Normally we would look it up only in INPUTS
558 ;; but cross-base uses it as a native input.
559 (bash (or (assoc-ref inputs "static-bash")
560 (assoc-ref native-inputs "static-bash"))))
561 ;; Use `pwd', not `/bin/pwd'.
562 (substitute* "configure"
563 (("/bin/pwd") "pwd"))
564
565 ;; Install the rpc data base file under `$out/etc/rpc'.
566 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
567 (substitute* "sunrpc/Makefile"
568 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
569 (string-append out "/etc/rpc" suffix "\n"))
570 (("^install-others =.*$")
571 (string-append "install-others = " out "/etc/rpc\n")))
572
573 (substitute* "Makeconfig"
574 ;; According to
575 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
576 ;; linking against libgcc_s is not needed with GCC
577 ;; 4.7.1.
578 ((" -lgcc_s") ""))
579
580 ;; Have `system' use that Bash.
581 (substitute* "sysdeps/posix/system.c"
582 (("#define[[:blank:]]+SHELL_PATH.*$")
583 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
584 bash)))
585
586 ;; Same for `popen'.
587 (substitute* "libio/iopopen.c"
588 (("/bin/sh")
589 (string-append bash "/bin/bash")))
590
d56f8d5e
LC
591 ;; Same for the shell used by the 'exec' functions for
592 ;; scripts that lack a shebang.
593 (substitute* (find-files "." "^paths\\.h$")
594 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
595 (string-append "#define _PATH_BSHELL \""
596 bash "/bin/bash\"\n")))
597
c5b65f7e
LC
598 ;; Nscd uses __DATE__ and __TIME__ to create a string to
599 ;; make sure the client and server come from the same
600 ;; libc. Use something deterministic instead.
601 (substitute* "nscd/nscd_stat.c"
602 (("static const char compilation\\[21\\] =.*$")
603 (string-append
604 "static const char compilation[21] = \""
605 (string-take (basename out) 20) "\";\n")))
606
57f65bcc
LC
607 ;; Make sure we don't retain a reference to the
608 ;; bootstrap Perl.
609 (substitute* "malloc/mtrace.pl"
610 (("^#!.*")
611 ;; The shebang can be omitted, because there's the
612 ;; "bilingual" eval/exec magic at the top of the file.
613 "")
614 (("exec @PERL@")
615 "exec perl"))))))))
7f614e49 616
90d891fc 617 (inputs `(("static-bash" ,static-bash)))
8fd6487e 618
6162b95d
LC
619 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
620 ;; install the message catalogs, with 'msgfmt'.
8fd6487e 621 (native-inputs `(("texinfo" ,texinfo)
6162b95d
LC
622 ("perl" ,perl)
623 ("gettext" ,gnu-gettext)))
8fd6487e 624
d6718df4
LC
625 (native-search-paths
626 ;; Search path for packages that provide locale data. This is useful
85e57214
LC
627 ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
628 ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
629 ;; distros.
d6718df4 630 (list (search-path-specification
fbb909ac 631 (variable "GUIX_LOCPATH")
f211b2af 632 (files '("lib/locale")))))
d6718df4 633
d45122f5
LC
634 (synopsis "The GNU C Library")
635 (description
7cdeac02
LC
636 "Any Unix-like operating system needs a C library: the library which
637defines the \"system calls\" and other basic facilities such as open, malloc,
638printf, exit...
639
640The GNU C library is used as the C library in the GNU system and most systems
641with the Linux kernel.")
4a44e743 642 (license lgpl2.0+)
7cdeac02
LC
643 (home-page "http://www.gnu.org/software/libc/")))
644
137d957e
LC
645(define-public glibc-2.21
646 ;; The old libc, which we use mostly to build locale data in the old format
647 ;; (which the new libc can cope with.)
648 (package
649 (inherit glibc)
650 (version "2.21")
651 (source (origin
652 (inherit (package-source glibc))
653 (uri (string-append "mirror://gnu/glibc/glibc-"
654 version ".tar.xz"))
655 (sha256
656 (base32
657 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
658 (patches (list (search-patch "glibc-ldd-x86_64.patch")))))))
659
aee6180c
LC
660(define-public glibc-locales
661 (package
662 (inherit glibc)
663 (name "glibc-locales")
664 (source (origin (inherit (package-source glibc))
665 (patches (cons (search-patch "glibc-locales.patch")
666 (origin-patches (package-source glibc))))))
667 (synopsis "All the locales supported by the GNU C Library")
668 (description
669 "This package provides all the locales supported by the GNU C Library,
670more than 400 in total. To use them set the 'LOCPATH' environment variable to
671the 'share/locale' sub-directory of this package.")
672 (outputs '("out")) ;110+ MiB
605217be 673 (native-search-paths '())
aee6180c
LC
674 (arguments
675 (let ((args `(#:tests? #f #:strip-binaries? #f
676 ,@(package-arguments glibc))))
677 (substitute-keyword-arguments args
678 ((#:phases phases)
679 `(alist-replace
680 'build
681 (lambda* (#:key outputs #:allow-other-keys)
aee6180c
LC
682 (zero? (system* "make" "localedata/install-locales"
683 "-j" (number->string (parallel-job-count)))))
684 (alist-delete 'install ,phases)))
685 ((#:configure-flags flags)
686 `(append ,flags
85e57214 687 ;; Use $(libdir)/locale/X.Y as is the case by default.
aee6180c
LC
688 (list (string-append "libc_cv_localedir="
689 (assoc-ref %outputs "out")
f2d7bbb5
LC
690 "/lib/locale/"
691 ,(package-version glibc))))))))))
aee6180c 692
c9505f3f
LC
693(define-public glibc-utf8-locales
694 (package
695 (name "glibc-utf8-locales")
696 (version (package-version glibc))
697 (source #f)
698 (build-system trivial-build-system)
699 (arguments
f2d7bbb5 700 `(#:modules ((guix build utils))
c9505f3f
LC
701 #:builder (begin
702 (use-modules (srfi srfi-1)
703 (guix build utils))
704
705 (let* ((libc (assoc-ref %build-inputs "glibc"))
706 (gzip (assoc-ref %build-inputs "gzip"))
707 (out (assoc-ref %outputs "out"))
f2d7bbb5
LC
708 (localedir (string-append out "/lib/locale/"
709 ,version)))
c9505f3f
LC
710 ;; 'localedef' needs 'gzip'.
711 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
712
713 (mkdir-p localedir)
714 (every (lambda (locale)
8a55e217
LC
715 (define file
716 ;; Use the "normalized codeset" by
717 ;; default--e.g., "en_US.utf8".
718 (string-append localedir "/" locale ".utf8"))
719
720 (and (zero? (system* "localedef" "--no-archive"
721 "--prefix" localedir
722 "-i" locale
723 "-f" "UTF-8" file))
724 (begin
725 ;; For backward compatibility with Guix
726 ;; <= 0.8.3, add "xx_YY.UTF-8".
727 (symlink (string-append locale ".utf8")
c9505f3f 728 (string-append localedir "/"
8a55e217
LC
729 locale ".UTF-8"))
730 #t)))
c9505f3f
LC
731
732 ;; These are the locales commonly used for
733 ;; tests---e.g., in Guile's i18n tests.
734 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
735 (inputs `(("glibc" ,glibc)
736 ("gzip" ,gzip)))
737 (synopsis "Small sample of UTF-8 locales")
738 (description
739 "This package provides a small sample of UTF-8 locales mostly useful in
740test environments.")
741 (home-page (package-home-page glibc))
742 (license (package-license glibc))))
aee6180c 743
ce0614dd
LC
744(define-public which
745 (package
746 (name "which")
70ca2e94 747 (version "2.21")
ce0614dd
LC
748 (source (origin
749 (method url-fetch)
750 (uri (string-append "mirror://gnu/which/which-"
751 version ".tar.gz"))
752 (sha256
753 (base32
70ca2e94 754 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
ce0614dd
LC
755 (build-system gnu-build-system)
756 (home-page "https://gnu.org/software/which/")
757 (synopsis "Find full path of shell commands")
758 (description
759 "The which program finds the location of executables in PATH, with a
760variety of options. It is an alternative to the shell \"type\" built-in
761command.")
762 (license gpl3+))) ; some files are under GPLv2+
763
21a8fe1b
MR
764(define-public glibc/hurd
765 ;; The Hurd's libc variant.
766 (package (inherit glibc)
767 (name "glibc-hurd")
768 (version "2.18")
769 (source (origin
770 (method git-fetch)
771 (uri (git-reference
772 (url "git://git.sv.gnu.org/hurd/glibc")
773 (commit "cc94b3cfe65523f980359e5f0e93a26196bda1d3")))
774 (sha256
775 (base32
776 "17gsh0kaz0zyvghjmx861mi2p65m9901lngi179x61zm6v2v3xc4"))
777 (file-name (string-append name "-" version))
778 (patches (map search-patch
779 '("glibc-hurd-extern-inline.patch")))))
780
781 ;; Libc provides <hurd.h>, which includes a bunch of Hurd and Mach headers,
782 ;; so both should be propagated.
783 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
784 ("hurd-headers" ,hurd-headers)
785 ("hurd-minimal" ,hurd-minimal)))
786 (native-inputs
787 `(,@(package-native-inputs glibc)
788 ("patch/libpthread-patch" ,(search-patch "libpthread-glibc-preparation.patch"))
789 ("mig" ,mig)
790 ("perl" ,perl)
791 ("libpthread" ,(origin
792 (method git-fetch)
793 (uri (git-reference
794 (url "git://git.sv.gnu.org/hurd/libpthread")
795 (commit "0ef7b75c4ba91b6660f0d3d8b51d14d25e3d5bfb")))
796 (sha256
797 (base32
798 "031py18fls15z0wprni33mf762kg6fx8xqijppimhp83yp6ky3l3"))
799 (file-name "libpthread")))))
800
801 (arguments
802 (substitute-keyword-arguments (package-arguments glibc)
803 ((#:configure-flags original-configure-flags)
804 `(append (list "--host=i686-pc-gnu"
805
806 ;; nscd fails to build for GNU/Hurd:
807 ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
808 ;; Disable it.
809 "--disable-nscd")
810 (filter (lambda (flag)
811 (not (or (string-prefix? "--with-headers=" flag)
812 (string-prefix? "--enable-kernel=" flag))))
813 ;; Evaluate 'original-configure-flags' in a
814 ;; lexical environment that has a dummy
815 ;; "linux-headers" input, to prevent errors.
816 (let ((%build-inputs `(("linux-headers" . "@DUMMY@")
817 ,@%build-inputs)))
818 ,original-configure-flags))))
819 ((#:phases phases)
820 `(alist-cons-after
821 'unpack 'prepare-libpthread
822 (lambda* (#:key inputs #:allow-other-keys)
823 (copy-recursively (assoc-ref inputs "libpthread") "libpthread")
824
825 (system* "patch" "--force" "-p1" "-i"
826 (assoc-ref inputs "patch/libpthread-patch"))
827 #t)
828 ,phases))))
829 (synopsis "The GNU C Library (GNU Hurd variant)")
830 (supported-systems %hurd-systems)))
831
832(define-public glibc/hurd-headers
833 (package (inherit glibc/hurd)
834 (name "glibc-hurd-headers")
835 (outputs '("out"))
836 (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
837 ("hurd-headers" ,hurd-headers)))
838 (arguments
839 (substitute-keyword-arguments (package-arguments glibc/hurd)
840 ;; We just pass the flags really needed to build the headers.
841 ((#:configure-flags _)
842 `(list "--enable-add-ons"
843 "--host=i686-pc-gnu"
844 "--enable-obsolete-rpc"))
845 ((#:phases _)
846 '(alist-replace
847 'install
848 (lambda* (#:key outputs #:allow-other-keys)
849 (and (zero? (system* "make" "install-headers"))
850
851 ;; Make an empty stubs.h to work around not being able to
852 ;; produce a valid stubs.h and causing the build to fail. See
853 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-04/msg00233.html>.
854 (let ((out (assoc-ref outputs "out")))
855 (close-port
856 (open-output-file
857 (string-append out "/include/gnu/stubs.h"))))))
858
859 ;; Nothing to build.
860 (alist-delete
861 'build
862
863 (alist-cons-before
864 'configure 'pre-configure
865 (lambda _
866 ;; Use the right 'pwd'.
867 (substitute* "configure"
868 (("/bin/pwd") "pwd")))
869 %standard-phases))))))))
870
e789d9a8
LC
871(define-public tzdata
872 (package
873 (name "tzdata")
d8d6d096 874 (version "2015c")
e789d9a8
LC
875 (source (origin
876 (method url-fetch)
877 (uri (string-append
878 "http://www.iana.org/time-zones/repository/releases/tzdata"
879 version ".tar.gz"))
880 (sha256
881 (base32
d8d6d096 882 "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6"))))
e789d9a8
LC
883 (build-system gnu-build-system)
884 (arguments
885 '(#:tests? #f
886 #:make-flags (let ((out (assoc-ref %outputs "out"))
887 (tmp (getenv "TMPDIR")))
888 (list (string-append "TOPDIR=" out)
889 (string-append "TZDIR=" out "/share/zoneinfo")
890
891 ;; Discard zic, dump, and tzselect, already
892 ;; provided by glibc.
893 (string-append "ETCDIR=" tmp "/etc")
894
895 ;; Likewise for the C library routines.
896 (string-append "LIBDIR=" tmp "/lib")
897 (string-append "MANDIR=" tmp "/man")
898
899 "AWK=awk"
900 "CC=gcc"))
901 #:modules ((guix build utils)
902 (guix build gnu-build-system)
903 (srfi srfi-1))
904 #:phases
905 (alist-replace
906 'unpack
c94d01ba
LC
907 (lambda* (#:key source inputs #:allow-other-keys)
908 (and (zero? (system* "tar" "xvf" source))
e789d9a8
LC
909 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
910 (alist-cons-after
911 'install 'post-install
912 (lambda* (#:key outputs #:allow-other-keys)
913 ;; Move data in the right place.
914 (let ((out (assoc-ref outputs "out")))
915 (copy-recursively (string-append out "/share/zoneinfo-posix")
916 (string-append out "/share/zoneinfo/posix"))
917 (copy-recursively (string-append out "/share/zoneinfo-leaps")
918 (string-append out "/share/zoneinfo/right"))
919 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
920 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
921 (alist-delete 'configure %standard-phases)))))
922 (inputs `(("tzcode" ,(origin
923 (method url-fetch)
924 (uri (string-append
925 "http://www.iana.org/time-zones/repository/releases/tzcode"
926 version ".tar.gz"))
927 (sha256
928 (base32
d8d6d096 929 "0bplibiy70dvlrhwqzkzxgmg81j6d2kklvjgi2f1g2zz1nkb3vkz"))))))
e789d9a8
LC
930 (home-page "http://www.iana.org/time-zones")
931 (synopsis "Database of current and historical time zones")
932 (description "The Time Zone Database (often called tz or zoneinfo)
933contains code and data that represent the history of local time for many
35b9e423 934representative locations around the globe. It is updated periodically to
e789d9a8
LC
935reflect changes made by political bodies to time zone boundaries, UTC offsets,
936and daylight-saving rules.")
937 (license public-domain)))
938
bdb36958
LC
939(define-public (canonical-package package)
940 ;; Avoid circular dependency by lazily resolving 'commencement'.
941 (let* ((iface (resolve-interface '(gnu packages commencement)))
942 (proc (module-ref iface 'canonical-package)))
943 (proc package)))
571aa6cd 944
1722d680 945;;; base.scm ends here