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