utils: Move 'package-name->name+version' to (guix build utils).
[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
2c1dea85
LC
251 ("gmp" ,gmp)))
252 (native-inputs
253 ;; Perl is needed to run tests in native builds, and to run the bundled
7f31c71c
LC
254 ;; copy of help2man. However, don't pass it when cross-compiling since
255 ;; that would lead it to try to run programs to get their '--help' output
256 ;; for help2man.
257 (if (%current-target-system)
258 '()
259 `(("perl" ,perl))))
9bf62d9b 260 (outputs '("out" "debug"))
2c957cd2 261 (arguments
8ba8aeb7
LC
262 `(#:parallel-build? #f ; help2man may be called too early
263 #:phases (alist-cons-before
264 'build 'patch-shell-references
265 (lambda* (#:key inputs #:allow-other-keys)
266 (let ((bash (assoc-ref inputs "bash")))
b47b2b52
LC
267 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
268 ;; that tests pass, since /bin/sh isn't in the chroot.
269 (setenv "SHELL" (which "sh"))
270
271 (substitute* (find-files "gnulib-tests" "\\.c$")
8ba8aeb7
LC
272 (("/bin/sh")
273 (format #f "~a/bin/sh" bash)))
274 (substitute* (find-files "tests" "\\.sh$")
275 (("#!/bin/sh")
b47b2b52 276 (format #f "#!~a/bin/sh" bash)))))
56c092ce 277 %standard-phases)))
f50d2669 278 (synopsis "Core GNU utilities (file, text, shell)")
d45122f5 279 (description
79c311b8 280 "GNU Coreutils includes all of the basic command-line tools that are
a22dc0c4
LC
281expected in a POSIX system. These provide the basic file, shell and text
282manipulation functions of the GNU system. Most of these tools offer extended
283functionality beyond that which is outlined in the POSIX standard.")
4a44e743 284 (license gpl3+)
2c957cd2 285 (home-page "http://www.gnu.org/software/coreutils/")))
af5521ca 286
ab776865
LC
287(define-public gnu-make
288 (package
289 (name "make")
6178ae9c 290 (version "4.1")
ab776865 291 (source (origin
87f5d366 292 (method url-fetch)
0db342a5 293 (uri (string-append "mirror://gnu/make/make-" version
ab776865
LC
294 ".tar.bz2"))
295 (sha256
296 (base32
6178ae9c 297 "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb"))
de80b504 298 (patches (list (search-patch "make-impure-dirs.patch")))))
ab776865 299 (build-system gnu-build-system)
aa6b0d6b 300 (native-inputs `(("pkg-config", pkg-config))) ; to detect Guile
ed41d48e 301 (inputs `(("guile" ,guile-2.0)))
9bf62d9b 302 (outputs '("out" "debug"))
ea8fbbf2 303 (arguments
de80b504 304 '(#:phases (alist-cons-before
ea8fbbf2
LC
305 'build 'set-default-shell
306 (lambda* (#:key inputs #:allow-other-keys)
307 ;; Change the default shell from /bin/sh.
308 (let ((bash (assoc-ref inputs "bash")))
309 (substitute* "job.c"
6178ae9c
MW
310 (("default_shell =.*$")
311 (format #f "default_shell = \"~a/bin/bash\";\n"
ea8fbbf2
LC
312 bash)))))
313 %standard-phases)))
f50d2669 314 (synopsis "Remake files automatically")
d45122f5 315 (description
a22dc0c4
LC
316 "Make is a program that is used to control the production of
317executables or other files from their source files. The process is
318controlled from a Makefile, in which the developer specifies how each file is
319generated from its source. It has powerful dependency resolution and the
320ability to determine when files have to be regenerated after their sources
79c311b8 321change. GNU make offers many powerful extensions over the standard utility.")
4a44e743 322 (license gpl3+)
ab776865
LC
323 (home-page "http://www.gnu.org/software/make/")))
324
8f6201a3
LC
325(define-public binutils
326 (package
327 (name "binutils")
f02c902c 328 (version "2.25.1")
8f6201a3 329 (source (origin
87f5d366 330 (method url-fetch)
0db342a5 331 (uri (string-append "mirror://gnu/binutils/binutils-"
8f6201a3
LC
332 version ".tar.bz2"))
333 (sha256
334 (base32
f02c902c 335 "08lzmhidzc16af1zbx34f8cy4z7mzrswpdbhrb8shy3xxpflmcdm"))
2c1ceeac 336 (patches (list (search-patch "binutils-ld-new-dtags.patch")
6c95f363 337 (search-patch "binutils-loongson-workaround.patch")))))
8f6201a3
LC
338 (build-system gnu-build-system)
339
340 ;; TODO: Add dependency on zlib + those for Gold.
8f6201a3 341 (arguments
de80b504 342 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
01d45404
LC
343 ;; on GCC when bootstrapping.
344 "LDFLAGS=-static-libgcc"
8f6201a3 345
01d45404 346 ;; Don't search under /usr/lib & co.
444c64b0
LC
347 "--with-lib-path=/no-ld-lib-path"
348
349 ;; Glibc 2.17 has a "comparison of unsigned
350 ;; expression >= 0 is always true" in wchar.h.
6c95f363
LC
351 "--disable-werror"
352
353 ;; Install BFD. It ends up in a hidden directory,
354 ;; but it's here.
cc0a1282
LC
355 "--enable-install-libbfd"
356
357 ;; Make sure 'ar' and 'ranlib' produce archives in a
358 ;; deterministic fashion.
359 "--enable-deterministic-archives")))
8f6201a3 360
f50d2669 361 (synopsis "Binary utilities: bfd gas gprof ld")
d45122f5 362 (description
a22dc0c4 363 "GNU Binutils is a collection of tools for working with binary files.
c5779c93
LC
364Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
365Other tools include programs to display binary profiling information, list
366the strings in a binary file, and utilities for working with archives. The
367\"bfd\" library for working with executable and object formats is also
368included.")
4a44e743 369 (license gpl3+)
8f6201a3
LC
370 (home-page "http://www.gnu.org/software/binutils/")))
371
4a740d0f
LC
372(define* (make-ld-wrapper name #:key binutils
373 (guile (canonical-package guile-2.0))
374 (bash (canonical-package bash)) target
8fdd4101
LC
375 (guile-for-build guile))
376 "Return a package called NAME that contains a wrapper for the 'ld' program
4a740d0f
LC
377of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When
378TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
379'TARGET-ld'. The wrapper uses GUILE and BASH."
8fdd4101
LC
380 (package
381 (name name)
382 (version "0")
383 (source #f)
384 (build-system trivial-build-system)
385 (inputs `(("binutils" ,binutils)
386 ("guile" ,guile)
387 ("bash" ,bash)
388 ("wrapper" ,(search-path %load-path
c8bfa5b4 389 "gnu/packages/ld-wrapper.in"))))
8fdd4101
LC
390 (arguments
391 `(#:guile ,guile-for-build
392 #:modules ((guix build utils))
393 #:builder (begin
394 (use-modules (guix build utils)
395 (system base compile))
396
397 (let* ((out (assoc-ref %outputs "out"))
398 (bin (string-append out "/bin"))
4a740d0f
LC
399 (ld ,(if target
400 `(string-append bin "/" ,target "-ld")
401 '(string-append bin "/ld")))
402 (go (string-append ld ".go")))
8fdd4101
LC
403
404 (setvbuf (current-output-port) _IOLBF)
405 (format #t "building ~s/bin/ld wrapper in ~s~%"
406 (assoc-ref %build-inputs "binutils")
407 out)
408
409 (mkdir-p bin)
410 (copy-file (assoc-ref %build-inputs "wrapper") ld)
411 (substitute* ld
9bab6bea
LC
412 (("@SELF@")
413 ld)
8fdd4101
LC
414 (("@GUILE@")
415 (string-append (assoc-ref %build-inputs "guile")
416 "/bin/guile"))
417 (("@BASH@")
418 (string-append (assoc-ref %build-inputs "bash")
419 "/bin/bash"))
420 (("@LD@")
421 (string-append (assoc-ref %build-inputs "binutils")
4a740d0f
LC
422 ,(if target
423 (string-append "/bin/"
424 target "-ld")
425 "/bin/ld"))))
8fdd4101
LC
426 (chmod ld #o555)
427 (compile-file ld #:output-file go)))))
428 (synopsis "The linker wrapper")
429 (description
430 "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
431missing '-rpath' flags, and to detect any misuse of libraries outside of the
432store.")
433 (home-page "http://www.gnu.org/software/guix/")
434 (license gpl3+)))
435
436(export make-ld-wrapper)
437
7cdeac02
LC
438(define-public glibc
439 (package
440 (name "glibc")
fdaae613 441 (version "2.21")
7cdeac02 442 (source (origin
87f5d366 443 (method url-fetch)
0db342a5 444 (uri (string-append "mirror://gnu/glibc/glibc-"
7cdeac02
LC
445 version ".tar.xz"))
446 (sha256
447 (base32
fdaae613 448 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
13990c73
LC
449 (snippet
450 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
451 ;; required on LFS distros to avoid loading the distro's libc.so
452 ;; instead of ours.
453 '(substitute* "sysdeps/unix/sysv/linux/configure"
454 (("use_ldconfig=yes")
455 "use_ldconfig=no")))
1faca892 456 (modules '((guix build utils)))
fdaae613 457 (patches (list (search-patch "glibc-ldd-x86_64.patch")))))
7cdeac02 458 (build-system gnu-build-system)
0a3da5b7
LC
459
460 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
461 ;; users should automatically pull Linux headers as well.
124b1767 462 (propagated-inputs `(("linux-headers" ,linux-libre-headers)))
0a3da5b7 463
97e11209 464 (outputs '("out" "debug"))
7f614e49 465
7cdeac02 466 (arguments
8197c978 467 `(#:out-of-source? #t
211db2f6
LC
468
469 ;; In version 2.21, there a race in the 'elf' directory, see
470 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
471 #:parallel-build? #f
472
112da588
LC
473 ;; The libraries have an empty RUNPATH, but some, such as the versioned
474 ;; libraries (libdl-2.21.so, etc.) have ld.so marked as NEEDED. Since
475 ;; these libraries are always going to be found anyway, just skip
476 ;; RUNPATH checks.
477 #:validate-runpath? #f
478
7cdeac02
LC
479 #:configure-flags
480 (list "--enable-add-ons"
481 "--sysconfdir=/etc"
7f614e49 482
97e11209
LC
483 ;; Installing a locale archive with all the locales is to
484 ;; expensive (~100 MiB), so we rely on users to install the
485 ;; locales they really want.
486 ;;
487 ;; Set the default locale path. In practice, $LOCPATH may be
488 ;; defined to point whatever locales users want. However, setuid
489 ;; binaries don't honor $LOCPATH, so they'll instead look into
490 ;; $libc_cv_localedir; we choose /run/current-system/locale, with
491 ;; the idea that it is going to be populated by the sysadmin.
492 ;;
7f614e49
LC
493 ;; `--localedir' is not honored, so work around it.
494 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
97e11209 495 (string-append "libc_cv_localedir=/run/current-system/locale")
7f614e49 496
7cdeac02
LC
497 (string-append "--with-headers="
498 (assoc-ref %build-inputs "linux-headers")
499 "/include")
5f456680 500
fdaae613 501 ;; This is the default for most architectures as of GNU libc 2.21,
39ccbfad
MW
502 ;; but we specify it explicitly for clarity and consistency. See
503 ;; "kernel-features.h" in the GNU libc for details.
504 "--enable-kernel=2.6.32"
5f456680 505
6e32f6c0 506 ;; Use our Bash instead of /bin/sh.
8cd8e97c 507 (string-append "BASH_SHELL="
6e32f6c0 508 (assoc-ref %build-inputs "bash")
8cd8e97c
LC
509 "/bin/bash")
510
511 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
512 "libc_cv_ssp=no")
6e32f6c0 513
7cdeac02 514 #:tests? #f ; XXX
57f65bcc
LC
515 #:phases (modify-phases %standard-phases
516 (add-before
517 'configure 'pre-configure
518 (lambda* (#:key inputs native-inputs outputs
519 #:allow-other-keys)
520 (let* ((out (assoc-ref outputs "out"))
521 (bin (string-append out "/bin"))
522 ;; FIXME: Normally we would look it up only in INPUTS
523 ;; but cross-base uses it as a native input.
524 (bash (or (assoc-ref inputs "static-bash")
525 (assoc-ref native-inputs "static-bash"))))
526 ;; Use `pwd', not `/bin/pwd'.
527 (substitute* "configure"
528 (("/bin/pwd") "pwd"))
529
530 ;; Install the rpc data base file under `$out/etc/rpc'.
531 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
532 (substitute* "sunrpc/Makefile"
533 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
534 (string-append out "/etc/rpc" suffix "\n"))
535 (("^install-others =.*$")
536 (string-append "install-others = " out "/etc/rpc\n")))
537
538 (substitute* "Makeconfig"
539 ;; According to
540 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
541 ;; linking against libgcc_s is not needed with GCC
542 ;; 4.7.1.
543 ((" -lgcc_s") ""))
544
545 ;; Have `system' use that Bash.
546 (substitute* "sysdeps/posix/system.c"
547 (("#define[[:blank:]]+SHELL_PATH.*$")
548 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
549 bash)))
550
551 ;; Same for `popen'.
552 (substitute* "libio/iopopen.c"
553 (("/bin/sh")
554 (string-append bash "/bin/bash")))
555
d56f8d5e
LC
556 ;; Same for the shell used by the 'exec' functions for
557 ;; scripts that lack a shebang.
558 (substitute* (find-files "." "^paths\\.h$")
559 (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$")
560 (string-append "#define _PATH_BSHELL \""
561 bash "/bin/bash\"\n")))
562
57f65bcc
LC
563 ;; Make sure we don't retain a reference to the
564 ;; bootstrap Perl.
565 (substitute* "malloc/mtrace.pl"
566 (("^#!.*")
567 ;; The shebang can be omitted, because there's the
568 ;; "bilingual" eval/exec magic at the top of the file.
569 "")
570 (("exec @PERL@")
571 "exec perl"))))))))
7f614e49 572
90d891fc 573 (inputs `(("static-bash" ,static-bash)))
8fd6487e 574
6162b95d
LC
575 ;; To build the manual, we need Texinfo and Perl. Gettext is needed to
576 ;; install the message catalogs, with 'msgfmt'.
8fd6487e 577 (native-inputs `(("texinfo" ,texinfo)
6162b95d
LC
578 ("perl" ,perl)
579 ("gettext" ,gnu-gettext)))
8fd6487e 580
d6718df4
LC
581 (native-search-paths
582 ;; Search path for packages that provide locale data. This is useful
583 ;; primarily in build environments.
584 (list (search-path-specification
585 (variable "LOCPATH")
8a00b930 586 (files '("lib/locale")))))
d6718df4 587
d45122f5
LC
588 (synopsis "The GNU C Library")
589 (description
7cdeac02
LC
590 "Any Unix-like operating system needs a C library: the library which
591defines the \"system calls\" and other basic facilities such as open, malloc,
592printf, exit...
593
594The GNU C library is used as the C library in the GNU system and most systems
595with the Linux kernel.")
4a44e743 596 (license lgpl2.0+)
7cdeac02
LC
597 (home-page "http://www.gnu.org/software/libc/")))
598
aee6180c
LC
599(define-public glibc-locales
600 (package
601 (inherit glibc)
602 (name "glibc-locales")
603 (source (origin (inherit (package-source glibc))
604 (patches (cons (search-patch "glibc-locales.patch")
605 (origin-patches (package-source glibc))))))
606 (synopsis "All the locales supported by the GNU C Library")
607 (description
608 "This package provides all the locales supported by the GNU C Library,
609more than 400 in total. To use them set the 'LOCPATH' environment variable to
610the 'share/locale' sub-directory of this package.")
611 (outputs '("out")) ;110+ MiB
605217be 612 (native-search-paths '())
aee6180c
LC
613 (arguments
614 (let ((args `(#:tests? #f #:strip-binaries? #f
615 ,@(package-arguments glibc))))
616 (substitute-keyword-arguments args
617 ((#:phases phases)
618 `(alist-replace
619 'build
620 (lambda* (#:key outputs #:allow-other-keys)
621 (let ((out (assoc-ref outputs "out")))
622 ;; Delete $out/bin, which contains 'bash'.
623 (delete-file-recursively (string-append out "/bin")))
624
625 (zero? (system* "make" "localedata/install-locales"
626 "-j" (number->string (parallel-job-count)))))
627 (alist-delete 'install ,phases)))
628 ((#:configure-flags flags)
629 `(append ,flags
b9e02a71 630 ;; Use $(libdir)/locale as is the case by default.
aee6180c
LC
631 (list (string-append "libc_cv_localedir="
632 (assoc-ref %outputs "out")
b9e02a71 633 "/lib/locale")))))))))
aee6180c 634
c9505f3f
LC
635(define-public glibc-utf8-locales
636 (package
637 (name "glibc-utf8-locales")
638 (version (package-version glibc))
639 (source #f)
640 (build-system trivial-build-system)
641 (arguments
642 '(#:modules ((guix build utils))
643 #:builder (begin
644 (use-modules (srfi srfi-1)
645 (guix build utils))
646
647 (let* ((libc (assoc-ref %build-inputs "glibc"))
648 (gzip (assoc-ref %build-inputs "gzip"))
649 (out (assoc-ref %outputs "out"))
650 (localedir (string-append out "/lib/locale")))
651 ;; 'localedef' needs 'gzip'.
652 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
653
654 (mkdir-p localedir)
655 (every (lambda (locale)
656 (zero? (system* "localedef" "--no-archive"
657 "--prefix" localedir "-i" locale
658 "-f" "UTF-8"
659 (string-append localedir "/"
660 locale
661 ".UTF-8"))))
662
663 ;; These are the locales commonly used for
664 ;; tests---e.g., in Guile's i18n tests.
665 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
666 (inputs `(("glibc" ,glibc)
667 ("gzip" ,gzip)))
668 (synopsis "Small sample of UTF-8 locales")
669 (description
670 "This package provides a small sample of UTF-8 locales mostly useful in
671test environments.")
672 (home-page (package-home-page glibc))
673 (license (package-license glibc))))
aee6180c 674
ce0614dd
LC
675(define-public which
676 (package
677 (name "which")
70ca2e94 678 (version "2.21")
ce0614dd
LC
679 (source (origin
680 (method url-fetch)
681 (uri (string-append "mirror://gnu/which/which-"
682 version ".tar.gz"))
683 (sha256
684 (base32
70ca2e94 685 "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
ce0614dd
LC
686 (build-system gnu-build-system)
687 (home-page "https://gnu.org/software/which/")
688 (synopsis "Find full path of shell commands")
689 (description
690 "The which program finds the location of executables in PATH, with a
691variety of options. It is an alternative to the shell \"type\" built-in
692command.")
693 (license gpl3+))) ; some files are under GPLv2+
694
e789d9a8
LC
695(define-public tzdata
696 (package
697 (name "tzdata")
d8d6d096 698 (version "2015c")
e789d9a8
LC
699 (source (origin
700 (method url-fetch)
701 (uri (string-append
702 "http://www.iana.org/time-zones/repository/releases/tzdata"
703 version ".tar.gz"))
704 (sha256
705 (base32
d8d6d096 706 "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6"))))
e789d9a8
LC
707 (build-system gnu-build-system)
708 (arguments
709 '(#:tests? #f
710 #:make-flags (let ((out (assoc-ref %outputs "out"))
711 (tmp (getenv "TMPDIR")))
712 (list (string-append "TOPDIR=" out)
713 (string-append "TZDIR=" out "/share/zoneinfo")
714
715 ;; Discard zic, dump, and tzselect, already
716 ;; provided by glibc.
717 (string-append "ETCDIR=" tmp "/etc")
718
719 ;; Likewise for the C library routines.
720 (string-append "LIBDIR=" tmp "/lib")
721 (string-append "MANDIR=" tmp "/man")
722
723 "AWK=awk"
724 "CC=gcc"))
725 #:modules ((guix build utils)
726 (guix build gnu-build-system)
727 (srfi srfi-1))
728 #:phases
729 (alist-replace
730 'unpack
c94d01ba
LC
731 (lambda* (#:key source inputs #:allow-other-keys)
732 (and (zero? (system* "tar" "xvf" source))
e789d9a8
LC
733 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
734 (alist-cons-after
735 'install 'post-install
736 (lambda* (#:key outputs #:allow-other-keys)
737 ;; Move data in the right place.
738 (let ((out (assoc-ref outputs "out")))
739 (copy-recursively (string-append out "/share/zoneinfo-posix")
740 (string-append out "/share/zoneinfo/posix"))
741 (copy-recursively (string-append out "/share/zoneinfo-leaps")
742 (string-append out "/share/zoneinfo/right"))
743 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
744 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
745 (alist-delete 'configure %standard-phases)))))
746 (inputs `(("tzcode" ,(origin
747 (method url-fetch)
748 (uri (string-append
749 "http://www.iana.org/time-zones/repository/releases/tzcode"
750 version ".tar.gz"))
751 (sha256
752 (base32
d8d6d096 753 "0bplibiy70dvlrhwqzkzxgmg81j6d2kklvjgi2f1g2zz1nkb3vkz"))))))
e789d9a8
LC
754 (home-page "http://www.iana.org/time-zones")
755 (synopsis "Database of current and historical time zones")
756 (description "The Time Zone Database (often called tz or zoneinfo)
757contains code and data that represent the history of local time for many
35b9e423 758representative locations around the globe. It is updated periodically to
e789d9a8
LC
759reflect changes made by political bodies to time zone boundaries, UTC offsets,
760and daylight-saving rules.")
761 (license public-domain)))
762
bdb36958
LC
763(define-public (canonical-package package)
764 ;; Avoid circular dependency by lazily resolving 'commencement'.
765 (let* ((iface (resolve-interface '(gnu packages commencement)))
766 (proc (module-ref iface 'canonical-package)))
767 (proc package)))
571aa6cd 768
1722d680 769;;; base.scm ends here