gnu: itstool: Add python2-libxml2 to propagated-inputs.
[jackhill/guix/guix.git] / gnu / packages / base.scm
index cbe115f..31331a1 100644 (file)
@@ -1,8 +1,9 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
-;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (gnu packages ed)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages gettext)
+  #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial))
 
 ;;; Commentary:
 ;;;
 (define-public hello
   (package
    (name "hello")
-   (version "2.9")
+   (version "2.10")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/hello/hello-" version
                                 ".tar.gz"))
             (sha256
-             (base32 "19qy37gkasc4csb1d3bdiz9snn8mir2p3aj0jgzmfv0r2hi7mfzc"))))
+             (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
    (build-system gnu-build-system)
    (synopsis "Hello, GNU world: An example GNU package")
    (description
@@ -64,18 +69,19 @@ command-line arguments, multiple languages, and so on.")
 (define-public grep
   (package
    (name "grep")
-   (version "2.20")
+   (version "2.21")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/grep/grep-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "0rcs0spsxdmh6yz8y4frkqp6f5iw19mdbdl9s2v6956hq0mlbbzh"))))
+              "1pp5n15qwxrw1pibwjhhgsibyv5cafhamf8lwzjygs6y00fa2i2j"))
+            (patches (list (search-patch "grep-CVE-2015-1345.patch")))))
    (build-system gnu-build-system)
    (synopsis "Print lines matching a pattern")
    (description
-    "grep is a tool for finding text inside files.  Text is found by
+     "grep is a tool for finding text inside files.  Text is found by
 matching a pattern provided by the user in one or many files.  The pattern
 may be provided as a basic or extended regular expression, or as fixed
 strings.  By default, the matching text is simply printed to the screen,
@@ -95,7 +101,8 @@ including, for example, recursive directory searching.")
                                 ".tar.bz2"))
             (sha256
              (base32
-              "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))))
+              "1myvrmh99jsvk7v3d7crm0gcrq51hmmm1r2kjyyci152in1x2j7h"))
+            (patches (list (search-patch "sed-hurd-path-max.patch")))))
    (build-system gnu-build-system)
    (synopsis "Stream editor")
    (arguments
@@ -130,7 +137,10 @@ implementation offers several extensions over the standard utility.")
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4"))))
+              "1wi2zwm4c9r3h3b8y4w0nm0qq897kn8kyj9k22ba0iqvxj48vvk4"))
+            (patches (map search-patch
+                          '("tar-d_ino_in_dirent-fix.patch"
+                            "tar-skip-unreliable-tests.patch")))))
    (build-system gnu-build-system)
    (synopsis "Managing tar archives")
    (description
@@ -146,18 +156,17 @@ standard utility.")
 (define-public patch
   (package
    (name "patch")
-   (version "2.7.1")
-   (source (origin
-            (method url-fetch)
-            (uri (string-append "mirror://gnu/patch/patch-"
-                                version ".tar.xz"))
-            (sha256
-             (base32
-              "1sqckf560pzwgniy00vcpdv2c9c11s4cmhlm14yqgg8avd3bl94i"))))
+    (version "2.7.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/patch/patch-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
+              (patches (list (search-patch "patch-hurd-path-max.patch")))))
    (build-system gnu-build-system)
    (native-inputs `(("ed", ed)))
-    ;; TODO: When cross-compiling, add this:
-    ;;  '(#:configure-flags '("ac_cv_func_strnlen_working=yes"))
    (synopsis "Apply differences to originals, with optional backups")
    (description
     "Patch is a program that applies changes to files based on differences
@@ -201,14 +210,20 @@ interactive means to merge two files.")
             (sha256
              (base32
               "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"))
-            (patches (list (search-patch "findutils-absolute-paths.patch")))))
+            (patches (map search-patch
+                          '("findutils-absolute-paths.patch"
+                            "findutils-localstatedir.patch")))))
    (build-system gnu-build-system)
    (arguments
-    ;; Work around cross-compilation failure.
-    ;; See <http://savannah.gnu.org/bugs/?27299#comment1>.
-    (if (%current-target-system)
-        '(#:configure-flags '("gl_cv_func_wcwidth_works=yes"))
-        '()))
+    `(#:configure-flags (list
+                         ;; Tell 'updatedb' to write to /var.
+                         "--localstatedir=/var"
+
+                         ;; Work around cross-compilation failure.  See
+                         ;; <http://savannah.gnu.org/bugs/?27299#comment1>.
+                         ,@(if (%current-target-system)
+                               '("gl_cv_func_wcwidth_works=yes")
+                               '()))))
    (synopsis "Operating on files matching given criteria")
    (description
     "Findutils supplies the basic file directory searching utilities of the
@@ -273,14 +288,14 @@ functionality beyond that which is outlined in the POSIX standard.")
 (define-public gnu-make
   (package
    (name "make")
-   (version "4.0")
+   (version "4.1")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/make/make-" version
                                 ".tar.bz2"))
             (sha256
              (base32
-              "1nyvn8mknw0mf7727lprva3lisl1y0n03lvar342rrpdmz3qc1p6"))
+              "19gwwhik3wdwn0r42b7xcihkbxvjl9r2bdal8nifc3k5i4rn3iqb"))
             (patches (list (search-patch "make-impure-dirs.patch")))))
    (build-system gnu-build-system)
    (native-inputs `(("pkg-config", pkg-config)))  ; to detect Guile
@@ -293,8 +308,8 @@ functionality beyond that which is outlined in the POSIX standard.")
                   ;; Change the default shell from /bin/sh.
                   (let ((bash (assoc-ref inputs "bash")))
                     (substitute* "job.c"
-                      (("default_shell\\[\\] =.*$")
-                       (format #f "default_shell[] = \"~a/bin/bash\";\n"
+                      (("default_shell =.*$")
+                       (format #f "default_shell = \"~a/bin/bash\";\n"
                                bash)))))
                 %standard-phases)))
    (synopsis "Remake files automatically")
@@ -311,14 +326,14 @@ change.  GNU make offers many powerful extensions over the standard utility.")
 (define-public binutils
   (package
    (name "binutils")
-   (version "2.24")
+   (version "2.25")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/binutils/binutils-"
                                 version ".tar.bz2"))
             (sha256
              (base32
-              "0ds1y7qa0xqihw4ihnsgg6bxanmb228r228ddvwzgrv4jszcbs75"))
+              "08r9i26b05zcwb9zxb6zllpfdiiicdfsgbpsjlrjmvx3rxjzrpi2"))
             (patches (list (search-patch "binutils-ld-new-dtags.patch")
                            (search-patch "binutils-loongson-workaround.patch")))))
    (build-system gnu-build-system)
@@ -347,24 +362,91 @@ change.  GNU make offers many powerful extensions over the standard utility.")
    (synopsis "Binary utilities: bfd gas gprof ld")
    (description
     "GNU Binutils is a collection of tools for working with binary files.
-Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler. Other
-tools include programs to display binary profiling information, list the
-strings in a binary file, and utilities for working with archives.  The \"bfd\"
-library for working with executable and object formats is also included.")
+Perhaps the most notable are \"ld\", a linker, and \"as\", an assembler.
+Other tools include programs to display binary profiling information, list
+the strings in a binary file, and utilities for working with archives.  The
+\"bfd\" library for working with executable and object formats is also
+included.")
    (license gpl3+)
    (home-page "http://www.gnu.org/software/binutils/")))
 
+(define* (make-ld-wrapper name #:key binutils
+                          (guile (canonical-package guile-2.0))
+                          (bash (canonical-package bash)) target
+                          (guile-for-build guile))
+  "Return a package called NAME that contains a wrapper for the 'ld' program
+of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line.  When
+TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
+'TARGET-ld'.  The wrapper uses GUILE and BASH."
+  (package
+    (name name)
+    (version "0")
+    (source #f)
+    (build-system trivial-build-system)
+    (inputs `(("binutils" ,binutils)
+              ("guile"    ,guile)
+              ("bash"     ,bash)
+              ("wrapper"  ,(search-path %load-path
+                                        "gnu/packages/ld-wrapper.in"))))
+    (arguments
+     `(#:guile ,guile-for-build
+       #:modules ((guix build utils))
+       #:builder (begin
+                   (use-modules (guix build utils)
+                                (system base compile))
+
+                   (let* ((out (assoc-ref %outputs "out"))
+                          (bin (string-append out "/bin"))
+                          (ld  ,(if target
+                                    `(string-append bin "/" ,target "-ld")
+                                    '(string-append bin "/ld")))
+                          (go  (string-append ld ".go")))
+
+                     (setvbuf (current-output-port) _IOLBF)
+                     (format #t "building ~s/bin/ld wrapper in ~s~%"
+                             (assoc-ref %build-inputs "binutils")
+                             out)
+
+                     (mkdir-p bin)
+                     (copy-file (assoc-ref %build-inputs "wrapper") ld)
+                     (substitute* ld
+                       (("@SELF@")
+                        ld)
+                       (("@GUILE@")
+                        (string-append (assoc-ref %build-inputs "guile")
+                                       "/bin/guile"))
+                       (("@BASH@")
+                        (string-append (assoc-ref %build-inputs "bash")
+                                       "/bin/bash"))
+                       (("@LD@")
+                        (string-append (assoc-ref %build-inputs "binutils")
+                                       ,(if target
+                                            (string-append "/bin/"
+                                                           target "-ld")
+                                            "/bin/ld"))))
+                     (chmod ld #o555)
+                     (compile-file ld #:output-file go)))))
+    (synopsis "The linker wrapper")
+    (description
+     "The linker wrapper (or 'ld-wrapper') wraps the linker to add any
+missing '-rpath' flags, and to detect any misuse of libraries outside of the
+store.")
+    (home-page "http://www.gnu.org/software/guix/")
+    (license gpl3+)))
+
+(export make-ld-wrapper)
+
 (define-public glibc
   (package
    (name "glibc")
-   (version "2.19")
+   (version "2.21")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/glibc/glibc-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "18m2dssd6ja5arxmdxinc90xvpqcsnqjfwmjl2as07j0i3srff9d"))
+              "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
             (snippet
              ;; Disable 'ldconfig' and /etc/ld.so.cache.  The latter is
              ;; required on LFS distros to avoid loading the distro's libc.so
@@ -373,42 +455,54 @@ library for working with executable and object formats is also included.")
                 (("use_ldconfig=yes")
                  "use_ldconfig=no")))
             (modules '((guix build utils)))
-            (patches (list (search-patch "glibc-CVE-2014-5119.patch")
-                           (search-patch "glibc-ldd-x86_64.patch")))))
+            (patches (list (search-patch "glibc-ldd-x86_64.patch")))))
    (build-system gnu-build-system)
 
    ;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
    ;; users should automatically pull Linux headers as well.
    (propagated-inputs `(("linux-headers" ,linux-libre-headers)))
 
-   ;; Store the locales separately (~100 MiB).  Note that "out" retains a
-   ;; reference to them anyway, so there's no space savings here.
-   ;; TODO: Eventually we may want to add a $LOCALE_ARCHIVE search path like
-   ;; Nixpkgs does.
-   (outputs '("out" "locales" "debug"))
+   (outputs '("out" "debug"))
 
    (arguments
     `(#:out-of-source? #t
+
+      ;; In version 2.21, there a race in the 'elf' directory, see
+      ;; <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00709.html>.
+      #:parallel-build? #f
+
+      ;; The libraries have an empty RUNPATH, but some, such as the versioned
+      ;; libraries (libdl-2.21.so, etc.) have ld.so marked as NEEDED.  Since
+      ;; these libraries are always going to be found anyway, just skip
+      ;; RUNPATH checks.
+      #:validate-runpath? #f
+
       #:configure-flags
       (list "--enable-add-ons"
             "--sysconfdir=/etc"
-            (string-append "--localedir=" (assoc-ref %outputs "locales")
-                           "/share/locale")
 
+            ;; Installing a locale archive with all the locales is to
+            ;; expensive (~100 MiB), so we rely on users to install the
+            ;; locales they really want.
+            ;;
+            ;; Set the default locale path.  In practice, $LOCPATH may be
+            ;; defined to point whatever locales users want.  However, setuid
+            ;; binaries don't honor $LOCPATH, so they'll instead look into
+            ;; $libc_cv_localedir; we choose /run/current-system/locale, with
+            ;; the idea that it is going to be populated by the sysadmin.
+            ;;
             ;; `--localedir' is not honored, so work around it.
             ;; See <http://sourceware.org/ml/libc-alpha/2013-03/msg00093.html>.
-            (string-append "libc_cv_localedir="
-                           (assoc-ref %outputs "locales")
-                           "/share/locale")
+            (string-append "libc_cv_localedir=/run/current-system/locale")
 
             (string-append "--with-headers="
                            (assoc-ref %build-inputs "linux-headers")
                            "/include")
 
-            ;; The default is to assume a 2.4 Linux interface, but we'll
-            ;; always use something newer.  See "kernel-features.h" in the
-            ;; GNU libc for details.
-            "--enable-kernel=2.6.30"
+            ;; This is the default for most architectures as of GNU libc 2.21,
+            ;; but we specify it explicitly for clarity and consistency.  See
+            ;; "kernel-features.h" in the GNU libc for details.
+            "--enable-kernel=2.6.32"
 
             ;; Use our Bash instead of /bin/sh.
             (string-append "BASH_SHELL="
@@ -421,7 +515,8 @@ library for working with executable and object formats is also included.")
       #:tests? #f                                 ; XXX
       #:phases (alist-cons-before
                 'configure 'pre-configure
-                (lambda* (#:key inputs outputs #:allow-other-keys)
+                (lambda* (#:key inputs native-inputs outputs
+                          #:allow-other-keys)
                   (let* ((out  (assoc-ref outputs "out"))
                          (bin  (string-append out "/bin")))
                     ;; Use `pwd', not `/bin/pwd'.
@@ -445,8 +540,13 @@ library for working with executable and object formats is also included.")
 
                     ;; Copy a statically-linked Bash in the output, with
                     ;; no references to other store paths.
+                    ;; FIXME: Normally we would look it up only in INPUTS but
+                    ;; cross-base uses it as a native input.
                     (mkdir-p bin)
-                    (copy-file (string-append (assoc-ref inputs "static-bash")
+                    (copy-file (string-append (or (assoc-ref inputs
+                                                             "static-bash")
+                                                  (assoc-ref native-inputs
+                                                             "static-bash"))
                                               "/bin/bash")
                                (string-append bin "/bash"))
                     (remove-store-references (string-append bin "/bash"))
@@ -476,17 +576,22 @@ library for working with executable and object formats is also included.")
                        "")
                       (("exec @PERL@")
                        "exec perl"))))
-                (alist-cons-after
-                 'install 'install-locales
-                 (lambda _
-                   (zero? (system* "make" "localedata/install-locales")))
-                 %standard-phases))))
+                %standard-phases)))
 
    (inputs `(("static-bash" ,(static-package bash-light))))
 
-   ;; To build the manual, we need Texinfo and Perl.
+   ;; To build the manual, we need Texinfo and Perl.  Gettext is needed to
+   ;; install the message catalogs, with 'msgfmt'.
    (native-inputs `(("texinfo" ,texinfo)
-                    ("perl" ,perl)))
+                    ("perl" ,perl)
+                    ("gettext" ,gnu-gettext)))
+
+   (native-search-paths
+    ;; Search path for packages that provide locale data.  This is useful
+    ;; primarily in build environments.
+    (list (search-path-specification
+           (variable "LOCPATH")
+           (files '("lib/locale")))))
 
    (synopsis "The GNU C Library")
    (description
@@ -499,10 +604,106 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/")))
 
+(define-public glibc-locales
+  (package
+    (inherit glibc)
+    (name "glibc-locales")
+    (source (origin (inherit (package-source glibc))
+                    (patches (cons (search-patch "glibc-locales.patch")
+                                   (origin-patches (package-source glibc))))))
+    (synopsis "All the locales supported by the GNU C Library")
+    (description
+     "This package provides all the locales supported by the GNU C Library,
+more than 400 in total.  To use them set the 'LOCPATH' environment variable to
+the 'share/locale' sub-directory of this package.")
+    (outputs '("out"))                            ;110+ MiB
+    (native-search-paths '())
+    (arguments
+     (let ((args `(#:tests? #f #:strip-binaries? #f
+                   ,@(package-arguments glibc))))
+       (substitute-keyword-arguments args
+         ((#:phases phases)
+          `(alist-replace
+            'build
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                ;; Delete $out/bin, which contains 'bash'.
+                (delete-file-recursively (string-append out "/bin")))
+
+              (zero? (system* "make" "localedata/install-locales"
+                              "-j" (number->string (parallel-job-count)))))
+            (alist-delete 'install ,phases)))
+         ((#:configure-flags flags)
+          `(append ,flags
+                   ;; Use $(libdir)/locale as is the case by default.
+                   (list (string-append "libc_cv_localedir="
+                                        (assoc-ref %outputs "out")
+                                        "/lib/locale")))))))))
+
+(define-public glibc-utf8-locales
+  (package
+    (name "glibc-utf8-locales")
+    (version (package-version glibc))
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     '(#:modules ((guix build utils))
+       #:builder (begin
+                   (use-modules (srfi srfi-1)
+                                (guix build utils))
+
+                   (let* ((libc      (assoc-ref %build-inputs "glibc"))
+                          (gzip      (assoc-ref %build-inputs "gzip"))
+                          (out       (assoc-ref %outputs "out"))
+                          (localedir (string-append out "/lib/locale")))
+                     ;; 'localedef' needs 'gzip'.
+                     (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
+
+                     (mkdir-p localedir)
+                     (every (lambda (locale)
+                              (zero? (system* "localedef" "--no-archive"
+                                              "--prefix" localedir "-i" locale
+                                              "-f" "UTF-8"
+                                              (string-append localedir "/"
+                                                             locale
+                                                             ".UTF-8"))))
+
+                            ;; These are the locales commonly used for
+                            ;; tests---e.g., in Guile's i18n tests.
+                            '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))))))
+    (inputs `(("glibc" ,glibc)
+              ("gzip" ,gzip)))
+    (synopsis "Small sample of UTF-8 locales")
+    (description
+     "This package provides a small sample of UTF-8 locales mostly useful in
+test environments.")
+    (home-page (package-home-page glibc))
+    (license (package-license glibc))))
+
+(define-public which
+  (package
+    (name "which")
+    (version "2.21")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/which/which-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl"))))
+    (build-system gnu-build-system)
+    (home-page "https://gnu.org/software/which/")
+    (synopsis "Find full path of shell commands")
+    (description
+     "The which program finds the location of executables in PATH, with a
+variety of options.  It is an alternative to the shell \"type\" built-in
+command.")
+    (license gpl3+))) ; some files are under GPLv2+
+
 (define-public tzdata
   (package
     (name "tzdata")
-    (version "2014a")
+    (version "2015c")
     (source (origin
              (method url-fetch)
              (uri (string-append
@@ -510,7 +711,7 @@ with the Linux kernel.")
                    version ".tar.gz"))
              (sha256
               (base32
-               "1cg843ajz4g16axpz56zvalwsbp1s764na2bk4fb44ayx162bzvw"))))
+               "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6"))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f
@@ -557,12 +758,12 @@ with the Linux kernel.")
                                 version ".tar.gz"))
                           (sha256
                            (base32
-                            "1xfkqi1q8cnxqbv8azdj5pqlzhkjz6xag09f1z0s8rxi86jkpf85"))))))
+                            "0bplibiy70dvlrhwqzkzxgmg81j6d2kklvjgi2f1g2zz1nkb3vkz"))))))
     (home-page "http://www.iana.org/time-zones")
     (synopsis "Database of current and historical time zones")
     (description "The Time Zone Database (often called tz or zoneinfo)
 contains code and data that represent the history of local time for many
-representative locations around the globe. It is updated periodically to
+representative locations around the globe.  It is updated periodically to
 reflect changes made by political bodies to time zone boundaries, UTC offsets,
 and daylight-saving rules.")
     (license public-domain)))