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