gnu: tzdata: Update to 2020a.
[jackhill/guix/guix.git] / gnu / packages / base.scm
index 2c5e7c6..715c454 100644 (file)
@@ -1,11 +1,11 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2019 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
-;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016, 2018 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
@@ -13,7 +13,8 @@
 ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Vitaliy Shatrov <D0dyBo0D0dyBo0@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
                 #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages ed)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages compression)
@@ -47,6 +50,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages gettext)
   #:use-module (guix utils)
   #:use-module (guix packages)
@@ -55,6 +59,8 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
   #:export (glibc
             libiconv-if-needed))
 
@@ -152,14 +158,14 @@ implementation offers several extensions over the standard utility.")
 (define-public tar
   (package
    (name "tar")
-   (version "1.30")
+   (version "1.32")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/tar/tar-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1lyjyk8z8hdddsxw0ikchrsfg3i0x3fsh7l63a8jgaz1n7dr5gzi"))
+              "1n7xy657ii0sa42zx6944v2m4v9qrh6sqgmw17l3nch3y43sxlyh"))
             (patches (search-patches "tar-skip-unreliable-tests.patch"
                                      "tar-remove-wholesparse-check.patch"))))
    (build-system gnu-build-system)
@@ -173,27 +179,7 @@ implementation offers several extensions over the standard utility.")
                        (substitute* "src/system.c"
                          (("/bin/sh")
                           (string-append bash "/bin/sh")))
-                       #t))))
-
-      ;; Work around a cross-compilation bug whereby libgnu.a would provide
-      ;; '__mktime_internal', which conflicts with the one in libc.a.
-      ,@(if (%current-target-system)
-            `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
-            '())
-
-      ;; Test #92 "link mismatch" expects "a/z: Not linked to a/y" but gets
-      ;; "a/y: Not linked to a/z" and fails, presumably due to differences in
-      ;; the order in which 'diff' traverses directories.  That leads to a
-      ;; test failure even though conceptually the test passes.  Skip it.
-      ;; Test 117 and 118 are prone to race conditions too, particularly
-      ;; when cross-compiling, so we skip those as well.  All issues have
-      ;; been fixed upstream in these commits:
-      ;; <https://git.savannah.gnu.org/cgit/tar.git/commit/?id=847a36f>
-      ;; <https://git.savannah.gnu.org/cgit/tar.git/commit/?id=64b43fd>
-      #:make-flags (list (string-append
-                          "TESTSUITEFLAGS= -k '!link mismatch,"
-                          "!directory removed before reading,"
-                          "!explicitly named directory removed before reading'"))))
+                       #t))))))
 
    ;; When cross-compiling, the 'set-shell-file-name' phase needs to be able
    ;; to refer to the target Bash.
@@ -245,16 +231,16 @@ differences.")
 (define-public diffutils
   (package
    (name "diffutils")
-   (version "3.6")
+   (version "3.7")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/diffutils/diffutils-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1mivg0fy3a6fcn535ln8nkgfj6vxh5hsxxs5h6692wxmsjyyh8fn"))
-            (patches (search-patches "diffutils-getopt.patch"))))
+              "09isrg0isjinv8c535nxsi1s86wfdfzml80dbw41dj9x3hiad9xk"))))
    (build-system gnu-build-system)
+   (native-inputs `(("perl" ,perl)))
    (synopsis "Comparing and merging files")
    (description
     "GNU Diffutils is a package containing tools for finding the
@@ -316,14 +302,14 @@ used to apply commands with arbitrarily long arguments.")
 (define-public coreutils
   (package
    (name "coreutils")
-   (version "8.30")
+   (version "8.31")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/coreutils/coreutils-"
                                 version ".tar.xz"))
             (sha256
              (base32
-              "0mxhw43d4wpqmvg0l4znk1vm10fy92biyh90lzdnqjcic2lb6cg8"))))
+              "1zg9m79x1i2nifj4kb0waf9x3i5h6ydkypkjnbsb9rnwis8rqypz"))))
    (build-system gnu-build-system)
    (inputs `(("acl"  ,acl)                        ; TODO: add SELinux
              ("gmp"  ,gmp)                        ;bignums in 'expr', yay!
@@ -365,19 +351,14 @@ used to apply commands with arbitrarily long arguments.")
                      ;; environments with long prefixes (/tmp/guix-build-...).
                      (substitute* "Makefile"
                        (("^.*tests/misc/env-S.pl.*$") ""))
-                     #t)))
-
-      ;; Work around a cross-compilation bug whereby libcoreutils.a would
-      ;; provide '__mktime_internal', which conflicts with the one in libc.a.
-      ,@(if (%current-target-system)
-            `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
-            '())))
+                     #t)))))
    (synopsis "Core GNU utilities (file, text, shell)")
    (description
-    "GNU Coreutils includes all of the basic command-line tools that are
-expected in a POSIX system.  These provide the basic file, shell and text
-manipulation functions of the GNU system.  Most of these tools offer extended
-functionality beyond that which is outlined in the POSIX standard.")
+    "GNU Coreutils package includes all of the basic command-line tools that
+are expected in a POSIX system, excluding shell.  This package is the union of
+the GNU fileutils, sh-utils, and textutils packages.  Most of these tools
+offer extended functionality beyond that which is outlined in the POSIX
+standard.")
    (license gpl3+)
    (home-page "https://www.gnu.org/software/coreutils/")))
 
