summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/algebra.scm15
-rw-r--r--gnu/packages/aspell.scm17
-rw-r--r--gnu/packages/autotools.scm10
-rw-r--r--gnu/packages/backup.scm47
-rw-r--r--gnu/packages/bash.scm3
-rw-r--r--gnu/packages/boost.scm59
-rw-r--r--gnu/packages/cmake.scm14
-rw-r--r--gnu/packages/code.scm18
-rw-r--r--gnu/packages/commencement.scm36
-rw-r--r--gnu/packages/cyrus-sasl.scm17
-rw-r--r--gnu/packages/dbm.scm6
-rw-r--r--gnu/packages/documentation.scm12
-rw-r--r--gnu/packages/emacs-xyz.scm15
-rw-r--r--gnu/packages/file.scm6
-rw-r--r--gnu/packages/firmware.scm5
-rw-r--r--gnu/packages/freedesktop.scm6
-rw-r--r--gnu/packages/fribidi.scm5
-rw-r--r--gnu/packages/games.scm48
-rw-r--r--gnu/packages/ghostscript.scm19
-rw-r--r--gnu/packages/glib.scm8
-rw-r--r--gnu/packages/gnupg.scm43
-rw-r--r--gnu/packages/groff.scm22
-rw-r--r--gnu/packages/guile-wm.scm4
-rw-r--r--gnu/packages/guile.scm7
-rw-r--r--gnu/packages/icu4c.scm35
-rw-r--r--gnu/packages/kerberos.scm21
-rw-r--r--gnu/packages/linux.scm178
-rw-r--r--gnu/packages/man.scm2
-rw-r--r--gnu/packages/openldap.scm38
-rw-r--r--gnu/packages/patches/aspell-default-dict-dir.patch24
-rw-r--r--gnu/packages/patches/aspell-gcc-compat.patch31
-rw-r--r--gnu/packages/patches/bash-linux-pgrp-pipe.patch32
-rw-r--r--gnu/packages/patches/bc-fix-cross-compilation.patch171
-rw-r--r--gnu/packages/patches/boost-dumpversion.patch24
-rw-r--r--gnu/packages/patches/cyrus-sasl-ac-try-run-fix.patch12
-rw-r--r--gnu/packages/patches/file-CVE-2018-10360.patch27
-rw-r--r--gnu/packages/patches/file-CVE-2019-18218.patch55
-rw-r--r--gnu/packages/patches/guile-sqlite3-fix-cross-compilation.patch55
-rw-r--r--gnu/packages/patches/python-2.7-search-paths.patch10
-rw-r--r--gnu/packages/patches/python-3-search-paths.patch11
-rw-r--r--gnu/packages/patches/python-cross-compile.patch145
-rw-r--r--gnu/packages/perl.scm7
-rw-r--r--gnu/packages/pkg-config.scm13
-rw-r--r--gnu/packages/pulseaudio.scm22
-rw-r--r--gnu/packages/python.scm54
-rw-r--r--gnu/packages/shells.scm9
-rw-r--r--gnu/packages/swig.scm1
-rw-r--r--gnu/packages/tcl.scm28
-rw-r--r--gnu/packages/texinfo.scm63
-rw-r--r--gnu/packages/tls.scm62
-rw-r--r--gnu/packages/version-control.scm40
-rw-r--r--gnu/packages/web.scm25
-rw-r--r--gnu/packages/xml.scm4
-rw-r--r--gnu/packages/xorg.scm60
54 files changed, 1357 insertions, 344 deletions
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index f626c0de97..00bbae81e3 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017, 2019 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -682,15 +683,23 @@ binary.")
              (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
              (sha256
               (base32
-               "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
+               "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))
+             (patches (search-patches "bc-fix-cross-compilation.patch"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("ed" ,ed)
+     `(("automake" ,automake)
+       ("autoconf" ,autoconf)
+       ("ed" ,ed)
        ("flex" ,flex)
        ("texinfo" ,texinfo)))
     (arguments
      '(#:configure-flags
-       (list "--with-readline")))
+       (list "--with-readline")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'autogen
+           (lambda _
+             (invoke "autoreconf" "-vif"))))))
     (home-page "https://www.gnu.org/software/bc/")
     (synopsis "Arbitrary precision numeric processing language")
     (description
diff --git a/gnu/packages/aspell.scm b/gnu/packages/aspell.scm
index af38c149c2..56d69fdb05 100644
--- a/gnu/packages/aspell.scm
+++ b/gnu/packages/aspell.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
@@ -38,7 +38,7 @@
 (define-public aspell
   (package
     (name "aspell")
-    (version "0.60.6.1")
+    (version "0.60.8")
     (source
      (origin
       (method url-fetch)
@@ -46,9 +46,8 @@
                           version ".tar.gz"))
       (sha256
        (base32
-        "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm"))
-      (patches (search-patches "aspell-default-dict-dir.patch"
-                               "aspell-gcc-compat.patch"))))
+        "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
+      (patches (search-patches "aspell-default-dict-dir.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -65,14 +64,6 @@
                  (("\"filter-path(.*)DICT_DIR" _ middle)
                   (string-append "\"filter-path" middle
                                  "\"" libdir "\"")))
-               #t)))
-         (add-after 'install 'wrap-aspell
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((bin/aspell (string-append (assoc-ref outputs "out")
-                                              "/bin/aspell")))
-               (wrap-program bin/aspell
-                 '("ASPELL_CONF" "" =
-                   ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))
                #t))))))
     (inputs `(("perl" ,perl)))
 
diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm
index ceb70dfee7..98f31f6bca 100644
--- a/gnu/packages/autotools.scm
+++ b/gnu/packages/autotools.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -354,21 +355,22 @@ Makefile, simplifying the entire process for the developer.")
 
        ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
        ;; <http://hydra.gnu.org/build/181662>.
-       #:tests? ,(not (string-prefix? "mips64"
-                                      (or (%current-target-system)
+       ;; Also, do not run tests when cross compiling
+       #:tests? ,(not (or (%current-target-system)
+                          (string-prefix? "mips64"
                                           (%current-system))))
 
        #:phases
        (modify-phases %standard-phases
          (add-before 'check 'pre-check
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
              ;; Run the test suite in parallel, if possible.
              (setenv "TESTSUITEFLAGS"
                      (string-append
                       "-j"
                       (number->string (parallel-job-count))))
            ;; Patch references to /bin/sh.
-           (let ((bash (assoc-ref inputs "bash")))
+           (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
              (substitute* "tests/testsuite"
                (("/bin/sh")
                 (string-append bash "/bin/sh")))
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 0894cb38bf..058f9c8d6f 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -230,24 +231,34 @@ backups (called chunks) to allow easy burning to CD/DVD.")
                (("/bin/pwd") (which "pwd")))
              #t))
          (replace 'check
-           (lambda _
-             ;; XXX: The test_owner_parse, test_read_disk, and
-             ;; test_write_disk_lookup tests expect user 'root' to exist, but
-             ;; the chroot's /etc/passwd doesn't have it.  Turn off those tests.
-             ;;
-             ;; XXX: Adjust test that fails with zstd 1.4.1 because the default
-             ;; options compresses two bytes better than this test expects.
-             ;; https://github.com/libarchive/libarchive/issues/1226
-             (substitute* "libarchive/test/test_write_filter_zstd.c"
-               (("compression-level\", \"6\"")
-                "compression-level\", \"7\""))
-
-             ;; The tests allow one to disable tests matching a globbing pattern.
-             (invoke "make" "libarchive_test" "bsdcpio_test" "bsdtar_test")
-             ;; XXX: This glob disables too much.
-             (invoke "./libarchive_test" "^test_*_disk*")
-             (invoke "./bsdcpio_test" "^test_owner_parse")
-             (invoke "./bsdtar_test")))
+           (lambda* (#:key (tests? #t) #:allow-other-keys)
+             (if tests?
+		 ;; XXX: The test_owner_parse, test_read_disk, and
+		 ;; test_write_disk_lookup tests expect user 'root' to
+		 ;; exist, but the chroot's /etc/passwd doesn't have
+		 ;; it.  Turn off those tests.
+		 ;;
+		 ;; XXX: Adjust test that fails with zstd 1.4.1
+		 ;; because the default options compresses two bytes
+		 ;; better than this test expects.
+		 ;; https://github.com/libarchive/libarchive/issues/1226
+                 (begin
+                   (substitute* "libarchive/test/test_write_filter_zstd.c"
+		     (("compression-level\", \"6\"")
+		      "compression-level\", \"7\""))
+
+		   ;; The tests allow one to disable tests matching a globbing pattern.
+		   (invoke "make"
+			   "libarchive_test"
+			   "bsdcpio_test"
+			   "bsdtar_test")
+
+		   ;; XXX: This glob disables too much.
+		   (invoke "./libarchive_test" "^test_*_disk*")
+		   (invoke "./bsdcpio_test" "^test_owner_parse")
+		   (invoke "./bsdtar_test"))
+                 ;; Tests may be disabled if cross-compiling.
+                 (format #t "Test suite not run.~%"))))
          (add-after 'install 'add--L-in-libarchive-pc
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out     (assoc-ref outputs "out"))
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index bb2397fafa..9ed0e2dae4 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -116,7 +116,8 @@ number/base32-hash tuples, directly usable in the 'patch-series' form."
                (base32
                 "0kgvfwqdcd90waczf4gx39xnrxzijhjrzyzv7s8v4w31qqm0za5l"))
               (patch-flags '("-p0"))
-              (patches %patch-series-5.0)))
+              (patches (cons (search-patch "bash-linux-pgrp-pipe.patch")
+                             %patch-series-5.0))))
      (version (string-append version "." (number->string (length %patch-series-5.0))))
      (build-system gnu-build-system)
 
diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index 2ef0591223..1d241ac6ff 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -55,6 +56,8 @@
                            (string-append "https://dl.bintray.com/boostorg/release/"
                                           version "/source/boost_"
                                           version-with-underscores ".tar.bz2"))))
+              (patches
+               (search-patches "boost-dumpversion.patch"))
               (sha256
                (base32
                 "0y47nc7w0arwgj4x1phadxbvl7wyfcgknbz5kv8lzpl98wsyh2j3"))))
@@ -63,7 +66,9 @@
               ("zlib" ,zlib)))
     (native-inputs
      `(("perl" ,perl)
-       ("python" ,python-2)
+       ,@(if (%current-target-system)
+             '()
+             `(("python" ,python-2)))
        ("tcsh" ,tcsh)))
     (arguments
      `(#:tests? #f
@@ -77,7 +82,24 @@
 
              ;; Set the RUNPATH to $libdir so that the libs find each other.
              (string-append "linkflags=-Wl,-rpath="
-                            (assoc-ref %outputs "out") "/lib"))
+                            (assoc-ref %outputs "out") "/lib")
+             ,@(if (%current-target-system)
+                   `("--user-config=user-config.jam"
+                     ;; Python is not supported when cross-compiling.
+                     "--without-python"
+                     "binary-format=elf"
+                     "target-os=linux"
+                     ,@(cond
+                        ((string-prefix? "arm" (%current-target-system))
+                         '("abi=aapcs"
+                           "address-model=32"
+                           "architecture=arm"))
+                        ((string-prefix? "aarch64" (%current-target-system))
+                         '("abi=aapcs"
+                           "address-model=64"
+                           "architecture=arm"))
+                        (else '())))
+                   '()))
        #:phases
        (modify-phases %standard-phases
          (delete 'bootstrap)
@@ -95,6 +117,14 @@
                (setenv "SHELL" (which "sh"))
                (setenv "CONFIG_SHELL" (which "sh"))
 
+               ,@(if (%current-target-system)
+                     `((call-with-output-file "user-config.jam"
+                          (lambda (port)
+                            (format port
+                                    "using gcc : cross : ~a-c++ ;"
+                                    ,(%current-target-system)))))
+                     '())
+
                (invoke "./bootstrap.sh"
                        (string-append "--prefix=" out)
                        ;; Auto-detection looks for ICU only in traditional
@@ -109,17 +139,20 @@
          (replace 'install
            (lambda* (#:key make-flags #:allow-other-keys)
              (apply invoke "./b2" "install" make-flags)))
-         (add-after 'install 'provide-libboost_python
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               ;; Boost can build support for both Python 2 and Python 3 since
-               ;; version 1.67.0, and suffixes each library with the Python
-               ;; version.  Many consumers only check for libboost_python
-               ;; however, so we provide it here as suggested in
-               ;; <https://github.com/boostorg/python/issues/203>.
-               (with-directory-excursion (string-append out "/lib")
-                 (symlink "libboost_python27.so" "libboost_python.so"))
-               #t))))))
+         ,@(if (%current-target-system)
+               '()
+               '((add-after 'install 'provide-libboost_python
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        ;; Boost can build support for both Python 2 and
+                        ;; Python 3 since version 1.67.0, and suffixes each
+                        ;; library with the Python version.  Many consumers
+                        ;; only check for libboost_python however, so we
+                        ;; provide it here as suggested in
+                        ;; <https://github.com/boostorg/python/issues/203>.
+                        (with-directory-excursion (string-append out "/lib")
+                          (symlink "libboost_python27.so" "libboost_python.so"))
+                        #t))))))))
 
     (home-page "https://www.boost.org")
     (synopsis "Peer-reviewed portable C++ source libraries")
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index e2c244c1a7..5c9b9810c8 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -145,16 +146,17 @@
          (replace 'configure
            (lambda* (#:key (configure-flags '()) #:allow-other-keys)
              (apply invoke "./configure" configure-flags))))))
-    (inputs
+    (native-inputs
      `(("bzip2" ,bzip2)
        ("curl" ,curl)
        ("expat" ,expat)
        ("file" ,file)
        ("libarchive" ,libarchive)
        ("libuv" ,libuv)
-       ("ncurses" ,ncurses) ; required for ccmake
        ("rhash" ,rhash)
        ("zlib" ,zlib)))
+    (inputs
+     `(("ncurses" ,ncurses))) ; required for ccmake
     (native-search-paths
      (list (search-path-specification
             (variable "CMAKE_PREFIX_PATH")
@@ -219,6 +221,14 @@ and workspaces that can be used in the compiler environment of your choice.")
                (append (search-patches "cmake-curl-certificates.patch")
                        (origin-patches (package-source cmake))))))))
 
+(define-public cmake-minimal-cross
+  (package
+    (inherit cmake-minimal)
+    (name "cmake-minimal-cross")
+    (native-search-paths '())
+    (search-paths
+     (package-native-search-paths cmake-minimal))))
+
 (define-public cmake-3.15.5
   ;; CMake 3.15.5 fixes some issues, but declare another version to
   ;; avoid triggering the rebuild of all CMake-based packages.
diff --git a/gnu/packages/code.scm b/gnu/packages/code.scm
index 20726cfebc..0af548a722 100644
--- a/gnu/packages/code.scm
+++ b/gnu/packages/code.scm
@@ -29,6 +29,7 @@
 
 (define-module (gnu packages code)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -641,9 +642,24 @@ the C, C++, C++/CLI, Objective‑C, C#, and Java programming languages.")
             ;; overrides this to be in PREFIX/doc.  Fix this.
             (substitute* "doc/Makefile.in"
               (("^docdir = .*$") "docdir = @docdir@\n"))
+            #t))
+        (add-after 'unpack 'fix-configure
+          (lambda* (#:key inputs native-inputs #:allow-other-keys)
+            ;; Replace outdated config.sub and config.guess:
+            (with-directory-excursion "config"
+              (for-each (lambda (file)
+                          (install-file
+                           (string-append (assoc-ref
+                                           (or native-inputs inputs) "automake")
+                                          "/share/automake-"
+                                          ,(version-major+minor
+                                            (package-version automake))
+                                          "/" file) "."))
+                        '("config.sub" "config.guess")))
             #t)))))
    (native-inputs
-    `(("texinfo" ,texinfo)))
+    `(("texinfo" ,texinfo)
+      ("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
    (synopsis "Code reformatter")
    (description
     "Indent is a program that makes source code easier to read by
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 6a382c7517..8bf7704598 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1716,20 +1716,13 @@ exec " gcc "/bin/" program
        #:implicit-inputs? #f
        ,@(package-arguments m4)))))
 
-(define m4-boot0*
-  (package
-    ;; TODO: On the next rebuild cycle, use M4-BOOT0 as is.
-    (inherit m4-boot0)
-    (name "m4")))
-
 (define bison-boot0
   ;; This Bison is needed to build MiG so we need it early in the process.
   ;; Recent versions of Linux-Libre headers also depend on this.
   (package
     (inherit bison)
-    ;; TODO: On the next build cycle, do:
-    ;;(name "bison-boot0")
-    (propagated-inputs `(("m4" ,m4-boot0*)))
+    (name "bison-boot0")
+    (propagated-inputs `(("m4" ,m4-boot0)))
     (native-inputs `(("perl" ,perl-boot0)))
     (inputs (%boot0-inputs))                      ;remove Flex...
     (arguments
@@ -1737,17 +1730,6 @@ exec " gcc "/bin/" program
        #:implicit-inputs? #f
        #:guile ,%bootstrap-guile
 
-       ;; XXX: These flags should be unconditional, but for now
-       ;; we just add them on x86 to avoid a full rebuild.
-       ;; TODO: On the next core-updates, use
-       ;; 'substitute-keyword-arguments' to inherit them from
-       ;; BISON.
-       ,@(if (member (%current-system)
-                     '("x86_64-linux" "i686-linux"))
-             '(#:parallel-build? #f
-               #:parallel-tests? #f)
-             '())
-
        ;; Zero timestamps in liby.a; this must be done
        ;; explicitly here because the bootstrap Binutils don't
        ;; do that (default is "cru".)
@@ -1758,19 +1740,16 @@ exec " gcc "/bin/" program
                            "RANLIB=ranlib")
                           (_
                            "RANLIB=ranlib -D"))
-                      "V=1")))))
+                      "V=1")
+
+       ,@(package-arguments bison)))))
 
 (define flex-boot0
   ;; This Flex is needed to build MiG as well as Linux-Libre headers.
   (package
     (inherit flex)
     (native-inputs `(("bison" ,bison-boot0)))
-    (propagated-inputs
-     ;; XXX: Here we use an 'm4-boot0' package that's not eq? so that it
-     ;; appears twice in '%build-inputs', like when we were using
-     ;; 'package-with-explicit-inputs'.
-     ;; TODO: Remove this hack on the next rebuild cycle.
-     `(("m4" ,(package (inherit m4-boot0*)))))
+    (propagated-inputs `(("m4" ,m4-boot0)))
     (inputs (%boot0-inputs))
     (arguments
      `(#:implicit-inputs? #f
@@ -2398,9 +2377,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
 
 (define gnu-make-final
   ;; The final GNU Make, which uses the final Guile.
-  ;; FIXME: This is a mistake: we shouldn't be propagating GUILE-FINAL to
-  ;; PKG-CONFIG.
-  ;; TODO: Fix that on the next rebuild cycle.
   (let ((pkg-config (package
                       (inherit %pkg-config)       ;the native pkg-config
                       (inputs `(("guile" ,guile-final)
diff --git a/gnu/packages/cyrus-sasl.scm b/gnu/packages/cyrus-sasl.scm
index f84136e631..3e65a1faf6 100644
--- a/gnu/packages/cyrus-sasl.scm
+++ b/gnu/packages/cyrus-sasl.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013, 2014, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@
 
 (define-module (gnu packages cyrus-sasl)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages kerberos)
   #:use-module (gnu packages tls)
@@ -41,8 +43,13 @@
                         "ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-"
                         version ".tar.gz")))
             (sha256 (base32
-                     "1m85zcpgfdhm43cavpdkhb1s2zq1b31472hq1w1gs3xh94anp1i6"))))
+                     "1m85zcpgfdhm43cavpdkhb1s2zq1b31472hq1w1gs3xh94anp1i6"))
+            (patches (search-patches "cyrus-sasl-ac-try-run-fix.patch"))))
    (build-system gnu-build-system)
+   (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
    (inputs `(("gdbm" ,gdbm)
              ("openssl" ,openssl)))
    (propagated-inputs
@@ -57,7 +64,13 @@
       ;; 'plugin_common.c'.  When building the shared libraries there, libtool
       ;; ends up doing "ln -s plugin_common.lo plugin_common.o", which can
       ;; fail with EEXIST when building things in parallel.
-      #:parallel-build? #f))
+      #:parallel-build? #f
+
+      #:phases
+      (modify-phases %standard-phases
+        (add-after 'unpack 'autogen
+          (lambda _
+            (invoke "autoreconf" "-vif"))))))
    (synopsis "Simple Authentication Security Layer implementation")
    (description
     "SASL (Simple Authentication Security Layer) is an Internet
diff --git a/gnu/packages/dbm.scm b/gnu/packages/dbm.scm
index 5191c475c2..84c5817a79 100644
--- a/gnu/packages/dbm.scm
+++ b/gnu/packages/dbm.scm
@@ -55,7 +55,7 @@
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
+           (lambda* (#:key target outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
                    (doc (assoc-ref outputs "doc")))
                ;; '--docdir' is not honored, so we need to patch.
@@ -74,6 +74,10 @@
                              '("--build=aarch64-unknown-linux-gnu")
                              '())
 
+                       ,@(if (%current-target-system)         ; cross building
+                             '((string-append "--host=" target))
+                             '())
+
                        ;; Remove 7 MiB of .a files.
                        "--disable-static"
 
diff --git a/gnu/packages/documentation.scm b/gnu/packages/documentation.scm
index 19c42b00eb..eda8ca3368 100644
--- a/gnu/packages/documentation.scm
+++ b/gnu/packages/documentation.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages python)
   #:use-module (gnu packages bison)
@@ -145,7 +147,15 @@ markup) can be customized and extended by the user.")
     (inputs
      `(("bash" ,bash-minimal)))
     (arguments
-     `(#:test-target "tests"
+     ;; Force cmake to use iconv header from cross-libc instead of the one
+     ;; from native libc.
+     `(,@(if (%current-target-system)
+             '(#:configure-flags
+               (list (string-append "-DICONV_INCLUDE_DIR="
+                                    (assoc-ref %build-inputs "cross-libc")
+                                    "/include")))
+             '())
+       #:test-target "tests"
        #:phases (modify-phases %standard-phases
                   (add-before 'configure 'patch-sh
                               (lambda* (#:key inputs #:allow-other-keys)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 7cb949eb84..a8fe1046be 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -9460,15 +9460,12 @@ It should enable you to implement low-level X11 applications.")
                ;; Add a .desktop file to xsessions
                (mkdir-p xsessions)
                (mkdir-p bin)
-               (with-output-to-file
-                   (string-append xsessions "/exwm.desktop")
-                 (lambda _
-                   (format #t "[Desktop Entry]~@
-                     Name=~a~@
-                     Comment=~a~@
-                     Exec=~a~@
-                     TryExec=~:*~a~@
-                     Type=Application~%" ,name ,synopsis exwm-executable)))
+               (make-desktop-entry-file
+                (string-append xsessions "/exwm.desktop")
+                #:name ,name
+                #:comment ,synopsis
+                #:exec exwm-executable
+                #:try-exec exwm-executable)
                ;; Add a shell wrapper to bin
                (with-output-to-file exwm-executable
                  (lambda _
diff --git a/gnu/packages/file.scm b/gnu/packages/file.scm
index 9ba51d1b74..cf770297c4 100644
--- a/gnu/packages/file.scm
+++ b/gnu/packages/file.scm
@@ -30,15 +30,15 @@
 (define-public file
   (package
     (name "file")
-    (version "5.33")
+    (version "5.37")
     (source (origin
               (method url-fetch)
               (uri (string-append "ftp://ftp.astron.com/pub/file/file-"
                                   version ".tar.gz"))
-              (patches (search-patches "file-CVE-2018-10360.patch"))
+              (patches (search-patches "file-CVE-2019-18218.patch"))
               (sha256
                (base32
-                "1iipnwjkag7q04zjkaqic41r9nlw0ml6mhqian6qkkbisb1whlhw"))))
+                "0zz0p9bqnswfx0c16j8k62ivjq1m16x10xqv4hy9lcyxyxkkkhg9"))))
    (build-system gnu-build-system)
 
    ;; When cross-compiling, this package depends upon a native install of
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index cc92c228ad..467a676faf 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -59,7 +60,7 @@
      '(#:phases
        (modify-phases %standard-phases
          (add-before 'configure 'pre-configure
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (chdir "target_firmware")
 
              ;; 'configure' is a simple script that runs 'cmake' with
@@ -67,7 +68,7 @@
              (substitute* "configure"
                (("^TOOLCHAIN=.*$")
                 (string-append "TOOLCHAIN="
-                               (assoc-ref inputs "cross-gcc")
+                               (assoc-ref (or native-inputs inputs) "cross-gcc")
                                "\n")))
              #t))
          (replace 'install
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index e7e17b99e2..708fdae2f1 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -554,7 +554,7 @@ Python.")
 (define-public wayland
   (package
     (name "wayland")
-    (version "1.17.0")
+    (version "1.18.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://wayland.freedesktop.org/releases/"
@@ -590,7 +590,7 @@ applications, X servers (rootless or fullscreen) or other display servers.")
 (define-public wayland-protocols
   (package
     (name "wayland-protocols")
-    (version "1.17")
+    (version "1.18")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -598,7 +598,7 @@ applications, X servers (rootless or fullscreen) or other display servers.")
                     "wayland-protocols-" version ".tar.xz"))
               (sha256
                (base32
-                "0bw1sqixqk2a7mqw630cs4dlgcp5yib90vyikzm3lr05jz7ij4yz"))))
+                "1cvl93h83ymbfhb567jv5gzyq08181w7c46rsw4xqqqpcvkvfwrx"))))
     (build-system gnu-build-system)
     (inputs
      `(("wayland" ,wayland)))
diff --git a/gnu/packages/fribidi.scm b/gnu/packages/fribidi.scm
index 61aa6fd726..ada7c261dd 100644
--- a/gnu/packages/fribidi.scm
+++ b/gnu/packages/fribidi.scm
@@ -29,7 +29,7 @@
   (package
     (replacement fribidi/fixed)
     (name "fribidi")
-    (version "1.0.5")
+    (version "1.0.7")
     (source
       (origin
         (method url-fetch)
@@ -38,7 +38,8 @@
                         "/download/v" version "/fribidi-" version
                          ".tar.bz2"))
         (sha256
-          (base32 "1kp4b1hpx2ky20ixgy2xhj5iygfl7ps5k9kglh1z5i7mhykg4r3a"))))
+         (base32 "0pckda4fcn0aw32lpycwdp25r2m7vca8zspq815ppi9gkwgg5das"))
+        (patches (search-patches "fribidi-CVE-2019-18397.patch"))))
     (build-system gnu-build-system)
     (synopsis "Implementation of the Unicode bidirectional algorithm")
     (description
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 07bef94c51..34e7047bae 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -5237,19 +5237,13 @@ Crowther & Woods, its original authors, in 1995.  It has been known as
                         (copy-recursively "game" (string-append data "/game"))
                         ;; launcher
                         (mkdir-p applications)
-                        (with-output-to-file (string-append applications "/"
-                                                            ,name ".desktop")
-                          (lambda ()
-                            (display
-                             (string-append
-                              "[Desktop Entry]
-Name=ToME4
-Comment=" ,synopsis "\n"
-"Exec=" ,name "\n"
-"Icon=" icon "\n"
-"Terminal=false
-Type=Application
-Categories=Game;RolePlaying;\n")))))
+                        (make-desktop-entry-file
+                         (string-append applications "/" ,name ".desktop")
+                         #:name "ToME4"
+                         #:comment ,synopsis
+                         #:exec ,name
+                         #:icon icon
+                         #:categories '("Game" "RolePlaying")))
                       #t)))))
     (home-page "https://te4.org")
     (description "Tales of Maj’Eyal (ToME) RPG, featuring tactical turn-based
@@ -7532,22 +7526,18 @@ on items and player adaptability for character progression.")
            ;; game, so we borrow SCUMMVM's.
            (let ((apps (string-append out "/share/applications")))
              (mkdir-p apps)
-             (with-output-to-file (string-append apps "/drascula.desktop")
-               (lambda _
-                 (format #t
-                         "[Desktop Entry]~@
-                     Name=Drascula: The Vampire Strikes Back~@
-                     GenericName=Drascula~@
-                     Exec=~a/bin/drascula~@
-                     Icon=~a/share/icons/hicolor/scalable/apps/scummvm.svg~@
-                     Categories=AdventureGame;Game;RolePlaying;~@
-                     Keywords=game;adventure;roleplaying;2D,fantasy;~@
-                     Comment=Classic 2D point and click adventure game~@
-                     Comment[de]=klassisches 2D-Abenteuerspiel in Zeigen-und-Klicken-Manier~@
-                     Comment[fr]=Jeux classique d'aventure pointer-et-cliquer en 2D~@
-                     Comment[it]=Gioco classico di avventura punta e clicca 2D~@
-                     Type=Application~%"
-                         out scummvm))))
+             (make-desktop-entry-file
+              (string-append apps "/drascula.desktop")
+              #:name "Drascula: The Vampire Strikes Back"
+              #:generic-name "Drascula"
+              #:exec (string-append out "/bin/drascula")
+              #:icon (string-append scummvm "/share/icons/hicolor/scalable/apps/scummvm.svg")
+              #:categories '("AdventureGame" "Game" "RolePlaying")
+              #:keywords '("game" "adventure" "roleplaying" "2D" "fantasy")
+              #:comment '((#f "Classic 2D point and click adventure game")
+                          ("de" "Klassisches 2D-Abenteuerspiel in Zeigen-und-Klicken-Manier")
+                          ("fr" "Jeu classique d'aventure pointer-et-cliquer en 2D")
+                          ("it" "Gioco classico di avventura punta e clicca 2D"))))
            #t))))
     (native-inputs
      `(("bash" ,bash)
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 3b74a96966..7839ac5b72 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -84,6 +85,24 @@ Consortium standard (ICC), approved as ISO 15076-1.")
             (sha256 (base32
                      "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
    (build-system gnu-build-system)
+   (native-inputs
+    `(("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
+   (arguments
+    `(#:phases
+      (modify-phases %standard-phases
+        (add-after 'unpack 'fix-configure
+          (lambda* (#:key inputs native-inputs #:allow-other-keys)
+            ;; Replace outdated config.sub and config.guess:
+            (for-each (lambda (file)
+                        (install-file
+                         (string-append (assoc-ref
+                                         (or native-inputs inputs) "automake")
+                                        "/share/automake-"
+                                        ,(version-major+minor
+                                          (package-version automake))
+                                        "/" file) "."))
+                      '("config.sub" "config.guess"))
+            #t)))))
    (synopsis "Library for handling paper sizes")
    (description
     "The paper library and accompanying files are intended to provide a simple
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index b3e85f8df9..8c3a077e0d 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -204,6 +204,14 @@ shared NFS home directories.")
 
       #:phases
       (modify-phases %standard-phases
+        (add-after 'unpack 'patch-dbus-launch-path
+          (lambda* (#:key inputs #:allow-other-keys)
+            (let ((dbus (assoc-ref inputs "dbus")))
+              (substitute* "gio/gdbusaddress.c"
+                (("command_line = g_strdup_printf \\(\"dbus-launch")
+                 (string-append "command_line = g_strdup_printf (\""
+                                dbus "/bin/dbus-launch")))
+              #t)))
         (add-before 'build 'pre-build
           (lambda* (#:key inputs outputs #:allow-other-keys)
             ;; For tests/gdatetime.c.
diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index f71c627781..7f01f8a0a6 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018, 2019 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -97,6 +98,31 @@
             (("namespace=errnos") "pkg_namespace=errnos"))
           #t))))
     (build-system gnu-build-system)
+    (arguments
+     (if (%current-target-system)
+         `(#:modules ((ice-9 match)
+                      (guix build gnu-build-system)
+                      (guix build utils))
+           #:phases
+           (modify-phases %standard-phases
+             ;; When cross-compiling, some platform specific properties cannot
+             ;; be detected. Create a symlink to the appropriate platform
+             ;; file. See Cross-Compiling section at:
+             ;; https://github.com/gpg/libgpg-error/blob/master/README
+             (add-after 'unpack 'cross-symlinks
+               (lambda* (#:key target inputs #:allow-other-keys)
+                 (let ((triplet
+                        (match (string-take target
+                                            (string-index target #\-))
+                          ("armhf" "arm-unknown-linux-gnueabi")
+                          (x
+                           (string-append x "-unknown-linux-gnu")))))
+                   (symlink
+                    (string-append "lock-obj-pub." triplet ".h")
+                    "src/syscfg/lock-obj-pub.linux-gnu.h"))
+                 #t))))
+         '()))
+    (native-inputs `(("gettext" ,gettext-minimal)))
     (home-page "https://gnupg.org")
     (synopsis "Library of error values for GnuPG components")
     (description
@@ -468,11 +494,26 @@ gpgpme starting with version 1.7.")
                 "1mhc5m4xygkfj7x18f8apiqpfdn9mrql0am5sk13cf5xn8x1r63z"))
               (file-name (string-append name "-" version "-checkout"))))
     (build-system gnu-build-system)
+    (arguments
+     ;; When cross-compiling, the bash script libgcrypt-config provided by
+     ;; libgcrypt must be accessible during configure phase.
+     `(,@(if (%current-target-system)
+             '(#:phases
+               (modify-phases %standard-phases
+                 (add-before 'configure 'add-libgrypt-config
+                   (lambda _
+                     (setenv "PATH" (string-append
+                                     (assoc-ref %build-inputs "libgcrypt")
+                                     "/bin:"
+                                     (getenv "PATH")))
+                     #t))))
+             '())))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("autoconf" ,autoconf)
        ("automake" ,automake)
-       ("texinfo" ,texinfo)))
+       ("texinfo" ,texinfo)
+       ("guile" ,guile-2.2)))
     (inputs
      `(("guile" ,guile-2.2)
        ("libgcrypt" ,libgcrypt)))
diff --git a/gnu/packages/groff.scm b/gnu/packages/groff.scm
index 98f17914bf..5fe353a901 100644
--- a/gnu/packages/groff.scm
+++ b/gnu/packages/groff.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,12 +56,28 @@
    ;; from 'inputs'.
 
    (inputs `(("ghostscript" ,ghostscript)))
-   (native-inputs `(("bison" ,bison)
+
+   ;; When cross-compiling, this package depends upon a native install of
+   ;; itself.
+   (native-inputs `(,@(if (%current-target-system)
+                          `(("self" ,this-package))
+                          '())
+                    ("bison" ,bison)
                     ("perl" ,perl)
                     ("psutils" ,psutils)
                     ("texinfo" ,texinfo)))
    (arguments
     `(#:parallel-build? #f   ; parallel build fails
+      ,@(if (%current-target-system)
+            `(#:make-flags
+              ;; In groff-minimal package, that inherits from this package,
+              ;; we'll need to locate "groff" instead of "self".
+              (let ((groff (or (assoc-ref %build-host-inputs "groff")
+                               (assoc-ref %build-host-inputs "self"))))
+                (list
+                 (string-append "GROFF_BIN_PATH=" groff)
+                 (string-append "GROFFBIN=" groff "/bin/groff"))))
+            '())
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'disable-relocatability
@@ -115,7 +132,8 @@ is usually the formatter of \"man\" documentation pages.")
     ;; Omit the DVI, PS, PDF, and HTML backends.
     (inputs '())
     (native-inputs `(("bison" ,bison)
-                     ("perl" ,perl)))
+                     ("perl" ,perl)
+                     ("groff" ,groff)))
 
     (arguments
      `(#:disallowed-references (,perl)
diff --git a/gnu/packages/guile-wm.scm b/gnu/packages/guile-wm.scm
index 622fc560d9..3a6eebc91a 100644
--- a/gnu/packages/guile-wm.scm
+++ b/gnu/packages/guile-wm.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016 Alex ter Weele <alex.ter.weele@gmail.com>
 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 ng0 <ng0@n0.is>
+;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,7 +58,8 @@
                                             "--with-guile-site-ccache-dir="
                                             (assoc-ref %outputs "out")
                                             "/lib/guile/2.2/site-ccache"))))
-      (native-inputs `(("pkg-config" ,pkg-config)
+      (native-inputs `(("guile" ,guile-2.2)
+                       ("pkg-config" ,pkg-config)
                        ("texinfo" ,texinfo)))
       (inputs `(("guile" ,guile-2.2)
                 ("xcb" ,xcb-proto)))
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 4419c48d1a..b552f332e5 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -9,7 +9,7 @@
 ;;; Copyright © 2016, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017, 2018 Amirouche <amirouche@hypermove.net>
 ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
@@ -541,11 +541,14 @@ Guile's foreign function interface.")
               (sha256
                (base32
                 "1nv8j7wk6b5n4p22szyi8lv8fs31rrzxhzz16gyj8r38c1fyp9qp"))
-              (file-name (string-append name "-" version "-checkout"))))
+              (file-name (string-append name "-" version "-checkout"))
+              (patches
+               (search-patches "guile-sqlite3-fix-cross-compilation.patch"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)
+       ("guile" ,guile-2.2)
        ("pkg-config" ,pkg-config)))
     (inputs
      `(("guile" ,guile-2.2)
diff --git a/gnu/packages/icu4c.scm b/gnu/packages/icu4c.scm
index 922dfbd348..c70871f7e7 100644
--- a/gnu/packages/icu4c.scm
+++ b/gnu/packages/icu4c.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@
   #:use-module (gnu packages python)
   #:use-module (guix licenses)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (guix download)
   #:use-module (guix build-system ant)
   #:use-module (guix build-system gnu))
@@ -70,13 +72,23 @@
             (sha256
              (base32 "0v0xsf14xwlj125y9fd8lrhsaych4d8liv8gr746zng6g225szb2"))))
    (build-system gnu-build-system)
+   ;; When cross-compiling, this package needs a source directory of a
+   ;; native-build of itself.
    (native-inputs
-    `(("python" ,python-minimal)))
+    `(("python" ,python-minimal)
+      ,@(if (%current-target-system)
+            `(("icu4c-build-root" ,icu4c-build-root))
+            '())))
    (inputs
     `(("perl" ,perl)))
    (arguments
     `(#:configure-flags
-      '("--enable-rpath")
+      (list
+       "--enable-rpath"
+        ,@(if (%current-target-system)
+              '((string-append "--with-cross-build="
+                                (assoc-ref %build-inputs "icu4c-build-root")))
+              '()))
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'chdir-to-source
@@ -105,6 +117,25 @@ C/C++ part.")
    (license x11)
    (home-page "http://site.icu-project.org/")))
 
+(define-public icu4c-build-root
+  (package
+    (inherit icu4c)
+    (name "icu4c-build-root")
+    (arguments
+     (substitute-keyword-arguments (package-arguments icu4c)
+       ((#:tests? _ '())
+        #f)
+       ((#:out-of-source? _ '())
+        #t)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (copy-recursively "../build" out)
+                 #t)))))))
+    (native-inputs '())))
+
 (define-public java-icu4j
   (package
     (name "java-icu4j")
diff --git a/gnu/packages/kerberos.scm b/gnu/packages/kerberos.scm
index 1253a58546..bf344ce8ce 100644
--- a/gnu/packages/kerberos.scm
+++ b/gnu/packages/kerberos.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -68,9 +69,21 @@
        ("perl" ,perl)))
     (arguments
      `(;; XXX: On 32-bit systems, 'kdb5_util' hangs on an fcntl/F_SETLKW call
-       ;; while running the tests in 'src/tests'.
-       #:tests? ,(string=? (%current-system) "x86_64-linux")
+       ;; while running the tests in 'src/tests'. Also disable tests when
+       ;; cross-compiling.
+       #:tests? ,(and (not (%current-target-system))
+                      (string=? (%current-system) "x86_64-linux"))
 
+       ,@(if (%current-target-system)
+             '(#:configure-flags
+               (list "krb5_cv_attr_constructor_destructor=yes"
+                     "ac_cv_func_regcomp=yes"
+                     "ac_cv_printf_positional=yes"
+                     "ac_cv_file__etc_environment=yes"
+                     "ac_cv_file__etc_TIMEZONE=no")
+               #:make-flags
+               (list "CFLAGS+=-DDESTRUCTOR_ATTR_WORKS=1"))
+             '())
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'enter-source-directory
@@ -78,8 +91,8 @@
              (chdir "src")
              #t))
          (add-before 'check 'pre-check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((perl (assoc-ref inputs "perl")))
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (let ((perl (assoc-ref (or native-inputs inputs) "perl")))
                (substitute* "plugins/kdb/db2/libdb2/test/run.test"
                  (("/bin/cat") (string-append perl "/bin/perl"))
                  (("D/bin/sh") (string-append "D" (which "sh")))
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 1962b961e7..19432817ca 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -22,7 +22,7 @@
 ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.com>
 ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
-;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2017 nee <nee-git@hidamari.blue>
@@ -1209,10 +1209,16 @@ by Robert Shea and Robert Anton Wilson.")
                 "0r84kwa5fl0sjdashcn4vh7hgfm7ahdcysig3mcjvpmkzi7p9g8h"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:modules ((guix build utils)
+     `(#:modules ((guix build utils)
                   (guix build gnu-build-system)
                   (srfi srfi-1)
                   (srfi srfi-26))
+       ,@(if (%current-target-system)
+             '(#:configure-flags
+               (list
+                "ac_cv_func_malloc_0_nonnull=yes"
+                "ac_cv_func_realloc_0_nonnull=yes"))
+             '())
        #:phases
        (modify-phases %standard-phases
          (add-after
@@ -1582,12 +1588,13 @@ MIDI functionality to the Linux-based operating system.")
                (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
                 "true\n"))
              #t)))))
+    (native-inputs
+     `(("gettext" ,gettext-minimal)))
     (inputs
      `(("libsamplerate" ,libsamplerate)
        ("ncurses" ,ncurses)
        ("alsa-lib" ,alsa-lib)
-       ("xmlto" ,xmlto)
-       ("gettext" ,gettext-minimal)))
+       ("xmlto" ,xmlto)))
     (home-page "http://www.alsa-project.org/")
     (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
     (description
@@ -2005,35 +2012,18 @@ transparently through a bridge.")
                  "/libnl-doc-" version ".tar.gz"))
            (sha256
             (base32 "19p5y8q3cm5wqvamqc4s5syxnnkvzxy3gw8ivxk6fv9ybn8jm35h"))))))
-    (inputs
-     `(("python-2" ,python-2)
-       ("python-3" ,python-3)))
-    (outputs '("out" "doc" "python2" "python3"))
+    (outputs `("out" "doc"))
     (arguments
-     `(#:modules ((guix build gnu-build-system)
-                  (guix build utils)
-                  (srfi srfi-1))
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
-         (add-after 'install 'install-python
-           (lambda* (#:key outputs #:allow-other-keys)
-             (define (python-inst python)
-               (invoke python "setup.py" "build")
-               (invoke python "setup.py" "install"
-                       (string-append "--prefix="
-                                      (assoc-ref %outputs python)))
-               (invoke python "setup.py" "clean"))
-             (setenv "LDFLAGS" (format #f "-Wl,-rpath=~a/lib"
-                                       (assoc-ref %outputs "out")))
-             (with-directory-excursion "./python"
-               (for-each python-inst '("python2" "python3")))
-             #t))
          (add-after 'install 'install-doc
-           (lambda* (#:key inputs outputs #:allow-other-keys)
+           (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
              (let ((dest (string-append (assoc-ref outputs "doc")
                                         "/share/doc/libnl")))
                (mkdir-p dest)
-               (invoke "tar" "xf" (assoc-ref inputs "libnl3-doc")
+               (invoke "tar" "xf" (assoc-ref
+                                   (or native-inputs inputs)
+                                   "libnl3-doc")
                        "--strip-components=1" "-C" dest)))))))
     (home-page "https://www.infradead.org/~tgr/libnl/")
     (synopsis "NetLink protocol library suite")
@@ -2048,6 +2038,43 @@ configuration and monitoring interfaces.")
     ;; 'nl-addr-add.c'), so the result is GPLv2-only.
     (license license:gpl2)))
 
+;; libnl python extensions used to be outputs of libnl. However, as
+;; cross-compiling python extensions is currently broken, create separate
+;; packages for libnl python extensions.
+(define (libnl-python-package python)
+  (let ((name (string-append "libnl-" python)))
+    (package
+      (inherit libnl)
+      (name name)
+      (inputs `(,@(cond
+                   ((string=? python "python2")
+                    `(("python-2" ,python-2)))
+                   ((string=? python "python3")
+                    `(("python-3" ,python-3))))))
+      (propagated-inputs `(("libnl" ,libnl)))
+      (outputs '("out"))
+      (arguments
+       `(#:modules ((guix build gnu-build-system)
+                    (guix build utils)
+                    (srfi srfi-1))
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (define (python-inst python)
+                 (invoke python "setup.py" "build")
+                 (invoke python "setup.py" "install"
+                         (string-append "--prefix="
+                                        (assoc-ref %outputs "out")))
+                 (invoke python "setup.py" "clean"))
+               (setenv "LDFLAGS" (format #f "-Wl,-rpath=~a/lib"
+                                         (assoc-ref inputs "libnl")))
+               (with-directory-excursion "./python" (python-inst ,python))
+               #t))))))))
+
+(define-public libnl-python2 (libnl-python-package "python2"))
+(define-public libnl-python3 (libnl-python-package "python3"))
+
 (define-public iw
   (package
     (name "iw")
@@ -2628,7 +2655,7 @@ from the module-init-tools project.")
               (patches (search-patches "eudev-rules-directory.patch"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'make-source-writable
            (lambda _
@@ -2637,19 +2664,25 @@ from the module-init-tools project.")
              (for-each make-file-writable (find-files "."))
              #t))
          (add-before 'bootstrap 'patch-file-names
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
             (substitute* "man/make.sh"
               (("/usr/bin/xsltproc")
-                (string-append (assoc-ref inputs "xsltproc")
+               (string-append (assoc-ref
+                               (or native-inputs inputs) "xsltproc")
                                "/bin/xsltproc")))
             #t))
          (add-after 'install 'build-hwdb
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Build OUT/etc/udev/hwdb.bin.  This allows 'lsusb' and
              ;; similar tools to display product names.
+             ;;
+             ;; XXX: This can't be done when cross-compiling. Find another way
+             ;; to generate hwdb.bin for cross-built systems.
              (let ((out (assoc-ref outputs "out")))
-               (invoke (string-append out "/bin/udevadm")
-                       "hwdb" "--update")))))
+               ,@(if (%current-target-system)
+                     '(#t)
+                     '((invoke (string-append out "/bin/udevadm")
+                               "hwdb" "--update")))))))
        #:configure-flags (list "--enable-manpages")))
     (native-inputs
      `(("autoconf" ,autoconf)
@@ -2712,7 +2745,7 @@ time.")
     (inputs
      `(("udev" ,eudev)))
     (arguments
-     '(#:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-after 'configure 'set-makefile-shell
            (lambda _
@@ -2747,7 +2780,12 @@ time.")
                                               (assoc-ref %outputs "out")
                                               "/lib,-rpath="
                                               (assoc-ref %outputs "out")
-                                              "/lib/device-mapper"))
+                                              "/lib/device-mapper")
+                               ;; This is needed when cross-compiling.
+                               ,@(if (%current-target-system)
+                                     '("ac_cv_func_malloc_0_nonnull=yes"
+                                       "ac_cv_func_realloc_0_nonnull=yes")
+                                     '()))
 
        ;; The tests use 'mknod', which requires root access.
        #:tests? #f))
@@ -2831,13 +2869,23 @@ interface.")
               (patches (search-patches "crda-optional-gcrypt.patch"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases (modify-phases %standard-phases
+     `(#:phases (modify-phases %standard-phases
                   (delete 'configure)
                   (add-after 'unpack 'gzip-determinism
                     (lambda _
                       (substitute* "Makefile"
                         (("gzip") "gzip --no-name"))
                       #t))
+                  ,@(if (%current-target-system)
+                        '((add-after
+                            'unpack 'fix-pkg-config
+                            (lambda* (#:key target #:allow-other-keys)
+                                     (substitute*
+                                       "Makefile"
+                                       (("pkg-config")
+                                        (string-append target "-pkg-config")))
+                                     #t)))
+                        '())
                   (add-before
                    'build 'no-werror-no-ldconfig
                    (lambda _
@@ -2847,37 +2895,44 @@ interface.")
                      #t))
                   (add-before
                    'build 'set-regulator-db-file-name
-                   (lambda* (#:key inputs #:allow-other-keys)
+                   (lambda* (#:key native-inputs inputs #:allow-other-keys)
                      ;; Tell CRDA where to find our database.
-                     (let ((regdb (assoc-ref inputs "wireless-regdb")))
+                     (let ((regdb (assoc-ref (or native-inputs inputs)
+                                             "wireless-regdb")))
                        (substitute* "crda.c"
                          (("\"/lib/crda/regulatory.bin\"")
                           (string-append "\"" regdb
                                          "/lib/crda/regulatory.bin\"")))
                        #t))))
        #:test-target "verify"
-       #:make-flags (let ((out   (assoc-ref %outputs "out"))
-                          (regdb (assoc-ref %build-inputs "wireless-regdb")))
-                      (list "CC=gcc" "V=1"
-
-                            ;; Disable signature-checking on 'regulatory.bin'.
-                            ;; The reason is that this simplifies maintenance
-                            ;; on our side (no need to manage a distro key
-                            ;; pair), and we can guarantee integrity of
-                            ;; 'regulatory.bin' by other means anyway, such as
-                            ;; 'guix gc --verify'.  See
-                            ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
-                            ;; for a discssion.
-                            "USE_OPENSSL=0"
-
-                            (string-append "PREFIX=" out)
-                            (string-append "SBINDIR=" out "/sbin/")
-                            (string-append "UDEV_RULE_DIR="
-                                           out "/lib/udev/rules.d")
-                            (string-append "LDFLAGS=-Wl,-rpath="
-                                           out "/lib -L.")
-                            (string-append "REG_BIN=" regdb
-                                           "/lib/crda/regulatory.bin")))))
+       #:make-flags (let ((out     (assoc-ref %outputs "out"))
+                          (regdb   (assoc-ref %build-inputs "wireless-regdb"))
+                          (target ,(%current-target-system)))
+                      (list
+                       (string-append
+                        "CC=" (if target
+                                  (string-append target "-gcc") "gcc"))
+                       "V=1"
+
+                       ;; Disable signature-checking on 'regulatory.bin'.
+                       ;; The reason is that this simplifies maintenance
+                       ;; on our side (no need to manage a distro key
+                       ;; pair), and we can guarantee integrity of
+                       ;; 'regulatory.bin' by other means anyway, such as
+                       ;; 'guix gc --verify'.  See
+                       ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
+                       ;; for a discssion.
+                       "USE_OPENSSL=0"
+
+                       (string-append "PREFIX=" out)
+                       (string-append "SBINDIR=" out "/sbin/")
+                       (string-append "UDEV_RULE_DIR="
+                                      out "/lib/udev/rules.d")
+                       (string-append "LDFLAGS=-Wl,-rpath="
+                                      out "/lib -L.")
+                       (string-append "REG_BIN=" regdb
+                                      "/lib/crda/regulatory.bin")
+                       "all_noverify"))))
     (native-inputs `(("pkg-config" ,pkg-config)
                      ("python" ,python-2)
                      ("wireless-regdb" ,wireless-regdb)))
@@ -3551,8 +3606,9 @@ MPEG-2 and audio over Linux IEEE 1394.")
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'patch-program-paths
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((coreutils (assoc-ref inputs "coreutils")))
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
+             (let ((coreutils (assoc-ref (or native-inputs inputs)
+                                         "coreutils")))
                (substitute* "udev-md-raid-arrays.rules"
                  (("/usr/bin/(readlink|basename)" all program)
                   (string-append coreutils "/bin/" program))))
diff --git a/gnu/packages/man.scm b/gnu/packages/man.scm
index e7e14c54ae..5cbb993519 100644
--- a/gnu/packages/man.scm
+++ b/gnu/packages/man.scm
@@ -216,6 +216,8 @@ Linux kernel and C library interfaces employed by user-space programs.")
        ;; ("perl-LocaleGettext" ,perl-LocaleGettext)
        ;; ("gettext" ,gettext-minimal)
        ))
+    (native-inputs
+     `(("perl" ,perl)))
     (home-page "https://www.gnu.org/software/help2man/")
     (synopsis "Automatically generate man pages from program --help")
     (description
diff --git a/gnu/packages/openldap.scm b/gnu/packages/openldap.scm
index 7abe9ab6f0..8316a593e6 100644
--- a/gnu/packages/openldap.scm
+++ b/gnu/packages/openldap.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -50,6 +51,7 @@
   #:use-module (gnu packages)
   #:use-module ((guix licenses) #:select (openldap2.8 lgpl2.1+ gpl3+ psfl))
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python))
@@ -79,16 +81,46 @@
    (inputs `(("bdb" ,bdb-5.3)
              ("cyrus-sasl" ,cyrus-sasl)
              ("gnutls" ,gnutls)
-             ("groff" ,groff)
              ("icu4c" ,icu4c)
              ("libgcrypt" ,libgcrypt)
              ("zlib" ,zlib)))
-   (native-inputs `(("libtool" ,libtool)))
+   (native-inputs `(("libtool" ,libtool)
+                    ("groff" ,groff)
+                    ("bdb" ,bdb-5.3)
+                    ;; For up to date 'config.guess' and 'config.sub'.
+                    ("automake" ,automake)))
    (arguments
     `(#:tests? #f
-      #:configure-flags '("--disable-static")
+      #:configure-flags
+      '("--disable-static"
+        ,@(if (%current-target-system)
+              '("--with-yielding_select=yes"
+                "ac_cv_func_memcmp_working=yes")
+              '()))
+      ;; Disable install stripping as it breaks cross-compiling.
+      #:make-flags '("STRIP=")
       #:phases
       (modify-phases %standard-phases
+        (add-after 'unpack 'fix-configure
+          (lambda* (#:key inputs native-inputs #:allow-other-keys)
+            ;; Replace outdated config.sub and config.guess:
+            (with-directory-excursion "build"
+              (for-each (lambda (file)
+                          (install-file (string-append
+                                         (assoc-ref
+                                          (or native-inputs inputs) "automake")
+                                         "/share/automake-"
+                                         ,(version-major+minor
+                                           (package-version automake))
+                                         "/" file) "."))
+                        '("config.sub" "config.guess")))
+            #t))
+        ,@(if (%current-target-system)
+              '((add-before 'configure 'fix-cross-gcc
+                  (lambda* (#:key target #:allow-other-keys)
+                    (setenv "CC" (string-append target "-gcc"))
+                    #t)))
+              '())
         (add-after 'install 'patch-sasl-path
           ;; Give -L arguments for cyrus-sasl to avoid propagation.
           (lambda* (#:key inputs outputs #:allow-other-keys)
diff --git a/gnu/packages/patches/aspell-default-dict-dir.patch b/gnu/packages/patches/aspell-default-dict-dir.patch
index 17a6ff606f..5f759a66d9 100644
--- a/gnu/packages/patches/aspell-default-dict-dir.patch
+++ b/gnu/packages/patches/aspell-default-dict-dir.patch
@@ -8,12 +8,34 @@ However it is necessary for applications that use libaspell since
 
 --- a/common/config.cpp
 +++ b/common/config.cpp
+@@ -651,7 +651,20 @@ namespace acommon {
+ 	  } else { // sep == '|'
+ 	    assert(replace[0] == '$');
+ 	    const char * env = getenv(replace.c_str()+1);
+-	    final_str += env ? env : second;
++	    if (env) {
++	      final_str += env;
++	    } else if (second[0] == '$') {
++	      // Expand the right-hand side of '|', which starts with a
++	      // reference to an environment variable.
++	      auto slash = second.find('/');
++	      String variable = second.substr(1, slash - 1);
++	      const char * env = getenv(variable.c_str());
++	      String value = env ? String(env) : "";
++	      value += second.substr(slash, second.size() - slash);
++	      final_str += value;
++	    } else {
++	      final_str += second;
++	    }
+ 	  }
+ 	  replace = "";
+ 	  in_replace = false;
 @@ -1349,6 +1349,9 @@ namespace acommon {
  #  define REPL     ".aspell.<lang>.prepl"
  #endif
  
 +#undef DICT_DIR
-+#define DICT_DIR "<$ASPELL_DICT_DIR|home-dir/.guix-profile/lib/aspell>"
++#define DICT_DIR "<$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell>"
 +
    static const KeyInfo config_keys[] = {
      // the description should be under 50 chars
diff --git a/gnu/packages/patches/aspell-gcc-compat.patch b/gnu/packages/patches/aspell-gcc-compat.patch
deleted file mode 100644
index 94c44f8fb6..0000000000
--- a/gnu/packages/patches/aspell-gcc-compat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Fix GCC7 warnings.
-
-Taken from upstream:
-https://git.savannah.gnu.org/cgit/aspell.git/commit/?id=8089fa02122fed0a6394eba14bbedcb1d18e2384
-
-diff --git a/modules/filter/tex.cpp b/modules/filter/tex.cpp
-index a979539..19ab63c 100644
---- a/modules/filter/tex.cpp
-+++ b/modules/filter/tex.cpp
-@@ -174,7 +174,7 @@ namespace {
- 
-     if (c == '{') {
- 
--      if (top.in_what == Parm || top.in_what == Opt || top.do_check == '\0')
-+      if (top.in_what == Parm || top.in_what == Opt || *top.do_check == '\0')
- 	push_command(Parm);
- 
-       top.in_what = Parm;
-diff --git a/prog/check_funs.cpp b/prog/check_funs.cpp
-index db54f3d..89ee09d 100644
---- a/prog/check_funs.cpp
-+++ b/prog/check_funs.cpp
-@@ -647,7 +647,7 @@ static void print_truncate(FILE * out, const char * word, int width) {
-     }
-   }
-   if (i == width-1) {
--    if (word == '\0')
-+    if (*word == '\0')
-       put(out,' ');
-     else if (word[len] == '\0')
-       put(out, word, len);
diff --git a/gnu/packages/patches/bash-linux-pgrp-pipe.patch b/gnu/packages/patches/bash-linux-pgrp-pipe.patch
new file mode 100644
index 0000000000..234a55e897
--- /dev/null
+++ b/gnu/packages/patches/bash-linux-pgrp-pipe.patch
@@ -0,0 +1,32 @@
+Unconditionally enable PGRP_PIPE on Linux (the kernel), regardless of
+the kernel version in use on the build machine.
+
+--- configure.ac.orig	2019-01-02 09:38:44.000000000 -0500
++++ configure.ac	2019-08-15 16:40:24.271758379 -0400
+@@ -1108,10 +1108,7 @@
+ solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
+ lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
+ linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
+-		case "`uname -r`" in
+-		1.*|2.[[0123]]*)	: ;;
+-		*)	AC_DEFINE(PGRP_PIPE) ;;
+-		esac ;;
++		AC_DEFINE(PGRP_PIPE) ;;
+ netbsd*|openbsd*)	LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
+ *qnx[[67]]*)	LOCAL_LIBS="-lncurses" ;;
+ *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
+--- configure.orig	2019-01-02 09:43:04.000000000 -0500
++++ configure	2019-08-15 16:41:44.440155912 -0400
+@@ -16312,11 +16312,7 @@
+ solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
+ lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
+ linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
+-		case "`uname -r`" in
+-		1.*|2.[0123]*)	: ;;
+-		*)	$as_echo "#define PGRP_PIPE 1" >>confdefs.h
+- ;;
+-		esac ;;
++		$as_echo "#define PGRP_PIPE 1" >>confdefs.h ;;
+ netbsd*|openbsd*)	LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
+ *qnx[67]*)	LOCAL_LIBS="-lncurses" ;;
+ *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
diff --git a/gnu/packages/patches/bc-fix-cross-compilation.patch b/gnu/packages/patches/bc-fix-cross-compilation.patch
new file mode 100644
index 0000000000..14dfecdbde
--- /dev/null
+++ b/gnu/packages/patches/bc-fix-cross-compilation.patch
@@ -0,0 +1,171 @@
+Patch taken from nix.
+
+commit fdda59736ddc048cf38a2c7103f4f5d9eeaf995e
+Author: Ben Gamari <ben@smart-cactus.org>
+Date:   Tue Oct 17 10:51:34 2017 -0400
+
+    Try implementing cross-compilation
+
+diff --git a/bc/Makefile.am b/bc/Makefile.am
+index d9d412e..fdef633 100644
+--- a/bc/Makefile.am
++++ b/bc/Makefile.am
+@@ -17,6 +17,7 @@ MAINTAINERCLEANFILES = Makefile.in bc.c bc.h scan.c \
+ 
+ AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../h
+ LIBBC = ../lib/libbc.a
++LIBBC_HOST = ../lib/libbc_host.a
+ LIBL = @LEXLIB@
+ LDADD = $(LIBBC) $(LIBL) @READLINELIB@
+ 
+@@ -29,12 +30,20 @@ $(PROGRAMS): libmath.h $(LIBBC)
+ scan.o: bc.h
+ global.o: libmath.h
++
++main_host.c : main.c
++	cp $< $@
+ 
+-fbcOBJ = main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o
++fbcOBJ = $(addsuffix _host,main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o)
++
++%.o_host : CC:=$(CC_FOR_BUILD)
++
++%.o_host : %.c
++	$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<
+ 
+-libmath.h: libmath.b $(fbcOBJ) $(LIBBC)
++libmath.h: libmath.b $(fbcOBJ) $(LIBBC_HOST)
+ 	echo '{0}' > libmath.h
+-	$(MAKE) global.o
+-	$(LINK) -o fbc $(fbcOBJ) global.o $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
++	$(MAKE) global.o_host
++	$(CC_FOR_BUILD) -o fbc $(fbcOBJ) global.o_host $(LIBBC_HOST) $(LIBL) ${READLINELIB} $(LIBS)
+ 	./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
+ 	$(srcdir)/fix-libmath_h
+ 	rm -f ./fbc ./global.o
+diff --git a/configure.ac b/configure.ac
+index fc74573..5cabb73 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,6 +20,7 @@ m4_define([dc_version], 1.4.1)
+ 
+ AC_INIT([bc],[bc_version])
+ AC_CONFIG_SRCDIR(doc/bc.1)
++AC_CONFIG_MACRO_DIR([m4])
+ AM_INIT_AUTOMAKE([dist-bzip2])
+ AC_CONFIG_HEADERS(config.h)
+ 
+@@ -35,6 +36,7 @@ AC_DEFINE([DC_COPYRIGHT],
+ 	  [Define the dc copyright line.])
+ 
+ AC_PROG_CC
++AX_CC_FOR_BUILD
+ AC_USE_SYSTEM_EXTENSIONS
+ 
+ AM_PROG_LEX
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index ec4bf59..c670f5b 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -1,5 +1,5 @@
+ ## Process this file with automake to produce Makefile.in
+-noinst_LIBRARIES = libbc.a
++noinst_LIBRARIES = libbc.a libbc_host.a
+ 
+ AM_CPPFLAGS = -I. -I.. -I$(srcdir)/../h
+ 
+@@ -24,3 +24,11 @@ testmul: testmul.o number.o
+ 
+ specialnumber: newnumber.o
+ 	cp newnumber.o number.o
++
++%.o_host : CC:=$(CC_FOR_BUILD)
++%.o_host : %.c
++	$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<
++
++libbc_host.a : $(addsuffix _host,$(libbc_a_OBJECTS))
++	ar cru $@ $+
++	ranlib $@
+diff --git a/m4/cc_for_build.m4 b/m4/cc_for_build.m4
+new file mode 100644
+index 0000000..c62ffad
+--- /dev/null
++++ b/m4/cc_for_build.m4
+@@ -0,0 +1,77 @@
++# ===========================================================================
++#     https://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html
++# ===========================================================================
++#
++# SYNOPSIS
++#
++#   AX_CC_FOR_BUILD
++#
++# DESCRIPTION
++#
++#   Find a build-time compiler. Sets CC_FOR_BUILD and EXEEXT_FOR_BUILD.
++#
++# LICENSE
++#
++#   Copyright (c) 2010 Reuben Thomas <rrt@sc3d.org>
++#   Copyright (c) 1999 Richard Henderson <rth@redhat.com>
++#
++#   This program is free software: you can redistribute it and/or modify it
++#   under the terms of the GNU General Public License as published by the
++#   Free Software Foundation, either version 3 of the License, or (at your
++#   option) any later version.
++#
++#   This program is distributed in the hope that it will be useful, but
++#   WITHOUT ANY WARRANTY; without even the implied warranty of
++#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
++#   Public License for more details.
++#
++#   You should have received a copy of the GNU General Public License along
++#   with this program. If not, see <https://www.gnu.org/licenses/>.
++#
++#   As a special exception, the respective Autoconf Macro's copyright owner
++#   gives unlimited permission to copy, distribute and modify the configure
++#   scripts that are the output of Autoconf when processing the Macro. You
++#   need not follow the terms of the GNU General Public License when using
++#   or distributing such scripts, even though portions of the text of the
++#   Macro appear in them. The GNU General Public License (GPL) does govern
++#   all other use of the material that constitutes the Autoconf Macro.
++#
++#   This special exception to the GPL applies to versions of the Autoconf
++#   Macro released by the Autoconf Archive. When you make and distribute a
++#   modified version of the Autoconf Macro, you may extend this special
++#   exception to the GPL to apply to your modified version as well.
++
++#serial 3
++
++dnl Get a default for CC_FOR_BUILD to put into Makefile.
++AC_DEFUN([AX_CC_FOR_BUILD],
++[# Put a plausible default for CC_FOR_BUILD in Makefile.
++if test -z "$CC_FOR_BUILD"; then
++  if test "x$cross_compiling" = "xno"; then
++    CC_FOR_BUILD='$(CC)'
++  else
++    CC_FOR_BUILD=gcc
++  fi
++fi
++AC_SUBST(CC_FOR_BUILD)
++# Also set EXEEXT_FOR_BUILD.
++if test "x$cross_compiling" = "xno"; then
++  EXEEXT_FOR_BUILD='$(EXEEXT)'
++else
++  AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
++    [rm -f conftest*
++     echo 'int main () { return 0; }' > conftest.c
++     bfd_cv_build_exeext=
++     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
++     for file in conftest.*; do
++       case $file in
++       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
++       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
++       esac
++     done
++     rm -f conftest*
++     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
++  EXEEXT_FOR_BUILD=""
++  test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
++fi
++AC_SUBST(EXEEXT_FOR_BUILD)])dnl
diff --git a/gnu/packages/patches/boost-dumpversion.patch b/gnu/packages/patches/boost-dumpversion.patch
new file mode 100644
index 0000000000..7df779cfe6
--- /dev/null
+++ b/gnu/packages/patches/boost-dumpversion.patch
@@ -0,0 +1,24 @@
+This issue is described here: https://github.com/openwrt/packages/pull/8685
+and has not been solved as of 1.70.0 release.
+
+--- a/tools/build/src/tools/common.jam
++++ b/tools/build/src/tools/common.jam
+@@ -973,18 +973,6 @@
+         }
+     }
+ 
+-    # From GCC 5, versioning changes and minor becomes patch
+-    if $(tag) = gcc && [ numbers.less 4 $(version[1]) ]
+-    {
+-        version = $(version[1]) ;
+-    }
+-
+-    # Ditto, from Clang 4
+-    if ( $(tag) = clang || $(tag) = clangw ) && [ numbers.less 3 $(version[1]) ]
+-    {
+-        version = $(version[1]) ;
+-    }
+-
+     # On intel, version is not added, because it does not matter and it is the
+     # version of vc used as backend that matters. Ideally, we should encode the
+     # backend version but that would break compatibility with V1.
diff --git a/gnu/packages/patches/cyrus-sasl-ac-try-run-fix.patch b/gnu/packages/patches/cyrus-sasl-ac-try-run-fix.patch
new file mode 100644
index 0000000000..8662e812e9
--- /dev/null
+++ b/gnu/packages/patches/cyrus-sasl-ac-try-run-fix.patch
@@ -0,0 +1,12 @@
+--- a/m4/sasl2.m4	2018-11-18 22:33:29.902625600 +0300
++++ b/m4/sasl2.m4	2018-11-18 22:33:59.828746176 +0300
+@@ -339,7 +339,8 @@
+ ],	
+ 	[ AC_DEFINE(HAVE_GSS_SPNEGO,,[Define if your GSSAPI implementation supports SPNEGO])
+ 	AC_MSG_RESULT(yes) ],
+-	AC_MSG_RESULT(no))
++	AC_MSG_RESULT(no),
++    AC_MSG_RESULT(no))
+   LIBS="$cmu_save_LIBS"
+ 
+ else
diff --git a/gnu/packages/patches/file-CVE-2018-10360.patch b/gnu/packages/patches/file-CVE-2018-10360.patch
deleted file mode 100644
index 9285611c04..0000000000
--- a/gnu/packages/patches/file-CVE-2018-10360.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-https://github.com/file/file/commit/a642587a9c9e2dd7feacdf513c3643ce26ad3c22.patch
-The leading part of the patch starting at line 27 was trimmed off.
-This patch should be OK to drop with file@5.35.
-
-From a642587a9c9e2dd7feacdf513c3643ce26ad3c22 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Sat, 9 Jun 2018 16:00:06 +0000
-Subject: [PATCH] Avoid reading past the end of buffer (Rui Reis)
-
----
- src/readelf.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/src/readelf.c b/src/readelf.c
-index 79c83f9f5..1f41b4611 100644
---- a/src/readelf.c
-+++ b/src/readelf.c
-@@ -842,7 +842,8 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
- 
- 				cname = (unsigned char *)
- 				    &nbuf[doff + prpsoffsets(i)];
--				for (cp = cname; *cp && isprint(*cp); cp++)
-+				for (cp = cname; cp < nbuf + size && *cp
-+				    && isprint(*cp); cp++)
- 					continue;
- 				/*
- 				 * Linux apparently appends a space at the end
diff --git a/gnu/packages/patches/file-CVE-2019-18218.patch b/gnu/packages/patches/file-CVE-2019-18218.patch
new file mode 100644
index 0000000000..21069823b7
--- /dev/null
+++ b/gnu/packages/patches/file-CVE-2019-18218.patch
@@ -0,0 +1,55 @@
+Fix CVE-2019-18218:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-18218
+
+Patch copied from upstream source repository:
+
+https://github.com/file/file/commit/46a8443f76cec4b41ec736eca396984c74664f84
+
+From 46a8443f76cec4b41ec736eca396984c74664f84 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 26 Aug 2019 14:31:39 +0000
+Subject: [PATCH] Limit the number of elements in a vector (found by oss-fuzz)
+
+---
+ src/cdf.c | 9 ++++-----
+ src/cdf.h | 1 +
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/cdf.c b/src/cdf.c
+index 9d6396742..bb81d6374 100644
+--- a/src/cdf.c
++++ b/src/cdf.c
+@@ -1027,8 +1027,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
+ 				goto out;
+ 			}
+ 			nelements = CDF_GETUINT32(q, 1);
+-			if (nelements == 0) {
+-				DPRINTF(("CDF_VECTOR with nelements == 0\n"));
++			if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
++				DPRINTF(("CDF_VECTOR with nelements == %"
++				    SIZE_T_FORMAT "u\n", nelements));
+ 				goto out;
+ 			}
+ 			slen = 2;
+@@ -1070,8 +1071,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
+ 					goto out;
+ 				inp += nelem;
+ 			}
+-			DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
+-			    nelements));
+ 			for (j = 0; j < nelements && i < sh.sh_properties;
+ 			    j++, i++)
+ 			{
+diff --git a/src/cdf.h b/src/cdf.h
+index 2f7e554b7..05056668f 100644
+--- a/src/cdf.h
++++ b/src/cdf.h
+@@ -48,6 +48,7 @@
+ typedef int32_t cdf_secid_t;
+ 
+ #define CDF_LOOP_LIMIT					10000
++#define CDF_ELEMENT_LIMIT				100000
+ 
+ #define CDF_SECID_NULL					0
+ #define CDF_SECID_FREE					-1
diff --git a/gnu/packages/patches/guile-sqlite3-fix-cross-compilation.patch b/gnu/packages/patches/guile-sqlite3-fix-cross-compilation.patch
new file mode 100644
index 0000000000..9ea9a47677
--- /dev/null
+++ b/gnu/packages/patches/guile-sqlite3-fix-cross-compilation.patch
@@ -0,0 +1,55 @@
+From a6e9e62a77ecc5012929613e20da23b2636450a5 Mon Sep 17 00:00:00 2001
+From: Mathieu Othacehe <mathieu.othacehe@parrot.com>
+Date: Mon, 25 Mar 2019 11:00:38 +0100
+Subject: [PATCH] cross compile
+
+---
+ build-aux/guile.am |  2 +-
+ configure.ac       | 19 ++++++++++++-------
+ 2 files changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/build-aux/guile.am b/build-aux/guile.am
+index dc1e63f..3126372 100644
+--- a/build-aux/guile.am
++++ b/build-aux/guile.am
+@@ -16,4 +16,4 @@ EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES)
+ GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
+ SUFFIXES = .scm .go
+ .scm.go:
+-	$(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_WARNINGS) -o "$@" "$<"
++	$(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<"
+diff --git a/configure.ac b/configure.ac
+index f648fcb..2d34d0a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -21,15 +21,20 @@ PKG_CHECK_MODULES([SQLITE], [sqlite3])
+ SQLITE_LIBDIR="`"$PKG_CONFIG" sqlite3 --variable libdir`"
+ AC_SUBST([SQLITE_LIBDIR])
+ 
+-AC_MSG_CHECKING([whether '$SQLITE_LIBDIR/libsqlite3' is usable])
+-GUILE_CHECK([retval],
+-  [(dynamic-func \"sqlite3_open_v2\"
++if test "$cross_compiling" = "no"; then
++   AC_MSG_CHECKING([whether '$SQLITE_LIBDIR/libsqlite3' is usable])
++   GUILE_CHECK([retval],
++   [(dynamic-func \"sqlite3_open_v2\"
+                  (dynamic-link \"$SQLITE_LIBDIR/libsqlite3\"))])
+-if test "$retval" != 0; then
+-  AC_MSG_RESULT([no])
+-  AC_MSG_ERROR([failed to load '$SQLITE_LIBDIR/libsqlite3'])
++   if test "$retval" != 0; then
++      AC_MSG_RESULT([no])
++      AC_MSG_ERROR([failed to load '$SQLITE_LIBDIR/libsqlite3'])
++   else
++      AC_MSG_RESULT([yes])
++   fi
+ else
+-  AC_MSG_RESULT([yes])
++   GUILE_TARGET="--target=$host_alias"
++   AC_SUBST([GUILE_TARGET])
+ fi
+ 
+ AC_CONFIG_FILES([Makefile sqlite3.scm])
+-- 
+2.17.1
+
diff --git a/gnu/packages/patches/python-2.7-search-paths.patch b/gnu/packages/patches/python-2.7-search-paths.patch
index a012bc8fe0..5a345c7691 100644
--- a/gnu/packages/patches/python-2.7-search-paths.patch
+++ b/gnu/packages/patches/python-2.7-search-paths.patch
@@ -3,13 +3,17 @@ looking for headers and libraries.
 
 --- Python-2.7.10/setup.py	2015-10-07 18:33:18.125153186 +0200
 +++ Python-2.7.10/setup.py	2015-10-07 18:33:47.497347552 +0200
-@@ -526,6 +526,10 @@ class PyBuildExt(build_ext):
+@@ -526,6 +526,14 @@ class PyBuildExt(build_ext):
              inc_dirs += ['/system/include', '/atheos/autolnk/include']
              inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
  
 +        # Always honor these variables.
-+        lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
-+        inc_dirs += os.getenv('CPATH', '').split(os.pathsep)
++        if not cross_compiling:
++            lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
++            inc_dirs += os.getenv('CPATH', '').split(os.pathsep)
++        else:
++            lib_dirs = os.getenv('CROSS_LIBRARY_PATH', '').split(os.pathsep)
++            inc_dirs = os.getenv('CROSS_CPATH', '').split(os.pathsep)
 +
          # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
          if host_platform in ['osf1', 'unixware7', 'openunix8']:
diff --git a/gnu/packages/patches/python-3-search-paths.patch b/gnu/packages/patches/python-3-search-paths.patch
index 5fea9c66b6..cf1647207b 100644
--- a/gnu/packages/patches/python-3-search-paths.patch
+++ b/gnu/packages/patches/python-3-search-paths.patch
@@ -3,7 +3,7 @@ looking for headers and libraries.
 
 --- a/setup.py	2015-10-07 23:32:58.891329173 +0200
 +++ b/setup.py	2015-10-07 23:46:29.653349924 +0200
-@@ -575,8 +575,8 @@
+@@ -575,15 +575,15 @@
          # if a file is found in one of those directories, it can
          # be assumed that no additional -I,-L directives are needed.
          if not cross_compiling:
@@ -14,3 +14,12 @@ looking for headers and libraries.
          else:
              # Add the sysroot paths. 'sysroot' is a compiler option used to
              # set the logical path of the standard system headers and
+             # libraries.
+-            lib_dirs = (self.compiler.library_dirs +
++            lib_dirs = (os.getenv('CROSS_LIBRARY_PATH', '').split(os.pathsep) +
+                         sysroot_paths(('LDFLAGS', 'CC'), system_lib_dirs))
+-            inc_dirs = (self.compiler.include_dirs +
++            inc_dirs = (os.getenv('CROSS_CPATH', '').split(os.pathsep) +
+                         sysroot_paths(('CPPFLAGS', 'CFLAGS', 'CC'),
+                                       system_include_dirs))
+         exts = []
diff --git a/gnu/packages/patches/python-cross-compile.patch b/gnu/packages/patches/python-cross-compile.patch
new file mode 100644
index 0000000000..5a470e1852
--- /dev/null
+++ b/gnu/packages/patches/python-cross-compile.patch
@@ -0,0 +1,145 @@
+Patch taken from https://bugs.python.org/issue22724 and augmented with
+following Nix patch
+https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch
+to fix the whole cross-compilation circus.
+
+---
+ Makefile.pre.in | 14 +++++++-------
+ configure       |  5 ++++-
+ setup.py        |  9 ++++++---
+ 3 files changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 2a14f3323b..6239fc32fc 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -492,7 +492,7 @@ $(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY)
+ 			$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ 
+ platform: $(BUILDPYTHON) pybuilddir.txt
+-	$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
++	$(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+ 
+ # Create build directory and generate the sysconfig build-time data there.
+ # pybuilddir.txt contains the name of the build dir and is used for
+@@ -503,7 +503,7 @@ platform: $(BUILDPYTHON) pybuilddir.txt
+ # or removed in case of failure.
+ pybuilddir.txt: $(BUILDPYTHON)
+ 	@echo "none" > ./pybuilddir.txt
+-	$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
++	$(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
+ 	if test $$? -ne 0 ; then \
+ 		echo "generate-posix-vars failed" ; \
+ 		rm -f ./pybuilddir.txt ; \
+@@ -525,7 +525,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
+ 	esac; \
+ 	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ 		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+-		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
++		$(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+ 
+ # Build static library
+ # avoid long command lines, same as LIBRARY_OBJS
+@@ -928,7 +928,7 @@ install:	@FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKI
+ 			upgrade) ensurepip="--upgrade" ;; \
+ 			install|*) ensurepip="" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
++		$(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -m ensurepip \
+ 			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+@@ -939,7 +939,7 @@ altinstall:	commoninstall
+ 			upgrade) ensurepip="--altinstall --upgrade --no-default-pip" ;; \
+ 			install|*) ensurepip="--altinstall --no-default-pip" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
++		$(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -m ensurepip \
+ 			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+@@ -1270,7 +1270,7 @@ libainstall:	@DEF_MAKE_RULE@ python-config
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall: sharedmods
+-	$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
++	$(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
+ 	   	--prefix=$(prefix) \
+ 		--install-scripts=$(BINDIR) \
+ 		--install-platlib=$(DESTSHARED) \
+@@ -1344,7 +1344,7 @@ frameworkinstallextras:
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+ 	SRCDIR=$(srcdir) $(RUNSHARED) \
+-	$(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
++	$(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
+ 	--prefix=$(prefix) \
+ 	--install-scripts=$(BINDIR) \
+ 	--root=$(DESTDIR)/
+diff --git a/configure b/configure
+index 67300fe2b6..6050f588c5 100755
+--- a/configure
++++ b/configure
+@@ -741,6 +741,7 @@ CONFIG_ARGS
+ SOVERSION
+ VERSION
+ PYTHON_FOR_BUILD
++PY_BUILD_ENVIRON
+ PYTHON_FOR_REGEN
+ host_os
+ host_vendor
+@@ -2964,7 +2965,8 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
+ 	fi
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
+ $as_echo "$interp" >&6; }
+-	PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
++	PY_BUILD_ENVIRON='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR)'
++	PYTHON_FOR_BUILD=$interp
+     fi
+ elif test "$cross_compiling" = maybe; then
+     as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
+@@ -2974,6 +2976,7 @@ fi
+ 
+ 
+ 
++
+ if test "$prefix" != "/"; then
+     prefix=`echo "$prefix" | sed -e 's/\/$//g'`
+ fi
+diff --git a/setup.py b/setup.py
+index cb47a2339c..472e7e2b26 100644
+--- a/setup.py
++++ b/setup.py
+@@ -497,8 +497,6 @@ class PyBuildExt(build_ext):
+         if not cross_compiling:
+             add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+-        if cross_compiling:
+-            self.add_gcc_paths()
+         self.add_multiarch_paths()
+ 
+         # Add paths specified in the environment variables LDFLAGS and
+@@ -556,7 +554,10 @@ class PyBuildExt(build_ext):
+         # be assumed that no additional -I,-L directives are needed.
+         inc_dirs = self.compiler.include_dirs[:]
+         lib_dirs = self.compiler.library_dirs[:]
+-        if not cross_compiling:
++        if cross_compiling:
++            inc_dirs = []
++            lib_dirs = []
++        else:
+             for d in (
+                 '/usr/include',
+                 ):
+@@ -621,6 +622,8 @@ class PyBuildExt(build_ext):
+         # Some modules that are normally always on:
+         #exts.append( Extension('_weakref', ['_weakref.c']) )
+ 
++        self.compiler.library_dirs = lib_dirs + [ '.' ]
++
+         # array objects
+         exts.append( Extension('array', ['arraymodule.c']) )
+ 
+-- 
+2.17.1
+
diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 6069413264..f200a94520 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -22,6 +22,7 @@
 ;;; Copyright © 2018, 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -81,7 +82,7 @@
                        "perl-reproducible-build-date.patch"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f
+     `(#:tests? #f
        #:configure-flags
        (let ((out  (assoc-ref %outputs "out"))
              (libc (assoc-ref %build-inputs "libc")))
@@ -130,7 +131,9 @@
          (add-after 'install 'remove-extra-references
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out     (assoc-ref outputs "out"))
-                    (libc    (assoc-ref inputs "libc"))
+                    (libc    (assoc-ref inputs
+                                        ,(if (%current-target-system)
+                                             "cross-libc" "libc")))
                     (config1 (car (find-files (string-append out "/lib/perl5")
                                               "^Config_heavy\\.pl$")))
                     (config2 (find-files (string-append out "/lib/perl5")
diff --git a/gnu/packages/pkg-config.scm b/gnu/packages/pkg-config.scm
index c3bc3025a3..9c632532be 100644
--- a/gnu/packages/pkg-config.scm
+++ b/gnu/packages/pkg-config.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,7 +50,17 @@
              (base32
               "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"))))
    (build-system gnu-build-system)
-   (arguments `(#:configure-flags '("--with-internal-glib")))
+   (arguments
+    `(#:configure-flags
+      '("--with-internal-glib"
+        ;; Those variables are guessed incorrectly when cross-compiling.
+        ;; See: https://developer.gimp.org/api/2.0/glib/glib-cross-compiling.html.
+        ,@(if (%current-target-system)
+              '("glib_cv_stack_grows=no"
+                "glib_cv_uscore=no"
+                "ac_cv_func_posix_getpwuid_r=yes"
+                "ac_cv_func_posix_getgrgid_r=yes")
+              '()))))
    (native-search-paths
     (list (search-path-specification
            (variable "PKG_CONFIG_PATH")
diff --git a/gnu/packages/pulseaudio.scm b/gnu/packages/pulseaudio.scm
index ff4049d707..89773d8be2 100644
--- a/gnu/packages/pulseaudio.scm
+++ b/gnu/packages/pulseaudio.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +30,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
@@ -102,10 +104,28 @@ for reading and writing new sound file formats.")
                "1ha46i0nbibq0pl0pjwcqiyny4hj8lp1bnl4dpxm64zjw9lb2zha"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ("automake" ,automake))) ;For up to date 'config.guess' and 'config.sub'.
     (propagated-inputs
      `(("libsndfile" ,libsndfile)
        ("fftw" ,fftw)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-configure
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             ;; Replace outdated config.sub and config.guess:
+             (with-directory-excursion "Cfg"
+               (for-each (lambda (file)
+                           (install-file (string-append
+                                          (assoc-ref
+                                           (or native-inputs inputs) "automake")
+                                          "/share/automake-"
+                                          ,(version-major+minor
+                                            (package-version automake))
+                                          "/" file) "."))
+                         '("config.sub" "config.guess")))
+             #t)))))
     (home-page "http://www.mega-nerd.com/SRC/index.html")
     (synopsis "Audio sample rate conversion library")
     (description
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 644c9d7666..504a468bab 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -38,7 +38,7 @@
 ;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
 ;;; Copyright © 2017, 2018 Adriano Peluso <catonano@gmail.com>
 ;;; Copyright © 2017 Ben Sturmfels <ben@sturm.com.au>
-;;; Copyright © 2017, 2018 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2017, 2018, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.org>
 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
 ;;; Copyright © 2017, 2018 Kei Kebreau <kkebreau@posteo.net>
@@ -109,7 +109,8 @@
                                "python-2-deterministic-build-info.patch"
                                "python-2.7-site-prefixes.patch"
                                "python-2.7-source-date-epoch.patch"
-                               "python-2.7-adjust-tests.patch"))
+                               "python-2.7-adjust-tests.patch"
+                               "python-cross-compile.patch"))
       (modules '((guix build utils)))
       (snippet
        '(begin
@@ -150,6 +151,13 @@
              "INSTALL=install -c"
              "MKDIR_P=mkdir -p"
 
+             ;; Disable runtime check failing if cross-compiling, see:
+             ;; https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html
+             ,@(if (%current-target-system)
+                   '("ac_cv_buggy_getaddrinfo=no"
+                     "ac_cv_file__dev_ptmx=no"
+                     "ac_cv_file__dev_ptc=no")
+                   '())
              (string-append "LDFLAGS=-Wl,-rpath="
                             (assoc-ref %outputs "out") "/lib"))
        ;; With no -j argument tests use all available cpus, so provide one.
@@ -170,6 +178,12 @@
           (add-before
            'configure 'patch-lib-shells
            (lambda _
+             ;; This variable is used in setup.py to enable cross compilation
+             ;; specific switches. As it is not set properly by configure
+             ;; script, set it manually.
+             ,@(if (%current-target-system)
+                   '((setenv "_PYTHON_HOST_PLATFORM" ""))
+                   '())
              ;; Filter for existing files, since some may not exist in all
              ;; versions of python that are built with this recipe.
              (substitute* (filter file-exists?
@@ -249,7 +263,9 @@
                            (if (null? opt) "none" (car opt)))
                    (for-each (lambda (file)
                                (apply invoke
-                                      `(,(string-append out "/bin/python")
+                                      `(,,(if (%current-target-system)
+                                              "python2"
+                                              '(string-append out "/bin/python"))
                                         ,@opt
                                         "-m" "compileall"
                                         "-f" ; force rebuild
@@ -292,7 +308,12 @@
        ("tcl" ,tcl)
        ("tk" ,tk)))                               ; for tkinter
     (native-inputs
-     `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ;; When cross-compiling, a native version of Python itself is needed.
+       ,@(if (%current-target-system)
+             `(("python2" ,this-package)
+               ("which" ,which))
+             '())))
     (native-search-paths
      (list (search-path-specification
             (variable "PYTHONPATH")
@@ -364,10 +385,11 @@ data types.")
        ((#:phases phases)
        `(modify-phases ,phases
           (add-before 'check 'set-TZDIR
-            (lambda* (#:key inputs #:allow-other-keys)
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
               ;; test_email requires the Olson time zone database.
               (setenv "TZDIR"
-                      (string-append (assoc-ref inputs "tzdata")
+                      (string-append (assoc-ref
+                                      (or native-inputs inputs) "tzdata")
                                      "/share/zoneinfo"))
               #t))
           ;; Unset SOURCE_DATE_EPOCH while running the test-suite and set it
@@ -388,18 +410,24 @@ data types.")
                             (if (null? opt) "none" (car opt)))
                     (for-each (lambda (file)
                                 (apply invoke
-                                       `(,(string-append out "/bin/python3")
-                                         ,@opt
-                                         "-m" "compileall"
-                                         "-f" ; force rebuild
-                                         ;; Don't build lib2to3, because it's Python 2 code.
-                                         "-x" "lib2to3/.*"
-                                         ,file)))
+                                       `(,,(if (%current-target-system)
+                                               "python3"
+                                               '(string-append out
+                                                               "/bin/python3"))
+                                          ,@opt
+                                          "-m" "compileall"
+                                          "-f" ; force rebuild
+                                          ;; Don't build lib2to3, because it's Python 2 code.
+                                          "-x" "lib2to3/.*"
+                                          ,file)))
                               (find-files out "\\.py$")))
                   (list '() '("-O") '("-OO")))
                  #t)))))))
     (native-inputs
      `(("tzdata" ,tzdata-for-tests)
+       ,@(if (%current-target-system)
+             `(("python3" ,this-package))
+             '())
        ,@(package-native-inputs python-2)))
     (native-search-paths
      (list (search-path-specification
diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index 40a59635b1..1fd138fb4c 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -356,6 +357,14 @@ written by Paul Haahr and Byron Rakitzis.")
     (arguments
      `(#:phases
         (modify-phases %standard-phases
+          ,@(if (%current-target-system)
+                '((add-before 'configure 'set-cross-cc
+                     (lambda _
+                       (substitute* "configure"
+                         (("CC_FOR_GETHOST=\"cc\"")
+                          "CC_FOR_GETHOST=\"gcc\""))
+                       #t)))
+                '())
           (add-before 'check 'patch-test-scripts
             (lambda _
               ;; Take care of pwd
diff --git a/gnu/packages/swig.scm b/gnu/packages/swig.scm
index b1b17fc68d..90d698a8b4 100644
--- a/gnu/packages/swig.scm
+++ b/gnu/packages/swig.scm
@@ -62,6 +62,7 @@
     (native-inputs `(("boost" ,boost)
                      ("pcre" ,pcre "bin")))       ;for 'pcre-config'
     (inputs `(;; Provide these to run the corresponding tests.
+              ("pcre" ,pcre)
               ("guile" ,guile-2.0)
               ("perl" ,perl)))
               ;; FIXME: reactivate input python as soon as the test failures
diff --git a/gnu/packages/tcl.scm b/gnu/packages/tcl.scm
index 1e4aa13cc9..31f9ae848e 100644
--- a/gnu/packages/tcl.scm
+++ b/gnu/packages/tcl.scm
@@ -53,7 +53,7 @@
                 "0kjzj7mkzfnb7ksxanbibibfpciyvsh5ffdlhs0bmfc75kgd435d"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases (modify-phases %standard-phases
+     `(#:phases (modify-phases %standard-phases
                   (add-before 'configure 'pre-configure
                     (lambda _ (chdir "unix") #t))
                  (add-after 'install 'install-private-headers
@@ -73,9 +73,16 @@
        ;; PREFIX/share/man.  The 'validate-documentation-location' phase is
        ;; not able to fix this up because the default install populates both
        ;; PREFIX/man and PREFIX/share/man.
-       #:configure-flags (list (string-append "--mandir="
-                                              (assoc-ref %outputs "out")
-                                              "/share/man"))
+       #:configure-flags
+       (list (string-append "--mandir="
+                            (assoc-ref %outputs "out")
+                            "/share/man")
+             ;; This is needed when cross-compiling, see:
+             ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719247
+             ,@(if (%current-target-system)
+                   '("tcl_cv_strtod_buggy=1"
+                     "ac_cv_func_strtod=yes")
+                   '()))
 
        ;; XXX: There are a few test failures (related to HTTP, most
        ;; likely related to name resolution), but that doesn't cause
@@ -179,9 +186,16 @@ X11 GUIs.")
                                          "/lib -lfontconfig")))
                        #t))))
 
-       #:configure-flags (list (string-append "--with-tcl="
-                                              (assoc-ref %build-inputs "tcl")
-                                              "/lib"))
+       #:configure-flags
+       (list (string-append "--with-tcl="
+                            (assoc-ref %build-inputs "tcl")
+                            "/lib")
+             ;; This is needed when cross-compiling, see:
+             ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719247
+             ,@(if (%current-target-system)
+                   '("tcl_cv_strtod_buggy=1"
+                     "ac_cv_func_strtod=yes")
+                   '()))
 
        ;; The tests require a running X server, so we just skip them.
        #:tests? #f))
diff --git a/gnu/packages/texinfo.scm b/gnu/packages/texinfo.scm
index 1edeea2425..ef3dfba09e 100644
--- a/gnu/packages/texinfo.scm
+++ b/gnu/packages/texinfo.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,9 +21,11 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages texinfo)
+  #:use-module (gnu packages autotools)
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
@@ -41,8 +44,28 @@
                (base32
                 "0rixv4c301djr0d0cnsxs8c1wjndi6bf9vi5axz6mwjkv80cmfcv"))))
     (build-system gnu-build-system)
-    (inputs `(("ncurses" ,ncurses)
-              ("perl" ,perl)))
+    (arguments
+     ;; When cross-compiling, the package is configured twice: once with the
+     ;; native compiler and once with the cross-compiler. During the configure
+     ;; with the native compiler, the environment is reset. This leads to
+     ;; multiple environment variables missing. Do not reset the environment
+     ;; to prevent that.
+     (if (%current-target-system)
+         '(#:phases
+           (modify-phases %standard-phases
+             (add-before 'configure 'fix-cross-configure
+               (lambda _
+                 (substitute* "configure"
+                   (("env -i")
+                    "env "))
+                 #t))))
+         '()))
+    (inputs `(("ncurses" ,ncurses)))
+    ;; When cross-compiling, texinfo will build some of its own binaries with
+    ;; the native compiler. This means ncurses is needed both in both inputs
+    ;; and native-inputs.
+    (native-inputs `(("perl" ,perl)
+                     ("ncurses" ,ncurses)))
 
     (native-search-paths
      ;; This is the variable used by the standalone Info reader.
@@ -83,8 +106,7 @@ is on expressing the content semantically, avoiding physical markup commands.")
               (patches (search-patches "texinfo-5-perl-compat.patch"))
               (sha256
                (base32
-                "1njfwh2z34r2c4r0iqa7v24wmjzvsfyz4vplzry8ln3479lfywal"))))
-    (native-inputs '())))
+                "1njfwh2z34r2c4r0iqa7v24wmjzvsfyz4vplzry8ln3479lfywal"))))))
 
 (define-public texinfo-4
   (package (inherit texinfo)
@@ -98,8 +120,37 @@ is on expressing the content semantically, avoiding physical markup commands.")
               (sha256
                (base32
                 "1rf9ckpqwixj65bw469i634897xwlgkm5i9g2hv3avl6mv7b0a3d"))))
-    (native-inputs '())
-    (inputs `(("ncurses" ,ncurses) ("xz" ,xz)))))
+    (inputs `(("ncurses" ,ncurses)
+              ("xz" ,xz)))
+    (native-inputs
+      `(("automake" ,automake)
+        ,@(package-native-inputs texinfo)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texinfo)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'unpack 'fix-configure
+             (lambda* (#:key inputs native-inputs #:allow-other-keys)
+               ;; Replace outdated config.sub and config.guess.
+               (with-directory-excursion "build-aux"
+                 (for-each
+                  (lambda (file)
+                    (install-file (string-append
+                                   (assoc-ref
+                                    (or native-inputs inputs) "automake")
+                                   "/share/automake-"
+                                   ,(version-major+minor
+                                     (package-version automake))
+                                   "/" file) "."))
+                  '("config.sub" "config.guess")))
+               #t))
+           ;; Build native version of tools before running 'build phase.
+           ,@(if (%current-target-system)
+                 `((add-before 'build 'make-native-gnu-lib
+                      (lambda* (#:key inputs #:allow-other-keys)
+                        (invoke "make" "-C" "tools/gnulib/lib")
+                        #t)))
+                 '())))))))
 
 (define-public info-reader
   ;; The idea of this package is to have the standalone Info reader without
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index dd8f0fa5c7..1870f3f4e6 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -297,6 +298,23 @@ required structures.")
       #:disallowed-references ,(list (canonical-package perl))
       #:phases
       (modify-phases %standard-phases
+	,@(if (%current-target-system)
+	      '((add-before
+		    'configure 'set-cross-compile
+		  (lambda* (#:key target outputs #:allow-other-keys)
+		    (setenv "CROSS_COMPILE" (string-append target "-"))
+		    (setenv "CONFIGURE_TARGET_ARCH"
+			    (cond
+			     ((string-prefix? "i686" target)
+			      "linux-x86")
+			     ((string-prefix? "x86_64" target)
+			      "linux-x86_64")
+			     ((string-prefix? "arm" target)
+			      "linux-armv4")
+			     ((string-prefix? "aarch64" target)
+			      "linux-aarch64")))
+		    #t)))
+	      '())
         (replace 'configure
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
@@ -306,7 +324,9 @@ required structures.")
                 (("/usr/bin/env")
                  (string-append (assoc-ref %build-inputs "coreutils")
                                 "/bin/env")))
-              (invoke "./config"
+              (invoke ,@(if (%current-target-system)
+			    '("./Configure")
+			    '("./config"))
                       "shared"       ;build shared libraries
                       "--libdir=lib"
 
@@ -317,7 +337,10 @@ required structures.")
                                      "/share/openssl-" ,version)
 
                       (string-append "--prefix=" out)
-                      (string-append "-Wl,-rpath," lib)))))
+                      (string-append "-Wl,-rpath," lib)
+		      ,@(if (%current-target-system)
+			    '((getenv "CONFIGURE_TARGET_ARCH"))
+			    '())))))
         (add-after 'install 'move-static-libraries
           (lambda* (#:key outputs #:allow-other-keys)
             ;; Move static libraries to the "static" output.
@@ -432,21 +455,26 @@ required structures.")
                    (("^MANDIR[[:blank:]]*=.*$")
                     (string-append "MANDIR = " out "/share/man\n")))
                  #t)))
-        (replace 'configure
-          ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let ((out (assoc-ref outputs "out")))
-              (invoke "./config"
-                      "shared"                 ;build shared libraries
-                      "--libdir=lib"
-
-                      ;; The default for this catch-all directory is
-                      ;; PREFIX/ssl.  Change that to something more
-                      ;; conventional.
-                      (string-append "--openssldir=" out
-                                     "/share/openssl-" ,version)
-
-                      (string-append "--prefix=" out)))))
+	   (replace 'configure
+	     ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
+	     (lambda* (#:key outputs #:allow-other-keys)
+	       (let ((out (assoc-ref outputs "out")))
+		 (invoke ,@(if (%current-target-system)
+			       '("./Configure")
+			       '("./config"))
+			 "shared"                 ;build shared libraries
+			 "--libdir=lib"
+
+			 ;; The default for this catch-all directory is
+			 ;; PREFIX/ssl.  Change that to something more
+			 ;; conventional.
+			 (string-append "--openssldir=" out
+					"/share/openssl-" ,version)
+
+			 (string-append "--prefix=" out)
+			 ,@(if (%current-target-system)
+			       '((getenv "CONFIGURE_TARGET_ARCH"))
+			       '())))))
         (delete 'move-extra-documentation)
         (add-after 'install 'move-man3-pages
           (lambda* (#:key outputs #:allow-other-keys)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index bde480e8e3..99af761868 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -141,6 +141,10 @@ changes to project files over time.  It supports both a distributed workflow
 as well as the classic centralized workflow.")
     (license license:gpl2+)))
 
+(define git-cross-configure-flags
+  '("ac_cv_fread_reads_directories=yes"
+    "ac_cv_snprintf_returns_bogus=no"))
+
 (define-public git
   (package
    (name "git")
@@ -238,7 +242,10 @@ as well as the classic centralized workflow.")
       ;; absolute file name to 'wish'.
       #:configure-flags (list (string-append "--with-tcltk="
                                              (assoc-ref %build-inputs "tk")
-                                             "/bin/wish8.6")) ; XXX
+                                             "/bin/wish8.6")  ; XXX
+                              ,@(if (%current-target-system)
+                                    git-cross-configure-flags
+                                    '()))
 
       #:modules ((srfi srfi-1)
                  (srfi srfi-26)
@@ -255,6 +262,15 @@ as well as the classic centralized workflow.")
                               (remove (cut string-prefix? bash-full <>) path)
                               ":"))
               #t)))
+        ;; Add cross curl-config script to PATH when cross-compiling.
+        ,@(if (%current-target-system)
+              '((add-before 'configure 'add-cross-curl-config
+                   (lambda* (#:key inputs #:allow-other-keys)
+                     (setenv "PATH"
+                             (string-append (assoc-ref inputs "curl") "/bin:"
+                                            (getenv "PATH")))
+                     #t)))
+              '())
         (add-after 'configure 'patch-makefiles
           (lambda _
             (substitute* "Makefile"
@@ -513,7 +529,10 @@ everything from small to very large projects with speed and efficiency.")
        ((#:make-flags flags)
         `(delete "USE_LIBPCRE2=yes" ,flags))
        ((#:configure-flags flags)
-        ''())
+        `(list
+          ,@(if (%current-target-system)
+                git-cross-configure-flags
+                '())))
        ((#:disallowed-references lst '())
         `(,perl ,@lst))))
     (outputs '("out"))
@@ -552,7 +571,14 @@ everything from small to very large projects with speed and efficiency.")
     (build-system cmake-build-system)
     (outputs '("out" "debug"))
     (arguments
-     `(#:configure-flags '("-DUSE_SHA1DC=ON") ; SHA-1 collision detection
+     `(#:configure-flags
+       (list "-DUSE_SHA1DC=ON"  ; SHA-1 collision detection
+             ,@(if (%current-target-system)
+                   `((string-append
+                      "-DPKG_CONFIG_EXECUTABLE="
+                      (assoc-ref %build-inputs "pkg-config")
+                      "/bin/" ,(%current-target-system) "-pkg-config"))
+                   '()))
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'fix-hardcoded-paths
@@ -567,9 +593,13 @@ everything from small to very large projects with speed and efficiency.")
            (lambda _
              (for-each make-file-writable (find-files "."))
              #t))
-         ;; Run checks more verbosely.
+         ;; Run checks more verbosely, unless we are cross-compiling.
          (replace 'check
-           (lambda _ (invoke "./libgit2_clar" "-v" "-Q"))))))
+           (lambda* (#:key (tests? #t) #:allow-other-keys)
+             (if tests?
+                 (invoke "./libgit2_clar" "-v" "-Q")
+                 ;; Tests may be disabled if cross-compiling.
+                 (format #t "Test suite not run.~%")))))))
     (inputs
      `(("libssh2" ,libssh2)
        ("http-parser" ,http-parser)))
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 7ce4889caf..076b82124d 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -35,6 +35,8 @@
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
 ;;; Copyright © 2019 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -5536,10 +5538,22 @@ into your tests.  It automatically starts up a HTTP server in a separate thread
        #:make-flags
        (list (string-append "PREFIX="
                             (assoc-ref %outputs "out"))
-             "CC=gcc" "library")
+             "library"
+             ,@(if (%current-target-system)
+                   '()
+                   '("CC=gcc")))
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         ,@(if (%current-target-system)
+               '((replace 'configure
+                    (lambda* (#:key target #:allow-other-keys)
+                      (substitute* (find-files "." "Makefile")
+                        (("CC\\?=.*$")
+                         (string-append "CC=" target "-gcc\n"))
+                        (("AR\\?=.*$")
+                         (string-append "AR=" target "-ar\n")))
+                      #t)))
+               '((delete 'configure))))))
     (synopsis "HTTP request/response parser for C")
     (description "This is a parser for HTTP messages written in C.  It parses
 both requests and responses.  The parser is designed to be used in
@@ -6754,9 +6768,10 @@ derivation by David Revoy from the original MonsterID by Andreas Gohr.")
                 (assoc-ref outputs "lib")))
              #t))
          (add-before 'check 'set-timezone-directory
-           (lambda* (#:key inputs #:allow-other-keys)
-             (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
-                                            "/share/zoneinfo"))
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (setenv "TZDIR" (string-append
+                               (assoc-ref (or native-inputs inputs) "tzdata")
+                               "/share/zoneinfo"))
              #t)))))
     (home-page "https://nghttp2.org/")
     (synopsis "HTTP/2 protocol client, proxy, server, and library")
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index ba7c121776..f2083ae27d 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -244,6 +244,8 @@ project (but it is usable outside of the Gnome platform).")
               ("libxml2" ,libxml2)
               ("python" ,python-minimal-wrapper)
               ("zlib" ,zlib)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
     (description
      "Libxslt is an XSLT C library developed for the GNOME project.  It is
 based on libxml for XML parsing, tree manipulation and XPath support.")
@@ -956,6 +958,8 @@ code for classes that correspond to data structures defined by XMLSchema.")
                                               (assoc-ref %build-inputs
                                                          "util-linux")
                                               "/bin/getopt"))))
+    (native-inputs
+     `(("util-linux" ,util-linux)))
     (inputs
      `(("util-linux" ,util-linux)                 ; for 'getopt'
        ("libxml2" ,libxml2)                       ; for 'xmllint'
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 72480f76f1..43f86d8e1f 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
 ;;; Copyright © 2019 nee <nee@cock.li>
 ;;; Copyright © 2019 Yoshinori Arai <kumagusu08@gmail.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4551,6 +4552,13 @@ cannot be adequately worked around on the client side of the wire.")
           (base32
             "0azqxllcsfxc3ilhz6kwc6x7m8wc477p59ir9p0yrsldx766zbar"))))
     (build-system gnu-build-system)
+    ;; Disable zero malloc check that fails when cross-compiling.
+    (arguments
+     `(#:configure-flags
+       (list
+        ,@(if (%current-target-system)
+              '("--disable-malloc0returnsnull")
+              '()))))
     (propagated-inputs
       `(("xorgproto" ,xorgproto)))
     (inputs
@@ -4636,6 +4644,13 @@ cannot be adequately worked around on the client side of the wire.")
           (base32
             "0j89cnb06g8x79wmmnwzykgkkfdhin9j7hjpvsxwlr3fz1wmjvf0"))))
     (build-system gnu-build-system)
+    ;; Disable zero malloc check that fails when cross-compiling.
+    (arguments
+     `(#:configure-flags
+       (list
+        ,@(if (%current-target-system)
+              '("--disable-malloc0returnsnull")
+              '()))))
     (propagated-inputs
       `(("xorgproto" ,xorgproto)))
     (inputs
@@ -4727,8 +4742,21 @@ protocol and arbitrary X extension protocol.")
             "0c3563kw9fg15dpgx4dwvl12qz6sdqdns1pxa574hc7i5m42mman"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases
+     `(#:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'fix-configure
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             ;; Replace outdated config.sub and config.guess:
+             (for-each (lambda (file)
+                         (install-file (string-append
+                                        (assoc-ref
+                                         (or native-inputs inputs) "automake")
+                                        "/share/automake-"
+                                        ,(version-major+minor
+                                          (package-version automake))
+                                        "/" file) "."))
+                       '("config.sub" "config.guess"))
+             #t))
          (add-after 'install 'wrap-mkfontdir
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (wrap-program (string-append (assoc-ref outputs "out")
@@ -4740,7 +4768,8 @@ protocol and arbitrary X extension protocol.")
     (inputs
       `(("mkfontscale" ,mkfontscale)))
     (native-inputs
-      `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ("automake" ,automake))) ;For up to date 'config.guess' and 'config.sub'.
     (home-page "https://www.x.org/wiki/")
     (synopsis "Create an index of X font files in a directory")
     (description
@@ -5244,16 +5273,22 @@ draggable titlebars and borders.")
     (outputs '("out"
                "doc"))                            ;8 MiB of man pages + XML
     (arguments
-     '(#:configure-flags (list (string-append "--mandir="
-                                              (assoc-ref %outputs "doc")
-                                              "/share/man"))))
+     `(#:configure-flags
+       (list (string-append "--mandir="
+                            (assoc-ref %outputs "doc")
+                            "/share/man")
+             ;; Disable zero malloc check that fails when cross-compiling.
+             ,@(if (%current-target-system)
+                   '("--disable-malloc0returnsnull")
+                   '()))))
     (propagated-inputs
       `(("xorgproto" ,xorgproto)
         ("libxcb" ,libxcb)))
     (inputs
       `(("xtrans" ,xtrans)))
     (native-inputs
-      `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ("xorgproto" ,xorgproto)))
     (home-page "https://www.x.org/wiki/")
     (synopsis "Xorg Core X11 protocol client library")
     (description "Xorg Core X11 protocol client library.")
@@ -6376,25 +6411,28 @@ output.")
                                " ")))
              #t))
          (add-before 'build 'make-doubled-bdfs
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
              (invoke "make" "-C" "Fonts"
                      "doubled_bdfs"
                      (string-append "SHELL="
-                                    (assoc-ref inputs "bash")
+                                    (assoc-ref (or native-inputs inputs)
+                                               "bash")
                                     "/bin/bash"))))
          (replace 'install
-           (lambda* (#:key inputs outputs #:allow-other-keys)
+           (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref %outputs "out")))
                (invoke "make" "install-linux"
                        (string-append "prefix=" out)
                        (string-append "SHELL="
-                                      (assoc-ref inputs "bash")
+                                      (assoc-ref (or native-inputs inputs)
+                                                 "bash")
                                       "/bin/bash"))))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("bdftopcf" ,bdftopcf)
        ("bdfresize" ,bdfresize)
-       ("sharutils" ,sharutils)))                 ;for 'uuencode'
+       ("sharutils" ,sharutils)                   ;for 'uuencode'
+       ("perl" ,perl)))
     (inputs
      `(("perl" ,perl)))                           ;used by 'ckbcomp'
     (synopsis "Set up the Linux console font and keyboard")