1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
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.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages base)
24 #:use-module ((guix licenses)
25 #:select (gpl3+ lgpl2.0+ public-domain))
26 #:use-module (gnu packages)
27 #:use-module (gnu packages acl)
28 #:use-module (gnu packages bash)
29 #:use-module (gnu packages ed)
30 #:use-module (gnu packages guile)
31 #:use-module (gnu packages multiprecision)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages linux)
35 #:use-module (gnu packages texinfo)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (guix utils)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system trivial))
45 ;;; Base packages of the Guix-based GNU user-land software distribution.
55 (uri (string-append "mirror://gnu/hello/hello-" version
58 (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
59 (build-system gnu-build-system)
60 (synopsis "Hello, GNU world: An example GNU package")
62 "GNU Hello prints the message \"Hello, world!\" and then exits. It
63 serves as an example of standard GNU coding practices. As such, it supports
64 command-line arguments, multiple languages, and so on.")
65 (home-page "http://www.gnu.org/software/hello/")
74 (uri (string-append "mirror://gnu/grep/grep-"
78 "1pp5n15qwxrw1pibwjhhgsibyv5cafhamf8lwzjygs6y00fa2i2j"))
79 (patches (list (search-patch "grep-CVE-2015-1345.patch")))))
80 (build-system gnu-build-system)
81 (synopsis "Print lines matching a pattern")
83 "grep is a tool for finding text inside files. Text is found by
84 matching a pattern provided by the user in one or many files. The pattern
85 may be provided as a basic or extended regular expression, or as fixed
86 strings. By default, the matching text is simply printed to the screen,
87 however the output can be greatly customized to include, for example, line
88 numbers. GNU grep offers many extensions over the standard utility,
89 including, for example, recursive directory searching.")
91 (home-page "http://www.gnu.org/software/grep/")))
99 (uri (string-append "mirror://gnu/sed/sed-" version
103 "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))))
104 (build-system gnu-build-system)
105 (synopsis "Stream editor")
107 (if (%current-target-system)
109 `(#:phases (alist-cons-before
110 'patch-source-shebangs 'patch-test-suite
111 (lambda* (#:key inputs #:allow-other-keys)
112 (let ((bash (assoc-ref inputs "bash")))
113 (patch-makefile-SHELL "testsuite/Makefile.tests")
114 (substitute* '("testsuite/bsd.sh"
115 "testsuite/bug-regex9.c")
117 (string-append bash "/bin/bash")))))
120 "Sed is a non-interactive, text stream editor. It receives a text
121 input from a file or from standard input and it then applies a series of text
122 editing commands to the stream and prints its output to standard output. It
123 is often used for substituting text patterns in a stream. The GNU
124 implementation offers several extensions over the standard utility.")
126 (home-page "http://www.gnu.org/software/sed/")))
134 (uri (string-append "mirror://gnu/tar/tar-"
138 "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4"))))
139 (build-system gnu-build-system)
140 (synopsis "Managing tar archives")
142 "Tar provides the ability to create tar archives, as well as the
143 ability to extract, update or list files in an existing archive. It is
144 useful for combining many files into one larger file, while maintaining
145 directory structure and file information such as permissions and
146 creation/modification dates. GNU tar offers many extensions over the
149 (home-page "http://www.gnu.org/software/tar/")))
157 (uri (string-append "mirror://gnu/patch/patch-"
161 "02gikxjvcxysr4l65c8vivgz62xmalp0av5ypzff8vqhrq3vpb0f"))))
162 (build-system gnu-build-system)
163 (native-inputs `(("ed", ed)))
164 (synopsis "Apply differences to originals, with optional backups")
166 "Patch is a program that applies changes to files based on differences
167 laid out as by the program \"diff\". The changes may be applied to one or more
168 files depending on the contents of the diff file. It accepts several
169 different diff formats. It may also be used to revert previously applied
172 (home-page "http://savannah.gnu.org/projects/patch/")))
174 (define-public diffutils
180 (uri (string-append "mirror://gnu/diffutils/diffutils-"
184 "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2"))))
185 (build-system gnu-build-system)
186 (synopsis "Comparing and merging files")
188 "GNU Diffutils is a package containing tools for finding the
189 differences between files. The \"diff\" command is used to show how two files
190 differ, while \"cmp\" shows the offsets and line numbers where they differ.
191 \"diff3\" allows you to compare three files. Finally, \"sdiff\" offers an
192 interactive means to merge two files.")
194 (home-page "http://www.gnu.org/software/diffutils/")))
196 (define-public findutils
202 (uri (string-append "mirror://gnu/findutils/findutils-"
206 "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"))
207 (patches (list (search-patch "findutils-absolute-paths.patch")))))
208 (build-system gnu-build-system)
210 ;; Work around cross-compilation failure.
211 ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
212 (if (%current-target-system)
213 '(#:configure-flags '("gl_cv_func_wcwidth_works=yes"))
215 (synopsis "Operating on files matching given criteria")
217 "Findutils supplies the basic file directory searching utilities of the
218 GNU system. It consists of two primary searching utilities: \"find\"
219 recursively searches for files in a directory according to given criteria and
220 \"locate\" lists files in a database that match a query. Two auxiliary tools
221 are included: \"updatedb\" updates the file name database and \"xargs\" may be
222 used to apply commands with arbitrarily long arguments.")
224 (home-page "http://www.gnu.org/software/findutils/")))
226 (define-public coreutils
232 (uri (string-append "mirror://gnu/coreutils/coreutils-"
236 "0bdq6yggyl7nkc2pbl6pxhhyx15nyqhz3ds6rfn448n6rxdwlhzc"))
237 (patches (list (search-patch "coreutils-dummy-man.patch")))))
238 (build-system gnu-build-system)
239 (inputs `(("acl" ,acl) ; TODO: add SELinux
242 ;; Perl is needed to run tests in native builds, and to run the bundled
243 ;; copy of help2man. However, don't pass it when cross-compiling since
244 ;; that would lead it to try to run programs to get their '--help' output
246 (if (%current-target-system)
249 (outputs '("out" "debug"))
251 `(#:parallel-build? #f ; help2man may be called too early
252 #:phases (alist-cons-before
253 'build 'patch-shell-references
254 (lambda* (#:key inputs #:allow-other-keys)
255 (let ((bash (assoc-ref inputs "bash")))
256 ;; 'split' uses either $SHELL or /bin/sh. Set $SHELL so
257 ;; that tests pass, since /bin/sh isn't in the chroot.
258 (setenv "SHELL" (which "sh"))
260 (substitute* (find-files "gnulib-tests" "\\.c$")
262 (format #f "~a/bin/sh" bash)))
263 (substitute* (find-files "tests" "\\.sh$")
265 (format #f "#!~a/bin/sh" bash)))))
267 (synopsis "Core GNU utilities (file, text, shell)")
269 "GNU Coreutils includes all of the basic command-line tools that are
270 expected in a POSIX system. These provide the basic file, shell and text
271 manipulation functions of the GNU system. Most of these tools offer extended
272 functionality beyond that which is outlined in the POSIX standard.")
274 (home-page "http://www.gnu.org/software/coreutils/")))
276 (define-public gnu-make
282 (uri (string-append "mirror://gnu/make/make-" version
286 "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb"))
287 (patches (list (search-patch "make-impure-dirs.patch")))))
288 (build-system gnu-build-system)
289 (native-inputs `(("pkg-config", pkg-config))) ; to detect Guile
290 (inputs `(("guile" ,guile-2.0)))
291 (outputs '("out" "debug"))
293 '(#:phases (alist-cons-before
294 'build 'set-default-shell
295 (lambda* (#:key inputs #:allow-other-keys)
296 ;; Change the default shell from /bin/sh.
297 (let ((bash (assoc-ref inputs "bash")))
299 (("default_shell =.*$")
300 (format #f "default_shell = \"~a/bin/bash\";\n"
303 (synopsis "Remake files automatically")
305 "Make is a program that is used to control the production of
306 executables or other files from their source files. The process is
307 controlled from a Makefile, in which the developer specifies how each file is
308 generated from its source. It has powerful dependency resolution and the
309 ability to determine when files have to be regenerated after their sources
310 change. GNU make offers many powerful extensions over the standard utility.")
312 (home-page "http://www.gnu.org/software/make/")))
314 (define-public binutils
320 (uri (string-append "mirror://gnu/binutils/binutils-"
324 "08r9i26b05zcwb9zxb6zllpfdiiicdfsgbpsjlrjmvx3rxjzrpi2"))
325 (patches (list (search-patch "binutils-ld-new-dtags.patch")
326 (search-patch "binutils-loongson-workaround.patch")))))
327 (build-system gnu-build-system)
329 ;; TODO: Add dependency on zlib + those for Gold.
331 `(#:configure-flags '(;; Add `-static-libgcc' to not retain a dependency
332 ;; on GCC when bootstrapping.
333 "LDFLAGS=-static-libgcc"
335 ;; Don't search under /usr/lib & co.
336 "--with-lib-path=/no-ld-lib-path"
338 ;; Glibc 2.17 has a "comparison of unsigned
339 ;; expression >= 0 is always true" in wchar.h.
342 ;; Install BFD. It ends up in a hidden directory,
344 "--enable-install-libbfd"
346 ;; Make sure 'ar' and 'ranlib' produce archives in a
347 ;; deterministic fashion.
348 "--enable-deterministic-archives")))
350 (synopsis "Binary utilities: bfd gas gprof ld")
352 "GNU Binutils is a collection of tools for working with binary files.
353 Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
354 Other tools include programs to display binary profiling information, list
355 the strings in a binary file, and utilities for working with archives. The
356 \"bfd\" library for working with executable and object formats is also
359 (home-page "http://www.gnu.org/software/binutils/")))
367 (uri (string-append "mirror://gnu/glibc/glibc-"
371 "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
373 ;; Disable 'ldconfig' and /etc/ld.so.cache. The latter is
374 ;; required on LFS distros to avoid loading the distro's libc.so
376 '(substitute* "sysdeps/unix/sysv/linux/configure"
377 (("use_ldconfig=yes")
379 (modules '((guix build utils)))
380 (patches (list (search-patch "glibc-ldd-x86_64.patch")))))
381 (build-system gnu-build-system)
383 ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
384 ;; users should automatically pull Linux headers as well.
385 (propagated-inputs `(("linux-headers" ,linux-libre-headers)))
387 (outputs '("out" "debug"))
390 `(#:out-of-source? #t
392 ;; In version 2.21, there a race in the 'elf' directory, see
393 ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
397 (list "--enable-add-ons"
400 ;; Installing a locale archive with all the locales is to
401 ;; expensive (~100 MiB), so we rely on users to install the
402 ;; locales they really want.
404 ;; Set the default locale path. In practice, $LOCPATH may be
405 ;; defined to point whatever locales users want. However, setuid
406 ;; binaries don't honor $LOCPATH, so they'll instead look into
407 ;; $libc_cv_localedir; we choose /run/current-system/locale, with
408 ;; the idea that it is going to be populated by the sysadmin.
410 ;; `--localedir' is not honored, so work around it.
411 ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
412 (string-append "libc_cv_localedir=/run/current-system/locale")
414 (string-append "--with-headers="
415 (assoc-ref %build-inputs "linux-headers")
418 ;; This is the default for most architectures as of GNU libc 2.21,
419 ;; but we specify it explicitly for clarity and consistency. See
420 ;; "kernel-features.h" in the GNU libc for details.
421 "--enable-kernel=2.6.32"
423 ;; Use our Bash instead of /bin/sh.
424 (string-append "BASH_SHELL="
425 (assoc-ref %build-inputs "bash")
428 ;; XXX: Work around "undefined reference to `__stack_chk_guard'".
432 #:phases (alist-cons-before
433 'configure 'pre-configure
434 (lambda* (#:key inputs outputs #:allow-other-keys)
435 (let* ((out (assoc-ref outputs "out"))
436 (bin (string-append out "/bin")))
437 ;; Use `pwd', not `/bin/pwd'.
438 (substitute* "configure"
439 (("/bin/pwd") "pwd"))
441 ;; Install the rpc data base file under `$out/etc/rpc'.
442 ;; FIXME: Use installFlags = [ "sysconfdir=$(out)/etc" ];
443 (substitute* "sunrpc/Makefile"
444 (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
445 (string-append out "/etc/rpc" suffix "\n"))
446 (("^install-others =.*$")
447 (string-append "install-others = " out "/etc/rpc\n")))
449 (substitute* "Makeconfig"
451 ;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
452 ;; linking against libgcc_s is not needed with GCC
456 ;; Copy a statically-linked Bash in the output, with
457 ;; no references to other store paths.
459 (copy-file (string-append (assoc-ref inputs "static-bash")
461 (string-append bin "/bash"))
462 (remove-store-references (string-append bin "/bash"))
463 (chmod (string-append bin "/bash") #o555)
465 ;; Keep a symlink, for `patch-shebang' resolution.
466 (with-directory-excursion bin
467 (symlink "bash" "sh"))
469 ;; Have `system' use that Bash.
470 (substitute* "sysdeps/posix/system.c"
471 (("#define[[:blank:]]+SHELL_PATH.*$")
472 (format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
476 (substitute* "libio/iopopen.c"
478 (string-append out "/bin/bash")))
480 ;; Make sure we don't retain a reference to the
482 (substitute* "malloc/mtrace.pl"
484 ;; The shebang can be omitted, because there's the
485 ;; "bilingual" eval/exec magic at the top of the file.
491 (inputs `(("static-bash" ,(static-package bash-light))))
493 ;; To build the manual, we need Texinfo and Perl.
494 (native-inputs `(("texinfo" ,texinfo)
498 ;; Search path for packages that provide locale data. This is useful
499 ;; primarily in build environments.
500 (list (search-path-specification
502 (files '("lib/locale")))))
504 (synopsis "The GNU C Library")
506 "Any Unix-like operating system needs a C library: the library which
507 defines the \"system calls\" and other basic facilities such as open, malloc,
510 The GNU C library is used as the C library in the GNU system and most systems
511 with the Linux kernel.")
513 (home-page "http://www.gnu.org/software/libc/")))
515 (define-public glibc-locales
518 (name "glibc-locales")
519 (source (origin (inherit (package-source glibc))
520 (patches (cons (search-patch "glibc-locales.patch")
521 (origin-patches (package-source glibc))))))
522 (synopsis "All the locales supported by the GNU C Library")
524 "This package provides all the locales supported by the GNU C Library,
525 more than 400 in total. To use them set the 'LOCPATH' environment variable to
526 the 'share/locale' sub-directory of this package.")
527 (outputs '("out")) ;110+ MiB
528 (native-search-paths '())
530 (let ((args `(#:tests? #f #:strip-binaries? #f
531 ,@(package-arguments glibc))))
532 (substitute-keyword-arguments args
536 (lambda* (#:key outputs #:allow-other-keys)
537 (let ((out (assoc-ref outputs "out")))
538 ;; Delete $out/bin, which contains 'bash'.
539 (delete-file-recursively (string-append out "/bin")))
541 (zero? (system* "make" "localedata/install-locales"
542 "-j" (number->string (parallel-job-count)))))
543 (alist-delete 'install ,phases)))
544 ((#:configure-flags flags)
546 ;; Use $(libdir)/locale as is the case by default.
547 (list (string-append "libc_cv_localedir="
548 (assoc-ref %outputs "out")
549 "/lib/locale")))))))))
551 (define-public glibc-utf8-locales
553 (name "glibc-utf8-locales")
554 (version (package-version glibc))
556 (build-system trivial-build-system)
558 '(#:modules ((guix build utils))
560 (use-modules (srfi srfi-1)
563 (let* ((libc (assoc-ref %build-inputs "glibc"))
564 (gzip (assoc-ref %build-inputs "gzip"))
565 (out (assoc-ref %outputs "out"))
566 (localedir (string-append out "/lib/locale")))
567 ;; 'localedef' needs 'gzip'.
568 (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
571 (every (lambda (locale)
572 (zero? (system* "localedef" "--no-archive"
573 "--prefix" localedir "-i" locale
575 (string-append localedir "/"
579 ;; These are the locales commonly used for
580 ;; tests---e.g., in Guile's i18n tests.
581 '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
582 (inputs `(("glibc" ,glibc)
584 (synopsis "Small sample of UTF-8 locales")
586 "This package provides a small sample of UTF-8 locales mostly useful in
588 (home-page (package-home-page glibc))
589 (license (package-license glibc))))
597 (uri (string-append "mirror://gnu/which/which-"
601 "1y2p50zadb36izzh2zw4dm5hvdiydqf3qa88l8kav20dcmfbc5yl"))))
602 (build-system gnu-build-system)
603 (home-page "https://gnu.org/software/which/")
604 (synopsis "Find full path of shell commands")
606 "The which program finds the location of executables in PATH, with a
607 variety of options. It is an alternative to the shell \"type\" built-in
609 (license gpl3+))) ; some files are under GPLv2+
611 (define-public tzdata
618 "http://www.iana.org/time-zones/repository/releases/tzdata"
622 "038fvj6zf51k6z9sbbxbj87ajaf69l3whal2vwshbm4l0qr71n52"))))
623 (build-system gnu-build-system)
626 #:make-flags (let ((out (assoc-ref %outputs "out"))
627 (tmp (getenv "TMPDIR")))
628 (list (string-append "TOPDIR=" out)
629 (string-append "TZDIR=" out "/share/zoneinfo")
631 ;; Discard zic, dump, and tzselect, already
632 ;; provided by glibc.
633 (string-append "ETCDIR=" tmp "/etc")
635 ;; Likewise for the C library routines.
636 (string-append "LIBDIR=" tmp "/lib")
637 (string-append "MANDIR=" tmp "/man")
641 #:modules ((guix build utils)
642 (guix build gnu-build-system)
647 (lambda* (#:key source inputs #:allow-other-keys)
648 (and (zero? (system* "tar" "xvf" source))
649 (zero? (system* "tar" "xvf" (assoc-ref inputs "tzcode")))))
651 'install 'post-install
652 (lambda* (#:key outputs #:allow-other-keys)
653 ;; Move data in the right place.
654 (let ((out (assoc-ref outputs "out")))
655 (copy-recursively (string-append out "/share/zoneinfo-posix")
656 (string-append out "/share/zoneinfo/posix"))
657 (copy-recursively (string-append out "/share/zoneinfo-leaps")
658 (string-append out "/share/zoneinfo/right"))
659 (delete-file-recursively (string-append out "/share/zoneinfo-posix"))
660 (delete-file-recursively (string-append out "/share/zoneinfo-leaps"))))
661 (alist-delete 'configure %standard-phases)))))
662 (inputs `(("tzcode" ,(origin
665 "http://www.iana.org/time-zones/repository/releases/tzcode"
669 "1qpd12imy7q5hb5fhk48mfw65s0xlrkmms0zr2gk0mj88qjn3m3z"))))))
670 (home-page "http://www.iana.org/time-zones")
671 (synopsis "Database of current and historical time zones")
672 (description "The Time Zone Database (often called tz or zoneinfo)
673 contains code and data that represent the history of local time for many
674 representative locations around the globe. It is updated periodically to
675 reflect changes made by political bodies to time zone boundaries, UTC offsets,
676 and daylight-saving rules.")
677 (license public-domain)))
679 (define-public (canonical-package package)
680 ;; Avoid circular dependency by lazily resolving 'commencement'.
681 (let* ((iface (resolve-interface '(gnu packages commencement)))
682 (proc (module-ref iface 'canonical-package)))
685 ;;; base.scm ends here