Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / base.scm
index 1f479cc..69d1205 100644 (file)
@@ -1,8 +1,8 @@
 ;;; 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 (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:
 ;;;
@@ -72,7 +75,8 @@ command-line arguments, multiple languages, and so on.")
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1pp5n15qwxrw1pibwjhhgsibyv5cafhamf8lwzjygs6y00fa2i2j"))))
+              "1pp5n15qwxrw1pibwjhhgsibyv5cafhamf8lwzjygs6y00fa2i2j"))
+            (patches (list (search-patch "grep-CVE-2015-1345.patch")))))
    (build-system gnu-build-system)
    (synopsis "Print lines matching a pattern")
    (description
@@ -147,18 +151,16 @@ 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"))))
    (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
@@ -359,14 +361,14 @@ included.")
 (define-public glibc
   (package
    (name "glibc")
-   (version "2.20")
+   (version "2.21")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/glibc/glibc-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "19bbyfc2gcxr9rihrkkbd3p362i608yhlyrr7icqsa6cmr16sjzq"))
+              "1f135546j34s9bfkydmx2nhh9vwxlx60jldi80zmsnln6wj3dsxf"))
             (snippet
              ;; Disable 'ldconfig' and /etc/ld.so.cache.  The latter is
              ;; required on LFS distros to avoid loading the distro's libc.so
@@ -375,10 +377,7 @@ included.")
                 (("use_ldconfig=yes")
                  "use_ldconfig=no")))
             (modules '((guix build utils)))
-            (patches (list (search-patch "glibc-CVE-2014-7817.patch")
-                           (search-patch "glibc-CVE-2012-3406.patch")
-                           (search-patch "glibc-mips-dangling-vfork-ref.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
@@ -389,6 +388,11 @@ included.")
 
    (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
+
       #:configure-flags
       (list "--enable-add-ons"
             "--sysconfdir=/etc"
@@ -411,7 +415,7 @@ included.")
                            (assoc-ref %build-inputs "linux-headers")
                            "/include")
 
-            ;; This is the default for most architectures as of GNU libc 2.20,
+            ;; 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"
@@ -490,6 +494,13 @@ included.")
    (native-inputs `(("texinfo" ,texinfo)
                     ("perl" ,perl)))
 
+   (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
     "Any Unix-like operating system needs a C library: the library which
@@ -501,6 +512,102 @@ 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.20")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/which/which-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1y2p50zadb36izzh2zw4dm5hvdiydqf3qa88l8kav20dcmfbc5yl"))))
+    (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")