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