@@ -435,14 +416,14 @@ change.  GNU make offers many powerful extensions over the standard utility.")
 (define-public binutils
   (package
    (name "binutils")
-   (version "2.31.1")
+   (version "2.32")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/binutils/binutils-"
                                 version ".tar.bz2"))
             (sha256
              (base32
-              "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"))
+              "0b8767nyal1bc4cyzg5h9iis8kpkln1i3wkamig75cifj1fb2f6y"))
             (patches (search-patches "binutils-loongson-workaround.patch"))))
    (build-system gnu-build-system)
 
@@ -480,6 +461,33 @@ included.")
    (license gpl3+)
    (home-page "https://www.gnu.org/software/binutils/")))
 
+(define-public binutils-gold
+  (package
+    (inherit binutils)
+    (name "binutils-gold")
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-source-shebangs 'patch-more-shebangs
+           (lambda _
+             (substitute* "gold/Makefile.in"
+               (("/bin/sh") (which "sh")))
+             #t)))
+       ,@(substitute-keyword-arguments (package-arguments binutils)
+         ; Upstream is aware of unrelocatable test failures on arm*.
+         ((#:tests? _ #f)
+          (if (any (cute string-prefix? <> (or (%current-target-system)
+                                               (%current-system)))
+                   '("i686" "x86_64"))
+              '#t '#f))
+         ((#:configure-flags flags)
+          `(cons* "--enable-gold=default"
+                 (delete "LDFLAGS=-static-libgcc" ,flags))))))
+     (native-inputs
+     `(("bc" ,bc)))
+     (inputs
+     `(("gcc:lib" ,gcc "lib")))))
+
 (define* (make-ld-wrapper name #:key
                           (target (const #f))
                           binutils
@@ -548,9 +556,9 @@ wrapper for the cross-linker for that target, called 'TARGET-ld'."
                        #t)))))
     (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.")
+     "The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any
+missing @code{-rpath} flags, and to detect any misuse of libraries outside of
+the store.")
     (home-page "https://www.gnu.org/software/guix//")
     (license gpl3+)))
 
@@ -561,15 +569,13 @@ store.")
   ;; version 2.28, GNU/Hurd used a different glibc branch.
   (package
    (name "glibc")
-   ;; Note: Always use a dot after the minor version since various places rely
-   ;; on "version-major+minor" to determine where locales are found.
-   (version "2.28")
+   (version "2.29")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
             (sha256
              (base32
-              "10iha5ynvdj5m62vgpgqbq4cwvc2yhyl2w9yyyjgfxmdmx8h145i"))
+              "0jzh58728flfh939a8k9pi1zdyalfzlxmwra7k0rzji5gvavivpk"))
             (snippet
              ;; Disable 'ldconfig' and /etc/ld.so.cache.  The latter is
              ;; required on LFS distros to avoid loading the distro's libc.so
@@ -581,12 +587,13 @@ store.")
                 #t))
             (modules '((guix build utils)))
             (patches (search-patches "glibc-ldd-x86_64.patch"
-                                     "glibc-2.28-git-fixes.patch"
+                                     "glibc-CVE-2019-7309.patch"
+                                     "glibc-CVE-2019-9169.patch"
+                                     "glibc-2.29-git-updates.patch"
                                      "glibc-hidden-visibility-ldconfig.patch"
                                      "glibc-versioned-locpath.patch"
                                      "glibc-allow-kernel-2.6.32.patch"
                                      "glibc-reinstate-prlimit64-fallback.patch"
-                                     "glibc-hurd-magic-pid.patch"
                                      "glibc-supported-locales.patch"))))
    (build-system gnu-build-system)
 
@@ -784,6 +791,7 @@ store.")
                     ("perl" ,perl)
                     ("bison" ,bison)
                     ("gettext" ,gettext-minimal)
+                    ("python" ,python-minimal)
 
                     ,@(if (hurd-target?)
                           `(("mig" ,mig)
@@ -813,6 +821,25 @@ with the Linux kernel.")
 ;; Below are old libc versions, which we use mostly to build locale data in
 ;; the old format (which the new libc cannot cope with.)
 
+(define-public glibc-2.28
+  (package
+    (inherit glibc)
+    (version "2.28")
+    (source (origin
+              (inherit (package-source glibc))
+              (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
+              (sha256
+               (base32
+                "10iha5ynvdj5m62vgpgqbq4cwvc2yhyl2w9yyyjgfxmdmx8h145i"))
+              (patches (search-patches "glibc-ldd-x86_64.patch"
+                                       "glibc-2.28-git-fixes.patch"
+                                       "glibc-hidden-visibility-ldconfig.patch"
+                                       "glibc-versioned-locpath.patch"
+                                       "glibc-allow-kernel-2.6.32.patch"
+                                       "glibc-reinstate-prlimit64-fallback.patch"
+                                       "glibc-hurd-magic-pid.patch"
+                                       "glibc-2.28-supported-locales.patch"))))))
+
 (define-public glibc-2.27
   (package
     (inherit glibc)
@@ -829,7 +856,10 @@ with the Linux kernel.")
                                        "glibc-versioned-locpath.patch"
                                        "glibc-allow-kernel-2.6.32.patch"
                                        "glibc-reinstate-prlimit64-fallback.patch"
-                                      "glibc-supported-locales.patch"))))))
+                                       "glibc-2.27-supported-locales.patch"
+                                       "glibc-CVE-2018-11236.patch"
+                                       "glibc-CVE-2018-11237.patch"))))
+    (properties `((lint-hidden-cve . ("CVE-2017-18269")))))) ; glibc-2.27-git-fixes
 
 (define-public glibc-2.26
   (package
@@ -943,30 +973,100 @@ with the Linux kernel.")
                   (("/bin/pwd") "pwd"))
                 #t))))))))
 
-(define-public glibc-locales
+(define-public (make-gcc-libc base-gcc libc)
+  "Return a GCC that targets LIBC."
+  (package (inherit base-gcc)
+           (name (string-append (package-name base-gcc) "-"
+                                (package-name libc) "-"
+                                (package-version libc)))
+           (arguments
+            (substitute-keyword-arguments
+             (ensure-keyword-arguments (package-arguments base-gcc)
+                                       '(#:implicit-inputs? #f))
+             ((#:phases phases)
+              `(modify-phases ,phases
+                 (add-before 'configure 'treat-glibc-as-system-header
+                   (lambda _
+                     (let ((libc (assoc-ref %build-inputs "libc")))
+                       ;; GCCs build processes requires that the libc
+                       ;; we're building against is on the system header
+                       ;; search path.
+                       (for-each (lambda (var)
+                                   (setenv var (string-append libc "/include")))
+                                 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
+                       #t)))))))
+           (native-inputs
+            `(,@(package-native-inputs base-gcc)
+              ,@(append (fold alist-delete (%final-inputs) '("libc" "libc:static")))
+              ("libc" ,libc)
+              ("libc:static" ,libc "static")))))
+
+(define-public (make-glibc-locales glibc)
   (package
     (inherit glibc)
     (name "glibc-locales")
     (source (origin (inherit (package-source glibc))
-                    (patches (cons (search-patch "glibc-locales.patch")
+                    ;; The patch for glibc 2.28 and earlier replaces the same
+                    ;; content, but the context in the patch is different
+                    ;; enough to fail to merge.
+                    (patches (cons (search-patch
+                                    (if (version>=? (package-version glibc)
+                                                    "2.29")
+                                        "glibc-locales.patch"
+                                        "glibc-locales-2.28.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.")
+more than 400 in total.  To use them set the @code{LOCPATH} environment variable
+to the @code{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
+         ((#:modules modules '((guix build utils)
+                               (guix build gnu-build-system)))
+          `((srfi srfi-11)
+            (gnu build locale)
+            ,@modules))
+         ((#:imported-modules modules '())
+          `((gnu build locale)
+            ,@%gnu-build-system-modules))
          ((#:phases phases)
           `(modify-phases ,phases
              (replace 'build
                (lambda _
                  (invoke "make" "localedata/install-locales"
                          "-j" (number->string (parallel-job-count)))))
+             (add-after 'build 'symlink-normalized-codesets
+               (lambda* (#:key outputs #:allow-other-keys)
+                 ;; The above phase does not install locales with names using
+                 ;; the "normalized codeset."  Thus, create symlinks like:
+                 ;;   en_US.utf8 -> en_US.UTF-8
+                 (define (locale-directory? file stat)
+                   (and (file-is-directory? file)
+                        (string-index (basename file) #\_)
+                        (string-rindex (basename file) #\.)))
+
+                 (let* ((out (assoc-ref outputs "out"))
+                        (locales (find-files out locale-directory?
+                                             #:directories? #t)))
+                   (for-each (lambda (directory)
+                               (let*-values (((base)
+                                              (basename directory))
+                                             ((name codeset)
+                                              (locale->name+codeset base))
+                                             ((normalized)
+                                              (normalize-codeset codeset)))
+                                 (unless (string=? codeset normalized)
+                                   (symlink base
+                                            (string-append (dirname directory)
+                                                           "/" name "."
+                                                           normalized)))))
+                             locales)
+                   #t)))
              (delete 'install)
              (delete 'move-static-libs)))
          ((#:configure-flags flags)
@@ -978,7 +1078,7 @@ the 'share/locale' sub-directory of this package.")
                                         ,(version-major+minor
                                           (package-version glibc)))))))))))
 
-(define-public glibc-utf8-locales
+(define-public (make-glibc-utf8-locales glibc)
   (package
     (name "glibc-utf8-locales")
     (version (package-version glibc))
@@ -1019,8 +1119,8 @@ the 'share/locale' sub-directory of this package.")
                                ;; tests---e.g., in Guile's i18n tests.
                                '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
                      #t))))
-    (inputs `(("glibc" ,glibc)
-              ("gzip" ,gzip)))
+    (native-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
@@ -1028,6 +1128,25 @@ test environments.")
     (home-page (package-home-page glibc))
     (license (package-license glibc))))
 
+(define-public glibc-locales
+  (make-glibc-locales glibc))
+(define-public glibc-utf8-locales
+  (make-glibc-utf8-locales glibc))
+
+;; Packages provided to ease use of binaries linked against the previous libc.
+(define-public glibc-locales-2.28
+  (package (inherit (make-glibc-locales glibc-2.28))
+           (name "glibc-locales-2.28")))
+(define-public glibc-utf8-locales-2.28
+  (package (inherit (make-glibc-utf8-locales glibc-2.28))
+           (name "glibc-utf8-locales-2.28")))
+
+;; These should no longer be needed.
+(define-public glibc-utf8-locales-2.27
+  (deprecated-package "glibc-utf8-locales-2.27" glibc-utf8-locales-2.28))
+(define-public glibc-locales-2.27
+  (deprecated-package "glibc-locales-2.27" glibc-locales-2.28))
+
 (define-public which
   (package
     (name "which")
@@ -1079,15 +1198,15 @@ command.")
 (define-public tzdata
   (package
     (name "tzdata")
-    (version "2018e")
+    (version "2020a")
     (source (origin
              (method url-fetch)
              (uri (string-append
-                   "https://www.iana.org/time-zones/repository/releases/tzdata"
+                   "https://data.iana.org/time-zones/releases/tzdata"
                    version ".tar.gz"))
              (sha256
               (base32
-               "0bk97fv2i5ns42prpmlaadsswdjwv0ifi7whj2s4q6l44rcqwa3b"))))
+               "18lrp0zh8m931jjlrv8lvjas4ka5dfkzdbwnbw5lwd2dlbn62wal"))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f
@@ -1133,11 +1252,11 @@ command.")
     (inputs `(("tzcode" ,(origin
                           (method url-fetch)
                           (uri (string-append
-                                "http://www.iana.org/time-zones/repository/releases/tzcode"
+                                "https://data.iana.org/time-zones/releases/tzcode"
                                 version ".tar.gz"))
                           (sha256
                            (base32
-                            "1kpb02631s58i068mwq63xlamcv1ffj4p6y4wpb9kdl01vr0qd6a"))))))
+                            "0sfnlqw1p93r7klny69rwr94fh22mz632h52phgzfgg01q9gfakx"))))))
     (home-page "https://www.iana.org/time-zones")
     (synopsis "Database of current and historical time zones")
     (description "The Time Zone Database (often called tz or zoneinfo)
@@ -1156,22 +1275,24 @@ and daylight-saving rules.")
   (hidden-package
    (package
      (inherit tzdata)
-     (version "2018d")
+     (version "2019b")
      (source (origin
                (method url-fetch)
-               (uri (string-append "https://www.iana.org/time-zones/repository"
-                                   "/releases/tzdata" version ".tar.gz"))
+               (uri (string-append
+                     "https://data.iana.org/time-zones/releases/tzdata"
+                     version ".tar.gz"))
                (sha256
                 (base32
-                 "0m6020dnk9r40z7k36jp13fa06xip3hn0fdx3nly66jzxgffs1ji"))))
-     (inputs `(("tzcode" ,(origin
-                            (method url-fetch)
-                            (uri (string-append
-                                  "http://www.iana.org/time-zones/repository/releases/tzcode"
-                                  version ".tar.gz"))
-                            (sha256
-                             (base32
-                              "1nd882yhsazmcfqmcqyfig3axycryl30gmizgqhqsx5dpa2lxr3x")))))))))
+                 "0r0clnlslwm15m1c61dinf1fi9ffgl6aipng7i7yryfwj0n0kn85"))))
+     (inputs
+      `(("tzcode" ,(origin
+                     (method url-fetch)
+                     (uri (string-append
+                           "https://data.iana.org/time-zones/releases/tzcode"
+                           version ".tar.gz"))
+                     (sha256
+                      (base32
+                       "0vbmswvv3li25s31shyllq5v24449lxnrki9hr043nipjd09sirf")))))))))
 
 (define-public libiconv
   (package