gnu: itstool: Add python2-libxml2 to propagated-inputs.
[jackhill/guix/guix.git] / gnu / packages / base.scm
index 698a6b6..31331a1 100644 (file)
   #: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:
 ;;;
@@ -98,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
@@ -133,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
@@ -149,14 +156,15 @@ standard utility.")
 (define-public patch
   (package
    (name "patch")
-    (version "2.7.4")
+    (version "2.7.5")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnu/patch/patch-"
                                   version ".tar.xz"))
               (sha256
                (base32
-                "02gikxjvcxysr4l65c8vivgz62xmalp0av5ypzff8vqhrq3vpb0f"))))
+                "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx"))
+              (patches (list (search-patch "patch-hurd-path-max.patch")))))
    (build-system gnu-build-system)
    (native-inputs `(("ed", ed)))
    (synopsis "Apply differences to originals, with optional backups")
@@ -202,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
@@ -356,6 +370,72 @@ 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")
@@ -386,7 +466,17 @@ included.")
 
    (arguments
     `(#:out-of-source? #t
-      #:parallel-build? #f ; There's at least one race in the build.
+
+      ;; 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"
@@ -425,7 +515,8 @@ 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'.
@@ -449,8 +540,13 @@ 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"))
@@ -484,9 +580,11 @@ included.")
 
    (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
@@ -537,14 +635,75 @@ the 'share/locale' sub-directory of this package.")
             (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")
-                                        "/share/locale")))))))))
+                                        "/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 "2014j")
+    (version "2015c")
     (source (origin
              (method url-fetch)
              (uri (string-append
@@ -552,7 +711,7 @@ the 'share/locale' sub-directory of this package.")
                    version ".tar.gz"))
              (sha256
               (base32
-               "038fvj6zf51k6z9sbbxbj87ajaf69l3whal2vwshbm4l0qr71n52"))))
+               "0nin48g5dmkfgckp25bngxchn3sw3yyjss5sq7gs5xspbxgsq3w6"))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f
@@ -599,7 +758,7 @@ the 'share/locale' sub-directory of this package.")
                                 version ".tar.gz"))
                           (sha256
                            (base32
-                            "1qpd12imy7q5hb5fhk48mfw65s0xlrkmms0zr2gk0mj88qjn3m3z"))))))
+                            "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)