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