aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-05-08 21:40:51 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-05-08 21:40:51 +0200
commit4bdf4182fe080c3409f6ef9b410146b67cfa2595 (patch)
treef1123ddb8c57eda6de026982904f6c5309adaca6 /gnu/packages/patches
parentc81457a5883ea43950eb2ecdcbb58a5b144bcd11 (diff)
parent23a59b180b28b9fa22120c2b8305b9324442b94d (diff)
downloadguix-4bdf4182fe080c3409f6ef9b410146b67cfa2595.tar
guix-4bdf4182fe080c3409f6ef9b410146b67cfa2595.tar.gz
Merge branch 'core-updates'
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/aegisub-make43.patch20
-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/avahi-CVE-2018-1000845.patch42
-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/behave-skip-a-couple-of-tests.patch462
-rw-r--r--gnu/packages/patches/clang-runtime-3.8-libsanitizer-mode-field.patch50
-rw-r--r--gnu/packages/patches/clang-runtime-3.9-libsanitizer-mode-field.patch50
-rw-r--r--gnu/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch60
-rw-r--r--gnu/packages/patches/cmake-curl-certificates.patch10
-rw-r--r--gnu/packages/patches/coreutils-ls.patch117
-rw-r--r--gnu/packages/patches/curl-use-ssl-cert-env.patch64
-rw-r--r--gnu/packages/patches/cyrus-sasl-ac-try-run-fix.patch12
-rw-r--r--gnu/packages/patches/datefudge-gettimeofday.patch13
-rw-r--r--gnu/packages/patches/dconf-meson-0.52.patch19
-rw-r--r--gnu/packages/patches/doxygen-1.8.17-runtests.patch73
-rw-r--r--gnu/packages/patches/doxygen-test.patch38
-rw-r--r--gnu/packages/patches/evolution-data-server-libical-compat.patch16
-rw-r--r--gnu/packages/patches/fifengine-swig-compat.patch17
-rw-r--r--gnu/packages/patches/file-CVE-2018-10360.patch27
-rw-r--r--gnu/packages/patches/findutils-gnulib-libio.patch114
-rw-r--r--gnu/packages/patches/findutils-makedev.patch22
-rw-r--r--gnu/packages/patches/findutils-test-rwlock-threads.patch38
-rw-r--r--gnu/packages/patches/findutils-test-xargs.patch22
-rw-r--r--gnu/packages/patches/fontconfig-hurd-path-max.patch17
-rw-r--r--gnu/packages/patches/fribidi-CVE-2019-18397.patch26
-rw-r--r--gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch52
-rw-r--r--gnu/packages/patches/gcc-5-hurd.patch63
-rw-r--r--gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch53
-rw-r--r--gnu/packages/patches/gcc-7-cross-toolexeclibdir.patch1041
-rw-r--r--gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch53
-rw-r--r--gnu/packages/patches/gcc-boot-4.6.4.patch (renamed from gnu/packages/patches/gcc-boot-4.7.4.patch)23
-rw-r--r--gnu/packages/patches/gd-CVE-2018-1000222.patch87
-rw-r--r--gnu/packages/patches/gd-CVE-2018-5711.patch61
-rw-r--r--gnu/packages/patches/gd-CVE-2019-6977.patch36
-rw-r--r--gnu/packages/patches/gd-CVE-2019-6978.patch301
-rw-r--r--gnu/packages/patches/gd-brect-bounds.patch63
-rw-r--r--gnu/packages/patches/gd-fix-tests-on-i686.patch2
-rw-r--r--gnu/packages/patches/gd-freetype-test-failure.patch59
-rw-r--r--gnu/packages/patches/gdm-default-session.patch44
-rw-r--r--gnu/packages/patches/ghc-dont-pass-linker-flags-via-response-files.patch27
-rw-r--r--gnu/packages/patches/ghc-testsuite-dlopen-pie.patch54
-rw-r--r--gnu/packages/patches/ghostscript-no-header-id.patch14
-rw-r--r--gnu/packages/patches/ghostscript-no-header-uuid.patch12
-rw-r--r--gnu/packages/patches/giflib-make-reallocarray-private.patch120
-rw-r--r--gnu/packages/patches/glibc-2.29-supported-locales.patch33
-rw-r--r--gnu/packages/patches/glibc-CVE-2019-19126.patch22
-rw-r--r--gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch30
-rw-r--r--gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch84
-rw-r--r--gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch90
-rw-r--r--gnu/packages/patches/glibc-hurd-gettyent.patch34
-rw-r--r--gnu/packages/patches/glibc-hurd-mach-print.patch23
-rw-r--r--gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch637
-rw-r--r--gnu/packages/patches/glibc-supported-locales.patch11
-rw-r--r--gnu/packages/patches/gnome-shell-disable-test.patch25
-rw-r--r--gnu/packages/patches/gnome-shell-theme.patch30
-rw-r--r--gnu/packages/patches/gnutls-cross.patch82
-rw-r--r--gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch41
-rw-r--r--gnu/packages/patches/gsl-test-i686.patch17
-rw-r--r--gnu/packages/patches/guile-3.0-linux-syscalls.patch345
-rw-r--r--gnu/packages/patches/guile-3.0-relocatable.patch69
-rw-r--r--gnu/packages/patches/guile-relocatable.patch36
-rw-r--r--gnu/packages/patches/guile-sqlite3-fix-cross-compilation.patch55
-rw-r--r--gnu/packages/patches/hurd-cross.patch33
-rw-r--r--gnu/packages/patches/hurd-fix-eth-multiplexer-dependency.patch26
-rw-r--r--gnu/packages/patches/inetutils-hurd.patch583
-rw-r--r--gnu/packages/patches/jbig2dec-ignore-testtest.patch16
-rw-r--r--gnu/packages/patches/less-hurd-path-max.patch36
-rw-r--r--gnu/packages/patches/libffi-3.2.1-complex-alpha.patch28
-rw-r--r--gnu/packages/patches/libgpg-error-gawk-compat.patch155
-rw-r--r--gnu/packages/patches/libjpeg-turbo-CVE-2019-2201.patch31
-rw-r--r--gnu/packages/patches/libreoffice-poppler-compat.patch19
-rw-r--r--gnu/packages/patches/libtirpc-hurd-client.patch50
-rw-r--r--gnu/packages/patches/libtirpc-hurd.patch172
-rw-r--r--gnu/packages/patches/libxslt-generated-ids.patch6
-rw-r--r--gnu/packages/patches/linphoneqt-tabbutton.patch96
-rw-r--r--gnu/packages/patches/make-glibc-compat.patch52
-rw-r--r--gnu/packages/patches/make-impure-dirs.patch12
-rw-r--r--gnu/packages/patches/mit-krb5-hurd.patch165
-rw-r--r--gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch29
-rw-r--r--gnu/packages/patches/openssh-hurd.patch30
-rw-r--r--gnu/packages/patches/pango-skip-libthai-test.patch23
-rw-r--r--gnu/packages/patches/pciutils-hurd-configure.patch35
-rw-r--r--gnu/packages/patches/perl-cross.patch60
-rw-r--r--gnu/packages/patches/potrace-tests.patch50
-rw-r--r--gnu/packages/patches/python-2.7-search-paths.patch12
-rw-r--r--gnu/packages/patches/python-3-arm-alignment.patch21
-rw-r--r--gnu/packages/patches/python-3-search-paths.patch23
-rw-r--r--gnu/packages/patches/python-3.8-search-paths.patch17
-rw-r--r--gnu/packages/patches/python-cffi-x87-stack-clean.patch29
-rw-r--r--gnu/packages/patches/python-cross-compile.patch145
-rw-r--r--gnu/packages/patches/python-gst-fix-build-with-python-3.8.patch36
-rw-r--r--gnu/packages/patches/python-pycrypto-time-clock.patch23
-rw-r--r--gnu/packages/patches/qtbase-moc-ignore-gcc-macro.patch17
-rw-r--r--gnu/packages/patches/screen-hurd-path-max.patch42
-rw-r--r--gnu/packages/patches/seahorse-gkr-use-0-on-empty-flags.patch32
-rw-r--r--gnu/packages/patches/shadow-hurd-pctrl.patch16
-rw-r--r--gnu/packages/patches/swig-guile-gc.patch76
-rw-r--r--gnu/packages/patches/tcl-fix-cross-compilation.patch39
-rw-r--r--gnu/packages/patches/tcsh-fix-autotest.patch45
-rw-r--r--gnu/packages/patches/tcsh-fix-out-of-bounds-read.patch31
-rw-r--r--gnu/packages/patches/telepathy-glib-channel-memory-leak.patch19
-rw-r--r--gnu/packages/patches/texlive-bin-CVE-2018-17407.patch249
-rw-r--r--gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch293
-rw-r--r--gnu/packages/patches/texlive-bin-poppler-0.83.patch52
-rw-r--r--gnu/packages/patches/texlive-bin-poppler-0.86.patch17
-rw-r--r--gnu/packages/patches/vigra-python-compat.patch18
108 files changed, 6125 insertions, 2250 deletions
diff --git a/gnu/packages/patches/aegisub-make43.patch b/gnu/packages/patches/aegisub-make43.patch
new file mode 100644
index 0000000000..32f9d7749c
--- /dev/null
+++ b/gnu/packages/patches/aegisub-make43.patch
@@ -0,0 +1,20 @@
+Fix build with GNU Make 4.3:
+
+https://github.com/Aegisub/Aegisub/issues/171
+
+Patch taken from upstream:
+
+https://github.com/Aegisub/Aegisub/commit/6bd3f4c26b8fc1f76a8b797fcee11e7611d59a39
+
+diff --git a/Makefile.target b/Makefile.target
+--- a/Makefile.target
++++ b/Makefile.target
+@@ -112,7 +112,7 @@ POST_FLAGS = $($@_FLAGS) -c -o $@ $<
+ # Libraries contain all object files they depend on (but they may depend on other files)
+ # Not using libtool on OS X because it has an unsilenceable warning about a
+ # compatibility issue with BSD 4.3 (wtf)
+-lib%.a: $$($$*_OBJ)
++lib%.a: $$($$(*F)_OBJ)
+ @$(BIN_MKDIR_P) $(dir $@)
+ $(BIN_AR) cru $@ $(filter %.o,$^)
+ $(BIN_RANLIB) $@
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/avahi-CVE-2018-1000845.patch b/gnu/packages/patches/avahi-CVE-2018-1000845.patch
deleted file mode 100644
index e5b13e0bee..0000000000
--- a/gnu/packages/patches/avahi-CVE-2018-1000845.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From e111def44a7df4624a4aa3f85fe98054bffb6b4f Mon Sep 17 00:00:00 2001
-From: Trent Lloyd <trent@lloyd.id.au>
-Date: Sat, 22 Dec 2018 09:06:07 +0800
-Subject: [PATCH] Drop legacy unicast queries from address not on local link
-
-When handling legacy unicast queries, ensure that the source IP is
-inside a subnet on the local link, otherwise drop the packet.
-
-Fixes #145
-Fixes #203
-CVE-2017-6519
-CVE-2018-100084
----
- avahi-core/server.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/avahi-core/server.c b/avahi-core/server.c
-index a2cb19a8..a2580e38 100644
---- a/avahi-core/server.c
-+++ b/avahi-core/server.c
-@@ -930,6 +930,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
-
- if (avahi_dns_packet_is_query(p)) {
- int legacy_unicast = 0;
-+ char t[AVAHI_ADDRESS_STR_MAX];
-
- /* For queries EDNS0 might allow ARCOUNT != 0. We ignore the
- * AR section completely here, so far. Until the day we add
-@@ -947,6 +948,13 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
- legacy_unicast = 1;
- }
-
-+ if (!is_mdns_mcast_address(dst_address) &&
-+ !avahi_interface_address_on_link(i, src_address)) {
-+
-+ avahi_log_debug("Received non-local unicast query from host %s on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), i->hardware->name, i->protocol);
-+ return;
-+ }
-+
- if (legacy_unicast)
- reflect_legacy_unicast_query_packet(s, p, i, src_address, port);
-
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/behave-skip-a-couple-of-tests.patch b/gnu/packages/patches/behave-skip-a-couple-of-tests.patch
new file mode 100644
index 0000000000..e3d4e15241
--- /dev/null
+++ b/gnu/packages/patches/behave-skip-a-couple-of-tests.patch
@@ -0,0 +1,462 @@
+Fix build with Python 3.8, this is a patch based on upstream commit [1].
+
+1: c000c88eb5239b87f299c85e83b349b0ef387ae7
+
+
+diff --git a/behave.ini b/behave.ini
+index 45c0f0d7..952240d6 100644
+--- a/behave.ini
++++ b/behave.ini
+@@ -15,8 +15,9 @@ show_skipped = false
+ format = rerun
+ progress3
+ outfiles = rerun.txt
+- reports/report_progress3.txt
++ build/behave.reports/report_progress3.txt
+ junit = true
++junit_directory = build/behave.reports
+ logging_level = INFO
+ # logging_format = LOG.%(levelname)-8s %(name)-10s: %(message)s
+ # logging_format = LOG.%(levelname)-8s %(asctime)s %(name)-10s: %(message)s
+diff --git a/features/environment.py b/features/environment.py
+index 4744e89a..3769ee40 100644
+--- a/features/environment.py
++++ b/features/environment.py
+@@ -1,5 +1,7 @@
+ # -*- coding: UTF-8 -*-
++# FILE: features/environemnt.py
+
++from __future__ import absolute_import, print_function
+ from behave.tag_matcher import ActiveTagMatcher, setup_active_tag_values
+ from behave4cmd0.setup_command_shell import setup_command_shell_processors4behave
+ import platform
+@@ -20,6 +22,15 @@
+ }
+ active_tag_matcher = ActiveTagMatcher(active_tag_value_provider)
+
++
++def print_active_tags_summary():
++ active_tag_data = active_tag_value_provider
++ print("ACTIVE-TAG SUMMARY:")
++ print("use.with_python.version=%s" % active_tag_data.get("python.version"))
++ # print("use.with_os=%s" % active_tag_data.get("os"))
++ print()
++
++
+ # -----------------------------------------------------------------------------
+ # HOOKS:
+ # -----------------------------------------------------------------------------
+@@ -30,11 +41,14 @@ def before_all(context):
+ setup_python_path()
+ setup_context_with_global_params_test(context)
+ setup_command_shell_processors4behave()
++ print_active_tags_summary()
++
+
+ def before_feature(context, feature):
+ if active_tag_matcher.should_exclude_with(feature.tags):
+ feature.skip(reason=active_tag_matcher.exclude_reason)
+
++
+ def before_scenario(context, scenario):
+ if active_tag_matcher.should_exclude_with(scenario.effective_tags):
+ scenario.skip(reason=active_tag_matcher.exclude_reason)
+diff --git a/features/step.duplicated_step.feature b/features/step.duplicated_step.feature
+index 59888b0f..396cca27 100644
+--- a/features/step.duplicated_step.feature
++++ b/features/step.duplicated_step.feature
+@@ -32,11 +32,11 @@ Feature: Duplicated Step Definitions
+ AmbiguousStep: @given('I call Alice') has already been defined in
+ existing step @given('I call Alice') at features/steps/alice_steps.py:3
+ """
+- And the command output should contain:
+- """
+- File "features/steps/alice_steps.py", line 7, in <module>
+- @given(u'I call Alice')
+- """
++ # -- DISABLED: Python 3.8 traceback line numbers differ w/ decorators (+1).
++ # And the command output should contain:
++ # """
++ # File "features/steps/alice_steps.py", line 7, in <module>
++ # """
+
+
+ Scenario: Duplicated Step Definition in another File
+@@ -70,11 +70,11 @@ Feature: Duplicated Step Definitions
+ AmbiguousStep: @given('I call Bob') has already been defined in
+ existing step @given('I call Bob') at features/steps/bob1_steps.py:3
+ """
+- And the command output should contain:
+- """
+- File "features/steps/bob2_steps.py", line 3, in <module>
+- @given('I call Bob')
+- """
++ # -- DISABLED: Python 3.8 traceback line numbers differ w/ decorators (+1).
++ # And the command output should contain:
++ # """
++ # File "features/steps/bob2_steps.py", line 3, in <module>
++ # """
+
+ @xfail
+ Scenario: Duplicated Same Step Definition via import from another File
+diff --git a/issue.features/environment.py b/issue.features/environment.py
+index 2dfec751..7e48ee03 100644
+--- a/issue.features/environment.py
++++ b/issue.features/environment.py
+@@ -1,5 +1,5 @@
+ # -*- coding: UTF-8 -*-
+-# FILE: features/environment.py
++# FILE: issue.features/environemnt.py
+ # pylint: disable=unused-argument
+ """
+ Functionality:
+@@ -7,17 +7,20 @@
+ * active tags
+ """
+
+-from __future__ import print_function
++
++from __future__ import absolute_import, print_function
+ import sys
+ import platform
+ import os.path
+ import six
+ from behave.tag_matcher import ActiveTagMatcher
+ from behave4cmd0.setup_command_shell import setup_command_shell_processors4behave
+-# PREPARED:
+-# from behave.tag_matcher import setup_active_tag_values
++# PREPARED: from behave.tag_matcher import setup_active_tag_values
+
+
++# ---------------------------------------------------------------------------
++# TEST SUPPORT: For Active Tags
++# ---------------------------------------------------------------------------
+ def require_tool(tool_name):
+ """Check if a tool (an executable program) is provided on this platform.
+
+@@ -45,12 +48,14 @@ def require_tool(tool_name):
+ # print("TOOL-NOT-FOUND: %s" % tool_name)
+ return False
+
++
+ def as_bool_string(value):
+ if bool(value):
+ return "yes"
+ else:
+ return "no"
+
++
+ def discover_ci_server():
+ # pylint: disable=invalid-name
+ ci_server = "none"
+@@ -67,11 +72,17 @@ def discover_ci_server():
+ return ci_server
+
+
++# ---------------------------------------------------------------------------
++# BEHAVE SUPPORT: Active Tags
++# ---------------------------------------------------------------------------
+ # -- MATCHES ANY TAGS: @use.with_{category}={value}
+ # NOTE: active_tag_value_provider provides category values for active tags.
++python_version = "%s.%s" % sys.version_info[:2]
+ active_tag_value_provider = {
++ "platform": sys.platform,
+ "python2": str(six.PY2).lower(),
+ "python3": str(six.PY3).lower(),
++ "python.version": python_version,
+ # -- python.implementation: cpython, pypy, jython, ironpython
+ "python.implementation": platform.python_implementation().lower(),
+ "pypy": str("__pypy__" in sys.modules).lower(),
+@@ -82,17 +92,33 @@ def discover_ci_server():
+ }
+ active_tag_matcher = ActiveTagMatcher(active_tag_value_provider)
+
++
++def print_active_tags_summary():
++ active_tag_data = active_tag_value_provider
++ print("ACTIVE-TAG SUMMARY:")
++ print("use.with_python.version=%s" % active_tag_data.get("python.version"))
++ # print("use.with_platform=%s" % active_tag_data.get("platform"))
++ # print("use.with_os=%s" % active_tag_data.get("os"))
++ print()
++
++
++# ---------------------------------------------------------------------------
++# BEHAVE HOOKS:
++# ---------------------------------------------------------------------------
+ def before_all(context):
+ # -- SETUP ACTIVE-TAG MATCHER (with userdata):
+ # USE: behave -D browser=safari ...
+- # NOT-NEEDED: setup_active_tag_values(active_tag_value_provider,
+- # context.config.userdata)
++ # NOT-NEEDED:
++ # setup_active_tag_values(active_tag_value_provider, context.config.userdata)
+ setup_command_shell_processors4behave()
++ print_active_tags_summary()
++
+
+ def before_feature(context, feature):
+ if active_tag_matcher.should_exclude_with(feature.tags):
+ feature.skip(reason=active_tag_matcher.exclude_reason)
+
++
+ def before_scenario(context, scenario):
+ if active_tag_matcher.should_exclude_with(scenario.effective_tags):
+ scenario.skip(reason=active_tag_matcher.exclude_reason)
+diff --git a/issue.features/issue0330.feature b/issue.features/issue0330.feature
+index dc1ebe75..81cb6e29 100644
+--- a/issue.features/issue0330.feature
++++ b/issue.features/issue0330.feature
+@@ -70,6 +70,7 @@ Feature: Issue #330: Skipped scenarios are included in junit reports when --no-s
+ And note that "bob.feature is skipped"
+
+
++ @not.with_python.version=3.8
+ Scenario: Junit report for skipped feature is created with --show-skipped
+ When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset"
+ Then it should pass with:
+@@ -83,6 +84,23 @@ Feature: Issue #330: Skipped scenarios are included in junit reports when --no-s
+ <testsuite errors="0" failures="0" name="bob.Bob" skipped="1" tests="1" time="0.0">
+ """
+
++ @use.with_python.version=3.8
++ Scenario: Junit report for skipped feature is created with --show-skipped
++ When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset"
++ Then it should pass with:
++ """
++ 1 feature passed, 0 failed, 1 skipped
++ """
++ And a file named "test_results/TESTS-alice.xml" exists
++ And a file named "test_results/TESTS-bob.xml" exists
++ And the file "test_results/TESTS-bob.xml" should contain:
++ """
++ <testsuite name="bob.Bob" tests="1" errors="0" failures="0" skipped="1" time="0.0">
++ """
++ # -- HINT FOR: Python < 3.8
++ # <testsuite errors="0" failures="0" name="bob.Bob" skipped="1" tests="1" time="0.0">
++
++ @not.with_python.version=3.8
+ Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped
+ When I run "behave --junit -t @tag1 --no-skipped"
+ Then it should pass with:
+@@ -102,7 +120,30 @@ Feature: Issue #330: Skipped scenarios are included in junit reports when --no-s
+ """
+ And note that "Charly2 is the skipped scenarion in charly.feature"
+
++ @use.with_python.version=3.8
++ Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped
++ When I run "behave --junit -t @tag1 --no-skipped"
++ Then it should pass with:
++ """
++ 2 features passed, 0 failed, 1 skipped
++ 2 scenarios passed, 0 failed, 2 skipped
++ """
++ And a file named "test_results/TESTS-alice.xml" exists
++ And a file named "test_results/TESTS-charly.xml" exists
++ And the file "test_results/TESTS-charly.xml" should contain:
++ """
++ <testsuite name="charly.Charly" tests="1" errors="0" failures="0" skipped="0"
++ """
++ # -- HINT FOR: Python < 3.8
++ # <testsuite errors="0" failures="0" name="charly.Charly" skipped="0" tests="1"
++ And the file "test_results/TESTS-charly.xml" should not contain:
++ """
++ <testcase classname="charly.Charly" name="Charly2"
++ """
++ And note that "Charly2 is the skipped scenarion in charly.feature"
++
+
++ @not.with_python.version=3.8
+ Scenario: Junit report for skipped scenario is shown and counted with --show-skipped
+ When I run "behave --junit -t @tag1 --show-skipped"
+ Then it should pass with:
+@@ -122,3 +163,26 @@ Feature: Issue #330: Skipped scenarios are included in junit reports when --no-s
+ """
+ And note that "Charly2 is the skipped scenarion in charly.feature"
+
++
++ @use.with_python.version=3.8
++ Scenario: Junit report for skipped scenario is shown and counted with --show-skipped
++ When I run "behave --junit -t @tag1 --show-skipped"
++ Then it should pass with:
++ """
++ 2 features passed, 0 failed, 1 skipped
++ 2 scenarios passed, 0 failed, 2 skipped
++ """
++ And a file named "test_results/TESTS-alice.xml" exists
++ And a file named "test_results/TESTS-charly.xml" exists
++ And the file "test_results/TESTS-charly.xml" should contain:
++ """
++ <testsuite name="charly.Charly" tests="2" errors="0" failures="0" skipped="1"
++ """
++ # HINT: Python < 3.8
++ # <testsuite errors="0" failures="0" name="charly.Charly" skipped="1" tests="2"
++ And the file "test_results/TESTS-charly.xml" should contain:
++ """
++ <testcase classname="charly.Charly" name="Charly2" status="skipped"
++ """
++ And note that "Charly2 is the skipped scenarion in charly.feature"
++
+diff --git a/issue.features/issue0446.feature b/issue.features/issue0446.feature
+index a2ed892d..901bdec5 100644
+--- a/issue.features/issue0446.feature
++++ b/issue.features/issue0446.feature
+@@ -58,6 +58,7 @@ Feature: Issue #446 -- Support scenario hook-errors with JUnitReporter
+ behave.reporter.junit.show_hostname = False
+ """
+
++ @not.with_python.version=3.8
+ Scenario: Hook error in before_scenario()
+ When I run "behave -f plain --junit features/before_scenario_failure.feature"
+ Then it should fail with:
+@@ -86,6 +87,40 @@ Feature: Issue #446 -- Support scenario hook-errors with JUnitReporter
+ And note that "the traceback is contained in the XML element <error/>"
+
+
++ @use.with_python.version=3.8
++ Scenario: Hook error in before_scenario()
++ When I run "behave -f plain --junit features/before_scenario_failure.feature"
++ Then it should fail with:
++ """
++ 0 scenarios passed, 1 failed, 0 skipped
++ """
++ And the command output should contain:
++ """
++ HOOK-ERROR in before_scenario: RuntimeError: OOPS
++ """
++ And the file "reports/TESTS-before_scenario_failure.xml" should contain:
++ """
++ <testsuite name="before_scenario_failure.Alice" tests="1" errors="1" failures="0" skipped="0"
++ """
++ # -- HINT FOR: Python < 3.8
++ # <testsuite errors="1" failures="0" name="before_scenario_failure.Alice" skipped="0" tests="1"
++ And the file "reports/TESTS-before_scenario_failure.xml" should contain:
++ """
++ <error type="RuntimeError" message="HOOK-ERROR in before_scenario: RuntimeError: OOPS">
++ """
++ # -- HINT FOR: Python < 3.8
++ # <error message="HOOK-ERROR in before_scenario: RuntimeError: OOPS" type="RuntimeError">
++ And the file "reports/TESTS-before_scenario_failure.xml" should contain:
++ """
++ File "features/environment.py", line 6, in before_scenario
++ cause_hook_failure()
++ File "features/environment.py", line 2, in cause_hook_failure
++ raise RuntimeError("OOPS")
++ """
++ And note that "the traceback is contained in the XML element <error/>"
++
++
++ @not.with_python.version=3.8
+ Scenario: Hook error in after_scenario()
+ When I run "behave -f plain --junit features/after_scenario_failure.feature"
+ Then it should fail with:
+@@ -114,3 +149,38 @@ Feature: Issue #446 -- Support scenario hook-errors with JUnitReporter
+ raise RuntimeError("OOPS")
+ """
+ And note that "the traceback is contained in the XML element <error/>"
++
++
++ @use.with_python.version=3.8
++ Scenario: Hook error in after_scenario()
++ When I run "behave -f plain --junit features/after_scenario_failure.feature"
++ Then it should fail with:
++ """
++ 0 scenarios passed, 1 failed, 0 skipped
++ """
++ And the command output should contain:
++ """
++ Scenario: B1
++ Given another step passes ... passed
++ HOOK-ERROR in after_scenario: RuntimeError: OOPS
++ """
++ And the file "reports/TESTS-after_scenario_failure.xml" should contain:
++ """
++ <testsuite name="after_scenario_failure.Bob" tests="1" errors="1" failures="0" skipped="0"
++ """
++ # -- HINT FOR: Python < 3.8
++ # <testsuite errors="1" failures="0" name="after_scenario_failure.Bob" skipped="0" tests="1"
++ And the file "reports/TESTS-after_scenario_failure.xml" should contain:
++ """
++ <error type="RuntimeError" message="HOOK-ERROR in after_scenario: RuntimeError: OOPS">
++ """
++ # -- HINT FOR: Python < 3.8
++ # <error message="HOOK-ERROR in after_scenario: RuntimeError: OOPS" type="RuntimeError">
++ And the file "reports/TESTS-after_scenario_failure.xml" should contain:
++ """
++ File "features/environment.py", line 10, in after_scenario
++ cause_hook_failure()
++ File "features/environment.py", line 2, in cause_hook_failure
++ raise RuntimeError("OOPS")
++ """
++ And note that "the traceback is contained in the XML element <error/>"
+diff --git a/issue.features/issue0457.feature b/issue.features/issue0457.feature
+index f80640e9..46f96e9c 100644
+--- a/issue.features/issue0457.feature
++++ b/issue.features/issue0457.feature
+@@ -24,6 +24,7 @@ Feature: Issue #457 -- Double-quotes in error messages of JUnit XML reports
+ """
+
+
++ @not.with_python.version=3.8
+ Scenario: Use failing assertation in a JUnit XML report
+ Given a file named "features/fails1.feature" with:
+ """
+@@ -44,6 +45,31 @@ Feature: Issue #457 -- Double-quotes in error messages of JUnit XML reports
+ <failure message="FAILED: My name is &quot;Alice&quot;"
+ """
+
++ @use.with_python.version=3.8
++ Scenario: Use failing assertation in a JUnit XML report
++ Given a file named "features/fails1.feature" with:
++ """
++ Feature:
++ Scenario: Alice
++ Given a step fails with message:
++ '''
++ My name is "Alice"
++ '''
++ """
++ When I run "behave --junit features/fails1.feature"
++ Then it should fail with:
++ """
++ 0 scenarios passed, 1 failed, 0 skipped
++ """
++ And the file "reports/TESTS-fails1.xml" should contain:
++ """
++ <failure type="AssertionError" message="FAILED: My name is &quot;Alice&quot;">
++ """
++ # -- HINT FOR: Python < 3.8
++ # <failure message="FAILED: My name is &quot;Alice&quot;"
++
++
++ @not.with_python.version=3.8
+ Scenario: Use exception in a JUnit XML report
+ Given a file named "features/fails2.feature" with:
+ """
+@@ -63,3 +89,26 @@ Feature: Issue #457 -- Double-quotes in error messages of JUnit XML reports
+ """
+ <error message="My name is &quot;Bob&quot; and &lt;here&gt; I am"
+ """
++
++ @use.with_python.version=3.8
++ Scenario: Use exception in a JUnit XML report
++ Given a file named "features/fails2.feature" with:
++ """
++ Feature:
++ Scenario: Bob
++ Given a step fails with error and message:
++ '''
++ My name is "Bob" and <here> I am
++ '''
++ """
++ When I run "behave --junit features/fails2.feature"
++ Then it should fail with:
++ """
++ 0 scenarios passed, 1 failed, 0 skipped
++ """
++ And the file "reports/TESTS-fails2.xml" should contain:
++ """
++ <error type="RuntimeError" message="My name is &quot;Bob&quot; and &lt;here&gt; I am">
++ """
++ # -- HINT FOR: Python < 3.8
++ # <error message="My name is &quot;Bob&quot; and &lt;here&gt; I am"
diff --git a/gnu/packages/patches/clang-runtime-3.8-libsanitizer-mode-field.patch b/gnu/packages/patches/clang-runtime-3.8-libsanitizer-mode-field.patch
new file mode 100644
index 0000000000..f4bca3ecb1
--- /dev/null
+++ b/gnu/packages/patches/clang-runtime-3.8-libsanitizer-mode-field.patch
@@ -0,0 +1,50 @@
+Adjust libsanitizer to ABI change in glibc 2.31.
+
+Adapted to 3.x from this upstream commit:
+https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
+
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1130,8 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+ #ifndef __GLIBC_PREREQ
+ #define __GLIBC_PREREQ(x, y) 0
+ #endif
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++ on many architectures. */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -188,17 +188,16 @@ namespace __sanitizer {
+ unsigned __seq;
+ u64 __unused1;
+ u64 __unused2;
+-#elif defined(__mips__) || defined(__aarch64__)
+- unsigned int mode;
+- unsigned short __seq;
+- unsigned short __pad1;
+- unsigned long __unused1;
+- unsigned long __unused2;
++#elif defined(__sparc__)
++ unsigned mode;
++ unsigned short __pad2;
++ unsigned short __seq;
++ unsigned long long __unused1;
++ unsigned long long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
+- unsigned short __seq;
+- unsigned short __pad2;
++ unsigned int mode;
++ unsigned short __seq;
++ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+ u64 __unused1;
+ u64 __unused2;
diff --git a/gnu/packages/patches/clang-runtime-3.9-libsanitizer-mode-field.patch b/gnu/packages/patches/clang-runtime-3.9-libsanitizer-mode-field.patch
new file mode 100644
index 0000000000..2598a1bdeb
--- /dev/null
+++ b/gnu/packages/patches/clang-runtime-3.9-libsanitizer-mode-field.patch
@@ -0,0 +1,50 @@
+Adjust libsanitizer to ABI change in glibc 2.31.
+
+Adapted to 3.x from this upstream commit:
+https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
+
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1139,8 +1139,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++ on many architectures. */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -194,17 +194,16 @@ namespace __sanitizer {
+ unsigned __seq;
+ u64 __unused1;
+ u64 __unused2;
+-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
+- unsigned int mode;
+- unsigned short __seq;
+- unsigned short __pad1;
+- unsigned long __unused1;
+- unsigned long __unused2;
++#elif defined(__sparc__)
++ unsigned mode;
++ unsigned short __pad2;
++ unsigned short __seq;
++ unsigned long long __unused1;
++ unsigned long long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
+- unsigned short __seq;
+- unsigned short __pad2;
++ unsigned int mode;
++ unsigned short __seq;
++ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+ u64 __unused1;
+ u64 __unused2;
diff --git a/gnu/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch b/gnu/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch
new file mode 100644
index 0000000000..ebb080ed9d
--- /dev/null
+++ b/gnu/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch
@@ -0,0 +1,60 @@
+Adjust libsanitizer to ABI change in glibc 2.31.
+
+Taken from this upstream commit:
+https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
+
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1126,8 +1126,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++ on many architectures. */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+
+diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -203,28 +203,15 @@ namespace __sanitizer {
+ u64 __unused1;
+ u64 __unused2;
+ #elif defined(__sparc__)
+-#if defined(__arch64__)
+- unsigned mode;
+- unsigned short __pad1;
+-#else
+- unsigned short __pad1;
+- unsigned short mode;
+- unsigned short __pad2;
+-#endif
+- unsigned short __seq;
+- unsigned long long __unused1;
+- unsigned long long __unused2;
+-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
+- unsigned int mode;
+- unsigned short __seq;
+- unsigned short __pad1;
+- unsigned long __unused1;
+- unsigned long __unused2;
++ unsigned mode;
++ unsigned short __pad2;
++ unsigned short __seq;
++ unsigned long long __unused1;
++ unsigned long long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
+- unsigned short __seq;
+- unsigned short __pad2;
++ unsigned int mode;
++ unsigned short __seq;
++ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+ u64 __unused1;
+ u64 __unused2;
diff --git a/gnu/packages/patches/cmake-curl-certificates.patch b/gnu/packages/patches/cmake-curl-certificates.patch
index 36252083f8..7fe2615271 100644
--- a/gnu/packages/patches/cmake-curl-certificates.patch
+++ b/gnu/packages/patches/cmake-curl-certificates.patch
@@ -6,19 +6,19 @@ as well as /etc/ssl/certs.
--- cmake-3.13.1/Source/cmCurl.cxx 2019-09-10 17:27:36.926907260 +0200
+++ cmake-3.13.1/Source/cmCurl.cxx 2019-09-10 17:52:35.475903919 +0200
-@@ -4,11 +4,8 @@
-
- #include "cmThirdParty.h"
+@@ -2,11 +2,8 @@
+ file Copyright.txt or https://cmake.org/licensing for details. */
+ #include "cmCurl.h"
-#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) && \
- !defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
# define CMAKE_FIND_CAFILE
# include "cmSystemTools.h"
-#endif
+ #include "cmStringAlgorithms.h"
// curl versions before 7.21.5 did not provide this error code
- #if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x071505
-@@ -29,6 +26,19 @@ std::string cmCurlSetCAInfo(::CURL* curl
+@@ -30,6 +27,19 @@
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile);
check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: ");
}
diff --git a/gnu/packages/patches/coreutils-ls.patch b/gnu/packages/patches/coreutils-ls.patch
new file mode 100644
index 0000000000..59cbbf00b5
--- /dev/null
+++ b/gnu/packages/patches/coreutils-ls.patch
@@ -0,0 +1,117 @@
+Patch taken from upstream to fix cross-compilation for aarch64. This can be
+removed on the next coreutils release.
+
+From 10fcb97bd728f09d4a027eddf8ad2900f0819b0a Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Thu, 5 Mar 2020 17:25:29 -0800
+Subject: [PATCH] ls: restore 8.31 behavior on removed directories
+
+* NEWS: Mention this.
+* src/ls.c: Do not include <sys/sycall.h>
+(print_dir): Don't worry about whether the directory is removed.
+* tests/ls/removed-directory.sh: Adjust to match new (i.e., old)
+behavior.
+---
+ NEWS | 6 ++++++
+ src/ls.c | 22 ----------------------
+ tests/ls/removed-directory.sh | 10 ++--------
+ 3 files changed, 8 insertions(+), 30 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index fdc8bf5db..653e7178b 100644
+--- a/NEWS
++++ b/NEWS
+@@ -2,6 +2,12 @@ GNU coreutils NEWS -*- outline -*-
+
+ * Noteworthy changes in release ?.? (????-??-??) [?]
+
++** Changes in behavior
++
++ On GNU/Linux systems, ls no longer issues an error message on
++ directory merely because it was removed. This reverts a change
++ that was made in release 8.32.
++
+
+ * Noteworthy changes in release 8.32 (2020-03-05) [stable]
+
+diff --git a/src/ls.c b/src/ls.c
+index 24b983287..4acf5f44d 100644
+--- a/src/ls.c
++++ b/src/ls.c
+@@ -49,10 +49,6 @@
+ # include <sys/ptem.h>
+ #endif
+
+-#ifdef __linux__
+-# include <sys/syscall.h>
+-#endif
+-
+ #include <stdio.h>
+ #include <assert.h>
+ #include <setjmp.h>
+@@ -2896,7 +2892,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+ struct dirent *next;
+ uintmax_t total_blocks = 0;
+ static bool first = true;
+- bool found_any_entries = false;
+
+ errno = 0;
+ dirp = opendir (name);
+@@ -2972,7 +2967,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+ next = readdir (dirp);
+ if (next)
+ {
+- found_any_entries = true;
+ if (! file_ignored (next->d_name))
+ {
+ enum filetype type = unknown;
+@@ -3018,22 +3012,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+ if (errno != EOVERFLOW)
+ break;
+ }
+-#ifdef __linux__
+- else if (! found_any_entries)
+- {
+- /* If readdir finds no directory entries at all, not even "." or
+- "..", then double check that the directory exists. */
+- if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1
+- && errno != EINVAL)
+- {
+- /* We exclude EINVAL as that pertains to buffer handling,
+- and we've passed NULL as the buffer for simplicity.
+- ENOENT is returned if appropriate before buffer handling. */
+- file_failure (command_line_arg, _("reading directory %s"), name);
+- }
+- break;
+- }
+-#endif
+ else
+ break;
+
+diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
+index e8c835dab..fe8f929a1 100755
+--- a/tests/ls/removed-directory.sh
++++ b/tests/ls/removed-directory.sh
+@@ -26,20 +26,14 @@ case $host_triplet in
+ *) skip_ 'non linux kernel' ;;
+ esac
+
+-LS_FAILURE=2
+-
+-cat <<\EOF >exp-err || framework_failure_
+-ls: reading directory '.': No such file or directory
+-EOF
+-
+ cwd=$(pwd)
+ mkdir d || framework_failure_
+ cd d || framework_failure_
+ rmdir ../d || framework_failure_
+
+-returns_ $LS_FAILURE ls >../out 2>../err || fail=1
++ls >../out 2>../err || fail=1
+ cd "$cwd" || framework_failure_
+ compare /dev/null out || fail=1
+-compare exp-err err || fail=1
++compare /dev/null err || fail=1
+
+ Exit $fail
diff --git a/gnu/packages/patches/curl-use-ssl-cert-env.patch b/gnu/packages/patches/curl-use-ssl-cert-env.patch
new file mode 100644
index 0000000000..c8e80b4445
--- /dev/null
+++ b/gnu/packages/patches/curl-use-ssl-cert-env.patch
@@ -0,0 +1,64 @@
+Make libcurl respect the SSL_CERT_{DIR,FILE} variables by default. The variables
+are fetched during initialization to preserve thread-safety (curl_global_init(3)
+must be called when no other threads exist).
+
+This fixes network functionality in rust:cargo, and probably removes the need
+for other future workarounds.
+===================================================================
+--- curl-7.66.0.orig/lib/easy.c 2020-01-02 15:43:11.883921171 +0100
++++ curl-7.66.0/lib/easy.c 2020-01-02 16:18:54.691882797 +0100
+@@ -134,6 +134,9 @@
+ # pragma warning(default:4232) /* MSVC extension, dllimport identity */
+ #endif
+
++char * Curl_ssl_cert_dir = NULL;
++char * Curl_ssl_cert_file = NULL;
++
+ /**
+ * curl_global_init() globally initializes curl given a bitwise set of the
+ * different features of what to initialize.
+@@ -155,6 +158,9 @@
+ #endif
+ }
+
++ Curl_ssl_cert_dir = curl_getenv("SSL_CERT_DIR");
++ Curl_ssl_cert_file = curl_getenv("SSL_CERT_FILE");
++
+ if(!Curl_ssl_init()) {
+ DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n"));
+ return CURLE_FAILED_INIT;
+@@ -260,6 +266,9 @@
+ Curl_ssl_cleanup();
+ Curl_resolver_global_cleanup();
+
++ free(Curl_ssl_cert_dir);
++ free(Curl_ssl_cert_file);
++
+ #ifdef WIN32
+ Curl_win32_cleanup(init_flags);
+ #endif
+diff -ur curl-7.66.0.orig/lib/url.c curl-7.66.0/lib/url.c
+--- curl-7.66.0.orig/lib/url.c 2020-01-02 15:43:11.883921171 +0100
++++ curl-7.66.0/lib/url.c 2020-01-02 16:21:11.563880346 +0100
+@@ -524,6 +524,21 @@
+ if(result)
+ return result;
+ #endif
++ extern char * Curl_ssl_cert_dir;
++ extern char * Curl_ssl_cert_file;
++ if(Curl_ssl_cert_dir) {
++ if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_ORIG], Curl_ssl_cert_dir))
++ return result;
++ if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], Curl_ssl_cert_dir))
++ return result;
++ }
++
++ if(Curl_ssl_cert_file) {
++ if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_ORIG], Curl_ssl_cert_file))
++ return result;
++ if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY], Curl_ssl_cert_file))
++ return result;
++ }
+ }
+
+ set->wildcard_enabled = FALSE;
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/datefudge-gettimeofday.patch b/gnu/packages/patches/datefudge-gettimeofday.patch
new file mode 100644
index 0000000000..11c7640869
--- /dev/null
+++ b/gnu/packages/patches/datefudge-gettimeofday.patch
@@ -0,0 +1,13 @@
+Add the 'restrict' qualifier to match the 'gettimeofday' declaration found
+in glibc 2.31.
+
+--- datefudge-1.23/datefudge.c 2020-02-17 22:35:21.343341725 +0100
++++ datefudge-1.23/datefudge.c 2020-02-17 22:35:49.619117874 +0100
+@@ -78,6 +78,6 @@
+ return 0;
+ }
+
+-int gettimeofday(struct timeval *x, struct timezone *y) {
++int gettimeofday(struct timeval *restrict x, void *restrict y) {
+ return __gettimeofday(x,y);
+ }
diff --git a/gnu/packages/patches/dconf-meson-0.52.patch b/gnu/packages/patches/dconf-meson-0.52.patch
new file mode 100644
index 0000000000..c636edc108
--- /dev/null
+++ b/gnu/packages/patches/dconf-meson-0.52.patch
@@ -0,0 +1,19 @@
+Fix build failure with Meson 0.52.
+
+Taken from upstream:
+https://gitlab.gnome.org/GNOME/dconf/commit/7ad890fb7a2ec90a777a756a1fa20a615ec7245e
+https://gitlab.gnome.org/GNOME/dconf/merge_requests/54
+
+diff --git a/client/meson.build b/client/meson.build
+index f3b7122cb05bfa7bb481c487e3cd052aa1ad58e5..de6387e2cac2aba12b83f2614c277bada434fd16 100644
+--- a/client/meson.build
++++ b/client/meson.build
+@@ -28,7 +28,7 @@ libdconf_client = static_library(
+
+ libdconf_client_dep = declare_dependency(
+ dependencies: gio_dep,
+- link_whole: libdconf_client,
++ link_with: libdconf_client,
+ )
+
+ libdconf = shared_library(
diff --git a/gnu/packages/patches/doxygen-1.8.17-runtests.patch b/gnu/packages/patches/doxygen-1.8.17-runtests.patch
new file mode 100644
index 0000000000..0340c72448
--- /dev/null
+++ b/gnu/packages/patches/doxygen-1.8.17-runtests.patch
@@ -0,0 +1,73 @@
+1.8.17 was released with a broken test runner.
+
+https://github.com/doxygen/doxygen/issues/7464
+
+Taken from upstream:
+https://github.com/doxygen/doxygen/commit/cd9dee013dc749a10bbe019c350e0e62b6635795
+
+diff --git a/testing/runtests.py b/testing/runtests.py
+index a4118b865..10fe50214 100755
+--- a/testing/runtests.py
++++ b/testing/runtests.py
+@@ -3,6 +3,7 @@
+ from __future__ import print_function
+ import argparse, glob, itertools, re, shutil, os, sys
+ import subprocess
++import shlex
+
+ config_reg = re.compile('.*\/\/\s*(?P<name>\S+):\s*(?P<value>.*)$')
+
+@@ -28,10 +29,10 @@ def xpopen(cmd, cmd1="",encoding='utf-8-sig', getStderr=False):
+ return os.popen(cmd).read() # Python 2 without encoding
+ else:
+ if (getStderr):
+- proc = subprocess.run(cmd1,encoding=encoding,capture_output=True) # Python 3 with encoding
+- return proc.stderr
++ proc = subprocess.Popen(shlex.split(cmd1),stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding=encoding) # Python 3 with encoding
++ return proc.stderr.read()
+ else:
+- proc = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding=encoding) # Python 3 with encoding
++ proc = subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding=encoding) # Python 3 with encoding
+ return proc.stdout.read()
+
+ class Tester:
+@@ -137,7 +138,7 @@ def prepare_test(self):
+ print('GENERATE_DOCBOOK=NO', file=f)
+ if (self.args.xhtml):
+ print('GENERATE_HTML=YES', file=f)
+- # HTML_OUTPUT can also be set locally
++ # HTML_OUTPUT can also have been set locally
+ print('HTML_OUTPUT=%s/html' % self.test_out, file=f)
+ print('HTML_FILE_EXTENSION=.xhtml', file=f)
+ if (self.args.pdf):
+@@ -184,7 +185,7 @@ def update_test(self,testmgr):
+ print('Non-existing file %s after \'check:\' statement' % check_file)
+ return
+ # convert output to canonical form
+- data = xpopen('%s --format --noblanks --nowarning %s' % (self.args.xmllint,check_file)).read()
++ data = xpopen('%s --format --noblanks --nowarning %s' % (self.args.xmllint,check_file))
+ if data:
+ # strip version
+ data = re.sub(r'xsd" version="[0-9.-]+"','xsd" version=""',data).rstrip('\n')
+@@ -326,7 +327,7 @@ def perform_test(self,testmgr):
+ tests.append(glob.glob('%s/*.xml' % (docbook_output)))
+ tests.append(glob.glob('%s/*/*/*.xml' % (docbook_output)))
+ tests = ' '.join(list(itertools.chain.from_iterable(tests))).replace(self.args.outputdir +'/','').replace('\\','/')
+- exe_string = '%s --nonet --postvalid %s' % (self.args.xmllint,tests)
++ exe_string = '%s --noout --nonet --postvalid %s' % (self.args.xmllint,tests)
+ exe_string1 = exe_string
+ exe_string += ' %s' % (redirx)
+ exe_string += ' %s more "%s/temp"' % (separ,docbook_output)
+@@ -346,7 +347,11 @@ def perform_test(self,testmgr):
+ redirx=' 2> %s/temp >nul:'%html_output
+ else:
+ redirx='2>%s/temp >/dev/null'%html_output
+- exe_string = '%s --path dtd --nonet --postvalid %s/*xhtml' % (self.args.xmllint,html_output)
++ check_file = []
++ check_file.append(glob.glob('%s/*.xhtml' % (html_output)))
++ check_file.append(glob.glob('%s/*/*/*.xhtml' % (html_output)))
++ check_file = ' '.join(list(itertools.chain.from_iterable(check_file))).replace(self.args.outputdir +'/','').replace('\\','/')
++ exe_string = '%s --noout --path dtd --nonet --postvalid %s' % (self.args.xmllint,check_file)
+ exe_string1 = exe_string
+ exe_string += ' %s' % (redirx)
+ exe_string += ' %s more "%s/temp"' % (separ,html_output)
diff --git a/gnu/packages/patches/doxygen-test.patch b/gnu/packages/patches/doxygen-test.patch
index 8ccb9ec3c4..1c0d4eb946 100644
--- a/gnu/packages/patches/doxygen-test.patch
+++ b/gnu/packages/patches/doxygen-test.patch
@@ -5,19 +5,40 @@ test.
diff -u -r doxygen-1.8.7.orig/testing/012/citelist.xml doxygen-1.8.7/testing/012/citelist.xml
--- doxygen-1.8.7.orig/testing/012/citelist.xml 2014-04-24 23:43:34.000000000 +0200
+++ doxygen-1.8.7/testing/012/citelist.xml 2014-04-24 23:49:43.000000000 +0200
-@@ -6,17 +6,6 @@
+@@ -6,38 +6,6 @@
<briefdescription>
</briefdescription>
<detaileddescription>
- <para>
- <variablelist>
- <varlistentry>
-- <term><anchor id="citelist_1CITEREF_knuth79"/>[1]</term>
+- <term><anchor id="citelist_1CITEREF_Be09"/>[1]</term>
+- </varlistentry>
+- <listitem>
+- <para>P.<nonbreakablespace/>Belotti. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3_5">Disjunctive cuts for non-convex MINLP</ulink>. In <ulink url="#CITEREF_LeLe12">Lee and Leyffer</ulink> <ulink url="#CITEREF_LeLe12">[4]</ulink>, pages 117<ndash/>144.</para>
+- <para/>
+- </listitem>
+- <varlistentry>
+- <term><anchor id="citelist_1CITEREF_BertholdHeinzVigerske2009"/>[2]</term>
+- </varlistentry>
+- <listitem>
+- <para>T.<nonbreakablespace/>Berthold, S.<nonbreakablespace/>Heinz, and S.<nonbreakablespace/>Vigerske. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3_15">Extending a CIP framework to solve MIQCPs</ulink>. In <ulink url="#CITEREF_LeLe12">Lee and Leyffer</ulink> <ulink url="#CITEREF_LeLe12">[4]</ulink>, pages 427<ndash/>444.</para>
+- <para/>
+- </listitem>
+- <varlistentry>
+- <term><anchor id="citelist_1CITEREF_knuth79"/>[3]</term>
- </varlistentry>
- <listitem>
- <para>Donald<nonbreakablespace/>E. Knuth. <emphasis>Tex and Metafont, New Directions in Typesetting</emphasis>. American Mathematical Society and Digital Press, Stanford, 1979.</para>
- <para/>
- </listitem>
+- <varlistentry>
+- <term><anchor id="citelist_1CITEREF_LeLe12"/>[4]</term>
+- </varlistentry>
+- <listitem>
+- <para>Jon Lee and Sven Leyffer, editors. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3"><emphasis>Mixed Integer Nonlinear Programming</emphasis></ulink>, volume 154 of <emphasis>The IMA Volumes in Mathematics and its Applications</emphasis>. Springer, 2012.</para>
+- <para/>
+- </listitem>
- </variablelist>
- </para>
</detaileddescription>
@@ -26,13 +47,14 @@ diff -u -r doxygen-1.8.7.orig/testing/012/citelist.xml doxygen-1.8.7/testing/012
diff -u -r doxygen-1.8.7.orig/testing/012/indexpage.xml doxygen-1.8.7/testing/012/indexpage.xml
--- doxygen-1.8.7.orig/testing/012/indexpage.xml 2014-04-24 23:43:34.000000000 +0200
+++ doxygen-1.8.7/testing/012/indexpage.xml 2014-04-24 23:44:05.000000000 +0200
-@@ -4,7 +4,7 @@
- <compoundname>index</compoundname>
- <title>My Project</title>
+@@ -6,8 +6,8 @@
+ <briefdescription>
+ </briefdescription>
<detaileddescription>
-- <para>See <ref refid="citelist_1CITEREF_knuth79" kindref="member">[1]</ref> for more info. </para>
-+ <para>See knuth79 for more info. </para>
+- <para>See <ref refid="citelist_1CITEREF_knuth79" kindref="member">[3]</ref> for more info.</para>
+- <para>Other references with cross references see <ref refid="citelist_1CITEREF_Be09" kindref="member">[1]</ref> and <ref refid="citelist_1CITEREF_BertholdHeinzVigerske2009" kindref="member">[2]</ref> for more info. </para>
++ <para>See knuth79 for more info.</para>
++ <para>Other references with cross references see Be09 and BertholdHeinzVigerske2009 for more info. </para>
</detaileddescription>
</compounddef>
</doxygen>
-
diff --git a/gnu/packages/patches/evolution-data-server-libical-compat.patch b/gnu/packages/patches/evolution-data-server-libical-compat.patch
index a988519ea0..da4302d42e 100644
--- a/gnu/packages/patches/evolution-data-server-libical-compat.patch
+++ b/gnu/packages/patches/evolution-data-server-libical-compat.patch
@@ -8,29 +8,29 @@ Adapted from upstream:
https://gitlab.gnome.org/GNOME/evolution-data-server/commit/77384ab552c19bf374dbeda53dc37f98d07bd4ec
diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e16b8b225..b3c881967 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -108,7 +108,7 @@
+@@ -111,7 +111,7 @@ add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
set(gcr_minimum_version 3.4)
set(libgdata_minimum_version 0.15.1)
--set(libical_minimum_version 2.0)
-+set(libical_minimum_version 3.0.7)
+-set(libical_glib_minimum_version 3.0.5)
++set(libical_glib_minimum_version 3.0.7)
set(libsecret_minimum_version 0.5)
set(libxml_minimum_version 2.0.0)
set(sqlite_minimum_version 3.7.17)
diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c
-index 7501f2a43dcc3af91e93e89751caf76e77c2ac23..93f4806ba2c5193f746e9fae5bf74d08ad05f8bf 100644
+index 7501f2a43..93f4806ba 100644
--- a/src/calendar/libedata-cal/e-cal-meta-backend.c
+++ b/src/calendar/libedata-cal/e-cal-meta-backend.c
-@@ -3958,9 +3958,8 @@
+@@ -4067,8 +4067,7 @@ e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
gchar *base64;
base64 = g_base64_encode ((const guchar *) content, len);
-- new_attach = icalattach_new_from_data (base64, NULL, NULL);
-+ new_attach = icalattach_new_from_data (base64, (GFunc) g_free, NULL);
+- new_attach = i_cal_attach_new_from_data (base64, NULL, NULL);
++ new_attach = i_cal_attach_new_from_data (base64, (GFunc) g_free, NULL);
g_free (content);
- g_free (base64);
ecmb_remove_all_but_filename_parameter (prop);
-
diff --git a/gnu/packages/patches/fifengine-swig-compat.patch b/gnu/packages/patches/fifengine-swig-compat.patch
new file mode 100644
index 0000000000..85cd05f835
--- /dev/null
+++ b/gnu/packages/patches/fifengine-swig-compat.patch
@@ -0,0 +1,17 @@
+Fix build failure when using Swig 4.
+
+Taken from upstream:
+https://github.com/fifengine/fifengine/commit/d14f232f4cd9a00b05d6872957070e8c020f515d
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -893,7 +893,7 @@ if(build-python)
+ find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
+ include_directories(${PYTHON_INCLUDE_PATH})
+
+- set(CMAKE_SWIG_FLAGS -modern -fastdispatch -dirvtable -nosafecstrings -noproxydel -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone -keyword -w511 -w473 -w404 -w314)
++ set(CMAKE_SWIG_FLAGS -modern -fastdispatch -dirvtable -noproxydel -fastproxy -fastinit -fastunpack -fastquery -modernargs -keyword -w511 -w473 -w404 -w314)
+
+ set_source_files_properties("${PROJECT_BINARY_DIR}/fife.i" PROPERTIES CPLUSPLUS ON)
+ set(FIFE_SOURCES ${FIFE_CORE_SRC})
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/findutils-gnulib-libio.patch b/gnu/packages/patches/findutils-gnulib-libio.patch
deleted file mode 100644
index 79f9fd914d..0000000000
--- a/gnu/packages/patches/findutils-gnulib-libio.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-Adjust to removal of libio interface in glibc 2.28.
-
-Based on this gnulib commit:
-https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a71827c0bc5e0ec67af23edef4f15cee8e
-
-diff --git a/gl/lib/fflush.c b/gl/lib/fflush.c
-index 5ae3e41..7a82470 100644
---- a/gl/lib/fflush.c
-+++ b/gl/lib/fflush.c
-@@ -33,7 +33,7 @@
- #undef fflush
-
-
--#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-
- /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
- static void
-@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
-
- #endif
-
--#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
-+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
-
- # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
- /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
-@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
- if (stream == NULL || ! freading (stream))
- return fflush (stream);
-
--#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-
- clear_ungetc_buffer_preserving_position (stream);
-
-diff --git a/gl/lib/fpurge.c b/gl/lib/fpurge.c
-index f313b22..ecdf82d 100644
---- a/gl/lib/fpurge.c
-+++ b/gl/lib/fpurge.c
-@@ -62,7 +62,7 @@ fpurge (FILE *fp)
- /* Most systems provide FILE as a struct and the necessary bitmask in
- <stdio.h>, because they need it for implementing getc() and putc() as
- fast macros. */
--# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- fp->_IO_read_end = fp->_IO_read_ptr;
- fp->_IO_write_ptr = fp->_IO_write_base;
- /* Avoid memory leak when there is an active ungetc buffer. */
-diff --git a/gl/lib/freadahead.c b/gl/lib/freadahead.c
-index 094daab..3f8101e 100644
---- a/gl/lib/freadahead.c
-+++ b/gl/lib/freadahead.c
-@@ -25,7 +25,7 @@
- size_t
- freadahead (FILE *fp)
- {
--#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- if (fp->_IO_write_ptr > fp->_IO_write_base)
- return 0;
- return (fp->_IO_read_end - fp->_IO_read_ptr)
-diff --git a/gl/lib/freading.c b/gl/lib/freading.c
-index 0512b19..8c48fe4 100644
---- a/gl/lib/freading.c
-+++ b/gl/lib/freading.c
-@@ -31,7 +31,7 @@ freading (FILE *fp)
- /* Most systems provide FILE as a struct and the necessary bitmask in
- <stdio.h>, because they need it for implementing getc() and putc() as
- fast macros. */
--# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- return ((fp->_flags & _IO_NO_WRITES) != 0
- || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
- && fp->_IO_read_base != NULL));
-diff --git a/gl/lib/fseeko.c b/gl/lib/fseeko.c
-index 1c65d2a..9026408 100644
---- a/gl/lib/fseeko.c
-+++ b/gl/lib/fseeko.c
-@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
- #endif
-
- /* These tests are based on fpurge.c. */
--#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- if (fp->_IO_read_end == fp->_IO_read_ptr
- && fp->_IO_write_ptr == fp->_IO_write_base
- && fp->_IO_save_base == NULL)
-@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
- return -1;
- }
-
--#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- fp->_flags &= ~_IO_EOF_SEEN;
- fp->_offset = pos;
- #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
-diff --git a/gl/lib/stdio-impl.h b/gl/lib/stdio-impl.h
-index 502d891..ea38ee2 100644
---- a/gl/lib/stdio-impl.h
-+++ b/gl/lib/stdio-impl.h
-@@ -18,6 +18,12 @@
- the same implementation of stdio extension API, except that some fields
- have different naming conventions, or their access requires some casts. */
-
-+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
-+ problem by defining it ourselves. FIXME: Do not rely on glibc
-+ internals. */
-+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
-+# define _IO_IN_BACKUP 0x100
-+#endif
-
- /* BSD stdio derived implementations. */
-
diff --git a/gnu/packages/patches/findutils-makedev.patch b/gnu/packages/patches/findutils-makedev.patch
deleted file mode 100644
index 2f16c625d8..0000000000
--- a/gnu/packages/patches/findutils-makedev.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Include <sys/sysmacros.h> for "makedev".
-
-Taken from this gnulib commit:
-https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4da63c5881f60f71999a943612da9112232b9161
-
-diff --git a/gl/lib/mountlist.c b/gl/lib/mountlist.c
-index bb4e4ee21..cf4020e2a 100644
---- a/gl/lib/mountlist.c
-+++ b/gl/lib/mountlist.c
-@@ -37,6 +37,12 @@
- # include <sys/param.h>
- #endif
-
-+#if MAJOR_IN_MKDEV
-+# include <sys/mkdev.h>
-+#elif MAJOR_IN_SYSMACROS
-+# include <sys/sysmacros.h>
-+#endif
-+
- #if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */
- # if HAVE_SYS_UCRED_H
- # include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
diff --git a/gnu/packages/patches/findutils-test-rwlock-threads.patch b/gnu/packages/patches/findutils-test-rwlock-threads.patch
new file mode 100644
index 0000000000..3062577c21
--- /dev/null
+++ b/gnu/packages/patches/findutils-test-rwlock-threads.patch
@@ -0,0 +1,38 @@
+Skip "test-rwlock1" when multithreading is disabled, which is the case
+during bootstrapping on architectures not supported by GNU Mes.
+
+Taken from upstream gnulib:
+https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=fdff8bd09a7f053381f8bdb107ab5280b7c95959
+
+diff --git a/gnulib-tests/test-rwlock1.c b/gnulib-tests/test-rwlock1.c
+--- a/gnulib-tests/test-rwlock1.c
++++ b/gnulib-tests/test-rwlock1.c
+@@ -21,6 +21,8 @@
+
+ #include <config.h>
+
++#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
++
+ #include "glthread/lock.h"
+
+ #include <errno.h>
+@@ -151,3 +153,18 @@ main ()
+ sleep (1);
+ }
+ }
++
++#else
++
++/* No multithreading available. */
++
++#include <stdio.h>
++
++int
++main ()
++{
++ fputs ("Skipping test: multithreading not enabled\n", stderr);
++ return 77;
++}
++
++#endif
+
diff --git a/gnu/packages/patches/findutils-test-xargs.patch b/gnu/packages/patches/findutils-test-xargs.patch
deleted file mode 100644
index 10c7bed28d..0000000000
--- a/gnu/packages/patches/findutils-test-xargs.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-This test relies on 'xargs' being available in $PATH, which is not
-the case when we build the initial Findutils doing bootstrapping.
-Reported at <https://savannah.gnu.org/bugs/index.php?46786>.
-
---- findutils-4.6.0/find/testsuite/sv-34976-execdir-fd-leak.sh 2015-12-31 19:37:59.401526288 +0100
-+++ findutils-4.6.0/find/testsuite/sv-34976-execdir-fd-leak.sh 2015-12-31 19:38:36.061770693 +0100
-@@ -50,13 +50,14 @@ die() {
- # Create test files, each 98 in the directories ".", "one" and "two".
- make_test_data() {
- d="$1"
-+ xargs="`cd ../../xargs; pwd -P`/xargs"
- (
- cd "$1" || exit 1
- mkdir one two || exit 1
- for i in ${three_to_hundred} ; do
- printf "./%03d one/%03d two/%03d " $i $i $i
- done \
-- | xargs touch || exit 1
-+ | "$xargs" touch || exit 1
- ) \
- || die "failed to set up the test in ${outdir}"
- }
diff --git a/gnu/packages/patches/fontconfig-hurd-path-max.patch b/gnu/packages/patches/fontconfig-hurd-path-max.patch
new file mode 100644
index 0000000000..f804e6801f
--- /dev/null
+++ b/gnu/packages/patches/fontconfig-hurd-path-max.patch
@@ -0,0 +1,17 @@
+Avoid usage of PATH_MAX.
+
+Taken from https://salsa.debian.org/freedesktop-team/fontconfig/-/blob/master/debian/patches/path_max.patch
+
+Index: fontconfig-2.13.1/src/fccfg.c
+===================================================================
+--- fontconfig-2.13.1.orig/src/fccfg.c
++++ fontconfig-2.13.1/src/fccfg.c
+@@ -2231,7 +2231,7 @@ FcConfigRealFilename (FcConfig *config,
+
+ if (n)
+ {
+- FcChar8 buf[PATH_MAX];
++ FcChar8 buf[FC_PATH_MAX];
+ ssize_t len;
+
+ if (sysroot)
diff --git a/gnu/packages/patches/fribidi-CVE-2019-18397.patch b/gnu/packages/patches/fribidi-CVE-2019-18397.patch
deleted file mode 100644
index aff1a669b2..0000000000
--- a/gnu/packages/patches/fribidi-CVE-2019-18397.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-https://github.com/fribidi/fribidi/commit/034c6e9a1d296286305f4cfd1e0072b879f52568.patch
-
-From 034c6e9a1d296286305f4cfd1e0072b879f52568 Mon Sep 17 00:00:00 2001
-From: Dov Grobgeld <dov.grobgeld@gmail.com>
-Date: Thu, 24 Oct 2019 09:37:29 +0300
-Subject: [PATCH] Truncate isolate_level to FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL
-
----
- lib/fribidi-bidi.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/lib/fribidi-bidi.c b/lib/fribidi-bidi.c
-index 6c84392..d384878 100644
---- a/lib/fribidi-bidi.c
-+++ b/lib/fribidi-bidi.c
-@@ -747,7 +747,9 @@ fribidi_get_par_embedding_levels_ex (
- }
-
- RL_LEVEL (pp) = level;
-- RL_ISOLATE_LEVEL (pp) = isolate_level++;
-+ RL_ISOLATE_LEVEL (pp) = isolate_level;
-+ if (isolate_level < FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL-1)
-+ isolate_level++;
- base_level_per_iso_level[isolate_level] = new_level;
-
- if (!FRIBIDI_IS_NEUTRAL (override))
diff --git a/gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..7df22c21aa
--- /dev/null
+++ b/gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch
@@ -0,0 +1,52 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+Adapted from these upstream revision:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 196eb3b3c64..b588e07e5ab 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -928,7 +928,11 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++ on many architectures. */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
++#endif
+ CHECK_SIZE_AND_OFFSET(ipc_perm, __seq);
+
+ CHECK_TYPE_SIZE(shmid_ds);
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index aec950454b3..6d94fc65c28 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -154,20 +154,13 @@ namespace __sanitizer {
+ u64 __unused1;
+ u64 __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+ unsigned mode;
+- unsigned short __pad1;
+-# else
+- unsigned short __pad1;
+- unsigned short mode;
+ unsigned short __pad2;
+-# endif
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
++ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
diff --git a/gnu/packages/patches/gcc-5-hurd.patch b/gnu/packages/patches/gcc-5-hurd.patch
new file mode 100644
index 0000000000..ae66424243
--- /dev/null
+++ b/gnu/packages/patches/gcc-5-hurd.patch
@@ -0,0 +1,63 @@
+This patch is needed to build gcc-5.5.0 on the Hurd.
+
+Backported from upstream: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6cd9cb89ebdc1e1394b81c4a418c2b3b0eb86c57
+
+commit b590b96ebc3f5b42a4829170e069722dd940e2543
+Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Sat May 9 04:50:23 2015 +0000
+
+ * src/c++98/Makefile.am (AM_CXXFLAGS): Add -std=gnu++98.
+ * src/c++98/Makefile.in: Regenerate.
+ * src/Makefile.am (AM_CXXFLAGS): Add -std=gnu++98.
+ * src/Makefile.in: Regenerate.
+
+ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222964 138bc75d-0d04-0410-961f-82ee72b054a4
+
+diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
+index a5f48b22c6d..cd07ccd81bc 100644
+--- a/libstdc++-v3/src/Makefile.am
++++ b/libstdc++-v3/src/Makefile.am
+@@ -168,6 +168,7 @@ compatibility-condvar.o: compatibility-condvar.cc
+ # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+ # as the occasion calls for it.
+ AM_CXXFLAGS = \
++ -std=gnu++98 \
+ $(glibcxx_compiler_pic_flag) \
+ $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
+ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
+diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
+index 433f9ea121a..31b56282e26 100644
+--- a/libstdc++-v3/src/Makefile.in
++++ b/libstdc++-v3/src/Makefile.in
+@@ -429,6 +429,7 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
+ # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+ # as the occasion calls for it.
+ AM_CXXFLAGS = \
++ -std=gnu++98 \
+ $(glibcxx_compiler_pic_flag) \
+ $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
+ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
+diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am
+index e348dfb1205..a5b68a19a8b 100644
+--- a/libstdc++-v3/src/c++98/Makefile.am
++++ b/libstdc++-v3/src/c++98/Makefile.am
+@@ -215,6 +215,7 @@ parallel_settings.o: parallel_settings.cc
+ # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+ # as the occasion calls for it.
+ AM_CXXFLAGS = \
++ -std=gnu++98 \
+ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+ $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
+ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
+diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in
+index 3c69791bb66..ce86136906b 100644
+--- a/libstdc++-v3/src/c++98/Makefile.in
++++ b/libstdc++-v3/src/c++98/Makefile.in
+@@ -421,6 +421,7 @@ PARALLEL_FLAGS = -D_GLIBCXX_PARALLEL
+ # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+ # as the occasion calls for it.
+ AM_CXXFLAGS = \
++ -std=gnu++98 \
+ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
+ $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
+ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
diff --git a/gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..005e3c4079
--- /dev/null
+++ b/gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch
@@ -0,0 +1,53 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+Adapted from these upstream revision:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 069d8d557de..c49c28c6e07 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1130,8 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+ #ifndef __GLIBC_PREREQ
+ #define __GLIBC_PREREQ(x, y) 0
+ #endif
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++ on many architectures. */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 304d04e3935..6dee89c97e1 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -207,20 +207,13 @@ namespace __sanitizer {
+ unsigned long __unused1;
+ unsigned long __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+ unsigned mode;
+- unsigned short __pad1;
+-# else
+- unsigned short __pad1;
+- unsigned short mode;
+ unsigned short __pad2;
+-# endif
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
++ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+
diff --git a/gnu/packages/patches/gcc-7-cross-toolexeclibdir.patch b/gnu/packages/patches/gcc-7-cross-toolexeclibdir.patch
new file mode 100644
index 0000000000..49982c3474
--- /dev/null
+++ b/gnu/packages/patches/gcc-7-cross-toolexeclibdir.patch
@@ -0,0 +1,1041 @@
+From 46339bdf619b93dfa05d5f004d062671d3dc26d2 Mon Sep 17 00:00:00 2001
+From: Mathieu Othacehe <m.othacehe@gmail.com>
+Date: Tue, 24 Mar 2020 13:50:56 +0100
+Subject: [PATCH] toolexec
+
+---
+ gcc/doc/install.texi | 4 ++++
+ libatomic/configure | 33 ++++++++++++++++++++++---
+ libffi/configure | 33 ++++++++++++++++++++++---
+ libgcc/configure | 38 +++++++++++++++++++++++++++--
+ libgomp/configure | 33 ++++++++++++++++++++++---
+ libhsail-rt/configure | 33 ++++++++++++++++++++++---
+ libitm/configure | 33 ++++++++++++++++++++++---
+ liboffloadmic/configure | 33 ++++++++++++++++++++++---
+ liboffloadmic/plugin/configure | 33 ++++++++++++++++++++++---
+ libquadmath/configure | 33 ++++++++++++++++++++++---
+ libsanitizer/configure | 33 ++++++++++++++++++++++---
+ libssp/configure | 33 ++++++++++++++++++++++---
+ libstdc++-v3/configure | 44 ++++++++++++++++++++++++++--------
+ 13 files changed, 374 insertions(+), 42 deletions(-)
+
+diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
+index 77ba08d3f21..28cb6d88da8 100644
+--- a/gcc/doc/install.texi
++++ b/gcc/doc/install.texi
+@@ -2083,6 +2083,10 @@ shorthand for
+ The following options only apply to building cross compilers.
+
+ @table @code
++@item --with-toolexeclibdir=@var{dir}
++Specify the installation directory for libraries built with a cross compiler.
++The default is @option{$@{gcc_tooldir@}/lib}.
++
+ @item --with-sysroot
+ @itemx --with-sysroot=@var{dir}
+ Tells GCC to consider @var{dir} as the root of a tree that contains
+diff --git a/libatomic/configure b/libatomic/configure
+index 2ae9b8d40f3..0fa531ec4a3 100755
+--- a/libatomic/configure
++++ b/libatomic/configure
+@@ -755,6 +755,7 @@ enable_option_checking
+ enable_version_specific_runtime_libs
+ enable_generated_files_in_srcdir
+ enable_multilib
++with_toolexeclibdir
+ enable_dependency_tracking
+ enable_shared
+ enable_static
+@@ -1414,6 +1415,9 @@ Optional Features:
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+@@ -3185,6 +3189,22 @@ fi
+ ac_config_commands="$ac_config_commands default-1"
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir
+ # Also toolexecdir, though it's only used in toolexeclibdir
+ case ${enable_version_specific_runtime_libs} in
+@@ -3200,7 +3220,14 @@ case ${enable_version_specific_runtime_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+@@ -11115,7 +11142,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11118 "configure"
++#line 11145 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11221,7 +11248,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11224 "configure"
++#line 11251 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/libffi/configure b/libffi/configure
+index 790a291011f..6e37039e84c 100755
+--- a/libffi/configure
++++ b/libffi/configure
+@@ -777,6 +777,7 @@ enable_debug
+ enable_structs
+ enable_raw_api
+ enable_purify_safety
++with_toolexeclibdir
+ enable_symvers
+ with_gcc_major_version_only
+ '
+@@ -1436,6 +1437,9 @@ Optional Packages:
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-gcc-major-version-only
+ use only GCC major number in filesystem paths
+
+@@ -11390,7 +11394,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11393 "configure"
++#line 11397 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11496,7 +11500,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11499 "configure"
++#line 11507 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -16002,10 +16006,33 @@ $as_echo "#define USING_PURIFY 1" >>confdefs.h
+ fi
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+diff --git a/libgcc/configure b/libgcc/configure
+index 441601a1f76..976827dc57e 100644
+--- a/libgcc/configure
++++ b/libgcc/configure
+@@ -669,6 +669,7 @@ enable_shared
+ enable_vtable_verify
+ with_aix_soname
+ enable_version_specific_runtime_libs
++with_toolexeclibdir
+ with_slibdir
+ enable_maintainer_mode
+ with_build_libsubdir
+@@ -1329,6 +1330,9 @@ Optional Packages:
+ --with-aix-soname=aix|svr4|both
+ shared library versioning (aka "SONAME") variant to
+ provide on AIX
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-slibdir=DIR shared libraries in DIR LIBDIR
+ --with-build-libsubdir=DIR Directory where to find libraries for build system
+ --with-system-libunwind use installed libunwind
+@@ -2403,6 +2407,22 @@ fi
+ $as_echo "$version_specific_libs" >&6; }
+
+
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
++
+ # Check whether --with-slibdir was given.
+ if test "${with_slibdir+set}" = set; then :
+ withval=$with_slibdir; slibdir="$with_slibdir"
+@@ -2410,7 +2430,14 @@ else
+ if test "${version_specific_libs}" = yes; then
+ slibdir='$(libsubdir)'
+ elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
+- slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
++ ;;
++ *)
++ slibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ slibdir='$(libdir)'
+ fi
+@@ -2640,7 +2667,14 @@ case ${version_specific_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_noncanonical)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
+ toolexeclibdir='$(libdir)'
+diff --git a/libgomp/configure b/libgomp/configure
+index 06166c66120..6b3beae0f63 100755
+--- a/libgomp/configure
++++ b/libgomp/configure
+@@ -782,6 +782,7 @@ enable_option_checking
+ enable_version_specific_runtime_libs
+ enable_generated_files_in_srcdir
+ enable_multilib
++with_toolexeclibdir
+ enable_dependency_tracking
+ enable_shared
+ enable_static
+@@ -1455,6 +1456,9 @@ Optional Features:
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+@@ -3338,6 +3342,22 @@ fi
+ ac_config_commands="$ac_config_commands default-1"
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir
+ # Also toolexecdir, though it's only used in toolexeclibdir
+ case ${enable_version_specific_runtime_libs} in
+@@ -3353,7 +3373,14 @@ case ${enable_version_specific_runtime_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+@@ -11155,7 +11182,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11158 "configure"
++#line 11185 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11261,7 +11288,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11264 "configure"
++#line 11295 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/libhsail-rt/configure b/libhsail-rt/configure
+index a4fcc10c1f9..1b4f2a953d0 100755
+--- a/libhsail-rt/configure
++++ b/libhsail-rt/configure
+@@ -737,6 +737,7 @@ enable_option_checking
+ enable_maintainer_mode
+ enable_dependency_tracking
+ enable_version_specific_runtime_libs
++with_toolexeclibdir
+ enable_shared
+ enable_static
+ with_pic
+@@ -1395,6 +1396,9 @@ Optional Features:
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+@@ -4418,6 +4422,22 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_version_specific_runtime_libs" >&5
+ $as_echo "$enable_version_specific_runtime_libs" >&6; }
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir
+ # Also toolexecdir, though it's only used in toolexeclibdir
+ case ${enable_version_specific_runtime_libs} in
+@@ -4433,7 +4453,14 @@ case ${enable_version_specific_runtime_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+@@ -10973,7 +11000,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10976 "configure"
++#line 11003 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11079,7 +11106,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11082 "configure"
++#line 11113 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/libitm/configure b/libitm/configure
+index 96c494d4a3f..ed47fab3c83 100644
+--- a/libitm/configure
++++ b/libitm/configure
+@@ -766,6 +766,7 @@ enable_option_checking
+ enable_version_specific_runtime_libs
+ enable_generated_files_in_srcdir
+ enable_multilib
++with_toolexeclibdir
+ enable_dependency_tracking
+ enable_shared
+ enable_static
+@@ -1430,6 +1431,9 @@ Optional Features:
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+@@ -3371,6 +3375,22 @@ fi
+ ac_config_commands="$ac_config_commands default-1"
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir
+ # Also toolexecdir, though it's only used in toolexeclibdir
+ case ${enable_version_specific_runtime_libs} in
+@@ -3386,7 +3406,14 @@ case ${enable_version_specific_runtime_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+@@ -11794,7 +11821,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11797 "configure"
++#line 11824 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11900,7 +11927,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11903 "configure"
++#line 11934 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/liboffloadmic/configure b/liboffloadmic/configure
+index f873716991b..6dfe9e37642 100644
+--- a/liboffloadmic/configure
++++ b/liboffloadmic/configure
+@@ -739,6 +739,7 @@ enable_maintainer_mode
+ enable_dependency_tracking
+ enable_multilib
+ enable_version_specific_runtime_libs
++with_toolexeclibdir
+ enable_shared
+ enable_static
+ with_pic
+@@ -1397,6 +1398,9 @@ Optional Features:
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+@@ -5003,6 +5007,22 @@ else
+ fi
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir.
+ # Also toolexecdir, though it's only used in toolexeclibdir.
+ case ${enable_version_specific_runtime_libs} in
+@@ -5018,7 +5038,14 @@ case ${enable_version_specific_runtime_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+@@ -11108,7 +11135,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11111 "configure"
++#line 11138 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11214,7 +11241,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11217 "configure"
++#line 11248 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/liboffloadmic/plugin/configure b/liboffloadmic/plugin/configure
+index c031eb3e7fa..570758344b4 100644
+--- a/liboffloadmic/plugin/configure
++++ b/liboffloadmic/plugin/configure
+@@ -735,6 +735,7 @@ enable_maintainer_mode
+ enable_dependency_tracking
+ enable_multilib
+ enable_version_specific_runtime_libs
++with_toolexeclibdir
+ enable_shared
+ enable_static
+ with_pic
+@@ -1394,6 +1395,9 @@ Optional Features:
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+@@ -4311,6 +4315,22 @@ fi
+ $as_echo "$enable_version_specific_runtime_libs" >&6; }
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir.
+ # Also toolexecdir, though it's only used in toolexeclibdir.
+ case ${enable_version_specific_runtime_libs} in
+@@ -4326,7 +4346,14 @@ case ${enable_version_specific_runtime_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+@@ -10815,7 +10842,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10818 "configure"
++#line 10845 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -10921,7 +10948,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10924 "configure"
++#line 10955 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/libquadmath/configure b/libquadmath/configure
+index 76a2c20b7e1..e887071aeb2 100755
+--- a/libquadmath/configure
++++ b/libquadmath/configure
+@@ -749,6 +749,7 @@ enable_fast_install
+ with_gnu_ld
+ enable_libtool_lock
+ enable_maintainer_mode
++with_toolexeclibdir
+ enable_symvers
+ enable_generated_files_in_srcdir
+ with_gcc_major_version_only
+@@ -1408,6 +1409,9 @@ Optional Packages:
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-gcc-major-version-only
+ use only GCC major number in filesystem paths
+
+@@ -10572,7 +10576,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10575 "configure"
++#line 10579 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -10678,7 +10682,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10681 "configure"
++#line 10689 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11917,6 +11921,22 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir
+ # Also toolexecdir, though it's only used in toolexeclibdir
+ case ${version_specific_libs} in
+@@ -11932,7 +11952,14 @@ case ${version_specific_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+diff --git a/libsanitizer/configure b/libsanitizer/configure
+index a3a08d635f4..5f4cdcad38d 100755
+--- a/libsanitizer/configure
++++ b/libsanitizer/configure
+@@ -767,6 +767,7 @@ enable_multilib
+ enable_version_specific_runtime_libs
+ enable_dependency_tracking
+ enable_maintainer_mode
++with_toolexeclibdir
+ enable_shared
+ enable_static
+ with_pic
+@@ -1425,6 +1426,9 @@ Optional Features:
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+@@ -4773,6 +4777,22 @@ fi
+
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir
+ # Also toolexecdir, though it's only used in toolexeclibdir
+ case ${version_specific_libs} in
+@@ -4788,7 +4808,14 @@ case ${version_specific_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+@@ -12032,7 +12059,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12035 "configure"
++#line 12062 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -12138,7 +12165,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12141 "configure"
++#line 12168 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/libssp/configure b/libssp/configure
+index ee1751d20db..3273cd40ab1 100755
+--- a/libssp/configure
++++ b/libssp/configure
+@@ -743,6 +743,7 @@ with_pic
+ enable_fast_install
+ with_gnu_ld
+ enable_libtool_lock
++with_toolexeclibdir
+ with_gcc_major_version_only
+ '
+ ac_precious_vars='build_alias
+@@ -1389,6 +1390,9 @@ Optional Packages:
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-gcc-major-version-only
+ use only GCC major number in filesystem paths
+
+@@ -10671,7 +10675,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10674 "configure"
++#line 10678 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -10777,7 +10781,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10780 "configure"
++#line 10784 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11039,6 +11043,22 @@ esac
+
+
+
++
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
++
++
+ # Calculate toolexeclibdir
+ # Also toolexecdir, though it's only used in toolexeclibdir
+ case ${version_specific_libs} in
+@@ -11054,7 +11074,14 @@ case ${version_specific_libs} in
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+- toolexeclibdir='$(toolexecdir)/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ toolexeclibdir='$(toolexecdir)/lib'
++ ;;
++ *)
++ toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
+index de8390703e2..88de3f728d4 100755
+--- a/libstdc++-v3/configure
++++ b/libstdc++-v3/configure
+@@ -903,6 +903,7 @@ enable_libstdcxx_threads
+ enable_libstdcxx_filesystem_ts
+ with_gxx_include_dir
+ enable_version_specific_runtime_libs
++with_toolexeclibdir
+ with_gcc_major_version_only
+ '
+ ac_precious_vars='build_alias
+@@ -1623,6 +1624,9 @@ Optional Packages:
+ set the std::string ABI to use by default
+ --with-gxx-include-dir=DIR
+ installation directory for include files
++ --with-toolexeclibdir=DIR
++ install libraries built with a cross compiler within
++ DIR
+ --with-gcc-major-version-only
+ use only GCC major number in filesystem paths
+
+@@ -11606,7 +11610,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11609 "configure"
++#line 11613 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11712,7 +11716,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11715 "configure"
++#line 11723 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -15398,7 +15402,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
+ # Fake what AC_TRY_COMPILE does.
+
+ cat > conftest.$ac_ext << EOF
+-#line 15401 "configure"
++#line 15409 "configure"
+ int main()
+ {
+ typedef bool atomic_type;
+@@ -15433,7 +15437,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
+ rm -f conftest*
+
+ cat > conftest.$ac_ext << EOF
+-#line 15436 "configure"
++#line 15440 "configure"
+ int main()
+ {
+ typedef short atomic_type;
+@@ -15468,7 +15472,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
+ rm -f conftest*
+
+ cat > conftest.$ac_ext << EOF
+-#line 15471 "configure"
++#line 15475 "configure"
+ int main()
+ {
+ // NB: _Atomic_word not necessarily int.
+@@ -15504,7 +15508,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
+ rm -f conftest*
+
+ cat > conftest.$ac_ext << EOF
+-#line 15507 "configure"
++#line 15511 "configure"
+ int main()
+ {
+ typedef long long atomic_type;
+@@ -15585,7 +15589,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
+ # unnecessary for this test.
+
+ cat > conftest.$ac_ext << EOF
+-#line 15588 "configure"
++#line 15592 "configure"
+ int main()
+ {
+ _Decimal32 d1;
+@@ -15627,7 +15631,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ # unnecessary for this test.
+
+ cat > conftest.$ac_ext << EOF
+-#line 15630 "configure"
++#line 15634 "configure"
+ template<typename T1, typename T2>
+ struct same
+ { typedef T2 type; };
+@@ -15661,7 +15665,7 @@ $as_echo "$enable_int128" >&6; }
+ rm -f conftest*
+
+ cat > conftest.$ac_ext << EOF
+-#line 15664 "configure"
++#line 15668 "configure"
+ template<typename T1, typename T2>
+ struct same
+ { typedef T2 type; };
+@@ -81674,6 +81678,19 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5
+ $as_echo "$version_specific_libs" >&6; }
+
++# Check whether --with-toolexeclibdir was given.
++if test "${with_toolexeclibdir+set}" = set; then :
++ withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
++ /)
++ ;;
++ */)
++ with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
++ ;;
++esac
++else
++ with_toolexeclibdir=no
++fi
++
+ # Default case for install directory for include files.
+ if test $version_specific_libs = no && test $gxx_include_dir = no; then
+ gxx_include_dir='include/c++/${gcc_version}'
+@@ -81704,7 +81721,14 @@ $as_echo "$version_specific_libs" >&6; }
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
+- glibcxx_toolexeclibdir='${toolexecdir}/lib'
++ case ${with_toolexeclibdir} in
++ no)
++ glibcxx_toolexeclibdir='${toolexecdir}/lib'
++ ;;
++ *)
++ glibcxx_toolexeclibdir=${with_toolexeclibdir}
++ ;;
++ esac
+ else
+ glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
+ glibcxx_toolexeclibdir='${libdir}'
+--
+2.24.0
+
diff --git a/gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..41b4a4cac6
--- /dev/null
+++ b/gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch
@@ -0,0 +1,53 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+Adapted from these upstream revision:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 97eae3fc7bc..4089d4695e2 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1145,8 +1145,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++ on many architectures. */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index c139322839a..7c3c2d866e5 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -211,20 +211,13 @@ namespace __sanitizer {
+ unsigned long __unused1;
+ unsigned long __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+ unsigned mode;
+- unsigned short __pad1;
+-# else
+- unsigned short __pad1;
+- unsigned short mode;
+ unsigned short __pad2;
+-# endif
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
++ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+
diff --git a/gnu/packages/patches/gcc-boot-4.7.4.patch b/gnu/packages/patches/gcc-boot-4.6.4.patch
index 3e51e31fdf..4ab0bf8641 100644
--- a/gnu/packages/patches/gcc-boot-4.7.4.patch
+++ b/gnu/packages/patches/gcc-boot-4.6.4.patch
@@ -1,4 +1,4 @@
-This patch enables building gcc-4.7.4 using gcc-2.95.3 and glibc-2.2.5
+This patch enables building gcc-4.6.4 using gcc-2.95.3 and glibc-2.2.5
* Tweak Makefile to allow overriding NATIVE_SYSTEM_HEADER_DIR using #:makeflags
* Add missing limits.h include.
@@ -14,12 +14,12 @@ diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f3cc49fdb18..bc5718fc9a6 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
-@@ -458,7 +458,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+@@ -440,7 +440,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
--NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
-+# NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+-NATIVE_SYSTEM_HEADER_DIR = /usr/include
++# NATIVE_SYSTEM_HEADER_DIR = /usr/include
# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
@@ -40,24 +40,11 @@ index 94b7a0b89a7..ab2baab55ca 100644
/* Linux has a feature called exec-shield-randomize that perturbs the
address of non-fixed mapped segments by a (relatively) small amount.
-diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
-index c301ff03cae..f86318c3bd5 100644
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -225,7 +225,7 @@ endif
- LIBGCC2_DEBUG_CFLAGS = -g
- LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
- $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
-- -fbuilding-libgcc -fno-stack-protector \
-+ -fno-stack-protector \
- $(INHIBIT_LIBC_CFLAGS)
-
- # Additional options to use when compiling libgcc2.a.
diff --git a/libgcc/generic-morestack-thread.c b/libgcc/generic-morestack-thread.c
index bbe6dd12b5a..1d1d48223d7 100644
--- a/libgcc/generic-morestack-thread.c
+++ b/libgcc/generic-morestack-thread.c
-@@ -35,7 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -34,7 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
will want to define inhibit_libc while building a compiler which
can build glibc. */
diff --git a/gnu/packages/patches/gd-CVE-2018-1000222.patch b/gnu/packages/patches/gd-CVE-2018-1000222.patch
deleted file mode 100644
index 7e94295bb6..0000000000
--- a/gnu/packages/patches/gd-CVE-2018-1000222.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-Fix CVE-2018-1000222:
-
-https://github.com/libgd/libgd/issues/447
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000222
-
-Patch copied from upstream source repository:
-
-https://github.com/libgd/libgd/commit/4b1e18a00ce7c4b7e6919c3b3109a034393b805a
-
-From 4b1e18a00ce7c4b7e6919c3b3109a034393b805a Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Sat, 14 Jul 2018 13:54:08 -0400
-Subject: [PATCH] bmp: check return value in gdImageBmpPtr
-
-Closes #447.
-
-(cherry picked from commit ac16bdf2d41724b5a65255d4c28fb0ec46bc42f5)
----
- src/gd_bmp.c | 17 ++++++++++++++---
- 1 file changed, 14 insertions(+), 3 deletions(-)
-
-diff --git a/src/gd_bmp.c b/src/gd_bmp.c
-index ccafdcd..d625da1 100644
---- a/src/gd_bmp.c
-+++ b/src/gd_bmp.c
-@@ -48,6 +48,8 @@ static int bmp_read_4bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp
- static int bmp_read_8bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header);
- static int bmp_read_rle(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info);
-
-+static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
-+
- #define BMP_DEBUG(s)
-
- static int gdBMPPutWord(gdIOCtx *out, int w)
-@@ -88,8 +90,10 @@ BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression)
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- if (out == NULL) return NULL;
-- gdImageBmpCtx(im, out, compression);
-- rv = gdDPExtractData(out, size);
-+ if (!_gdImageBmpCtx(im, out, compression))
-+ rv = gdDPExtractData(out, size);
-+ else
-+ rv = NULL;
- out->gd_free(out);
- return rv;
- }
-@@ -142,6 +146,11 @@ BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression)
- compression - whether to apply RLE or not.
- */
- BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
-+{
-+ _gdImageBmpCtx(im, out, compression);
-+}
-+
-+static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
- {
- int bitmap_size = 0, info_size, total_size, padding;
- int i, row, xpos, pixel;
-@@ -149,6 +158,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
- unsigned char *uncompressed_row = NULL, *uncompressed_row_start = NULL;
- FILE *tmpfile_for_compression = NULL;
- gdIOCtxPtr out_original = NULL;
-+ int ret = 1;
-
- /* No compression if its true colour or we don't support seek */
- if (im->trueColor) {
-@@ -326,6 +336,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
- out_original = NULL;
- }
-
-+ ret = 0;
- cleanup:
- if (tmpfile_for_compression) {
- #ifdef _WIN32
-@@ -339,7 +350,7 @@ cleanup:
- if (out_original) {
- out_original->gd_free(out_original);
- }
-- return;
-+ return ret;
- }
-
- static int compress_row(unsigned char *row, int length)
---
-2.18.0
-
diff --git a/gnu/packages/patches/gd-CVE-2018-5711.patch b/gnu/packages/patches/gd-CVE-2018-5711.patch
deleted file mode 100644
index 83b12cde63..0000000000
--- a/gnu/packages/patches/gd-CVE-2018-5711.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-This patch is adapted from commit a11f47475e6443b7f32d21f2271f28f417e2ac04 and
-fixes CVE-2018-5711.
-
-From a11f47475e6443b7f32d21f2271f28f417e2ac04 Mon Sep 17 00:00:00 2001
-From: "Christoph M. Becker" <cmbecker69@gmx.de>
-Date: Wed, 29 Nov 2017 19:37:38 +0100
-Subject: [PATCH] Fix #420: Potential infinite loop in gdImageCreateFromGifCtx
-
-Due to a signedness confusion in `GetCode_` a corrupt GIF file can
-trigger an infinite loop. Furthermore we make sure that a GIF without
-any palette entries is treated as invalid *after* open palette entries
-have been removed.
-
-CVE-2018-5711
-
-See also https://bugs.php.net/bug.php?id=75571.
----
- src/gd_gif_in.c | 12 ++++++------
- 1 file changed, 38 insertions(+), 6 deletions(-)
-
-diff --git a/src/gd_gif_in.c b/src/gd_gif_in.c
-index daf26e7..0a8bd71 100644
---- a/src/gd_gif_in.c
-+++ b/src/gd_gif_in.c
-@@ -335,11 +335,6 @@ terminated:
- return 0;
- }
-
-- if(!im->colorsTotal) {
-- gdImageDestroy(im);
-- return 0;
-- }
--
- /* Check for open colors at the end, so
- * we can reduce colorsTotal and ultimately
- * BitsPerPixel */
-@@ -351,6 +346,11 @@ terminated:
- }
- }
-
-+ if(!im->colorsTotal) {
-+ gdImageDestroy(im);
-+ return 0;
-+ }
-+
- return im;
- }
-
-@@ -447,7 +447,7 @@ static int
- GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroDataBlockP)
- {
- int i, j, ret;
-- unsigned char count;
-+ int count;
-
- if(flag) {
- scd->curbit = 0;
-
---
-2.13.6
-
diff --git a/gnu/packages/patches/gd-CVE-2019-6977.patch b/gnu/packages/patches/gd-CVE-2019-6977.patch
deleted file mode 100644
index b21a8ac619..0000000000
--- a/gnu/packages/patches/gd-CVE-2019-6977.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fix CVE-2019-6977:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-6977
-
-Patch copied from Debian:
-
-https://salsa.debian.org/debian/libgd2/commit/2d7d3b68bb79843e5271a05543e996fd5a3a8cd1
-
-Description: Heap-based buffer overflow in gdImageColorMatch
-Origin: other, https://gist.github.com/cmb69/1f36d285eb297ed326f5c821d7aafced
-Bug-PHP: https://bugs.php.net/bug.php?id=77270
-Bug-Debian: https://bugs.debian.org/920645
-Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2019-6977
-Forwarded: no
-Author: "Christoph M. Becker" <cmbecker69@gmx.de>
-Last-Update: 2019-02-01
-
-At least some of the image reading functions may return images which
-use color indexes greater than or equal to im->colorsTotal. We cater
-to this by always using a buffer size which is sufficient for
-`gdMaxColors` in `gdImageColorMatch()`.
----
-
---- a/src/gd_color_match.c
-+++ b/src/gd_color_match.c
-@@ -31,8 +31,8 @@ BGD_DECLARE(int) gdImageColorMatch (gdIm
- return -4; /* At least 1 color must be allocated */
- }
-
-- buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * im2->colorsTotal);
-- memset (buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal );
-+ buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * gdMaxColors);
-+ memset (buf, 0, sizeof(unsigned long) * 5 * gdMaxColors );
-
- for (x=0; x < im1->sx; x++) {
- for( y=0; y<im1->sy; y++ ) {
diff --git a/gnu/packages/patches/gd-CVE-2019-6978.patch b/gnu/packages/patches/gd-CVE-2019-6978.patch
deleted file mode 100644
index 69fc5056fc..0000000000
--- a/gnu/packages/patches/gd-CVE-2019-6978.patch
+++ /dev/null
@@ -1,301 +0,0 @@
-Fix CVE-2019-6978:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-6978
-
-Patch copied from upstream source repository:
-
-https://github.com/libgd/libgd/commit/553702980ae89c83f2d6e254d62cf82e204956d0
-
-From 553702980ae89c83f2d6e254d62cf82e204956d0 Mon Sep 17 00:00:00 2001
-From: "Christoph M. Becker" <cmbecker69@gmx.de>
-Date: Thu, 17 Jan 2019 11:54:55 +0100
-Subject: [PATCH] Fix #492: Potential double-free in gdImage*Ptr()
-
-Whenever `gdImage*Ptr()` calls `gdImage*Ctx()` and the latter fails, we
-must not call `gdDPExtractData()`; otherwise a double-free would
-happen. Since `gdImage*Ctx()` are void functions, and we can't change
-that for BC reasons, we're introducing static helpers which are used
-internally.
-
-We're adding a regression test for `gdImageJpegPtr()`, but not for
-`gdImageGifPtr()` and `gdImageWbmpPtr()` since we don't know how to
-trigger failure of the respective `gdImage*Ctx()` calls.
-
-This potential security issue has been reported by Solmaz Salimi (aka.
-Rooney).
----
- src/gd_gif_out.c | 18 +++++++++++++++---
- src/gd_jpeg.c | 20 ++++++++++++++++----
- src/gd_wbmp.c | 21 ++++++++++++++++++---
- tests/jpeg/.gitignore | 1 +
- tests/jpeg/CMakeLists.txt | 1 +
- tests/jpeg/Makemodule.am | 3 ++-
- tests/jpeg/jpeg_ptr_double_free.c | 31 +++++++++++++++++++++++++++++++
- 7 files changed, 84 insertions(+), 11 deletions(-)
- create mode 100644 tests/jpeg/jpeg_ptr_double_free.c
-
-diff --git a/src/gd_gif_out.c b/src/gd_gif_out.c
-index 298a581..d5a9534 100644
---- a/src/gd_gif_out.c
-+++ b/src/gd_gif_out.c
-@@ -99,6 +99,7 @@ static void char_init(GifCtx *ctx);
- static void char_out(int c, GifCtx *ctx);
- static void flush_char(GifCtx *ctx);
-
-+static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out);
-
-
-
-@@ -131,8 +132,11 @@ BGD_DECLARE(void *) gdImageGifPtr(gdImagePtr im, int *size)
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- if (out == NULL) return NULL;
-- gdImageGifCtx(im, out);
-- rv = gdDPExtractData(out, size);
-+ if (!_gdImageGifCtx(im, out)) {
-+ rv = gdDPExtractData(out, size);
-+ } else {
-+ rv = NULL;
-+ }
- out->gd_free(out);
- return rv;
- }
-@@ -220,6 +224,12 @@ BGD_DECLARE(void) gdImageGif(gdImagePtr im, FILE *outFile)
-
- */
- BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
-+{
-+ _gdImageGifCtx(im, out);
-+}
-+
-+/* returns 0 on success, 1 on failure */
-+static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
- {
- gdImagePtr pim = 0, tim = im;
- int interlace, BitsPerPixel;
-@@ -231,7 +241,7 @@ BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
- based temporary image. */
- pim = gdImageCreatePaletteFromTrueColor(im, 1, 256);
- if(!pim) {
-- return;
-+ return 1;
- }
- tim = pim;
- }
-@@ -247,6 +257,8 @@ BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
- /* Destroy palette based temporary image. */
- gdImageDestroy( pim);
- }
-+
-+ return 0;
- }
-
-
-diff --git a/src/gd_jpeg.c b/src/gd_jpeg.c
-index fc05842..96ef430 100644
---- a/src/gd_jpeg.c
-+++ b/src/gd_jpeg.c
-@@ -117,6 +117,8 @@ static void fatal_jpeg_error(j_common_ptr cinfo)
- exit(99);
- }
-
-+static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality);
-+
- /*
- * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality
- * QUALITY. If QUALITY is in the range 0-100, increasing values
-@@ -231,8 +233,11 @@ BGD_DECLARE(void *) gdImageJpegPtr(gdImagePtr im, int *size, int quality)
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- if (out == NULL) return NULL;
-- gdImageJpegCtx(im, out, quality);
-- rv = gdDPExtractData(out, size);
-+ if (!_gdImageJpegCtx(im, out, quality)) {
-+ rv = gdDPExtractData(out, size);
-+ } else {
-+ rv = NULL;
-+ }
- out->gd_free(out);
- return rv;
- }
-@@ -253,6 +258,12 @@ void jpeg_gdIOCtx_dest(j_compress_ptr cinfo, gdIOCtx *outfile);
-
- */
- BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
-+{
-+ _gdImageJpegCtx(im, outfile, quality);
-+}
-+
-+/* returns 0 on success, 1 on failure */
-+static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
- {
- struct jpeg_compress_struct cinfo;
- struct jpeg_error_mgr jerr;
-@@ -287,7 +298,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
- if(row) {
- gdFree(row);
- }
-- return;
-+ return 1;
- }
-
- cinfo.err->emit_message = jpeg_emit_message;
-@@ -328,7 +339,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
- if(row == 0) {
- gd_error("gd-jpeg: error: unable to allocate JPEG row structure: gdCalloc returns NULL\n");
- jpeg_destroy_compress(&cinfo);
-- return;
-+ return 1;
- }
-
- rowptr[0] = row;
-@@ -405,6 +416,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
- jpeg_finish_compress(&cinfo);
- jpeg_destroy_compress(&cinfo);
- gdFree(row);
-+ return 0;
- }
-
-
-diff --git a/src/gd_wbmp.c b/src/gd_wbmp.c
-index f19a1c9..a49bdbe 100644
---- a/src/gd_wbmp.c
-+++ b/src/gd_wbmp.c
-@@ -88,6 +88,8 @@ int gd_getin(void *in)
- return (gdGetC((gdIOCtx *)in));
- }
-
-+static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out);
-+
- /*
- Function: gdImageWBMPCtx
-
-@@ -100,6 +102,12 @@ int gd_getin(void *in)
- out - the stream where to write
- */
- BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
-+{
-+ _gdImageWBMPCtx(image, fg, out);
-+}
-+
-+/* returns 0 on success, 1 on failure */
-+static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
- {
- int x, y, pos;
- Wbmp *wbmp;
-@@ -107,7 +115,7 @@ BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
- /* create the WBMP */
- if((wbmp = createwbmp(gdImageSX(image), gdImageSY(image), WBMP_WHITE)) == NULL) {
- gd_error("Could not create WBMP\n");
-- return;
-+ return 1;
- }
-
- /* fill up the WBMP structure */
-@@ -123,11 +131,15 @@ BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
-
- /* write the WBMP to a gd file descriptor */
- if(writewbmp(wbmp, &gd_putout, out)) {
-+ freewbmp(wbmp);
- gd_error("Could not save WBMP\n");
-+ return 1;
- }
-
- /* des submitted this bugfix: gdFree the memory. */
- freewbmp(wbmp);
-+
-+ return 0;
- }
-
- /*
-@@ -271,8 +283,11 @@ BGD_DECLARE(void *) gdImageWBMPPtr(gdImagePtr im, int *size, int fg)
- void *rv;
- gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
- if (out == NULL) return NULL;
-- gdImageWBMPCtx(im, fg, out);
-- rv = gdDPExtractData(out, size);
-+ if (!_gdImageWBMPCtx(im, fg, out)) {
-+ rv = gdDPExtractData(out, size);
-+ } else {
-+ rv = NULL;
-+ }
- out->gd_free(out);
- return rv;
- }
-#diff --git a/tests/jpeg/.gitignore b/tests/jpeg/.gitignore
-#index c28aa87..13bcf04 100644
-#--- a/tests/jpeg/.gitignore
-#+++ b/tests/jpeg/.gitignore
-#@@ -3,5 +3,6 @@
-# /jpeg_empty_file
-# /jpeg_im2im
-# /jpeg_null
-#+/jpeg_ptr_double_free
-# /jpeg_read
-# /jpeg_resolution
-diff --git a/tests/jpeg/CMakeLists.txt b/tests/jpeg/CMakeLists.txt
-index 19964b0..a8d8162 100644
---- a/tests/jpeg/CMakeLists.txt
-+++ b/tests/jpeg/CMakeLists.txt
-@@ -2,6 +2,7 @@ IF(JPEG_FOUND)
- LIST(APPEND TESTS_FILES
- jpeg_empty_file
- jpeg_im2im
-+ jpeg_ptr_double_free
- jpeg_null
- )
-
-diff --git a/tests/jpeg/Makemodule.am b/tests/jpeg/Makemodule.am
-index 7e5d317..b89e169 100644
---- a/tests/jpeg/Makemodule.am
-+++ b/tests/jpeg/Makemodule.am
-@@ -2,7 +2,8 @@ if HAVE_LIBJPEG
- libgd_test_programs += \
- jpeg/jpeg_empty_file \
- jpeg/jpeg_im2im \
-- jpeg/jpeg_null
-+ jpeg/jpeg_null \
-+ jpeg/jpeg_ptr_double_free
-
- if HAVE_LIBPNG
- libgd_test_programs += \
-diff --git a/tests/jpeg/jpeg_ptr_double_free.c b/tests/jpeg/jpeg_ptr_double_free.c
-new file mode 100644
-index 0000000..df5a510
---- /dev/null
-+++ b/tests/jpeg/jpeg_ptr_double_free.c
-@@ -0,0 +1,31 @@
-+/**
-+ * Test that failure to convert to JPEG returns NULL
-+ *
-+ * We are creating an image, set its width to zero, and pass this image to
-+ * `gdImageJpegPtr()` which is supposed to fail, and as such should return NULL.
-+ *
-+ * See also <https://github.com/libgd/libgd/issues/381>
-+ */
-+
-+
-+#include "gd.h"
-+#include "gdtest.h"
-+
-+
-+int main()
-+{
-+ gdImagePtr src, dst;
-+ int size;
-+
-+ src = gdImageCreateTrueColor(1, 10);
-+ gdTestAssert(src != NULL);
-+
-+ src->sx = 0; /* this hack forces gdImageJpegPtr() to fail */
-+
-+ dst = gdImageJpegPtr(src, &size, 0);
-+ gdTestAssert(dst == NULL);
-+
-+ gdImageDestroy(src);
-+
-+ return gdNumFailures();
-+}
---
-2.20.1
-
diff --git a/gnu/packages/patches/gd-brect-bounds.patch b/gnu/packages/patches/gd-brect-bounds.patch
new file mode 100644
index 0000000000..575e4dc2ad
--- /dev/null
+++ b/gnu/packages/patches/gd-brect-bounds.patch
@@ -0,0 +1,63 @@
+Revert upstream commit 04bb9a08b3c25f8e3c0c235f9cefc0f94df59a5a because it
+causes a test failure on i686 and possibly other architectures.
+
+See <https://github.com/libgd/libgd/issues/613>.
+
+diff --git a/src/gdft.c b/src/gdft.c
+--- a/src/gdft.c
++++ b/src/gdft.c
+@@ -1579,6 +1579,12 @@ BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, const c
+ double scalex = (double)hdpi / (64 * METRIC_RES);
+ double scaley = (double)vdpi / (64 * METRIC_RES);
+
++ /* increase by 1 pixel to allow for rounding */
++ total_min.x -= METRIC_RES;
++ total_min.y -= METRIC_RES;
++ total_max.x += METRIC_RES;
++ total_max.y += METRIC_RES;
++
+ /* rotate bounding rectangle, scale and round to int pixels, and translate */
+ brect[0] = x + (total_min.x * cos_a + total_max.y * sin_a)*scalex;
+ brect[1] = y - (total_min.x * sin_a - total_max.y * cos_a)*scaley;
+diff --git a/tests/gdimagestringft/gdimagestringft_bbox.c b/tests/gdimagestringft/gdimagestringft_bbox.c
+--- a/tests/gdimagestringft/gdimagestringft_bbox.c
++++ b/tests/gdimagestringft/gdimagestringft_bbox.c
+@@ -8,22 +8,22 @@
+ #define DELTA (PI/8)
+
+ static int EXPECT[16][8] = {
+- {500, 400, 628, 400, 628, 376, 500, 376},
+- {492, 362, 611, 312, 601, 290, 483, 339},
+- {470, 330, 561, 239, 544, 221, 453, 312},
+- {437, 308, 486, 189, 464, 180, 414, 299},
+- {400, 301, 400, 173, 376, 173, 376, 301},
+- {363, 309, 313, 190, 291, 200, 340, 318},
+- {332, 331, 241, 240, 223, 257, 314, 348},
+- {311, 363, 192, 314, 183, 336, 302, 386},
+- {304, 399, 176, 399, 176, 423, 304, 423},
+- {312, 435, 193, 485, 203, 507, 321, 458},
+- {333, 465, 242, 556, 259, 574, 350, 483},
+- {364, 486, 315, 605, 337, 614, 387, 495},
+- {399, 492, 399, 620, 423, 620, 423, 492},
+- {434, 484, 484, 603, 506, 593, 457, 475},
+- {463, 464, 554, 555, 572, 538, 481, 447},
+- {483, 434, 602, 483, 611, 461, 492, 411},
++ {498, 401, 630, 401, 630, 374, 498, 374},
++ {491, 364, 613, 313, 602, 288, 481, 338},
++ {470, 332, 563, 239, 544, 219, 451, 312},
++ {438, 310, 488, 189, 463, 178, 412, 300},
++ {401, 303, 401, 171, 374, 171, 374, 303},
++ {365, 310, 314, 188, 289, 199, 339, 320},
++ {334, 331, 241, 238, 221, 257, 314, 350},
++ {313, 362, 192, 312, 181, 337, 303, 388},
++ {306, 398, 174, 398, 174, 425, 306, 425},
++ {313, 433, 191, 484, 202, 509, 323, 459},
++ {333, 463, 240, 556, 259, 576, 352, 483},
++ {363, 484, 313, 605, 338, 616, 389, 494},
++ {398, 490, 398, 622, 425, 622, 425, 490},
++ {432, 483, 483, 605, 508, 594, 458, 473},
++ {461, 464, 554, 557, 574, 538, 481, 445},
++ {481, 435, 602, 485, 613, 460, 491, 409},
+ };
+
+ int main()
diff --git a/gnu/packages/patches/gd-fix-tests-on-i686.patch b/gnu/packages/patches/gd-fix-tests-on-i686.patch
index 280893c1d4..7ec8e7fee9 100644
--- a/gnu/packages/patches/gd-fix-tests-on-i686.patch
+++ b/gnu/packages/patches/gd-fix-tests-on-i686.patch
@@ -38,7 +38,7 @@ diff -ru libgd-2.2.3.orig/tests/gdimagecopyresampled/bug00201.c libgd-2.2.3/test
@@ -65,7 +66,8 @@
gdImageDestroy(background);
gdImageDestroy(scaled_logo);
-
+
- gdAssertImageEqualsToFile("gdimagecopyresampled/bug00201_exp.png", img);
+ if (FLT_EVAL_METHOD != 2)
+ gdAssertImageEqualsToFile("gdimagecopyresampled/bug00201_exp.png", img);
diff --git a/gnu/packages/patches/gd-freetype-test-failure.patch b/gnu/packages/patches/gd-freetype-test-failure.patch
deleted file mode 100644
index 49c16ca089..0000000000
--- a/gnu/packages/patches/gd-freetype-test-failure.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-Fix a test failure with freetype 2.7:
-
-https://github.com/libgd/libgd/commit/a5570d3ed30ff76c2a8bdd54f4ab1825acca0143
-
-Patch copied from upstream source repository:
-
-https://github.com/libgd/libgd/commit/a5570d3ed30ff76c2a8bdd54f4ab1825acca0143
-
-From a5570d3ed30ff76c2a8bdd54f4ab1825acca0143 Mon Sep 17 00:00:00 2001
-From: "Christoph M. Becker" <cmbecker69@gmx.de>
-Date: Sun, 29 Jan 2017 17:07:50 +0100
-Subject: [PATCH] Fix #302: Test suite fails with freetype 2.7
-
-Actually, the test failures are not necessarily related to freetype
-2.7, but rather are caused by subpixel hinting which is enabled by
-default in freetype 2.7. Subpixel hinting is, however, already
-available in freetype 2.5 and in versions having the "Infinality"
-patch.
-
-To get the expected results in all environments, we have to disable
-subpixel hinting, what is easily done by setting a respective
-environment variable.
-
-See also:
-* https://www.freetype.org/freetype2/docs/subpixel-hinting.html
-* https://www.freetype.org/freetype2/docs/reference/ft2-tt_driver.html
----
- tests/freetype/bug00132.c | 3 +++
- tests/gdimagestringft/gdimagestringft_bbox.c | 3 +++
- 2 files changed, 6 insertions(+)
-
-diff --git a/tests/freetype/bug00132.c b/tests/freetype/bug00132.c
-index 713dd2d..42ed5b1 100644
---- a/tests/freetype/bug00132.c
-+++ b/tests/freetype/bug00132.c
-@@ -11,6 +11,9 @@ int main()
- char *path;
- char *ret = NULL;
-
-+ /* disable subpixel hinting */
-+ putenv("FREETYPE_PROPERTIES=truetype:interpreter-version=35");
-+
- im = gdImageCreateTrueColor(50, 30);
-
- if (!im) {
-diff --git a/tests/gdimagestringft/gdimagestringft_bbox.c b/tests/gdimagestringft/gdimagestringft_bbox.c
-index 0161ec8..1596a9e 100644
---- a/tests/gdimagestringft/gdimagestringft_bbox.c
-+++ b/tests/gdimagestringft/gdimagestringft_bbox.c
-@@ -38,6 +38,9 @@ int main()
- int error = 0;
- FILE *fp;
-
-+ /* disable subpixel hinting */
-+ putenv("FREETYPE_PROPERTIES=truetype:interpreter-version=35");
-+
- path = gdTestFilePath("freetype/DejaVuSans.ttf");
- im = gdImageCreate(800, 800);
- gdImageColorAllocate(im, 0xFF, 0xFF, 0xFF); /* allocate white for background color */
diff --git a/gnu/packages/patches/gdm-default-session.patch b/gnu/packages/patches/gdm-default-session.patch
index 4839a04de4..9ab2829cdb 100644
--- a/gnu/packages/patches/gdm-default-session.patch
+++ b/gnu/packages/patches/gdm-default-session.patch
@@ -5,11 +5,10 @@ and not in the directories listed in $XDG_DATA_DIRS. The latter includes
Fixes <https://bugs.gnu.org/37831>.
-diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
-index 6a116a8..02c1458 100644
---- a/daemon/gdm-session.c
-+++ b/daemon/gdm-session.c
-@@ -348,24 +348,18 @@ get_system_session_dirs (GdmSession *self)
+diff -ur a/daemon/gdm-session.c b/daemon/gdm-session.c
+--- a/daemon/gdm-session.c 2019-09-25 10:40:24.000000000 -0400
++++ b/daemon/gdm-session.c 2020-04-18 18:30:02.671856808 -0400
+@@ -348,24 +348,18 @@
GArray *search_array = NULL;
char **search_dirs;
int i;
@@ -35,7 +34,7 @@ index 6a116a8..02c1458 100644
g_array_append_vals (search_array, x_search_dirs, G_N_ELEMENTS (x_search_dirs));
#ifdef ENABLE_WAYLAND_SUPPORT
-@@ -373,16 +367,7 @@ get_system_session_dirs (GdmSession *self)
+@@ -373,16 +367,7 @@
#ifdef ENABLE_USER_DISPLAY_SERVER
g_array_prepend_val (search_array, wayland_search_dir);
@@ -52,40 +51,39 @@ index 6a116a8..02c1458 100644
g_array_append_val (search_array, wayland_search_dir);
#endif
}
-diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c
-index afbc5c0..bb5e3e6 100644
---- a/libgdm/gdm-sessions.c
-+++ b/libgdm/gdm-sessions.c
-@@ -238,19 +238,11 @@ collect_sessions (void)
+diff -ur a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c
+--- a/libgdm/gdm-sessions.c 2019-10-07 04:53:35.000000000 -0400
++++ b/libgdm/gdm-sessions.c 2020-04-18 18:31:42.491348691 -0400
+@@ -245,19 +245,12 @@
"/etc/X11/sessions/",
DMCONFDIR "/Sessions/",
DATADIR "/gdm/BuiltInSessions/",
- DATADIR "/xsessions/",
-- NULL
+ "/run/current-system/profile/share/xsessions/"
};
- xorg_search_array = g_array_new (TRUE, TRUE, sizeof (char *));
+ names_seen_before = g_hash_table_new (g_str_hash, g_str_equal);
+ xorg_search_array = g_ptr_array_new_with_free_func (g_free);
- const gchar * const *system_data_dirs = g_get_system_data_dirs ();
-
- for (i = 0; system_data_dirs[i]; i++) {
- session_dir = g_build_filename (system_data_dirs[i], "xsessions", NULL);
-- g_array_append_val (xorg_search_array, session_dir);
+- g_ptr_array_add (xorg_search_array, session_dir);
- }
-
- g_array_append_vals (xorg_search_array, xorg_search_dirs, G_N_ELEMENTS (xorg_search_dirs));
-
- #ifdef ENABLE_WAYLAND_SUPPORT
-@@ -261,11 +253,6 @@ collect_sessions (void)
+ for (i = 0; i < G_N_ELEMENTS (xorg_search_dirs); i++) {
+ g_ptr_array_add (xorg_search_array, g_strdup (xorg_search_dirs[i]));
+ }
+@@ -269,11 +262,6 @@
- wayland_search_array = g_array_new (TRUE, TRUE, sizeof (char *));
+ wayland_search_array = g_ptr_array_new_with_free_func (g_free);
- for (i = 0; system_data_dirs[i]; i++) {
- session_dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
-- g_array_append_val (wayland_search_array, session_dir);
+- g_ptr_array_add (wayland_search_array, session_dir);
- }
-
- g_array_append_vals (wayland_search_array, wayland_search_dirs, G_N_ELEMENTS (wayland_search_dirs));
- #endif
-
+ for (i = 0; i < G_N_ELEMENTS (wayland_search_dirs); i++) {
+ g_ptr_array_add (wayland_search_array, g_strdup (wayland_search_dirs[i]));
+ }
diff --git a/gnu/packages/patches/ghc-dont-pass-linker-flags-via-response-files.patch b/gnu/packages/patches/ghc-dont-pass-linker-flags-via-response-files.patch
deleted file mode 100644
index 40aae7a9d7..0000000000
--- a/gnu/packages/patches/ghc-dont-pass-linker-flags-via-response-files.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Don’t add linker flags via ‘response files’ since ld-wrapper
-doesn’t handle them.
-See https://github.com/NixOS/nixpkgs/commit/a421e7bd4a28c69bded8b17888325e31554f61a1
-https://gcc.gnu.org/ml/gcc/2016-10/msg00151.html
-
-diff --git a/compiler/main/SysTools.hs.orig b/compiler/main/SysTools.hs
-index 1ab5b13..99270fc 100644
---- a/compiler/main/SysTools.hs.orig
-+++ b/compiler/main/SysTools.hs
-@@ -424,7 +424,7 @@ runCc dflags args = do
- args1 = map Option (getOpts dflags opt_c)
- args2 = args0 ++ args1 ++ args
- mb_env <- getGccEnv args2
-- runSomethingResponseFile dflags cc_filter "C Compiler" p args2 mb_env
-+ runSomethingFiltered dflags cc_filter "C Compiler" p args2 mb_env
- where
- -- discard some harmless warnings from gcc that we can't turn off
- cc_filter = unlines . doFilter . lines
-@@ -945,7 +945,7 @@ runLink dflags args = do
- args1 = map Option (getOpts dflags opt_l)
- args2 = args0 ++ linkargs ++ args1 ++ args
- mb_env <- getGccEnv args2
-- runSomethingResponseFile dflags ld_filter "Linker" p args2 mb_env
-+ runSomethingFiltered dflags ld_filter "Linker" p args2 mb_env
- where
- ld_filter = case (platformOS (targetPlatform dflags)) of
- OSSolaris2 -> sunos_ld_filter
diff --git a/gnu/packages/patches/ghc-testsuite-dlopen-pie.patch b/gnu/packages/patches/ghc-testsuite-dlopen-pie.patch
new file mode 100644
index 0000000000..99ba3ac42f
--- /dev/null
+++ b/gnu/packages/patches/ghc-testsuite-dlopen-pie.patch
@@ -0,0 +1,54 @@
+Do not attempt to dlopen PIE objects, which was disallowed with glibc 2.30.
+
+https://gitlab.haskell.org/ghc/ghc/issues/17952
+https://sourceware.org/bugzilla/show_bug.cgi?id=24323
+
+Patch submitted upstream:
+https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2947
+
+diff --git a/testsuite/tests/dynlibs/Makefile b/testsuite/tests/dynlibs/Makefile
+--- a/testsuite/tests/dynlibs/Makefile
++++ b/testsuite/tests/dynlibs/Makefile
+@@ -60,6 +60,4 @@ T5373:
+ .PHONY: T13702
+ T13702:
+ '$(TEST_HC)' -v0 -dynamic -rdynamic -fPIC -pie T13702.hs
+- '$(TEST_HC)' -v0 -dynamic T13702a.hs
+- ./T13702 # first make sure executable itself works
+- ./T13702a # then try dynamically loading it as library
++ ./T13702
+diff --git a/testsuite/tests/dynlibs/T13702.hs b/testsuite/tests/dynlibs/T13702.hs
+--- a/testsuite/tests/dynlibs/T13702.hs
++++ b/testsuite/tests/dynlibs/T13702.hs
+@@ -2,8 +2,3 @@
+
+ main :: IO ()
+ main = putStrLn "hello world"
+-
+-foreign export ccall "hello" hello :: IO ()
+-
+-hello :: IO ()
+-hello = putStrLn "hello world again"
+diff --git a/testsuite/tests/dynlibs/T13702.stdout b/testsuite/tests/dynlibs/T13702.stdout
+--- a/testsuite/tests/dynlibs/T13702.stdout
++++ b/testsuite/tests/dynlibs/T13702.stdout
+@@ -1,2 +1 @@
+ hello world
+-hello world again
+diff --git a/testsuite/tests/dynlibs/T13702a.hs b/testsuite/tests/dynlibs/T13702a.hs
+deleted file mode 100644
+--- a/testsuite/tests/dynlibs/T13702a.hs
++++ /dev/null
+@@ -1,12 +0,0 @@
+-{-# LANGUAGE ForeignFunctionInterface #-}
+-
+-import Foreign
+-import System.Posix.DynamicLinker
+-
+-main :: IO ()
+-main = do
+- dl <- dlopen "./T13702" [RTLD_NOW]
+- funptr <- dlsym dl "hello" :: IO (FunPtr (IO ()))
+- mkAction funptr
+-
+-foreign import ccall "dynamic" mkAction :: FunPtr (IO ()) -> IO ()
diff --git a/gnu/packages/patches/ghostscript-no-header-id.patch b/gnu/packages/patches/ghostscript-no-header-id.patch
index da1aa5530f..45fc95fd6e 100644
--- a/gnu/packages/patches/ghostscript-no-header-id.patch
+++ b/gnu/packages/patches/ghostscript-no-header-id.patch
@@ -9,10 +9,10 @@ See: https://bugs.ghostscript.com/show_bug.cgi?id=698208
diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c
--- orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c 2017-07-09 23:30:28.960479189 +0200
+++ gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c 2017-07-09 23:34:34.306524488 +0200
-@@ -1785,8 +1785,11 @@
+@@ -1810,8 +1810,11 @@
* +1 for the linearisation dict and +1 for the primary hint stream.
*/
- linear_params->FirsttrailerOffset = gp_ftell_64(linear_params->Lin_File.file);
+ linear_params->FirsttrailerOffset = gp_ftell(linear_params->Lin_File.file);
- gs_sprintf(LDict, "\ntrailer\n<</Size %ld/Info %d 0 R/Root %d 0 R/ID[%s%s]/Prev %d>>\nstartxref\r\n0\n%%%%EOF\n \n",
- linear_params->LastResource + 3, pdev->ResourceUsage[linear_params->Info_id].NewObjectNumber, pdev->ResourceUsage[linear_params->Catalog_id].NewObjectNumber, fileID, fileID, 0);
+ gs_sprintf(LDict, "\ntrailer\n<</Size %ld/Info %d 0 R/Root %d 0 R",
@@ -20,10 +20,10 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c gnu-ghostscript-9.
+ if (pdev->OwnerPassword.size > 0 || !(!getenv("GS_GENERATE_UUIDS") || (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 && strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))) /* ID is mandatory when encrypting */
+ gs_sprintf(LDict, "/ID[%s%s]", fileID, fileID);
+ gs_sprintf(LDict, "/Prev %d>>\nstartxref\r\n0\n%%%%EOF\n \n", 0);
- fwrite(LDict, strlen(LDict), 1, linear_params->Lin_File.file);
+ gp_fwrite(LDict, strlen(LDict), 1, linear_params->Lin_File.file);
/* Write document catalog (Part 4) */
-@@ -2321,8 +2324,11 @@
+@@ -2346,8 +2349,11 @@
if (code != 0)
return_error(gs_error_ioerror);
@@ -34,10 +34,10 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c gnu-ghostscript-9.
+ if (pdev->OwnerPassword.size > 0 || !(!getenv("GS_GENERATE_UUIDS") || (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 || strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))) /* ID is mandatory when encrypting */
+ gs_sprintf(LDict, "/ID[%s%s]", fileID, fileID);
+ gs_sprintf(LDict, "/Prev %"PRId64">>\nstartxref\r\n0\n%%%%EOF\n", mainxref);
- fwrite(LDict, strlen(LDict), 1, linear_params->sfile);
+ gp_fwrite(LDict, strlen(LDict), 1, linear_params->sfile);
- code = gp_fseek_64(linear_params->sfile, pdev->ResourceUsage[HintStreamObj].LinearisedOffset, SEEK_SET);
-@@ -3016,10 +3022,12 @@
+ code = gp_fseek(linear_params->sfile, pdev->ResourceUsage[HintStreamObj].LinearisedOffset, SEEK_SET);
+@@ -3012,10 +3018,12 @@
stream_puts(s, "trailer\n");
pprintld3(s, "<< /Size %ld /Root %ld 0 R /Info %ld 0 R\n",
pdev->next_id, Catalog_id, Info_id);
diff --git a/gnu/packages/patches/ghostscript-no-header-uuid.patch b/gnu/packages/patches/ghostscript-no-header-uuid.patch
index 473531220c..f4b55764c8 100644
--- a/gnu/packages/patches/ghostscript-no-header-uuid.patch
+++ b/gnu/packages/patches/ghostscript-no-header-uuid.patch
@@ -11,7 +11,7 @@ See: https://bugs.ghostscript.com/show_bug.cgi?id=698208
diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c aa/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c
--- orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c 2017-07-09 23:30:28.960479189 +0200
+++ gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c 2017-07-10 01:04:12.252478276 +0200
-@@ -617,7 +617,7 @@
+@@ -620,7 +620,7 @@
return code;
/* PDF/A XMP reference recommends setting UUID to empty. If not empty must be a URI */
@@ -20,13 +20,12 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c aa/gnu-ghostscrip
instance_uuid[0] = 0x00;
cre_date_time_len = pdf_get_docinfo_item(pdev, "/CreationDate", cre_date_time, sizeof(cre_date_time));
-@@ -719,15 +719,18 @@
+@@ -720,14 +720,17 @@
pdf_xml_tag_close(s, "rdf:Description");
pdf_xml_newline(s);
- pdf_xml_tag_open_beg(s, "rdf:Description");
-- pdf_xml_attribute_name(s, "rdf:about");
-- pdf_xml_attribute_value(s, instance_uuid);
+- pdf_xml_copy(s, " rdf:about=\"\"");
- pdf_xml_attribute_name(s, "xmlns:xapMM");
- pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/mm/");
- pdf_xml_attribute_name(s, "xapMM:DocumentID");
@@ -36,8 +35,7 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c aa/gnu-ghostscrip
+ if (!getenv("GS_GENERATE_UUIDS") || (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 && strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
+ {
+ pdf_xml_tag_open_beg(s, "rdf:Description");
-+ pdf_xml_attribute_name(s, "rdf:about");
-+ pdf_xml_attribute_value(s, instance_uuid);
++ pdf_xml_copy(s, " rdf:about=\"\"");
+ pdf_xml_attribute_name(s, "xmlns:xapMM");
+ pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/mm/");
+ pdf_xml_attribute_name(s, "xapMM:DocumentID");
@@ -47,4 +45,4 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c aa/gnu-ghostscrip
+ }
pdf_xml_tag_open_beg(s, "rdf:Description");
- pdf_xml_attribute_name(s, "rdf:about");
+ pdf_xml_copy(s, " rdf:about=\"\"");
diff --git a/gnu/packages/patches/giflib-make-reallocarray-private.patch b/gnu/packages/patches/giflib-make-reallocarray-private.patch
deleted file mode 100644
index 69228c5be8..0000000000
--- a/gnu/packages/patches/giflib-make-reallocarray-private.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-Move the declaration from gif_lib.h to gif_lib_private.h to solve
-conflicts when some .c-file #includes both stdlib.h and gif_lib.h.
-See also https://sourceforge.net/p/giflib/bugs/110/
-
-diff -ur giflib-5.1.4.orig/lib/dgif_lib.c giflib-5.1.4/lib/dgif_lib.c
---- giflib-5.1.4.orig/lib/dgif_lib.c 2018-02-28 20:31:02.294682673 +0100
-+++ giflib-5.1.4/lib/dgif_lib.c 2018-02-28 22:38:11.659126414 +0100
-@@ -396,7 +396,7 @@
-
- if (GifFile->SavedImages) {
- SavedImage* new_saved_images =
-- (SavedImage *)reallocarray(GifFile->SavedImages,
-+ (SavedImage *)giflib_private_reallocarray(GifFile->SavedImages,
- (GifFile->ImageCount + 1), sizeof(SavedImage));
- if (new_saved_images == NULL) {
- GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM;
-@@ -1108,7 +1108,7 @@
- if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) {
- return GIF_ERROR;
- }
-- sp->RasterBits = (unsigned char *)reallocarray(NULL, ImageSize,
-+ sp->RasterBits = (unsigned char *)giflib_private_reallocarray(NULL, ImageSize,
- sizeof(GifPixelType));
-
- if (sp->RasterBits == NULL) {
-diff -ur giflib-5.1.4.orig/lib/gifalloc.c giflib-5.1.4/lib/gifalloc.c
---- giflib-5.1.4.orig/lib/gifalloc.c 2018-02-28 20:31:02.294682673 +0100
-+++ giflib-5.1.4/lib/gifalloc.c 2018-02-28 22:38:11.657126423 +0100
-@@ -8,7 +8,7 @@
- #include <stdio.h>
- #include <string.h>
-
--#include "gif_lib.h"
-+#include "gif_lib_private.h"
-
- #define MAX(x, y) (((x) > (y)) ? (x) : (y))
-
-@@ -188,7 +188,7 @@
-
- /* perhaps we can shrink the map? */
- if (RoundUpTo < ColorUnion->ColorCount) {
-- GifColorType *new_map = (GifColorType *)reallocarray(Map,
-+ GifColorType *new_map = (GifColorType *)giflib_private_reallocarray(Map,
- RoundUpTo, sizeof(GifColorType));
- if( new_map == NULL ) {
- GifFreeMapObject(ColorUnion);
-@@ -232,7 +232,7 @@
- if (*ExtensionBlocks == NULL)
- *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock));
- else {
-- ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray
-+ ExtensionBlock* ep_new = (ExtensionBlock *)giflib_private_reallocarray
- (*ExtensionBlocks, (*ExtensionBlockCount + 1),
- sizeof(ExtensionBlock));
- if( ep_new == NULL )
-@@ -325,7 +325,7 @@
- if (GifFile->SavedImages == NULL)
- GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage));
- else
-- GifFile->SavedImages = (SavedImage *)reallocarray(GifFile->SavedImages,
-+ GifFile->SavedImages = (SavedImage *)giflib_private_reallocarray(GifFile->SavedImages,
- (GifFile->ImageCount + 1), sizeof(SavedImage));
-
- if (GifFile->SavedImages == NULL)
-@@ -355,7 +355,7 @@
- }
-
- /* next, the raster */
-- sp->RasterBits = (unsigned char *)reallocarray(NULL,
-+ sp->RasterBits = (unsigned char *)giflib_private_reallocarray(NULL,
- (CopyFrom->ImageDesc.Height *
- CopyFrom->ImageDesc.Width),
- sizeof(GifPixelType));
-@@ -369,7 +369,7 @@
-
- /* finally, the extension blocks */
- if (sp->ExtensionBlocks != NULL) {
-- sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL,
-+ sp->ExtensionBlocks = (ExtensionBlock *)giflib_private_reallocarray(NULL,
- CopyFrom->ExtensionBlockCount,
- sizeof(ExtensionBlock));
- if (sp->ExtensionBlocks == NULL) {
-diff -ur giflib-5.1.4.orig/lib/gif_lib.h giflib-5.1.4/lib/gif_lib.h
---- giflib-5.1.4.orig/lib/gif_lib.h 2018-02-28 20:31:02.294682673 +0100
-+++ giflib-5.1.4/lib/gif_lib.h 2018-02-28 20:31:43.135716712 +0100
-@@ -244,9 +244,6 @@
- GifPixelType ColorTransIn2[]);
- extern int GifBitSize(int n);
-
--extern void *
--reallocarray(void *optr, size_t nmemb, size_t size);
--
- /******************************************************************************
- Support for the in-core structures allocation (slurp mode).
- ******************************************************************************/
-diff -ur giflib-5.1.4.orig/lib/gif_lib_private.h giflib-5.1.4/lib/gif_lib_private.h
---- giflib-5.1.4.orig/lib/gif_lib_private.h 2018-02-28 20:31:02.294682673 +0100
-+++ giflib-5.1.4/lib/gif_lib_private.h 2018-02-28 22:38:11.657126423 +0100
-@@ -54,6 +54,9 @@
- bool gif89;
- } GifFilePrivateType;
-
-+extern void *
-+giflib_private_reallocarray(void *optr, size_t nmemb, size_t size);
-+
- #endif /* _GIF_LIB_PRIVATE_H */
-
- /* end */
-diff -ur giflib-5.1.4.orig/lib/openbsd-reallocarray.c giflib-5.1.4/lib/openbsd-reallocarray.c
---- giflib-5.1.4.orig/lib/openbsd-reallocarray.c 2018-02-28 20:31:02.295682659 +0100
-+++ giflib-5.1.4/lib/openbsd-reallocarray.c 2018-02-28 22:38:11.656126428 +0100
-@@ -27,7 +27,7 @@
- #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
-
- void *
--reallocarray(void *optr, size_t nmemb, size_t size)
-+giflib_private_reallocarray(void *optr, size_t nmemb, size_t size)
- {
- if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
- nmemb > 0 && SIZE_MAX / nmemb < size) {
diff --git a/gnu/packages/patches/glibc-2.29-supported-locales.patch b/gnu/packages/patches/glibc-2.29-supported-locales.patch
new file mode 100644
index 0000000000..05865dc7be
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.29-supported-locales.patch
@@ -0,0 +1,33 @@
+This patch is taken from debian's glibc package (generate-supported.mk).
+It install the localedata/SUPPORTED file of the glibc. This file lists
+all the supported locales of the glibc.
+
+diff --git a/localedata/Makefile b/localedata/Makefile
+index 65079f9eb8..14818f84e0 100644
+--- a/localedata/Makefile
++++ b/localedata/Makefile
+@@ -169,7 +169,8 @@ endif
+ # Files to install.
+ install-others := $(addprefix $(inst_i18ndir)/, \
+ $(addsuffix .gz, $(charmaps)) \
+- $(locales))
++ $(locales)) \
++ $(inst_i18ndir)/SUPPORTED
+
+ tests: $(objdir)/iconvdata/gconv-modules
+
+@@ -380,6 +381,14 @@ endif
+
+ include SUPPORTED
+
++$(inst_i18ndir)/SUPPORTED: SUPPORTED $(+force)
++ for locale in $(SUPPORTED-LOCALES); do \
++ [ $$locale = true ] && continue; \
++ echo $$locale | sed 's,/, ,' >> LOCALES; \
++ done
++ $(make-target-directory)
++ $(INSTALL_DATA) LOCALES $@
++
+ INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
+ INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
+ \ No newline at end of file
diff --git a/gnu/packages/patches/glibc-CVE-2019-19126.patch b/gnu/packages/patches/glibc-CVE-2019-19126.patch
new file mode 100644
index 0000000000..5b9ac58ab7
--- /dev/null
+++ b/gnu/packages/patches/glibc-CVE-2019-19126.patch
@@ -0,0 +1,22 @@
+Fix CVE-2019-19126:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19126
+https://sourceware.org/bugzilla/show_bug.cgi?id=25204
+
+Taken from upstream:
+https://sourceware.org/git/?p=glibc.git;a=commit;h=37c90e117310728a4ad1eb998c0bbe7d79c4a398
+
+diff --git a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
+index 975cbe2..df2cdfd 100644
+--- a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
++++ b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
+@@ -31,7 +31,8 @@
+ environment variable, LD_PREFER_MAP_32BIT_EXEC. */
+ #define EXTRA_LD_ENVVARS \
+ case 21: \
+- if (memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
++ if (!__libc_enable_secure \
++ && memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
+ GLRO(dl_x86_cpu_features).feature[index_arch_Prefer_MAP_32BIT_EXEC] \
+ |= bit_arch_Prefer_MAP_32BIT_EXEC; \
+ break;
diff --git a/gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch b/gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch
new file mode 100644
index 0000000000..d11fc00c75
--- /dev/null
+++ b/gnu/packages/patches/glibc-bootstrap-system-2.2.5.patch
@@ -0,0 +1,30 @@
+We want to allow builds in chroots that lack /bin/sh. Thus, system(3)
+and popen(3) need to be tweaked to use the right shell. For the bootstrap
+glibc, we just use whatever `sh' can be found in $PATH. The final glibc
+instead uses the hard-coded absolute file name of `bash'.
+
+--- a/sysdeps/posix/system.c
++++ b/sysdeps/posix/system.c
+@@ -106,8 +106,8 @@ do_system (const char *line)
+ (void) UNBLOCK;
+
+ /* Exec the shell. */
+- (void) __execve (SHELL_PATH, (char *const *) new_argv, __environ);
++ (void) execvp (SHELL_NAME, (char *const *) new_argv);
+ _exit (127);
+ }
+ else if (pid < (pid_t) 0)
+ /* The fork failed. */
+--- a/libio/iopopen.c
++++ b/libio/iopopen.c
+@@ -170,7 +170,7 @@ _IO_new_proc_open (fp, command, mode)
+ for (p = proc_file_chain; p; p = p->next)
+ _IO_close (_IO_fileno ((_IO_FILE *) p));
+
+- _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
++ execlp ("sh", "sh", "-c", command, (char *) 0);
+ _IO__exit (127);
+ }
+ _IO_close (child_end);
+
+
diff --git a/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
new file mode 100644
index 0000000000..1c3fe427f9
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
@@ -0,0 +1,84 @@
+This is needed to run Python on the Hurd, especially during the build of
+python-boot0.
+
+Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/debian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff
+
+Use the realtime clock for the monotonic clock. This is of course not a proper
+implementation (which is being done in Mach), but will permit to fix at least
+the iceweasel stack.
+
+vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
+_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the
+former.
+
+From 0aa1dfd580cf9ad7b812c307b128decb782b825f Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Mon, 2 Mar 2020 18:59:04 +0100
+Subject: [PATCH 2/2] Use realtime clock for the monotonic clock.
+
+---
+ sysdeps/mach/clock_gettime.c | 2 +-
+ sysdeps/mach/hurd/bits/posix_opt.h | 6 +++---
+ sysdeps/posix/clock_getres.c | 1 +
+ sysdeps/pthread/timer_create.c | 2 +-
+ 4 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
+index ac3547df3c..af8681ba4e 100644
+--- a/sysdeps/mach/clock_gettime.c
++++ b/sysdeps/mach/clock_gettime.c
+@@ -25,7 +25,7 @@
+ int
+ __clock_gettime (clockid_t clock_id, struct timespec *ts)
+ {
+- if (clock_id != CLOCK_REALTIME)
++ if (clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_REALTIME)
+ {
+ errno = EINVAL;
+ return -1;
+diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
+index 0050151332..27b3a28ab7 100644
+--- a/sysdeps/mach/hurd/bits/posix_opt.h
++++ b/sysdeps/mach/hurd/bits/posix_opt.h
+@@ -163,10 +163,10 @@
+ #define _POSIX_THREAD_PROCESS_SHARED -1
+
+ /* The monotonic clock might be available. */
+-#define _POSIX_MONOTONIC_CLOCK 0
++#define _POSIX_MONOTONIC_CLOCK 200809L
+
+-/* The clock selection interfaces are available. */
+-#define _POSIX_CLOCK_SELECTION 200809L
++/* The clock selection interfaces are not really available yet. */
++#define _POSIX_CLOCK_SELECTION -1
+
+ /* Advisory information interfaces could be available in future. */
+ #define _POSIX_ADVISORY_INFO 0
+diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
+index fcd79fd554..1dd02aa449 100644
+--- a/sysdeps/posix/clock_getres.c
++++ b/sysdeps/posix/clock_getres.c
+@@ -52,6 +52,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
+ switch (clock_id)
+ {
+ case CLOCK_REALTIME:
++ case CLOCK_MONOTONIC:
+ retval = realtime_getres (res);
+ break;
+
+diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create.c
+index 9d8a9ea8ae..3430582c09 100644
+--- a/sysdeps/pthread/timer_create.c
++++ b/sysdeps/pthread/timer_create.c
+@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
+ return -1;
+ }
+
+- if (clock_id != CLOCK_REALTIME)
++ if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC)
+ {
+ __set_errno (EINVAL);
+ return -1;
+--
+2.24.0
+
diff --git a/gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch b/gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch
new file mode 100644
index 0000000000..8f9676c873
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-clock_t_centiseconds.patch
@@ -0,0 +1,90 @@
+This is needed to run Python on the Hurd, especially during the build of
+python-boot0.
+
+Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/debian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff
+
+ commit d57f2f9b4bd007846af2fb4217486ea572579010
+ Author: Richard Braun <rbraun@sceen.net>
+ Date: Tue Aug 27 11:35:31 2013 +0200
+
+ Express CPU time (clock_t of times(2)) in centiseconds
+
+From 170c292b643fdc1eb56881e6592b07c0c019993e Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Mon, 2 Mar 2020 18:28:54 +0100
+Subject: [PATCH 1/2] Express CPU time (clock_t) in centiseconds
+
+---
+ sysdeps/mach/hurd/clock.c | 8 ++++----
+ sysdeps/mach/hurd/getclktck.c | 5 ++---
+ sysdeps/mach/hurd/setitimer.c | 2 +-
+ sysdeps/mach/hurd/times.c | 2 +-
+ 4 files changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/sysdeps/mach/hurd/clock.c b/sysdeps/mach/hurd/clock.c
+index 7cb42df786..4db49b579d 100644
+--- a/sysdeps/mach/hurd/clock.c
++++ b/sysdeps/mach/hurd/clock.c
+@@ -44,10 +44,10 @@ clock (void)
+ if (err)
+ return __hurd_fail (err);
+
+- total = bi.user_time.seconds * 1000000 + bi.user_time.microseconds;
+- total += tti.user_time.seconds * 1000000 + tti.user_time.microseconds;
+- total += bi.system_time.seconds * 1000000 + bi.system_time.microseconds;
+- total += tti.system_time.seconds * 1000000 + tti.system_time.microseconds;
++ total = bi.user_time.seconds * 100 + bi.user_time.microseconds / 10000;
++ total += tti.user_time.seconds * 100 + tti.user_time.microseconds / 10000;
++ total += bi.system_time.seconds * 100 + bi.system_time.microseconds / 10000;
++ total += tti.system_time.seconds * 100 + tti.system_time.microseconds / 10000;
+
+ return total;
+ }
+diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c
+index 943e36e805..5a3cf0930b 100644
+--- a/sysdeps/mach/hurd/getclktck.c
++++ b/sysdeps/mach/hurd/getclktck.c
+@@ -18,12 +18,11 @@
+
+ #include <time.h>
+
+-/* Return frequency of `times'.
+- Since Mach reports CPU times in microseconds, we always use 1 million. */
++/* Return frequency of `times'. */
+ int
+ __getclktck (void)
+ {
+- return 1000000;
++ return 100;
+ }
+
+ /* Before glibc 2.2, the Hurd actually did this differently, so we
+diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
+index b16f4ddd5d..8bf1464830 100644
+--- a/sysdeps/mach/hurd/setitimer.c
++++ b/sysdeps/mach/hurd/setitimer.c
+@@ -43,7 +43,7 @@ quantize_timeval (struct timeval *tv)
+ static time_t quantum = -1;
+
+ if (quantum == -1)
+- quantum = 1000000 / __getclktck ();
++ quantum = 100 / __getclktck ();
+
+ tv->tv_usec = ((tv->tv_usec + (quantum - 1)) / quantum) * quantum;
+ if (tv->tv_usec >= 1000000)
+diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c
+index 23ed992783..cbf6039b19 100644
+--- a/sysdeps/mach/hurd/times.c
++++ b/sysdeps/mach/hurd/times.c
+@@ -29,7 +29,7 @@
+ static inline clock_t
+ clock_from_time_value (const time_value_t *t)
+ {
+- return t->seconds * 1000000 + t->microseconds;
++ return t->seconds * 100 + t->microseconds / 10000;
+ }
+
+ /* Store the CPU time used by this process and all its
+--
+2.24.0
+
diff --git a/gnu/packages/patches/glibc-hurd-gettyent.patch b/gnu/packages/patches/glibc-hurd-gettyent.patch
new file mode 100644
index 0000000000..721a8d4fa8
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-gettyent.patch
@@ -0,0 +1,34 @@
+From d6d2caef3e44d0713bb6625f697a1ec615abae70 Mon Sep 17 00:00:00 2001
+From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
+Date: Sun, 5 Apr 2020 16:29:54 +0200
+Subject: [PATCH 4/4] misc: Choose a longer arbitrary line length.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This allows running specifying a `getty' in the GNU Guix store.
+
+* misc/getttyent.c (MAXLINELENGTH): Use 512 (instead of 100) as
+another "great" arbitrary limit.
+
+Co-Authored-By: Ludovic Courtès <ludo@gnu.org>
+---
+ misc/getttyent.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/misc/getttyent.c b/misc/getttyent.c
+index 92d92b026f..508d296291 100644
+--- a/misc/getttyent.c
++++ b/misc/getttyent.c
+@@ -66,7 +66,7 @@ __getttyent (void)
+ static struct ttyent tty;
+ int c;
+ char *p;
+-#define MAXLINELENGTH 100
++#define MAXLINELENGTH 512
+ static char line[MAXLINELENGTH];
+
+ if (!tf && !__setttyent())
+--
+2.26.0
+
diff --git a/gnu/packages/patches/glibc-hurd-mach-print.patch b/gnu/packages/patches/glibc-hurd-mach-print.patch
new file mode 100644
index 0000000000..7fdf6733d0
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-mach-print.patch
@@ -0,0 +1,23 @@
+Provide a 'mach_print' symbol in libc.
+
+--- a/sysdeps/mach/hurd/i386/libc.abilist 2020-04-01 19:22:44.710088821 +0200
++++ b/sysdeps/mach/hurd/i386/libc.abilist 2020-04-01 19:22:52.062051161 +0200
+@@ -338,6 +338,7 @@
+ GLIBC_2.2.6 __mach_port_allocate F
+ GLIBC_2.2.6 __mach_port_deallocate F
+ GLIBC_2.2.6 __mach_port_insert_right F
++GLIBC_2.21 __mach_print F
+ GLIBC_2.2.6 __mach_reply_port F
+ GLIBC_2.2.6 __mach_task_self_ D 0x4
+ GLIBC_2.2.6 __mach_thread_self F
+
+--- a/mach/Versions
++++ b/mach/Versions
+@@ -56,6 +56,7 @@
+ }
+ GLIBC_2.21 {
+ __mach_host_self_;
++ mach_print;
+ }
+
+ HURD_CTHREADS_0.3 {
diff --git a/gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch b/gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch
new file mode 100644
index 0000000000..36ea55e188
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch
@@ -0,0 +1,637 @@
+This patch is needed to build e2fsprogs, util-linux.
+
+Taken from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/debian/patches/hurd-i386/tg-hurdsig-SA_SIGINFO.diff
+
+From: Jeremie Koenig <jk@jk.fr.eu.org>
+Subject: [PATCH] implement SA_SIGINFO signal handlers.
+
+ 52baaca Hurd signals: Copy bits/sigaction.h
+ 4232c66 Hurd signals: SA_SIGINFO support
+ 1831cfe Hurd signals: Use POSIX sigcodes
+
+---
+ hurd/hurd/signal.h | 5 +
+ hurd/hurdfault.c | 2
+ hurd/hurdinit.c | 2
+ hurd/hurdsig.c | 6 -
+ sysdeps/mach/hurd/bits/sigaction.h | 86 +++++++++++++++++++++
+ sysdeps/mach/hurd/i386/bits/sigcontext.h | 4
+ sysdeps/mach/hurd/i386/exc2signal.c | 123 +++++++++++++++++++-----------
+ sysdeps/mach/hurd/i386/trampoline.c | 125 ++++++++++++++++++++++++++++---
+ sysdeps/mach/hurd/kill.c | 2
+ sysdeps/mach/hurd/setitimer.c | 2
+ 10 files changed, 293 insertions(+), 64 deletions(-)
+
+Index: glibc-2.31/hurd/hurd/signal.h
+===================================================================
+--- glibc-2.31.orig/hurd/hurd/signal.h
++++ glibc-2.31/hurd/hurd/signal.h
+@@ -290,6 +290,11 @@ extern int _hurd_raise_signal (struct hu
+ extern void _hurd_exception2signal (struct hurd_signal_detail *detail,
+ int *signo);
+
++/* Translate a Mach exception into a signal with a legacy sigcode. */
++
++extern void _hurd_exception2signal_legacy (struct hurd_signal_detail *detail,
++ int *signo);
++
+
+ /* Make the thread described by SS take the signal described by SIGNO and
+ DETAIL. If the process is traced, this will in fact stop with a SIGNO
+Index: glibc-2.31/hurd/hurdfault.c
+===================================================================
+--- glibc-2.31.orig/hurd/hurdfault.c
++++ glibc-2.31/hurd/hurdfault.c
+@@ -70,7 +70,7 @@ _hurdsig_fault_catch_exception_raise (ma
+ codes into a signal number and subcode. */
+ _hurd_exception2signal (&d, &signo);
+
+- return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.code)
++ return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.exc_subcode)
+ ? 0 : EGREGIOUS;
+ }
+
+Index: glibc-2.31/hurd/hurdinit.c
+===================================================================
+--- glibc-2.31.orig/hurd/hurdinit.c
++++ glibc-2.31/hurd/hurdinit.c
+@@ -177,7 +177,7 @@ _hurd_new_proc_init (char **argv,
+ /* This process is "traced", meaning it should stop on signals or exec.
+ We are all set up now to handle signals. Stop ourselves, to inform
+ our parent (presumably a debugger) that the exec has completed. */
+- __msg_sig_post (_hurd_msgport, SIGTRAP, 0, __mach_task_self ());
++ __msg_sig_post (_hurd_msgport, SIGTRAP, TRAP_TRACE, __mach_task_self ());
+ }
+
+ #include <shlib-compat.h>
+Index: glibc-2.31/hurd/hurdsig.c
+===================================================================
+--- glibc-2.31.orig/hurd/hurdsig.c
++++ glibc-2.31/hurd/hurdsig.c
+@@ -730,7 +730,7 @@ post_signal (struct hurd_sigstate *ss,
+ { /* PE cannot be null. */
+ do
+ {
+- if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
++ if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->exc_subcode))
+ {
+ if (pe->preemptor)
+ {
+@@ -1374,7 +1374,7 @@ _S_msg_sig_post (mach_port_t me,
+ if (err = signal_allowed (signo, refport))
+ return err;
+
+- d.code = sigcode;
++ d.code = d.exc_subcode = sigcode;
+ d.exc = 0;
+
+ /* Post the signal to a global receiver thread (or mark it pending in
+@@ -1403,7 +1403,7 @@ _S_msg_sig_post_untraced (mach_port_t me
+ if (err = signal_allowed (signo, refport))
+ return err;
+
+- d.code = sigcode;
++ d.code = d.exc_subcode = sigcode;
+ d.exc = 0;
+
+ /* Post the signal to the designated signal-receiving thread. This will
+Index: glibc-2.31/sysdeps/mach/hurd/bits/sigaction.h
+===================================================================
+--- /dev/null
++++ glibc-2.31/sysdeps/mach/hurd/bits/sigaction.h
+@@ -0,0 +1,86 @@
++/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _BITS_SIGACTION_H
++#define _BITS_SIGACTION_H 1
++
++#ifndef _SIGNAL_H
++# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
++#endif
++
++/* These definitions match those used by the 4.4 BSD kernel.
++ If the operating system has a `sigaction' system call that correctly
++ implements the POSIX.1 behavior, there should be a system-dependent
++ version of this file that defines `struct sigaction' and the `SA_*'
++ constants appropriately. */
++
++/* Structure describing the action to be taken when a signal arrives. */
++struct sigaction
++ {
++ /* Signal handler. */
++#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
++ union
++ {
++ /* Used if SA_SIGINFO is not set. */
++ __sighandler_t sa_handler;
++ /* Used if SA_SIGINFO is set. */
++ void (*sa_sigaction) (int, siginfo_t *, void *);
++ }
++ __sigaction_handler;
++# define sa_handler __sigaction_handler.sa_handler
++# define sa_sigaction __sigaction_handler.sa_sigaction
++#else
++ __sighandler_t sa_handler;
++#endif
++
++ /* Additional set of signals to be blocked. */
++ __sigset_t sa_mask;
++
++ /* Special flags. */
++ int sa_flags;
++ };
++
++/* Bits in `sa_flags'. */
++#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
++# define SA_ONSTACK 0x0001 /* Take signal on signal stack. */
++#endif
++#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
++# define SA_RESTART 0x0002 /* Restart syscall on signal return. */
++# define SA_NODEFER 0x0010 /* Don't automatically block the signal when
++ its handler is being executed. */
++# define SA_RESETHAND 0x0004 /* Reset to SIG_DFL on entry to handler. */
++#endif
++#define SA_NOCLDSTOP 0x0008 /* Don't send SIGCHLD when children stop. */
++#define SA_SIGINFO 0x0040 /* Signal handler with SA_SIGINFO args */
++
++#ifdef __USE_MISC
++# define SA_INTERRUPT 0 /* Historical no-op ("not SA_RESTART"). */
++
++/* Some aliases for the SA_ constants. */
++# define SA_NOMASK SA_NODEFER
++# define SA_ONESHOT SA_RESETHAND
++# define SA_STACK SA_ONSTACK
++#endif
++
++
++/* Values for the HOW argument to `sigprocmask'. */
++#define SIG_BLOCK 1 /* Block signals. */
++#define SIG_UNBLOCK 2 /* Unblock signals. */
++#define SIG_SETMASK 3 /* Set the set of blocked signals. */
++
++#endif
+Index: glibc-2.31/sysdeps/mach/hurd/i386/bits/sigcontext.h
+===================================================================
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/bits/sigcontext.h
++++ glibc-2.31/sysdeps/mach/hurd/i386/bits/sigcontext.h
+@@ -97,6 +97,10 @@ struct sigcontext
+ #define sc_ps sc_efl
+
+
++/* The deprecated sigcode values below are passed as an extra, non-portable
++ argument to regular signal handlers. You should use SA_SIGINFO handlers
++ instead, which use the standard POSIX signal codes. */
++
+ /* Codes for SIGFPE. */
+ #define FPE_INTOVF_TRAP 0x1 /* integer overflow */
+ #define FPE_INTDIV_FAULT 0x2 /* integer divide by zero */
+Index: glibc-2.31/sysdeps/mach/hurd/i386/exc2signal.c
+===================================================================
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/exc2signal.c
++++ glibc-2.31/sysdeps/mach/hurd/i386/exc2signal.c
+@@ -23,8 +23,8 @@
+ /* Translate the Mach exception codes, as received in an `exception_raise' RPC,
+ into a signal number and signal subcode. */
+
+-void
+-_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
++static void
++exception2signal (struct hurd_signal_detail *detail, int *signo, int posix)
+ {
+ detail->error = 0;
+
+@@ -36,44 +36,62 @@ _hurd_exception2signal (struct hurd_sign
+ break;
+
+ case EXC_BAD_ACCESS:
+- if (detail->exc_code == KERN_INVALID_ADDRESS
+- || detail->exc_code == KERN_PROTECTION_FAILURE
+- || detail->exc_code == KERN_WRITE_PROTECTION_FAILURE)
+- *signo = SIGSEGV;
+- else
+- *signo = SIGBUS;
+- detail->code = detail->exc_subcode;
++ switch (detail->exc_code)
++ {
++ case KERN_INVALID_ADDRESS:
++ case KERN_MEMORY_FAILURE:
++ *signo = SIGSEGV;
++ detail->code = posix ? SEGV_MAPERR : detail->exc_subcode;
++ break;
++
++ case KERN_PROTECTION_FAILURE:
++ case KERN_WRITE_PROTECTION_FAILURE:
++ *signo = SIGSEGV;
++ detail->code = posix ? SEGV_ACCERR : detail->exc_subcode;
++ break;
++
++ default:
++ *signo = SIGBUS;
++ detail->code = posix ? BUS_ADRERR : detail->exc_subcode;
++ break;
++ }
+ detail->error = detail->exc_code;
+ break;
+
+ case EXC_BAD_INSTRUCTION:
+ *signo = SIGILL;
+- if (detail->exc_code == EXC_I386_INVOP)
+- detail->code = ILL_INVOPR_FAULT;
+- else if (detail->exc_code == EXC_I386_STKFLT)
+- detail->code = ILL_STACK_FAULT;
+- else
+- detail->code = 0;
++ switch (detail->exc_code)
++ {
++ case EXC_I386_INVOP:
++ detail->code = posix ? ILL_ILLOPC : ILL_INVOPR_FAULT;
++ break;
++
++ case EXC_I386_STKFLT:
++ detail->code = posix ? ILL_BADSTK : ILL_STACK_FAULT;
++ break;
++
++ default:
++ detail->code = 0;
++ break;
++ }
+ break;
+
+ case EXC_ARITHMETIC:
++ *signo = SIGFPE;
+ switch (detail->exc_code)
+ {
+ case EXC_I386_DIV: /* integer divide by zero */
+- *signo = SIGFPE;
+- detail->code = FPE_INTDIV_FAULT;
++ detail->code = posix ? FPE_INTDIV : FPE_INTDIV_FAULT;
+ break;
+
+ case EXC_I386_INTO: /* integer overflow */
+- *signo = SIGFPE;
+- detail->code = FPE_INTOVF_TRAP;
++ detail->code = posix ? FPE_INTOVF : FPE_INTOVF_TRAP;
+ break;
+
+ /* These aren't anywhere documented or used in Mach 3.0. */
+ case EXC_I386_NOEXT:
+ case EXC_I386_EXTOVR:
+ default:
+- *signo = SIGFPE;
+ detail->code = 0;
+ break;
+
+@@ -82,51 +100,43 @@ _hurd_exception2signal (struct hurd_sign
+ Give an error code corresponding to the first bit set. */
+ if (detail->exc_subcode & FPS_IE)
+ {
+- *signo = SIGILL;
+- detail->code = ILL_FPEOPR_FAULT;
++ /* NB: We used to send SIGILL here but we can't distinguish
++ POSIX vs. legacy with respect to what signal we send. */
++ detail->code = posix ? FPE_FLTINV : 0 /*ILL_FPEOPR_FAULT*/;
+ }
+ else if (detail->exc_subcode & FPS_DE)
+ {
+- *signo = SIGFPE;
+- detail->code = FPE_FLTDNR_FAULT;
++ detail->code = posix ? FPE_FLTUND : FPE_FLTDNR_FAULT;
+ }
+ else if (detail->exc_subcode & FPS_ZE)
+ {
+- *signo = SIGFPE;
+- detail->code = FPE_FLTDIV_FAULT;
++ detail->code = posix ? FPE_FLTDIV : FPE_FLTDIV_FAULT;
+ }
+ else if (detail->exc_subcode & FPS_OE)
+ {
+- *signo = SIGFPE;
+- detail->code = FPE_FLTOVF_FAULT;
++ detail->code = posix ? FPE_FLTOVF : FPE_FLTOVF_FAULT;
+ }
+ else if (detail->exc_subcode & FPS_UE)
+ {
+- *signo = SIGFPE;
+- detail->code = FPE_FLTUND_FAULT;
++ detail->code = posix ? FPE_FLTUND : FPE_FLTUND_FAULT;
+ }
+ else if (detail->exc_subcode & FPS_PE)
+ {
+- *signo = SIGFPE;
+- detail->code = FPE_FLTINX_FAULT;
++ detail->code = posix ? FPE_FLTRES : FPE_FLTINX_FAULT;
+ }
+ else
+ {
+- *signo = SIGFPE;
+ detail->code = 0;
+ }
+ break;
+
+ /* These two can only be arithmetic exceptions if we
+- are in V86 mode, which sounds like emulation to me.
+- (See Mach 3.0 i386/trap.c.) */
++ are in V86 mode. (See Mach 3.0 i386/trap.c.) */
+ case EXC_I386_EMERR:
+- *signo = SIGFPE;
+- detail->code = FPE_EMERR_FAULT;
++ detail->code = posix ? 0 : FPE_EMERR_FAULT;
+ break;
+ case EXC_I386_BOUND:
+- *signo = SIGFPE;
+- detail->code = FPE_EMBND_FAULT;
++ detail->code = posix ? FPE_FLTSUB : FPE_EMBND_FAULT;
+ break;
+ }
+ break;
+@@ -143,7 +153,7 @@ _hurd_exception2signal (struct hurd_sign
+ if (detail->exc_code == EXC_I386_BOUND)
+ {
+ *signo = SIGFPE;
+- detail->code = FPE_SUBRNG_FAULT;
++ detail->code = posix ? FPE_FLTSUB : FPE_SUBRNG_FAULT;
+ }
+ else
+ {
+@@ -154,13 +164,34 @@ _hurd_exception2signal (struct hurd_sign
+
+ case EXC_BREAKPOINT:
+ *signo = SIGTRAP;
+- if (detail->exc_code == EXC_I386_SGL)
+- detail->code = DBG_SINGLE_TRAP;
+- else if (detail->exc_code == EXC_I386_BPT)
+- detail->code = DBG_BRKPNT_FAULT;
+- else
+- detail->code = 0;
++ switch (detail->exc_code)
++ {
++ case EXC_I386_SGL:
++ detail->code = posix ? TRAP_BRKPT : DBG_SINGLE_TRAP;
++ break;
++
++ case EXC_I386_BPT:
++ detail->code = posix ? TRAP_BRKPT : DBG_BRKPNT_FAULT;
++ break;
++
++ default:
++ detail->code = 0;
++ break;
++ }
+ break;
+ }
+ }
+ libc_hidden_def (_hurd_exception2signal)
++
++void
++_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
++{
++ exception2signal (detail, signo, 1);
++}
++
++void
++_hurd_exception2signal_legacy (struct hurd_signal_detail *detail, int *signo)
++{
++ exception2signal (detail, signo, 0);
++}
++
+Index: glibc-2.31/sysdeps/mach/hurd/i386/trampoline.c
+===================================================================
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/trampoline.c
++++ glibc-2.31/sysdeps/mach/hurd/i386/trampoline.c
+@@ -19,13 +19,66 @@
+ #include <hurd/signal.h>
+ #include <hurd/userlink.h>
+ #include <thread_state.h>
++#include <mach/exception.h>
+ #include <mach/machine/eflags.h>
+ #include <assert.h>
+ #include <errno.h>
+ #include "hurdfault.h"
+ #include <intr-msg.h>
++#include <sys/ucontext.h>
+
+
++/* Fill in a siginfo_t structure for SA_SIGINFO-enabled handlers. */
++static void fill_siginfo (siginfo_t *si, int signo,
++ const struct hurd_signal_detail *detail,
++ const struct machine_thread_all_state *state)
++{
++ si->si_signo = signo;
++ si->si_errno = detail->error;
++ si->si_code = detail->code;
++
++ /* XXX We would need a protocol change for sig_post to include
++ * this information. */
++ si->si_pid = -1;
++ si->si_uid = -1;
++
++ /* Address of the faulting instruction or memory access. */
++ if (detail->exc == EXC_BAD_ACCESS)
++ si->si_addr = (void *) detail->exc_subcode;
++ else
++ si->si_addr = (void *) state->basic.eip;
++
++ /* XXX On SIGCHLD, this should be the exit status of the child
++ * process. We would need a protocol change for the proc server
++ * to send this information along with the signal. */
++ si->si_status = 0;
++
++ si->si_band = 0; /* SIGPOLL is not supported yet. */
++ si->si_value.sival_int = 0; /* sigqueue() is not supported yet. */
++}
++
++/* Fill in a ucontext_t structure SA_SIGINFO-enabled handlers. */
++static void fill_ucontext (ucontext_t *uc, const struct sigcontext *sc)
++{
++ uc->uc_flags = 0;
++ uc->uc_link = NULL;
++ uc->uc_sigmask = sc->sc_mask;
++ uc->uc_stack.ss_sp = (__ptr_t) sc->sc_esp;
++ uc->uc_stack.ss_size = 0;
++ uc->uc_stack.ss_flags = 0;
++
++ /* Registers. */
++ memcpy (&uc->uc_mcontext.gregs[REG_GS], &sc->sc_gs,
++ (REG_TRAPNO - REG_GS) * sizeof (int));
++ uc->uc_mcontext.gregs[REG_TRAPNO] = 0;
++ uc->uc_mcontext.gregs[REG_ERR] = 0;
++ memcpy (&uc->uc_mcontext.gregs[REG_EIP], &sc->sc_eip,
++ (NGREG - REG_EIP) * sizeof (int));
++
++ /* XXX FPU state. */
++ memset (&uc->uc_mcontext.fpregs, 0, sizeof (fpregset_t));
++}
++
+ struct sigcontext *
+ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
+ int signo, struct hurd_signal_detail *detail,
+@@ -43,15 +96,38 @@ _hurd_setup_sighandler (struct hurd_sigs
+ struct
+ {
+ int signo;
+- long int sigcode;
+- struct sigcontext *scp; /* Points to ctx, below. */
++ union
++ {
++ /* Extra arguments for traditional signal handlers */
++ struct
++ {
++ long int sigcode;
++ struct sigcontext *scp; /* Points to ctx, below. */
++ } legacy;
++
++ /* Extra arguments for SA_SIGINFO handlers */
++ struct
++ {
++ siginfo_t *siginfop; /* Points to siginfo, below. */
++ ucontext_t *uctxp; /* Points to uctx, below. */
++ } posix;
++ };
+ void *sigreturn_addr;
+ void *sigreturn_returns_here;
+ struct sigcontext *return_scp; /* Same; arg to sigreturn. */
++
++ /* NB: sigreturn assumes link is next to ctx. */
+ struct sigcontext ctx;
+ struct hurd_userlink link;
++ ucontext_t ucontext;
++ siginfo_t siginfo;
+ } *stackframe;
+
++ /* sigaction for preemptors */
++ static const struct sigaction legacy_sigaction = {
++ .sa_flags = SA_RESTART
++ };
++
+ if (ss->context)
+ {
+ /* We have a previous sigcontext that sigreturn was about
+@@ -94,9 +170,13 @@ _hurd_setup_sighandler (struct hurd_sigs
+ the SP on sigreturn. */
+ state->basic.uesp = state->basic.ecx;
+
+- /* XXX what if handler != action->handler (for instance, if a signal
+- * preemptor took over) ? */
+ action = & _hurd_sigstate_actions (ss) [signo];
++ if ( (action->sa_flags & SA_SIGINFO)
++ && handler != (__sighandler_t) action->sa_sigaction
++ || !(action->sa_flags & SA_SIGINFO)
++ && handler != action->sa_handler)
++ /* A signal preemptor took over, use legacy semantic. */
++ action = &legacy_sigaction;
+
+ if ((action->sa_flags & SA_ONSTACK)
+ && !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
+@@ -140,15 +220,9 @@ _hurd_setup_sighandler (struct hurd_sigs
+ = &stackframe->link.thread.next;
+ ss->active_resources = &stackframe->link;
+
+- /* Set up the arguments for the signal handler. */
+- stackframe->signo = signo;
+- stackframe->sigcode = detail->code;
+- stackframe->scp = stackframe->return_scp = scp = &stackframe->ctx;
+- stackframe->sigreturn_addr = &__sigreturn;
+- stackframe->sigreturn_returns_here = firewall; /* Crash on return. */
+-
+ /* Set up the sigcontext from the current state of the thread. */
+
++ scp = &stackframe->ctx;
+ scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
+
+ /* struct sigcontext is laid out so that starting at sc_gs mimics a
+@@ -162,6 +236,35 @@ _hurd_setup_sighandler (struct hurd_sigs
+ &state->fpu, &scp->sc_i386_float_state,
+ sizeof (state->fpu));
+
++ /* Set up the arguments for the signal handler. */
++ stackframe->signo = signo;
++ if (action->sa_flags & SA_SIGINFO)
++ {
++ stackframe->posix.siginfop = &stackframe->siginfo;
++ stackframe->posix.uctxp = &stackframe->ucontext;
++ fill_siginfo (&stackframe->siginfo, signo, detail, state);
++ fill_ucontext (&stackframe->ucontext, scp);
++ }
++ else
++ {
++ if (detail->exc)
++ {
++ int nsigno;
++ _hurd_exception2signal_legacy (detail, &nsigno);
++ assert (nsigno == signo);
++ }
++ else
++ detail->code = 0;
++
++ stackframe->legacy.sigcode = detail->code;
++ stackframe->legacy.scp = &stackframe->ctx;
++ }
++
++ /* Set up the bottom of the stack. */
++ stackframe->sigreturn_addr = &__sigreturn;
++ stackframe->sigreturn_returns_here = firewall; /* Crash on return. */
++ stackframe->return_scp = &stackframe->ctx;
++
+ _hurdsig_end_catch_fault ();
+
+ if (! ok)
+Index: glibc-2.31/sysdeps/mach/hurd/kill.c
+===================================================================
+--- glibc-2.31.orig/sysdeps/mach/hurd/kill.c
++++ glibc-2.31/sysdeps/mach/hurd/kill.c
+@@ -64,7 +64,7 @@ __kill (pid_t pid, int sig)
+ {
+ if (msgport != MACH_PORT_NULL)
+ /* Send a signal message to his message port. */
+- return __msg_sig_post (msgport, sig, 0, refport);
++ return __msg_sig_post (msgport, sig, SI_USER, refport);
+
+ /* The process has no message port. Perhaps try direct
+ frobnication of the task. */
+Index: glibc-2.31/sysdeps/mach/hurd/setitimer.c
+===================================================================
+--- glibc-2.31.orig/sysdeps/mach/hurd/setitimer.c
++++ glibc-2.31/sysdeps/mach/hurd/setitimer.c
+@@ -105,7 +105,7 @@ timer_thread (void)
+ __msg_sig_post_request (_hurd_msgport,
+ _hurd_itimer_port,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE,
+- SIGALRM, 0, __mach_task_self ());
++ SIGALRM, SI_TIMER, __mach_task_self ());
+ break;
+
+ case MACH_RCV_INTERRUPTED:
+Index: glibc-2.31/sysdeps/mach/hurd/i386/sigcontextinfo.h
+===================================================================
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/sigcontextinfo.h
++++ glibc-2.31/sysdeps/mach/hurd/i386/sigcontextinfo.h
+@@ -18,11 +18,10 @@
+ #ifndef _SIGCONTEXTINFO_H
+ #define _SIGCONTEXTINFO_H
+
+-#define SIGCONTEXT struct sigcontext
+ static inline uintptr_t
+-sigcontext_get_pc (struct sigcontext ctx)
++sigcontext_get_pc (struct ucontext_t *ctx)
+ {
+- return ctx.sc_eip;
++ return ctx->uc_mcontext.gregs[REG_EIP];
+ }
+
+ #endif
diff --git a/gnu/packages/patches/glibc-supported-locales.patch b/gnu/packages/patches/glibc-supported-locales.patch
index 05865dc7be..28577c75c0 100644
--- a/gnu/packages/patches/glibc-supported-locales.patch
+++ b/gnu/packages/patches/glibc-supported-locales.patch
@@ -3,20 +3,19 @@ It install the localedata/SUPPORTED file of the glibc. This file lists
all the supported locales of the glibc.
diff --git a/localedata/Makefile b/localedata/Makefile
-index 65079f9eb8..14818f84e0 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
-@@ -169,7 +169,8 @@ endif
- # Files to install.
+@@ -176,7 +176,8 @@
+ else
install-others := $(addprefix $(inst_i18ndir)/, \
$(addsuffix .gz, $(charmaps)) \
- $(locales))
+ $(locales)) \
+ $(inst_i18ndir)/SUPPORTED
+ endif
tests: $(objdir)/iconvdata/gconv-modules
-
-@@ -380,6 +381,14 @@ endif
+@@ -401,6 +402,14 @@
include SUPPORTED
@@ -30,4 +29,4 @@ index 65079f9eb8..14818f84e0 100644
+
INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
- \ No newline at end of file
+
diff --git a/gnu/packages/patches/gnome-shell-disable-test.patch b/gnu/packages/patches/gnome-shell-disable-test.patch
new file mode 100644
index 0000000000..b4c7e73cd7
--- /dev/null
+++ b/gnu/packages/patches/gnome-shell-disable-test.patch
@@ -0,0 +1,25 @@
+This test seems to require a D-Bus connection not available in the build
+environment.
+
+diff -ur /tmp/guix-build-gnome-shell-3.34.2.drv-0/gnome-shell-3.34.2/src/st/meson.build b/src/st/meson.build
+--- /tmp/guix-build-gnome-shell-3.34.2.drv-0/gnome-shell-3.34.2/src/st/meson.build 1969-12-31 19:00:00.000000000 -0500
++++ b/src/st/meson.build 2019-12-23 00:46:14.721198022 -0500
+@@ -132,18 +132,6 @@
+ sources: st_enums[1]
+ )
+
+-test_theme = executable('test-theme',
+- sources: 'test-theme.c',
+- c_args: st_cflags,
+- dependencies: [mutter_dep, gtk_dep],
+- build_rpath: mutter_typelibdir,
+- link_with: libst
+-)
+-
+-test('CSS styling support', test_theme,
+- workdir: meson.current_source_dir()
+-)
+-
+ libst_gir = gnome.generate_gir(libst,
+ sources: st_gir_sources,
+ nsversion: '1.0',
diff --git a/gnu/packages/patches/gnome-shell-theme.patch b/gnu/packages/patches/gnome-shell-theme.patch
index fc7f7caf0f..3fa0670c43 100644
--- a/gnu/packages/patches/gnome-shell-theme.patch
+++ b/gnu/packages/patches/gnome-shell-theme.patch
@@ -2,25 +2,23 @@ Adjust GNOME-Shell so that it uses a Guix theme by default.
Patch by Ludovic Courtès <ludo@gnu.org>.
-diff --git a/data/gnome-shell-theme.gresource.xml b/data/gnome-shell-theme.gresource.xml
-index 76aeaa5..8eaf32e 100644
---- a/data/gnome-shell-theme.gresource.xml
-+++ b/data/gnome-shell-theme.gresource.xml
-@@ -22,6 +22,8 @@
+diff -ur a/data/gnome-shell-theme.gresource.xml b/data/gnome-shell-theme.gresource.xml
+--- a/data/gnome-shell-theme.gresource.xml 2019-12-11 15:06:31.000000000 -0500
++++ b/data/gnome-shell-theme.gresource.xml 2019-12-21 00:31:55.895866241 -0500
+@@ -19,6 +19,8 @@
<file>no-events.svg</file>
<file>no-notifications.svg</file>
<file>noise-texture.png</file>
+ <file>guix-background.png</file>
+ <file>guix-logo.png</file>
<file>pad-osd.css</file>
- <file>page-indicator-active.svg</file>
- <file>page-indicator-inactive.svg</file>
-diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
-index 54d9f39..b9badd0 100644
---- a/data/theme/gnome-shell-sass/_common.scss
-+++ b/data/theme/gnome-shell-sass/_common.scss
-@@ -1742,7 +1742,16 @@ $legacy_icon_size: 24px;
-
+ <file alias="icons/pointer-double-click-symbolic.svg">pointer-double-click-symbolic.svg</file>
+ <file alias="icons/pointer-drag-symbolic.svg">pointer-drag-symbolic.svg</file>
+diff -ur a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
+--- a/data/theme/gnome-shell-sass/_common.scss 2019-12-11 15:06:31.000000000 -0500
++++ b/data/theme/gnome-shell-sass/_common.scss 2019-12-21 00:33:49.495832135 -0500
+@@ -1994,7 +1994,16 @@
+ }
}
- .login-dialog-logo-bin { padding: 24px 0px; }
@@ -37,14 +35,14 @@ index 54d9f39..b9badd0 100644
.login-dialog-banner { color: darken($osd_fg_color,10%); }
.login-dialog-button-box { spacing: 5px; }
.login-dialog-message-warning { color: $warning_color; }
-@@ -1889,9 +1898,10 @@ $legacy_icon_size: 24px;
+@@ -2143,9 +2152,10 @@
}
#lockDialogGroup {
-- background: #2e3436 url(resource:///org/gnome/shell/theme/noise-texture.png);
+- background: lighten(#2e3436, 8%) url(resource:///org/gnome/shell/theme/noise-texture.png);
- background-repeat: repeat;
-}
-+ background: #2e3436 url(resource:///org/gnome/shell/theme/guix-background.png);
++ background: lighten(#2e3436, 8%) url(resource:///org/gnome/shell/theme/guix-background.png);
+ background-repeat: no-repeat;
+ background-size: cover;
+ background-position: center; }
diff --git a/gnu/packages/patches/gnutls-cross.patch b/gnu/packages/patches/gnutls-cross.patch
new file mode 100644
index 0000000000..82d08da24e
--- /dev/null
+++ b/gnu/packages/patches/gnutls-cross.patch
@@ -0,0 +1,82 @@
+Not sent upstream.
+
+From e23de62e28f64599148ff06e439fac116a391299 Mon Sep 17 00:00:00 2001
+From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
+Date: Fri, 10 Apr 2020 07:24:48 +0200
+Subject: [PATCH] guile: Cross build fix.
+
+To cross-build, both the host guile and the native guile-for-build
+must be available. If the native guile is not available, no snarfing
+is done and the guile cross build is skipped.
+
+During the cross-build gnutls.scm does not load when compliling
+extra.scm, becase of missing definitions from guile-gnutls-v-2.
+
+* guile/modules/gnutls.in (protocol/ssl-3 protocol/tls-1.0,
+protocol/tls-1.1, credentials/anonymous, cipher/rijndael-256-cbc,
+cipher/rijndael-128-cbc, cipher/rijndael-cbc, cipher/arcfour-128,
+certificate-verify/allow-any-x509-v1-ca-certificate,
+certificate-verify/allow-x509-v1-ca-certificate): Define to #f
+initially. When "GNUTLS_GUILE_CROSS_COMPILING" not set, set! to value
+from "guile-gnutls-v-2" load-extension C module.
+---
+ guile/modules/gnutls.in | 40 +++++++++++++++++++++++++++-------------
+ 1 file changed, 27 insertions(+), 13 deletions(-)
+
+diff --git a/guile/modules/gnutls.in b/guile/modules/gnutls.in
+index 6461c404a..954e315de 100644
+--- a/guile/modules/gnutls.in
++++ b/guile/modules/gnutls.in
+@@ -564,22 +564,36 @@ This defines 'variable' as an alias for 'alias', and emits a warning when
+ (identifier? #'id)
+ #'alias))))))))))
+
+-
+ ;; Renaming.
+-(define protocol/ssl-3 protocol/ssl3)
+-(define protocol/tls-1.0 protocol/tls1-0)
+-(define protocol/tls-1.1 protocol/tls1-1)
++(define protocol/ssl-3 #f)
++(define protocol/tls-1.0 #f)
++(define protocol/tls-1.1 #f)
+
+ ;; Aliases.
+-(define credentials/anonymous credentials/anon)
+-(define cipher/rijndael-256-cbc cipher/aes-256-cbc)
+-(define cipher/rijndael-128-cbc cipher/aes-128-cbc)
+-(define cipher/rijndael-cbc cipher/aes-128-cbc)
+-(define cipher/arcfour-128 cipher/arcfour)
+-(define certificate-verify/allow-any-x509-v1-ca-certificate
+- certificate-verify/allow-any-x509-v1-ca-crt)
+-(define certificate-verify/allow-x509-v1-ca-certificate
+- certificate-verify/allow-x509-v1-ca-crt)
++(define credentials/anonymous #f)
++(define cipher/rijndael-256-cbc #f)
++(define cipher/rijndael-128-cbc #f)
++(define cipher/rijndael-cbc #f)
++(define cipher/arcfour-128 #f)
++(define certificate-verify/allow-any-x509-v1-ca-certificate #f)
++(define certificate-verify/allow-x509-v1-ca-certificate #f)
++
++(unless (getenv "GNUTLS_GUILE_CROSS_COMPILING")
++ ;; Renaming.
++ (set! protocol/ssl-3 protocol/ssl3)
++ (set! protocol/tls-1.0 protocol/tls1-0)
++ (set! protocol/tls-1.1 protocol/tls1-1)
++
++ ;; Aliases.
++ (set! credentials/anonymous credentials/anon)
++ (set! cipher/rijndael-256-cbc cipher/aes-256-cbc)
++ (set! cipher/rijndael-128-cbc cipher/aes-128-cbc)
++ (set! cipher/rijndael-cbc cipher/aes-128-cbc)
++ (set! cipher/arcfour-128 cipher/arcfour)
++ (set! certificate-verify/allow-any-x509-v1-ca-certificate
++ certificate-verify/allow-any-x509-v1-ca-crt)
++ (set! certificate-verify/allow-x509-v1-ca-certificate
++ certificate-verify/allow-x509-v1-ca-crt))
+
+ ;; Deprecated OpenPGP bindings.
+ (define-deprecated certificate-type/openpgp)
+--
+2.26.0
+
diff --git a/gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch b/gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch
new file mode 100644
index 0000000000..2bea74ea95
--- /dev/null
+++ b/gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch
@@ -0,0 +1,41 @@
+This patch is needed to build Grub on the Hurd.
+
+Taken from upstream: https://git.savannah.gnu.org/cgit/grub.git/commit//?id=dabdfa1c6a80639197d05f683a445fa8615517fe
+
+From 7606547586b2d6ca1b384e15e0358d3a3ddc48a6 Mon Sep 17 00:00:00 2001
+From: David Michael <fedora.dm0@gmail.com>
+Date: Fri, 5 Jul 2019 07:45:59 -0400
+Subject: verifiers: Blocklist fallout cleanup
+
+Blocklist fallout cleanup after commit 5c6f9bc15 (generic/blocklist: Fix
+implicit declaration of function grub_file_filter_disable_compression()).
+
+Signed-off-by: David Michael <fedora.dm0@gmail.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+
+---
+ grub-core/osdep/generic/blocklist.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/osdep/generic/blocklist.c b/grub-core/osdep/generic/blocklist.c
+index ea2a511b6..2d9040302 100644
+--- a/grub-core/osdep/generic/blocklist.c
++++ b/grub-core/osdep/generic/blocklist.c
+@@ -59,7 +59,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
+
+ grub_disk_cache_invalidate_all ();
+
+- file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS);
++ file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS);
+ if (file)
+ {
+ if (grub_file_size (file) != core_size)
+@@ -116,7 +116,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
+
+ grub_file_t file;
+ /* Now read the core image to determine where the sectors are. */
+- file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS);
++ file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS);
+ if (! file)
+ grub_util_error ("%s", grub_errmsg);
+
diff --git a/gnu/packages/patches/gsl-test-i686.patch b/gnu/packages/patches/gsl-test-i686.patch
deleted file mode 100644
index 8828c08614..0000000000
--- a/gnu/packages/patches/gsl-test-i686.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Work around a test failure due to a rounding issue on 32-bit
-platforms, as reported at:
-
- https://lists.gnu.org/archive/html/bug-gsl/2016-10/msg00000.html
-
---- gsl-2.2.1/linalg/test.c 2016-10-05 13:27:42.464059730 +0200
-+++ gsl-2.2.1/linalg/test.c 2016-10-05 13:27:46.988095882 +0200
-@@ -4843,9 +4843,6 @@ main(void)
- gsl_test(test_cholesky_decomp_unit(), "Cholesky Decomposition [unit triangular]");
- gsl_test(test_cholesky_solve(), "Cholesky Solve");
-
-- gsl_test(test_cholesky_decomp(r), "Cholesky Decomposition");
-- gsl_test(test_cholesky_invert(r), "Cholesky Inverse");
-- gsl_test(test_pcholesky_decomp(r), "Pivoted Cholesky Decomposition");
- gsl_test(test_pcholesky_solve(r), "Pivoted Cholesky Solve");
- gsl_test(test_pcholesky_invert(r), "Pivoted Cholesky Inverse");
- gsl_test(test_mcholesky_decomp(r), "Modified Cholesky Decomposition");
diff --git a/gnu/packages/patches/guile-3.0-linux-syscalls.patch b/gnu/packages/patches/guile-3.0-linux-syscalls.patch
new file mode 100644
index 0000000000..0d27f77ee2
--- /dev/null
+++ b/gnu/packages/patches/guile-3.0-linux-syscalls.patch
@@ -0,0 +1,345 @@
+This patch adds bindings to Linux syscalls for which glibc has symbols.
+
+Using the FFI would have been nice, but that's not an option when using
+a statically-linked Guile in an initrd that doesn't have libc.so around.
+
+diff --git a/libguile/posix.c b/libguile/posix.c
+--- a/libguile/posix.c
++++ b/libguile/posix.c
+@@ -2375,6 +2375,336 @@ scm_init_popen (void)
+ }
+ #endif /* HAVE_START_CHILD */
+
++
++/* Linux! */
++#ifdef __linux__
++
++#include <sys/mount.h>
++#include <sys/syscall.h>
++
++#include "libguile/foreign.h"
++#include "libguile/bytevectors.h"
++#include <libguile/variable.h>
++
++SCM_DEFINE (scm_mount, "mount", 3, 2, 0,
++ (SCM source, SCM target, SCM type, SCM flags, SCM data),
++ "Mount file system of @var{type} specified by @var{source} "
++ "on @var{target}.")
++#define FUNC_NAME s_scm_mount
++{
++ int err;
++ char *c_source, *c_target, *c_type, *c_data;
++ unsigned long c_flags;
++
++ c_source = scm_to_locale_string (source);
++ c_target = scm_to_locale_string (target);
++ c_type = scm_to_locale_string (type);
++ c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_ulong (flags);
++
++ if (SCM_UNBNDP (data) || scm_is_false (data))
++ c_data = NULL;
++ else
++ c_data = scm_to_locale_string (data);
++
++ err = mount (c_source, c_target, c_type, c_flags, c_data);
++ if (err != 0)
++ err = errno;
++
++ free (c_source);
++ free (c_target);
++ free (c_type);
++
++ if (c_data != NULL)
++ free (c_data);
++
++ if (err != 0)
++ {
++ errno = err;
++ SCM_SYSERROR;
++ }
++
++ return SCM_UNSPECIFIED;
++}
++#undef FUNC_NAME
++
++SCM_DEFINE (scm_umount, "umount", 1, 0, 0,
++ (SCM target),
++ "Unmount the file system on @var{target}.")
++#define FUNC_NAME s_scm_umount
++{
++ int err;
++ char *c_target;
++
++ c_target = scm_to_locale_string (target);
++
++ err = umount (c_target);
++ if (err != 0)
++ err = errno;
++
++ free (c_target);
++
++ if (err != 0)
++ {
++ errno = err;
++ SCM_SYSERROR;
++ }
++
++ return SCM_UNSPECIFIED;
++}
++#undef FUNC_NAME
++
++/* Linux's module installation syscall. See `kernel/module.c' in Linux;
++ the function itself is part of the GNU libc.
++
++ Load the LEN bytes at MODULE as a kernel module, with arguments from
++ ARGS, a space-separated list of options. */
++extern long init_module (void *module, unsigned long len, const char *args);
++
++/* Load a kernel module from FD. FLAGS must be a bitwise or of
++ MODULE_INIT_* constants. The GNU libc doesn't provide a wrapper for
++ this one so we use 'syscall'. */
++static int
++finit_module (int fd, const char *args, int flags)
++{
++ return syscall (SYS_finit_module, fd, args, flags);
++}
++
++
++SCM_DEFINE (scm_load_linux_module, "load-linux-module", 1, 1, 0,
++ (SCM data, SCM options),
++ "Load the Linux kernel module whose contents are in bytevector "
++ "DATA (the contents of a @code{.ko} file), with the arguments "
++ "from the OPTIONS string.")
++#define FUNC_NAME s_scm_load_linux_module
++{
++ long err;
++ void *c_data;
++ unsigned long c_len;
++ char *c_options;
++
++ SCM_VALIDATE_BYTEVECTOR (SCM_ARG1, data);
++
++ c_data = SCM_BYTEVECTOR_CONTENTS (data);
++ c_len = SCM_BYTEVECTOR_LENGTH (data);
++ c_options =
++ scm_to_locale_string (SCM_UNBNDP (options) ? scm_nullstr : options);
++
++ err = init_module (c_data, c_len, c_options);
++
++ free (c_options);
++
++ if (err != 0)
++ SCM_SYSERROR;
++
++ return SCM_UNSPECIFIED;
++}
++#undef FUNC_NAME
++
++SCM_DEFINE (scm_load_linux_module_fd, "load-linux-module/fd", 1, 2, 0,
++ (SCM fd, SCM options, SCM flags),
++ "Load the Linux kernel module from the file at FD, "
++ "with the arguments from the OPTIONS string, and "
++ "optionally the given FLAGS.")
++#define FUNC_NAME s_scm_load_linux_module_fd
++{
++ long err;
++ int c_fd, c_flags;
++ char *c_options;
++
++ c_fd = scm_to_int (fd);
++ c_options =
++ scm_to_locale_string (SCM_UNBNDP (options) ? scm_nullstr : options);
++ c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_int (flags);
++
++ err = finit_module (c_fd, c_options, c_flags);
++
++ free (c_options);
++
++ if (err != 0)
++ SCM_SYSERROR;
++
++ return SCM_UNSPECIFIED;
++}
++#undef FUNC_NAME
++
++
++/* Rebooting, halting, and all that. */
++
++#include <sys/reboot.h>
++
++SCM_VARIABLE_INIT (flag_RB_AUTOBOOT, "RB_AUTOBOOT",
++ scm_from_int (RB_AUTOBOOT));
++SCM_VARIABLE_INIT (flag_RB_HALT_SYSTEM, "RB_HALT_SYSTEM",
++ scm_from_int (RB_HALT_SYSTEM));
++SCM_VARIABLE_INIT (flag_RB_ENABLE_CAD, "RB_ENABLE_CAD",
++ scm_from_int (RB_ENABLE_CAD));
++SCM_VARIABLE_INIT (flag_RB_DISABLE_CAD, "RB_DISABLE_CAD",
++ scm_from_int (RB_DISABLE_CAD));
++SCM_VARIABLE_INIT (flag_RB_POWER_OFF, "RB_POWER_OFF",
++ scm_from_int (RB_POWER_OFF));
++SCM_VARIABLE_INIT (flag_RB_SW_SUSPEND, "RB_SW_SUSPEND",
++ scm_from_int (RB_SW_SUSPEND));
++SCM_VARIABLE_INIT (flag_RB_KEXEC, "RB_KEXEC",
++ scm_from_int (RB_KEXEC));
++
++SCM_DEFINE (scm_reboot, "reboot", 0, 1, 0,
++ (SCM command),
++ "Reboot the system. @var{command} must be one of the @code{RB_} "
++ "constants; if omitted, @var{RB_AUTOBOOT} is used, thus "
++ "performing a hard reset.")
++#define FUNC_NAME s_scm_reboot
++{
++ int c_command;
++
++ if (SCM_UNBNDP (command))
++ c_command = RB_AUTOBOOT;
++ else
++ c_command = scm_to_int (command);
++
++ reboot (c_command);
++
++ return SCM_UNSPECIFIED; /* likely unreached */
++}
++#undef FUNC_NAME
++
++/* Linux network interfaces. See <linux/if.h>. */
++
++#include <linux/if.h>
++#include <linux/sockios.h>
++#include "libguile/socket.h"
++
++SCM_VARIABLE_INIT (flag_IFF_UP, "IFF_UP",
++ scm_from_int (IFF_UP));
++SCM_VARIABLE_INIT (flag_IFF_BROADCAST, "IFF_BROADCAST",
++ scm_from_int (IFF_BROADCAST));
++SCM_VARIABLE_INIT (flag_IFF_DEBUG, "IFF_DEBUG",
++ scm_from_int (IFF_DEBUG));
++SCM_VARIABLE_INIT (flag_IFF_LOOPBACK, "IFF_LOOPBACK",
++ scm_from_int (IFF_LOOPBACK));
++SCM_VARIABLE_INIT (flag_IFF_POINTOPOINT, "IFF_POINTOPOINT",
++ scm_from_int (IFF_POINTOPOINT));
++SCM_VARIABLE_INIT (flag_IFF_NOTRAILERS, "IFF_NOTRAILERS",
++ scm_from_int (IFF_NOTRAILERS));
++SCM_VARIABLE_INIT (flag_IFF_RUNNING, "IFF_RUNNING",
++ scm_from_int (IFF_RUNNING));
++SCM_VARIABLE_INIT (flag_IFF_NOARP, "IFF_NOARP",
++ scm_from_int (IFF_NOARP));
++SCM_VARIABLE_INIT (flag_IFF_PROMISC, "IFF_PROMISC",
++ scm_from_int (IFF_PROMISC));
++SCM_VARIABLE_INIT (flag_IFF_ALLMULTI, "IFF_ALLMULTI",
++ scm_from_int (IFF_ALLMULTI));
++
++SCM_DEFINE (scm_set_network_interface_address, "set-network-interface-address",
++ 3, 0, 0,
++ (SCM socket, SCM name, SCM address),
++ "Configure network interface @var{name}.")
++#define FUNC_NAME s_scm_set_network_interface_address
++{
++ char *c_name;
++ struct ifreq ifr;
++ struct sockaddr *c_address;
++ size_t sa_len;
++ int fd, err;
++
++ socket = SCM_COERCE_OUTPORT (socket);
++ SCM_VALIDATE_OPFPORT (1, socket);
++ fd = SCM_FPORT_FDES (socket);
++
++ memset (&ifr, 0, sizeof ifr);
++ c_name = scm_to_locale_string (name);
++ c_address = scm_to_sockaddr (address, &sa_len);
++
++ strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1);
++ memcpy (&ifr.ifr_addr, c_address, sa_len);
++
++ err = ioctl (fd, SIOCSIFADDR, &ifr);
++ if (err != 0)
++ err = errno;
++
++ free (c_name);
++ free (c_address);
++
++ if (err != 0)
++ {
++ errno = err;
++ SCM_SYSERROR;
++ }
++
++ return SCM_UNSPECIFIED;
++}
++#undef FUNC_NAME
++
++SCM_DEFINE (scm_set_network_interface_flags, "set-network-interface-flags",
++ 3, 0, 0,
++ (SCM socket, SCM name, SCM flags),
++ "Change the flags of network interface @var{name} to "
++ "@var{flags}.")
++#define FUNC_NAME s_scm_set_network_interface_flags
++{
++ struct ifreq ifr;
++ char *c_name;
++ int fd, err;
++
++ socket = SCM_COERCE_OUTPORT (socket);
++ SCM_VALIDATE_OPFPORT (1, socket);
++ fd = SCM_FPORT_FDES (socket);
++
++ memset (&ifr, 0, sizeof ifr);
++ c_name = scm_to_locale_string (name);
++ strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1);
++ ifr.ifr_flags = scm_to_short (flags);
++
++ err = ioctl (fd, SIOCSIFFLAGS, &ifr);
++ if (err != 0)
++ err = errno;
++
++ free (c_name);
++
++ if (err != 0)
++ {
++ errno = err;
++ SCM_SYSERROR;
++ }
++
++ return SCM_UNSPECIFIED;
++}
++#undef FUNC_NAME
++
++SCM_DEFINE (scm_network_interface_flags, "network-interface-flags",
++ 2, 0, 0,
++ (SCM socket, SCM name),
++ "Return the flags of network interface @var{name}.")
++#define FUNC_NAME s_scm_network_interface_flags
++{
++ struct ifreq ifr;
++ char *c_name;
++ int fd, err;
++
++ socket = SCM_COERCE_OUTPORT (socket);
++ SCM_VALIDATE_OPFPORT (1, socket);
++ fd = SCM_FPORT_FDES (socket);
++
++ memset (&ifr, 0, sizeof ifr);
++ c_name = scm_to_locale_string (name);
++ strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1);
++
++ err = ioctl (fd, SIOCGIFFLAGS, &ifr);
++ if (err != 0)
++ err = errno;
++
++ free (c_name);
++
++ if (err != 0)
++ {
++ errno = err;
++ SCM_SYSERROR;
++ }
++
++ return scm_from_short (ifr.ifr_flags);
++}
++#undef FUNC_NAME
++#endif
++
+ void
+ scm_init_posix ()
+ {
diff --git a/gnu/packages/patches/guile-3.0-relocatable.patch b/gnu/packages/patches/guile-3.0-relocatable.patch
new file mode 100644
index 0000000000..3d101636dc
--- /dev/null
+++ b/gnu/packages/patches/guile-3.0-relocatable.patch
@@ -0,0 +1,69 @@
+This patch changes Guile to use a default search path relative to the
+location of the `guile' binary, allowing it to be relocated.
+
+diff --git a/libguile/load.c b/libguile/load.c
+--- a/libguile/load.c
++++ b/libguile/load.c
+@@ -27,6 +27,7 @@
+ #include <stat-time.h>
+ #include <string.h>
+ #include <stdio.h>
++#include <libgen.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -334,6 +335,32 @@ scm_init_load_path ()
+ SCM cpath = SCM_EOL;
+
+ #ifdef SCM_LIBRARY_DIR
++ char *program, *bin_dir, *prefix, *module_dir, *ccache_dir;
++
++ /* Determine the source and compiled module directories at run-time,
++ relative to the executable's location.
++
++ Note: Use /proc/self/exe instead of argv[0] because the latter is
++ not necessarily an absolute, nor a valid file name. */
++
++ program = scm_gc_malloc_pointerless (256, "string");
++ readlink ("/proc/self/exe", program, 256);
++
++ bin_dir = dirname (strdupa (program));
++
++ prefix = scm_gc_malloc_pointerless (strlen (bin_dir) + 4, "string");
++ strcpy (prefix, bin_dir);
++ strcat (prefix, "/..");
++ prefix = canonicalize_file_name (prefix);
++
++ module_dir = scm_gc_malloc_pointerless (strlen (prefix) + 50, "string");
++ strcpy (module_dir, prefix);
++ strcat (module_dir, "/share/guile/" SCM_EFFECTIVE_VERSION);
++
++ ccache_dir = scm_gc_malloc_pointerless (strlen (prefix) + 50, "string");
++ strcpy (ccache_dir, prefix);
++ strcat (ccache_dir, "/lib/guile/" SCM_EFFECTIVE_VERSION "/ccache");
++
+ env = scm_i_mirror_backslashes (getenv ("GUILE_SYSTEM_PATH"));
+ if (env && strcmp (env, "") == 0)
+ /* special-case interpret system-path=="" as meaning no system path instead
+@@ -342,10 +369,7 @@ scm_init_load_path ()
+ else if (env)
+ path = scm_parse_path (scm_from_locale_string (env), path);
+ else
+- path = scm_list_4 (scm_from_utf8_string (SCM_LIBRARY_DIR),
+- scm_from_utf8_string (SCM_SITE_DIR),
+- scm_from_utf8_string (SCM_GLOBAL_SITE_DIR),
+- scm_from_utf8_string (SCM_PKGDATA_DIR));
++ path = scm_list_1 (scm_from_locale_string (module_dir));
+
+ env = scm_i_mirror_backslashes (getenv ("GUILE_SYSTEM_COMPILED_PATH"));
+ if (env && strcmp (env, "") == 0)
+@@ -355,8 +379,7 @@ scm_init_load_path ()
+ cpath = scm_parse_path (scm_from_locale_string (env), cpath);
+ else
+ {
+- cpath = scm_list_2 (scm_from_utf8_string (SCM_CCACHE_DIR),
+- scm_from_utf8_string (SCM_SITE_CCACHE_DIR));
++ cpath = scm_list_1 (scm_from_locale_string (ccache_dir));
+ }
+
+ #endif /* SCM_LIBRARY_DIR */
diff --git a/gnu/packages/patches/guile-relocatable.patch b/gnu/packages/patches/guile-relocatable.patch
index 464333880c..d8726b4807 100644
--- a/gnu/packages/patches/guile-relocatable.patch
+++ b/gnu/packages/patches/guile-relocatable.patch
@@ -1,6 +1,17 @@
-This patch changes Guile to use a default search path relative to the
-location of the `guile' binary, allowing it to be relocated.
+From 501ad55982a8f92a7a95c76c75944d644870181d Mon Sep 17 00:00:00 2001
+From: Ludovic Courtès <ludo@gnu.org>
+Date: Thu, 12 Mar 2020 15:16:04 +0100
+Subject: [PATCH] load: Make Guile run-time relocatable using /proc/self/exe.
+Import from
+
+ http://git.savannah.gnu.org/cgit/guix.git/commit/?id=920f2c42ce3345dc1355a41377ebf01a33fdae51
+---
+ libguile/load.c | 35 +++++++++++++++++++++++++++++------
+ 1 file changed, 29 insertions(+), 6 deletions(-)
+
+diff --git a/libguile/load.c b/libguile/load.c
+index c2ee5093a..128cdf95a 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -26,6 +26,7 @@
@@ -11,7 +22,7 @@ location of the `guile' binary, allowing it to be relocated.
#include "libguile/_scm.h"
#include "libguile/alist.h"
-@@ -326,6 +327,32 @@ scm_init_load_path ()
+@@ -325,6 +326,32 @@ scm_init_load_path ()
SCM cpath = SCM_EOL;
#ifdef SCM_LIBRARY_DIR
@@ -44,25 +55,28 @@ location of the `guile' binary, allowing it to be relocated.
env = scm_i_mirror_backslashes (getenv ("GUILE_SYSTEM_PATH"));
if (env && strcmp (env, "") == 0)
/* special-case interpret system-path=="" as meaning no system path instead
-@@ -334,10 +361,7 @@ scm_init_load_path ()
+@@ -333,10 +360,7 @@ scm_init_load_path ()
else if (env)
path = scm_parse_path (scm_from_locale_string (env), path);
else
-- path = scm_list_4 (scm_from_utf8_string (SCM_LIBRARY_DIR),
-- scm_from_utf8_string (SCM_SITE_DIR),
-- scm_from_utf8_string (SCM_GLOBAL_SITE_DIR),
-- scm_from_utf8_string (SCM_PKGDATA_DIR));
+- path = scm_list_4 (scm_from_locale_string (SCM_LIBRARY_DIR),
+- scm_from_locale_string (SCM_SITE_DIR),
+- scm_from_locale_string (SCM_GLOBAL_SITE_DIR),
+- scm_from_locale_string (SCM_PKGDATA_DIR));
+ path = scm_list_1 (scm_from_locale_string (module_dir));
env = scm_i_mirror_backslashes (getenv ("GUILE_SYSTEM_COMPILED_PATH"));
if (env && strcmp (env, "") == 0)
-@@ -347,8 +371,7 @@ scm_init_load_path ()
+@@ -346,8 +370,7 @@ scm_init_load_path ()
cpath = scm_parse_path (scm_from_locale_string (env), cpath);
else
{
-- cpath = scm_list_2 (scm_from_utf8_string (SCM_CCACHE_DIR),
-- scm_from_utf8_string (SCM_SITE_CCACHE_DIR));
+- cpath = scm_list_2 (scm_from_locale_string (SCM_CCACHE_DIR),
+- scm_from_locale_string (SCM_SITE_CCACHE_DIR));
+ cpath = scm_list_1 (scm_from_locale_string (ccache_dir));
}
#endif /* SCM_LIBRARY_DIR */
+--
+2.24.0
+
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/hurd-cross.patch b/gnu/packages/patches/hurd-cross.patch
new file mode 100644
index 0000000000..cc95dddccc
--- /dev/null
+++ b/gnu/packages/patches/hurd-cross.patch
@@ -0,0 +1,33 @@
+This fixes linking libfstest/test-fcntl (and others).
+
+As discussed with upstream: https://lists.gnu.org/archive/html/bug-hurd/2020-03/msg00018.html
+
+From 96a9f67a8685e713f25259c18306797d54cc27a5 Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Sat, 14 Mar 2020 11:28:31 +0100
+Subject: [PATCH] build: Fix cross build on Guix.
+
+As discussed in https://lists.gnu.org/archive/html/bug-hurd/2020-03/msg00018.html.
+
+* Makeconf (lpath): Add -Wl,-rpath-link=<dir> next to -L<dir>.
+---
+ Makeconf | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Makeconf b/Makeconf
+index 67f7ab1c..f68ff6e3 100644
+--- a/Makeconf
++++ b/Makeconf
+@@ -325,7 +325,8 @@ _libsubst=${libsubst$(patsubst %,-override,${libsubst-override})}
+
+ # Direct the linker where to find shared objects specified in the
+ # dependencies of other shared objects it encounters.
+-lpath := -L. $(patsubst %,-L%,$(dir $(wildcard ../lib*/lib*.so)))
++lib_dirs := $(dir $(wildcard ../lib*/lib*.so))
++lpath := -L. $(lib_dirs:%=-L%) $(lib_dirs:%=-Wl,-rpath-link=%)
+
+ # Main rule to link executables
+ #
+--
+2.24.0
+
diff --git a/gnu/packages/patches/hurd-fix-eth-multiplexer-dependency.patch b/gnu/packages/patches/hurd-fix-eth-multiplexer-dependency.patch
deleted file mode 100644
index 5f0da3eab3..0000000000
--- a/gnu/packages/patches/hurd-fix-eth-multiplexer-dependency.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From ef0399bad41e60cb30d5073129abeb206076394a Mon Sep 17 00:00:00 2001
-From: Manolis Ragkousis <manolis837@gmail.com>
-Date: Sat, 8 Apr 2017 16:44:52 +0300
-Subject: [PATCH] eth-multiplexer: Fix iohelp missing dependency.
-
-* eth-multiplexer/Makefile (HURDLIBS): Add iohelp.
----
- eth-multiplexer/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile
-index 07f909e7..cefa0abd 100644
---- a/eth-multiplexer/Makefile
-+++ b/eth-multiplexer/Makefile
-@@ -26,7 +26,7 @@ MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
- device-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name"
- OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
- LCLHDRS = ethernet.h util.h vdev.h netfs_impl.h
--HURDLIBS = ports ihash fshelp shouldbeinlibc netfs bpf
-+HURDLIBS = ports ihash iohelp fshelp shouldbeinlibc netfs bpf
- LDLIBS = -lpthread
-
- CFLAGS += -I$(top_srcdir)/libbpf
---
-2.12.2
-
diff --git a/gnu/packages/patches/inetutils-hurd.patch b/gnu/packages/patches/inetutils-hurd.patch
new file mode 100644
index 0000000000..bd65c4feb1
--- /dev/null
+++ b/gnu/packages/patches/inetutils-hurd.patch
@@ -0,0 +1,583 @@
+Support compiling on the Hurd.
+
+Taken from https://git.hadrons.org/cgit/debian/pkgs/inetutils.git/tree/debian/patches/0002-ifconfig-Improve-the-support-for-GNU-Hurd.patch
+
+From 9a90d9b9119906df23cb2db1503cb0f099942dd9 Mon Sep 17 00:00:00 2001
+From: Mats Erik Andersson <gnu@gisladisker.se>
+Date: Sat, 18 Jul 2015 01:12:41 +0200
+Subject: [PATCH 02/35] ifconfig: Improve the support for GNU/Hurd.
+
+Use system specific code instead of generic code.
+This provides abilities similar to other systems.
+---
+ ChangeLog | 17 +++
+ ifconfig/system.c | 10 +-
+ ifconfig/system.h | 2 +
+ ifconfig/system/Makefile.am | 4 +-
+ ifconfig/system/generic.c | 14 +-
+ ifconfig/system/hurd.c | 292 ++++++++++++++++++++++++++++++++++++
+ ifconfig/system/hurd.h | 50 ++++++
+ 7 files changed, 381 insertions(+), 8 deletions(-)
+ create mode 100644 ifconfig/system/hurd.c
+ create mode 100644 ifconfig/system/hurd.h
+
+diff --git a/ifconfig/system.c b/ifconfig/system.c
+index 30677e41..e108dc2e 100644
+--- a/ifconfig/system.c
++++ b/ifconfig/system.c
+@@ -25,10 +25,12 @@
+ # include "system/solaris.c"
+ #elif defined __QNX__
+ # include "system/qnx.c"
+-# elif defined __DragonFly__ || defined __FreeBSD__ || \
+- defined __FreeBSD_kernel__ || \
+- defined __NetBSD__ || defined __OpenBSD__
+-# include "system/bsd.c"
++#elif defined __DragonFly__ || defined __FreeBSD__ || \
++ defined __FreeBSD_kernel__ || \
++ defined __NetBSD__ || defined __OpenBSD__
++# include "system/bsd.c"
++#elif defined __GNU__
++# include "system/hurd.c"
+ #else
+ # include "system/generic.c"
+ #endif
+diff --git a/ifconfig/system.h b/ifconfig/system.h
+index 8521ad95..66878d3a 100644
+--- a/ifconfig/system.h
++++ b/ifconfig/system.h
+@@ -97,6 +97,8 @@ extern struct if_nameindex* (*system_if_nameindex) (void);
+ defined __FreeBSD_kernel__ || \
+ defined __NetBSD__ || defined __OpenBSD__
+ # include "system/bsd.h"
++# elif defined __GNU__
++# include "system/hurd.h"
+ # else
+ # include "system/generic.h"
+ # endif
+diff --git a/ifconfig/system/Makefile.am b/ifconfig/system/Makefile.am
+index 954c6774..62a9f1c4 100644
+--- a/ifconfig/system/Makefile.am
++++ b/ifconfig/system/Makefile.am
+@@ -26,8 +26,10 @@ noinst_HEADERS = \
+ linux.h \
+ solaris.h \
+ qnx.h \
++ hurd.h \
+ bsd.c \
+ generic.c \
+ linux.c \
+ solaris.c \
+- qnx.c
++ qnx.c \
++ hurd.c
+diff --git a/ifconfig/system/generic.c b/ifconfig/system/generic.c
+index 9a2bda55..20a78bde 100644
+--- a/ifconfig/system/generic.c
++++ b/ifconfig/system/generic.c
+@@ -22,6 +22,8 @@
+ #include <config.h>
+
+ #include "../ifconfig.h"
++
++#include <unused-parameter.h>
+
+
+ /* Output format stuff. */
+@@ -36,19 +38,25 @@ const char *system_help;
+ struct argp_child system_argp_child;
+
+ int
+-system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
++system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
++ char option _GL_UNUSED_PARAMETER,
++ char *optarg _GL_UNUSED_PARAMETER)
+ {
+ return 0;
+ }
+
+ int
+-system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
++system_parse_opt_rest (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
++ int argc _GL_UNUSED_PARAMETER,
++ char *argv[] _GL_UNUSED_PARAMETER)
+ {
+ return 0;
+ }
+
+ int
+-system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
++system_configure (int sfd _GL_UNUSED_PARAMETER,
++ struct ifreq *ifr _GL_UNUSED_PARAMETER,
++ struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
+ {
+ return 0;
+ }
+diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
+new file mode 100644
+index 00000000..3bd19775
+--- /dev/null
++++ b/ifconfig/system/hurd.c
+@@ -0,0 +1,292 @@
++/* hurd.c -- Code for ifconfig specific to GNU/Hurd.
++ Copyright (C) 2015 Free Software Foundation, Inc.
++
++ This file is part of GNU Inetutils.
++
++ GNU Inetutils 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.
++
++ GNU Inetutils 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 `http://www.gnu.org/licenses/'. */
++
++/* Mostly written by Marcus Brinkmann.
++ Adaptions to GNU/Hurd by Mats Erik Andersson. */
++
++#include <config.h>
++
++#include <stdlib.h>
++#include <sys/ioctl.h>
++#include <net/if_arp.h>
++#include "../ifconfig.h"
++
++#include <unused-parameter.h>
++
++
++/* Output format stuff. */
++
++const char *system_default_format = "gnu";
++
++
++/* Argument parsing stuff. */
++
++const char *system_help = "NAME [ADDR]\
++ [broadcast BRDADDR] [netmask MASK]\
++ [mtu N] [up|down] [FLAGS]";
++
++struct argp_child system_argp_child;
++
++int
++system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
++ char option _GL_UNUSED_PARAMETER,
++ char *optarg _GL_UNUSED_PARAMETER)
++{
++ return 0;
++}
++
++int
++system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
++{
++ int i = 0, mask, rev;
++ enum {
++ EXPECT_NOTHING,
++ EXPECT_AF,
++ EXPECT_BROADCAST,
++ EXPECT_NETMASK,
++ EXPECT_METRIC,
++ EXPECT_MTU
++ } expect = EXPECT_AF;
++
++ *ifp = parse_opt_new_ifs (argv[0]);
++
++ while (++i < argc)
++ {
++ switch (expect)
++ {
++ case EXPECT_BROADCAST:
++ parse_opt_set_brdaddr (*ifp, argv[i]);
++ break;
++
++ case EXPECT_NETMASK:
++ parse_opt_set_netmask (*ifp, argv[i]);
++ break;
++
++ case EXPECT_MTU:
++ parse_opt_set_mtu (*ifp, argv[i]);
++ break;
++
++ /* XXX: 2015-07-18, GNU/Hurd does not yet support
++ ioctl(SIOCSIFMETRIC), but we let the code
++ handle this standard ability anyway!
++ */
++ case EXPECT_METRIC:
++ parse_opt_set_metric (*ifp, argv[i]);
++ break;
++
++ case EXPECT_AF:
++ expect = EXPECT_NOTHING;
++ if (!strcmp (argv[i], "inet"))
++ continue;
++ else if (!strcmp (argv[i], "inet6"))
++ {
++ error (0, 0, "%s is not a supported address family", argv[i]);
++ return 0;
++ }
++ break;
++
++ case EXPECT_NOTHING:
++ break;
++ }
++
++ if (expect != EXPECT_NOTHING)
++ expect = EXPECT_NOTHING;
++ else if (!strcmp (argv[i], "broadcast"))
++ expect = EXPECT_BROADCAST;
++ else if (!strcmp (argv[i], "netmask"))
++ expect = EXPECT_NETMASK;
++ else if (!strcmp (argv[i], "metric"))
++ expect = EXPECT_METRIC;
++ else if (!strcmp (argv[i], "mtu"))
++ expect = EXPECT_MTU;
++ else if (!strcmp (argv[i], "up"))
++ parse_opt_set_flag (*ifp, IFF_UP | IFF_RUNNING, 0);
++ else if (!strcmp (argv[i], "down"))
++ parse_opt_set_flag (*ifp, IFF_UP, 1);
++ else if (((mask = if_nameztoflag (argv[i], &rev))
++ & ~IU_IFF_CANTCHANGE) != 0)
++ parse_opt_set_flag (*ifp, mask, rev);
++ else
++ {
++ if (!((*ifp)->valid & IF_VALID_ADDR))
++ parse_opt_set_address (*ifp, argv[i]);
++ else if (!((*ifp)->valid & IF_VALID_DSTADDR))
++ parse_opt_set_dstaddr (*ifp, argv[i]);
++ }
++ }
++
++ switch (expect)
++ {
++ case EXPECT_BROADCAST:
++ error (0, 0, "option `broadcast' requires an argument");
++ break;
++
++ case EXPECT_NETMASK:
++ error (0, 0, "option `netmask' requires an argument");
++ break;
++
++ case EXPECT_METRIC:
++ error (0, 0, "option `metric' requires an argument");
++ break;
++
++ case EXPECT_MTU:
++ error (0, 0, "option `mtu' requires an argument");
++ break;
++
++ case EXPECT_AF:
++ case EXPECT_NOTHING:
++ return 1;
++ }
++
++ return 0;
++}
++
++int
++system_configure (int sfd _GL_UNUSED_PARAMETER,
++ struct ifreq *ifr _GL_UNUSED_PARAMETER,
++ struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
++{
++ return 0;
++}
++
++struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
++
++static void
++print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
++ unsigned char *data)
++{
++ *column += printf ("%02X:%02X:%02X:%02X:%02X:%02X",
++ data[0], data[1], data[2], data[3], data[4], data[5]);
++ had_output = 1;
++}
++
++struct arphrd_symbol
++{
++ const char *name;
++ const char *title;
++ int value;
++ void (*print_hwaddr) (format_data_t form, unsigned char *data);
++} arphrd_symbols[] =
++ {
++#ifdef ARPHRD_ETHER /* Ethernet 10/100Mbps. */
++ { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
++#endif
++#ifdef ARPHRD_LOOPBACK /* Loopback device. */
++ { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
++#endif
++ /* XXX: The image debian-hurd-20150424 returns the value 4
++ instead of expected ARPHRD_LOOPBACK. This has been
++ discussed in the list debian-hurd, where I was asked
++ to resist the temptation of a work around!
++ */
++ { NULL, NULL, 0, NULL}
++ };
++
++struct arphrd_symbol *
++arphrd_findvalue (int value)
++{
++ struct arphrd_symbol *arp = arphrd_symbols;
++ while (arp->name != NULL)
++ {
++ if (arp->value == value)
++ break;
++ arp++;
++ }
++ if (arp->name)
++ return arp;
++ else
++ return NULL;
++}
++
++void
++system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
++{
++#ifdef SIOCGIFHWADDR
++ struct arphrd_symbol *arp;
++
++ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
++ select_arg (form, argc, argv, 1);
++
++ arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
++ select_arg (form, argc, argv, (arp && arp->print_hwaddr) ? 0 : 1);
++#else
++ select_arg (form, argc, argv, 1);
++#endif
++}
++
++void
++system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
++ char *argv[] _GL_UNUSED_PARAMETER)
++{
++#ifdef SIOCGIFHWADDR
++ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
++ error (EXIT_FAILURE, errno,
++ "SIOCGIFHWADDR failed for interface `%s'",
++ form->ifr->ifr_name);
++ else
++ {
++ struct arphrd_symbol *arp;
++
++ arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
++ if (arp && arp->print_hwaddr)
++ arp->print_hwaddr (form,
++ (unsigned char *) form->ifr->ifr_hwaddr.sa_data);
++ else
++ put_string (form, "(hwaddr unknown)");
++ }
++#else
++ *column += printf ("(not available)");
++ had_output = 1;
++#endif
++}
++
++void
++system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
++{
++#ifdef SIOCGIFHWADDR
++ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) >= 0)
++ select_arg (form, argc, argv, 0);
++ else
++#endif
++ select_arg (form, argc, argv, 1);
++}
++
++void
++system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
++ char *argv[] _GL_UNUSED_PARAMETER)
++{
++#ifdef SIOCGIFHWADDR
++ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
++ error (EXIT_FAILURE, errno,
++ "SIOCGIFHWADDR failed for interface `%s'",
++ form->ifr->ifr_name);
++ else
++ {
++ struct arphrd_symbol *arp;
++
++ arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
++ if (arp)
++ put_string (form, arp->title);
++ else
++ put_string (form, "(hwtype unknown)");
++ }
++#else
++ *column += printf ("(not available)");
++ had_output = 1;
++#endif
++}
+diff --git a/ifconfig/system/hurd.h b/ifconfig/system/hurd.h
+new file mode 100644
+index 00000000..bab14565
+--- /dev/null
++++ b/ifconfig/system/hurd.h
+@@ -0,0 +1,50 @@
++/*
++ Copyright (C) 2015 Free Software Foundation, Inc.
++
++ This file is part of GNU Inetutils.
++
++ GNU Inetutils 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.
++
++ GNU Inetutils 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 `http://www.gnu.org/licenses/'. */
++
++/* Written by Mats Erik Andersson. */
++
++#ifndef IFCONFIG_SYSTEM_HURD_H
++# define IFCONFIG_SYSTEM_HURD_H
++
++# include "../printif.h"
++# include "../options.h"
++
++
++/* Option support. */
++
++struct system_ifconfig
++{
++ int valid;
++};
++
++
++/* Output format support. */
++
++# define SYSTEM_FORMAT_HANDLER \
++ { "hurd", fh_nothing}, \
++ { "hwaddr?", system_fh_hwaddr_query}, \
++ { "hwaddr", system_fh_hwaddr}, \
++ { "hwtype?", system_fh_hwtype_query}, \
++ { "hwtype", system_fh_hwtype},
++
++void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
++void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
++void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
++void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
++
++#endif /* !IFCONFIG_SYSTEM_HURD_H */
+--
+2.23.0.rc1.170.gbd704faa3e
+
+From 589dab9c7d3119da82837dabae34c8a3d16cbe49 Mon Sep 17 00:00:00 2001
+From: Mats Erik Andersson <gnu@gisladisker.se>
+Date: Thu, 30 Jul 2015 01:06:42 +0200
+Subject: [PATCH 07/35] ifconfig: Hardware detection in GNU/Hurd.
+
+A work-around needed to distinguish hardware type.
+---
+ ChangeLog | 10 ++++++++++
+ ifconfig/system/hurd.c | 19 ++++++++++++-------
+ 2 files changed, 22 insertions(+), 7 deletions(-)
+
+diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
+index 3bd19775..b6261a00 100644
+--- a/ifconfig/system/hurd.c
++++ b/ifconfig/system/hurd.c
+@@ -175,6 +175,16 @@ print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
+ had_output = 1;
+ }
+
++/* GNU/Hurd and Mach are using a mixture of BSD definitions
++ * and GNU/Linux interface headers, which in this situation
++ * means that sa_family_t is an unsigned char, from BSD, while
++ * all ARPHRD_* come from GNU/Linux and are thus 16 bits wide.
++ * We must account for this. The following bitmask will
++ * adapt to any future change!
++ */
++
++#define _ARP_MASK ((sizeof (sa_family_t) == 1) ? 0xff : 0xffff)
++
+ struct arphrd_symbol
+ {
+ const char *name;
+@@ -184,16 +194,11 @@ struct arphrd_symbol
+ } arphrd_symbols[] =
+ {
+ #ifdef ARPHRD_ETHER /* Ethernet 10/100Mbps. */
+- { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
++ { "ETHER", "Ethernet", ARPHRD_ETHER & _ARP_MASK, print_hwaddr_ether},
+ #endif
+ #ifdef ARPHRD_LOOPBACK /* Loopback device. */
+- { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
++ { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK & _ARP_MASK, NULL},
+ #endif
+- /* XXX: The image debian-hurd-20150424 returns the value 4
+- instead of expected ARPHRD_LOOPBACK. This has been
+- discussed in the list debian-hurd, where I was asked
+- to resist the temptation of a work around!
+- */
+ { NULL, NULL, 0, NULL}
+ };
+
+--
+2.23.0.rc1.170.gbd704faa3e
+
+From d379784b4461d17b2536effd1b52bae21cd28a32 Mon Sep 17 00:00:00 2001
+From: Guillem Jover <guillem@hadrons.org>
+Date: Fri, 16 Aug 2019 00:34:03 +0200
+Subject: [PATCH 35/35] telnet: Several ioctls have been disabled in the Hurd's
+ glibc
+
+But not the related option macros. inetutils uses those macros to decide
+whether the ioctls are available, so it is FTBFS now. The Hurd's glibc
+is being fixed, but we'll use this for now to get the builds going.
+---
+ telnet/sys_bsd.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/telnet/sys_bsd.c b/telnet/sys_bsd.c
+index 662536ab..5eb35cb5 100644
+--- a/telnet/sys_bsd.c
++++ b/telnet/sys_bsd.c
+@@ -63,6 +63,7 @@
+ #include <errno.h>
+ #include <arpa/telnet.h>
+ #include <sys/select.h>
++#include <sys/ioctl.h>
+ #include <unused-parameter.h>
+
+ #include "ring.h"
+@@ -157,7 +158,7 @@ TerminalRead (char *buf, int n)
+ int
+ TerminalAutoFlush (void)
+ {
+-#if defined LNOFLSH
++#if defined TIOCLGET && defined LNOFLSH
+ int flush;
+
+ ioctl (0, TIOCLGET, (char *) &flush);
+@@ -260,7 +261,9 @@ TerminalSaveState (void)
+ ioctl (0, TIOCGETP, (char *) &ottyb);
+ ioctl (0, TIOCGETC, (char *) &otc);
+ ioctl (0, TIOCGLTC, (char *) &oltc);
++#ifdef TIOCLGET
+ ioctl (0, TIOCLGET, (char *) &olmode);
++#endif
+
+ ntc = otc;
+ nltc = oltc;
+@@ -755,7 +758,9 @@ TerminalNewMode (register int f)
+ #endif
+ }
+ #ifndef USE_TERMIO
++#ifdef TIOCLSET
+ ioctl (tin, TIOCLSET, (char *) &lmode);
++#endif
+ ioctl (tin, TIOCSLTC, (char *) &ltc);
+ ioctl (tin, TIOCSETC, (char *) &tc);
+ ioctl (tin, TIOCSETN, (char *) &sb);
+--
+2.23.0.rc1.170.gbd704faa3e
+
diff --git a/gnu/packages/patches/jbig2dec-ignore-testtest.patch b/gnu/packages/patches/jbig2dec-ignore-testtest.patch
deleted file mode 100644
index 7c80c545e9..0000000000
--- a/gnu/packages/patches/jbig2dec-ignore-testtest.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Do not run the test 'test_jbig2dec.py'. It doesn't seem to do anything
-and reports failure. TODO: Actually fix the test instead of ignoring it.
-
-diff --git a/Makefile.in b/Makefile.in
-index 63982d4..8af1d61 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -93,7 +93,7 @@ host_triplet = @host@
- bin_PROGRAMS = jbig2dec$(EXEEXT)
- noinst_PROGRAMS = test_sha1$(EXEEXT) test_huffman$(EXEEXT) \
- test_arith$(EXEEXT)
--TESTS = test_sha1$(EXEEXT) test_jbig2dec.py test_huffman$(EXEEXT) \
-+TESTS = test_sha1$(EXEEXT) test_huffman$(EXEEXT) \
- test_arith$(EXEEXT)
- subdir = .
- ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
diff --git a/gnu/packages/patches/less-hurd-path-max.patch b/gnu/packages/patches/less-hurd-path-max.patch
new file mode 100644
index 0000000000..4d23a08788
--- /dev/null
+++ b/gnu/packages/patches/less-hurd-path-max.patch
@@ -0,0 +1,36 @@
+Avoid usage of PATH_MAX.
+
+Submitted to bug-less@gnu.org.
+
+From ef652341ed8b2c14ac40312ccd4ed329cb69fd0c Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Sat, 7 Mar 2020 14:57:19 +0100
+Subject: [PATCH] Avoid usage of PATH_MAX.
+
+* filename.c (lrealpath): Have realpath allocate the buffer. Fixes
+compilation on the Hurd and avoids possible buffer overflow on other
+systems.
+---
+ filename.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/filename.c b/filename.c
+index e420837..faa71b0 100644
+--- a/filename.c
++++ b/filename.c
+@@ -795,9 +795,9 @@ lrealpath(path)
+ char *path;
+ {
+ #if HAVE_REALPATH
+- char rpath[PATH_MAX];
+- if (realpath(path, rpath) != NULL)
+- return (save(rpath));
++ char *rpath = NULL;
++ if ((rpath = realpath(path, rpath)) != NULL)
++ return (rpath);
+ #endif
+ return (save(path));
+ }
+--
+2.24.0
+
diff --git a/gnu/packages/patches/libffi-3.2.1-complex-alpha.patch b/gnu/packages/patches/libffi-3.2.1-complex-alpha.patch
deleted file mode 100644
index ebbc0635a5..0000000000
--- a/gnu/packages/patches/libffi-3.2.1-complex-alpha.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-The patch fixes build failure of form:
- ../src/alpha/osf.S:298:2: error: #error "osf.S out of sync with ffi.h"
-Upstream fixed the bug in a more invasive way
-but didn't have releases since 3.2.1.
-
-The patch is taken from Gentoo:
-https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/libffi/files/libffi-3.2.1-complex_alpha.patch
-
---- libffi-3.2.1/src/alpha/osf.S 2015-01-16 10:46:15.000000000 +0100
-+++ libffi-3.2.1/src/alpha/osf.S 2015-01-16 10:46:24.000000000 +0100
-@@ -279,6 +279,7 @@
- .gprel32 $load_64 # FFI_TYPE_SINT64
- .gprel32 $load_none # FFI_TYPE_STRUCT
- .gprel32 $load_64 # FFI_TYPE_POINTER
-+ .gprel32 $load_none # FFI_TYPE_COMPLEX
-
- /* Assert that the table above is in sync with ffi.h. */
-
-@@ -294,7 +295,8 @@
- || FFI_TYPE_SINT64 != 12 \
- || FFI_TYPE_STRUCT != 13 \
- || FFI_TYPE_POINTER != 14 \
-- || FFI_TYPE_LAST != 14
-+ || FFI_TYPE_COMPLEX != 15 \
-+ || FFI_TYPE_LAST != 15
- #error "osf.S out of sync with ffi.h"
- #endif
-
diff --git a/gnu/packages/patches/libgpg-error-gawk-compat.patch b/gnu/packages/patches/libgpg-error-gawk-compat.patch
deleted file mode 100644
index 85477b0be6..0000000000
--- a/gnu/packages/patches/libgpg-error-gawk-compat.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-From 7865041c77f4f7005282f10f9b6666b19072fbdf Mon Sep 17 00:00:00 2001
-From: NIIBE Yutaka <gniibe@fsij.org>
-Date: Mon, 15 Apr 2019 15:10:44 +0900
-Subject: [PATCH] awk: Prepare for Gawk 5.0.
-
-* src/Makefile.am: Use pkg_namespace (instead of namespace).
-* src/mkerrnos.awk: Likewise.
-* lang/cl/mkerrcodes.awk: Don't escape # in regexp.
-* src/mkerrcodes.awk, src/mkerrcodes1.awk, src/mkerrcodes2.awk: Ditto.
-
---
-
-In Gawk 5.0, regexp routines are replaced by Gnulib implementation,
-which only allows escaping specific characters.
-
-GnuPG-bug-id: 4459
-Reported-by: Marius Schamschula
-Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
----
- lang/cl/mkerrcodes.awk | 2 +-
- src/Makefile.am | 2 +-
- src/mkerrcodes.awk | 2 +-
- src/mkerrcodes1.awk | 2 +-
- src/mkerrcodes2.awk | 2 +-
- src/mkerrnos.awk | 2 +-
- src/mkstrtable.awk | 10 +++++-----
- 7 files changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/lang/cl/mkerrcodes.awk b/lang/cl/mkerrcodes.awk
-index ae29043..9a1fc18 100644
---- a/lang/cl/mkerrcodes.awk
-+++ b/lang/cl/mkerrcodes.awk
-@@ -122,7 +122,7 @@ header {
- }
-
- !header {
-- sub (/\#.+/, "");
-+ sub (/#.+/, "");
- sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
-
- if (/^$/)
-diff --git a/src/Makefile.am b/src/Makefile.am
-index ce1b882..f2590cb 100644
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -293,7 +293,7 @@ code-from-errno.h: mkerrcodes$(EXEEXT_FOR_BUILD) Makefile
-
- errnos-sym.h: Makefile mkstrtable.awk errnos.in
- $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
-- -v prefix=GPG_ERR_ -v namespace=errnos_ \
-+ -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
- $(srcdir)/errnos.in >$@
-
-
-diff --git a/src/mkerrcodes.awk b/src/mkerrcodes.awk
-index 46d436c..e9c857c 100644
---- a/src/mkerrcodes.awk
-+++ b/src/mkerrcodes.awk
-@@ -85,7 +85,7 @@ header {
- }
-
- !header {
-- sub (/\#.+/, "");
-+ sub (/#.+/, "");
- sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
-
- if (/^$/)
-diff --git a/src/mkerrcodes1.awk b/src/mkerrcodes1.awk
-index a771a73..4578e29 100644
---- a/src/mkerrcodes1.awk
-+++ b/src/mkerrcodes1.awk
-@@ -81,7 +81,7 @@ header {
- }
-
- !header {
-- sub (/\#.+/, "");
-+ sub (/#.+/, "");
- sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
-
- if (/^$/)
-diff --git a/src/mkerrcodes2.awk b/src/mkerrcodes2.awk
-index ea58503..188f7a4 100644
---- a/src/mkerrcodes2.awk
-+++ b/src/mkerrcodes2.awk
-@@ -91,7 +91,7 @@ header {
- }
-
- !header {
-- sub (/\#.+/, "");
-+ sub (/#.+/, "");
- sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
-
- if (/^$/)
-diff --git a/src/mkerrnos.awk b/src/mkerrnos.awk
-index f79df66..15b1aad 100644
---- a/src/mkerrnos.awk
-+++ b/src/mkerrnos.awk
-@@ -83,7 +83,7 @@ header {
- }
-
- !header {
-- sub (/\#.+/, "");
-+ sub (/#.+/, "");
- sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
-
- if (/^$/)
-diff --git a/src/mkstrtable.awk b/src/mkstrtable.awk
-index c9de9c1..285e45f 100644
---- a/src/mkstrtable.awk
-+++ b/src/mkstrtable.awk
-@@ -77,7 +77,7 @@
- #
- # The variable prefix can be used to prepend a string to each message.
- #
--# The variable namespace can be used to prepend a string to each
-+# The variable pkg_namespace can be used to prepend a string to each
- # variable and macro name.
-
- BEGIN {
-@@ -102,7 +102,7 @@ header {
- print "/* The purpose of this complex string table is to produce";
- print " optimal code with a minimum of relocations. */";
- print "";
-- print "static const char " namespace "msgstr[] = ";
-+ print "static const char " pkg_namespace "msgstr[] = ";
- header = 0;
- }
- else
-@@ -110,7 +110,7 @@ header {
- }
-
- !header {
-- sub (/\#.+/, "");
-+ sub (/#.+/, "");
- sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
-
- if (/^$/)
-@@ -150,7 +150,7 @@ END {
- else
- print " gettext_noop (\"" last_msgstr "\");";
- print "";
-- print "static const int " namespace "msgidx[] =";
-+ print "static const int " pkg_namespace "msgidx[] =";
- print " {";
- for (i = 0; i < coded_msgs; i++)
- print " " pos[i] ",";
-@@ -158,7 +158,7 @@ END {
- print " };";
- print "";
- print "static GPG_ERR_INLINE int";
-- print namespace "msgidxof (int code)";
-+ print pkg_namespace "msgidxof (int code)";
- print "{";
- print " return (0 ? 0";
-
diff --git a/gnu/packages/patches/libjpeg-turbo-CVE-2019-2201.patch b/gnu/packages/patches/libjpeg-turbo-CVE-2019-2201.patch
deleted file mode 100644
index 35f2bf5963..0000000000
--- a/gnu/packages/patches/libjpeg-turbo-CVE-2019-2201.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Fix integer overflow which can potentially lead to RCE.
-
-https://www.openwall.com/lists/oss-security/2019/11/11/1
-https://nvd.nist.gov/vuln/detail/CVE-2019-2201
-
-The problem was partially fixed in 2.0.3. This patch is a follow-up.
-https://github.com/libjpeg-turbo/libjpeg-turbo/issues/388
-https://github.com/libjpeg-turbo/libjpeg-turbo/commit/c30b1e72dac76343ef9029833d1561de07d29bad
-
-diff --git a/tjbench.c b/tjbench.c
-index a7d397318..13a5bde62 100644
---- a/tjbench.c
-+++ b/tjbench.c
-@@ -171,7 +171,7 @@ static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
- }
- /* Set the destination buffer to gray so we know whether the decompressor
- attempted to write to it */
-- memset(dstBuf, 127, pitch * scaledh);
-+ memset(dstBuf, 127, (size_t)pitch * scaledh);
-
- if (doYUV) {
- int width = doTile ? tilew : scaledw;
-@@ -193,7 +193,7 @@ static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
- double start = getTime();
-
- for (row = 0, dstPtr = dstBuf; row < ntilesh;
-- row++, dstPtr += pitch * tileh) {
-+ row++, dstPtr += (size_t)pitch * tileh) {
- for (col = 0, dstPtr2 = dstPtr; col < ntilesw;
- col++, tile++, dstPtr2 += ps * tilew) {
- int width = doTile ? min(tilew, w - col * tilew) : scaledw;
diff --git a/gnu/packages/patches/libreoffice-poppler-compat.patch b/gnu/packages/patches/libreoffice-poppler-compat.patch
new file mode 100644
index 0000000000..8dc0b60a12
--- /dev/null
+++ b/gnu/packages/patches/libreoffice-poppler-compat.patch
@@ -0,0 +1,19 @@
+Fix type mismatch with Poppler 0.86.
+
+Taken from Arch Linux:
+https://git.archlinux.org/svntogit/packages.git/tree/trunk/libreoffice-poppler-0.86.patch?h=packages/libreoffice-fresh
+
+diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
++++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+@@ -563,7 +563,9 @@ void PDFOutDev::processLink(Link* link, Catalog*)
+ if (!(pAction && pAction->getKind() == actionURI))
+ return;
+
+-#if POPPLER_CHECK_VERSION(0, 72, 0)
++#if POPPLER_CHECK_VERSION(0, 86, 0)
++ const char* pURI = static_cast<LinkURI*>(pAction)->getURI().c_str();
++#elif POPPLER_CHECK_VERSION(0, 72, 0)
+ const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->c_str();
+ #else
+ const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->getCString();
diff --git a/gnu/packages/patches/libtirpc-hurd-client.patch b/gnu/packages/patches/libtirpc-hurd-client.patch
new file mode 100644
index 0000000000..526ad262d2
--- /dev/null
+++ b/gnu/packages/patches/libtirpc-hurd-client.patch
@@ -0,0 +1,50 @@
+Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/06-hurd-client-port.diff
+
+Description: Fix client code for hurd, avoiding malloc overflow
+ When trying to setup a inet connection, it happens the following:
+ - in libtirp, src/clnt_vc.c, clnt_vc_create gets called
+ - when trying to allocate vc_fd_locks, __rpc_dtbsize() is used as size
+ for that array of fd locks
+ - __rpc_dtbsize(), in src/rpc_generic.c, queries using rlimit the
+ maximum (rlim_max) number of file descriptors (RLIMIT_NOFILE):
+ - on Linux, the default is { rlim_cur = 1024, rlim_max = 4096 }
+ - on kFreeBSD, the default is { rlim_cur = 1024, rlim_max = 1024 }
+ - on Hurd, the default is { rlim_cur = 1024, rlim_max = RLIM_INFINITY }
+ meaning that on Hurd the memory allocation fails (as
+ __rpc_dtbsize() * sizeof(int) overflows and is negative)
+
+ Change libtiprc so __rpc_dtbsize falls back on rlim_cur if rlim_max
+ is unlimited.
+
+ This patch fixes the client connection using inet sockets; local unix
+ sockets are not working, for two reasons so far:
+ - getpeername on them gives EOPNOTSUPP
+ - SO_REUSEADDR is not implemented for them
+Author: Pino Toscano <pino@debian.org>
+
+Bug-Debian: http://bugs.debian.org/739674
+Forwarded: no
+Reviewed-By: Petter Reinholdtsen
+Last-Update: 2014-03-03
+
+--- a/src/rpc_generic.c
++++ b/src/rpc_generic.c
+@@ -107,12 +107,17 @@
+ {
+ static int tbsize;
+ struct rlimit rl;
++ rlim_t lim;
+
+ if (tbsize) {
+ return (tbsize);
+ }
+ if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
+- return (tbsize = (int)rl.rlim_max);
++ lim = rl.rlim_max;
++ if (lim == RLIM_INFINITY) {
++ lim = rl.rlim_cur;
++ }
++ return (tbsize = (int)lim);
+ }
+ /*
+ * Something wrong. I'll try to save face by returning a
diff --git a/gnu/packages/patches/libtirpc-hurd.patch b/gnu/packages/patches/libtirpc-hurd.patch
new file mode 100644
index 0000000000..cd625d696f
--- /dev/null
+++ b/gnu/packages/patches/libtirpc-hurd.patch
@@ -0,0 +1,172 @@
+This is a combination of two patches:
+
+1) Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/03-kfreebsd.diff
+
+Description: Fix build on non Linux architectures
+Author: Andreas Beckmann <anbe@debian.org>
+Last-Update: 2019-09-01
+
+2) Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/05-hurd-port.diff
+
+Description: Get source building on Hurd
+ - Look for <sys/user.h> before using it.
+ - Define MAXHOSTNAMELEN to 64 if missing.
+ - Bind sockets on Hurd like on Linux.
+Author: Petter Reinholdtsen <pere@hungry.com>
+
+--- a/src/svc_dg.c
++++ b/src/svc_dg.c
+@@ -648,6 +648,7 @@
+ void
+ svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
+ {
++#ifdef __linux__
+ int val = 1;
+
+ switch (si->si_af) {
+@@ -660,6 +661,7 @@
+ break;
+ #endif
+ }
++#endif
+ }
+
+ /*
+@@ -670,6 +672,7 @@
+ int
+ svc_dg_valid_pktinfo(struct msghdr *msg)
+ {
++#ifdef __linux__
+ struct cmsghdr *cmsg;
+
+ if (!msg->msg_name)
+@@ -716,4 +719,7 @@
+ }
+
+ return 1;
++#else
++ return 0;
++#endif
+ }
+--- a/src/clnt_vc.c
++++ b/src/clnt_vc.c
+@@ -71,10 +71,12 @@
+ #define MCALL_MSG_SIZE 24
+
+ #define CMGROUP_MAX 16
+-#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
+
+ #undef rpc_createerr /* make it clear it is a thread safe variable */
+
++#ifndef SCM_CREDS
++#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
++
+ /*
+ * Credentials structure, used to verify the identity of a peer
+ * process that has sent us a message. This is allocated by the
+@@ -90,6 +92,7 @@
+ short cmcred_ngroups; /* number or groups */
+ gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
+ };
++#endif
+
+ struct cmessage {
+ struct cmsghdr cmsg;
+--- a/src/getpeereid.c
++++ b/src/getpeereid.c
+@@ -25,9 +25,14 @@
+ */
+
+
++#include "config.h"
++
+ #include <sys/param.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
++#ifdef HAVE_SYS_USER_H
++# include <sys/user.h>
++#endif /* HAVE_SYS_USER_H */
+
+ #include <errno.h>
+ #include <unistd.h>
+--- a/src/getpeereid.c
++++ b/src/getpeereid.c
+@@ -35,12 +36,25 @@
+ int
+ getpeereid(int s, uid_t *euid, gid_t *egid)
+ {
++#ifndef HAVE_SYS_USER_H
++ return(-1);
++#else
++#ifdef XUCRED_VERSION
++ struct xucred uc;
++#define uid cr_uid
++#define gid cr_gid
++#else
+ struct ucred uc;
++#endif
+ socklen_t uclen;
+ int error;
+
+ uclen = sizeof(uc);
++#ifdef XUCRED_VERSION
++ error = getsockopt(s, 0, LOCAL_PEERCRED, &uc, &uclen);
++#else
+ error = getsockopt(s, SOL_SOCKET, SO_PEERCRED, &uc, &uclen); /* SCM_CREDENTIALS */
++#endif
+ if (error != 0)
+ return (error);
+ // if (uc.cr_version != XUCRED_VERSION)
+@@ -59,4 +66,5 @@
+ *euid = uc.uid;
+ *egid = uc.gid;
+ return (0);
++#endif /* HAVE_SYS_USER_H */
+ }
+--- a/tirpc/reentrant.h
++++ b/tirpc/reentrant.h
+@@ -36,7 +36,7 @@
+ * These definitions are only guaranteed to be valid on Linux.
+ */
+
+-#if defined(__linux__)
++#if defined(__linux__) || defined(__GLIBC__)
+
+ #include <pthread.h>
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -93,7 +93,7 @@
+ AC_PROG_LIBTOOL
+ AC_HEADER_DIRENT
+ AC_PREFIX_DEFAULT(/usr)
+-AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h gssapi/gssapi_ext.h])
++AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h gssapi/gssapi_ext.h sys/user.h])
+ AC_CHECK_LIB([pthread], [pthread_create])
+ AC_CHECK_FUNCS([getrpcbyname getrpcbynumber setrpcent endrpcent getrpcent])
+
+--- a/src/auth_unix.c
++++ b/src/auth_unix.c
+@@ -56,6 +56,11 @@
+ #include <rpc/auth.h>
+ #include <rpc/auth_unix.h>
+
++/* Workaround for Hurd */
++#ifndef MAXHOSTNAMELEN
++# define MAXHOSTNAMELEN 64
++#endif
++
+ /* auth_unix.c */
+ static void authunix_nextverf (AUTH *);
+ static bool_t authunix_marshal (AUTH *, XDR *);
+--- a/src/bindresvport.c
++++ b/src/bindresvport.c
+@@ -64,7 +64,7 @@
+ return bindresvport_sa(sd, (struct sockaddr *)sin);
+ }
+
+-#ifdef __linux__
++#if defined(__linux__) || defined(__GNU__)
+
+ #define STARTPORT 600
+ #define LOWPORT 512
diff --git a/gnu/packages/patches/libxslt-generated-ids.patch b/gnu/packages/patches/libxslt-generated-ids.patch
index 4273875c7c..1cd2363d6a 100644
--- a/gnu/packages/patches/libxslt-generated-ids.patch
+++ b/gnu/packages/patches/libxslt-generated-ids.patch
@@ -162,10 +162,10 @@ diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
index 95e8fe6..8eedae4 100644
--- a/libxslt/xsltInternals.h
+++ b/libxslt/xsltInternals.h
-@@ -1786,6 +1786,8 @@ struct _xsltTransformContext {
- int funcLevel; /* Needed to catch recursive functions issues */
- int maxTemplateDepth;
+@@ -1782,6 +1782,8 @@ struct _xsltTransformContext {
int maxTemplateVars;
+ unsigned long opLimit;
+ unsigned long opCount;
+
+ unsigned long nextid;/* for generating stable ids */
};
diff --git a/gnu/packages/patches/linphoneqt-tabbutton.patch b/gnu/packages/patches/linphoneqt-tabbutton.patch
new file mode 100644
index 0000000000..6b3214026e
--- /dev/null
+++ b/gnu/packages/patches/linphoneqt-tabbutton.patch
@@ -0,0 +1,96 @@
+From ecaab0f73d0b74bbfbf150286305fa6e12970037 Mon Sep 17 00:00:00 2001
+From: Ronan Abhamon <ronan.abhamon@belledonne-communications.com>
+Date: Fri, 19 Jan 2018 14:42:01 +0100
+Subject: [PATCH] fix(SettingsWindow): rename icon property of TabButton to
+ iconName (issue with Qt 5.10 and new icon property)
+
+---
+ ui/modules/Common/Form/Tab/TabButton.qml | 8 ++++----
+ ui/views/App/Settings/SettingsWindow.qml | 14 +++++++-------
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/ui/modules/Common/Form/Tab/TabButton.qml b/ui/modules/Common/Form/Tab/TabButton.qml
+index ad220ab2..a47bb20b 100644
+--- a/ui/modules/Common/Form/Tab/TabButton.qml
++++ b/ui/modules/Common/Form/Tab/TabButton.qml
+@@ -12,8 +12,8 @@ Controls.TabButton {
+
+ // ---------------------------------------------------------------------------
+
+- property string icon
+ property int iconSize: TabButtonStyle.icon.size
++ property string iconName
+
+ readonly property bool _isSelected: parent.parent.currentItem === button
+
+@@ -66,9 +66,9 @@ Controls.TabButton {
+ Layout.leftMargin: TabButtonStyle.text.leftPadding
+
+ icon: {
+- var icon = button.icon
+- return icon.length
+- ? (icon + '_' + (button._isSelected ? 'selected' : 'normal'))
++ var iconName = button.iconName
++ return iconName.length
++ ? (iconName + '_' + (button._isSelected ? 'selected' : 'normal'))
+ : ''
+ }
+ iconSize: button.iconSize
+diff --git a/ui/views/App/Settings/SettingsWindow.qml b/ui/views/App/Settings/SettingsWindow.qml
+index b8f5a80f..58909544 100644
+--- a/ui/views/App/Settings/SettingsWindow.qml
++++ b/ui/views/App/Settings/SettingsWindow.qml
+@@ -48,43 +48,43 @@ ApplicationWindow {
+ id: tabBar
+
+ TabButton {
+- icon: 'settings_sip_accounts'
++ iconName: 'settings_sip_accounts'
+ text: qsTr('sipAccountsTab')
+ width: implicitWidth
+ }
+
+ TabButton {
+- icon: 'settings_audio'
++ iconName: 'settings_audio'
+ text: qsTr('audioTab')
+ width: implicitWidth
+ }
+
+ TabButton {
+- icon: 'settings_video'
++ iconName: 'settings_video'
+ text: qsTr('videoTab')
+ width: implicitWidth
+ }
+
+ TabButton {
+- icon: 'settings_call'
++ iconName: 'settings_call'
+ text: qsTr('callsAndChatTab')
+ width: implicitWidth
+ }
+
+ TabButton {
+- icon: 'settings_network'
++ iconName: 'settings_network'
+ text: qsTr('networkTab')
+ width: implicitWidth
+ }
+
+ TabButton {
+- icon: 'settings_advanced'
++ iconName: 'settings_advanced'
+ text: qsTr('uiTab')
+ width: implicitWidth
+ }
+
+ TabButton {
+- icon: 'settings_advanced'
++ iconName: 'settings_advanced'
+ text: qsTr('uiAdvanced')
+ width: implicitWidth
+ }
+--
+2.21.0
+
diff --git a/gnu/packages/patches/make-glibc-compat.patch b/gnu/packages/patches/make-glibc-compat.patch
deleted file mode 100644
index 9ce7f2b5bf..0000000000
--- a/gnu/packages/patches/make-glibc-compat.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-Work with the new glob interface in glibc 2.27.
-
-Taken from this upstream commit:
-https://git.savannah.gnu.org/cgit/make.git/commit/?id=193f1e81edd6b1b56b0eb0ff8aa4b41c7b4257b4
-
-diff --git a/dir.c b/dir.c
-index adbb8a9..c343e4c 100644
---- a/dir.c
-+++ b/dir.c
-@@ -1299,15 +1299,40 @@ local_stat (const char *path, struct stat *buf)
- }
- #endif
-
-+/* Similarly for lstat. */
-+#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
-+# ifndef VMS
-+# ifndef HAVE_SYS_STAT_H
-+int lstat (const char *path, struct stat *sbuf);
-+# endif
-+# else
-+ /* We are done with the fake lstat. Go back to the real lstat */
-+# ifdef lstat
-+# undef lstat
-+# endif
-+# endif
-+# define local_lstat lstat
-+#elif defined(WINDOWS32)
-+/* Windows doesn't support lstat(). */
-+# define local_lstat local_stat
-+#else
-+static int
-+local_lstat (const char *path, struct stat *buf)
-+{
-+ int e;
-+ EINTRLOOP (e, lstat (path, buf));
-+ return e;
-+}
-+#endif
-+
- void
- dir_setup_glob (glob_t *gl)
- {
- gl->gl_opendir = open_dirstream;
- gl->gl_readdir = read_dirstream;
- gl->gl_closedir = free;
-+ gl->gl_lstat = local_lstat;
- gl->gl_stat = local_stat;
-- /* We don't bother setting gl_lstat, since glob never calls it.
-- The slot is only there for compatibility with 4.4 BSD. */
- }
-
- void
diff --git a/gnu/packages/patches/make-impure-dirs.patch b/gnu/packages/patches/make-impure-dirs.patch
index 83a5fbe3a5..89595b06ec 100644
--- a/gnu/packages/patches/make-impure-dirs.patch
+++ b/gnu/packages/patches/make-impure-dirs.patch
@@ -4,9 +4,9 @@ don't look in /usr/include and friends.
Patch from Nixpkgs, by Eelco Dolstra.
-diff -rc make-3.81-orig/read.c make-3.81/read.c
-*** make-3.81-orig/read.c 2006-03-17 15:24:20.000000000 +0100
---- make-3.81/read.c 2007-05-24 17:16:31.000000000 +0200
+diff -rc make-3.81-orig/src/read.c make-3.81/src/read.c
+*** make-3.81-orig/src/read.c 2006-03-17 15:24:20.000000000 +0100
+--- make-3.81/src/read.c 2007-05-24 17:16:31.000000000 +0200
***************
*** 99,107 ****
--- 99,109 ----
@@ -21,9 +21,9 @@ diff -rc make-3.81-orig/read.c make-3.81/read.c
#endif
0
};
-diff -rc make-3.81-orig/remake.c make-3.81/remake.c
-*** make-3.81-orig/remake.c 2006-03-20 03:36:37.000000000 +0100
---- make-3.81/remake.c 2007-05-24 17:06:54.000000000 +0200
+diff -rc make-3.81-orig/src/remake.c make-3.81/src/remake.c
+*** make-3.81-orig/src/remake.c 2006-03-20 03:36:37.000000000 +0100
+--- make-3.81/src/remake.c 2007-05-24 17:06:54.000000000 +0200
***************
*** 1452,1460 ****
--- 1452,1462 ----
diff --git a/gnu/packages/patches/mit-krb5-hurd.patch b/gnu/packages/patches/mit-krb5-hurd.patch
new file mode 100644
index 0000000000..d4962b1e60
--- /dev/null
+++ b/gnu/packages/patches/mit-krb5-hurd.patch
@@ -0,0 +1,165 @@
+Avoid using MAXPATHLEN and MAXHOSTLEN on the Hurd.
+
+Taken from https://salsa.debian.org/debian/krb5/-/blob/master/debian/patches/debian-local/0001-Debian-HURD-compatibility.patch
+
+From: Sam Hartman <hartmans@debian.org>
+Date: Mon, 26 Dec 2011 18:05:13 -0500
+Subject: Debian: HURD compatibility
+
+HURD has no MAXPATHLEN or MAXHOSTLEN.
+
+Patch-Category: debian-local
+---
+ src/clients/ksu/ksu.h | 4 ++++
+ src/include/k5-int.h | 3 +++
+ src/kadmin/ktutil/ktutil_funcs.c | 4 ++++
+ src/kprop/kprop_util.c | 4 ++++
+ src/lib/gssapi/spnego/spnego_mech.c | 3 +++
+ src/lib/krb5/os/sn2princ.c | 4 ++++
+ src/plugins/kdb/db2/libdb2/include/db-int.h | 4 ++++
+ src/tests/resolve/resolve.c | 4 ++++
+ 8 files changed, 30 insertions(+)
+
+$ diff -u krb5-1.18/src/util/ss/help.c.orig krb5-1.18/src/util/ss/help.c
+--- krb5-1.18/src/util/ss/help.c.orig 2020-03-07 23:25:52.712418587 +0100
++++ krb5-1.18/src/util/ss/help.c 2020-03-07 23:26:25.764941122 +0100
+@@ -6,6 +6,9 @@
+ */
+
+ #include <sys/param.h>
++#ifndef MAXPATHLEN
++# define MAXPATHLEN 4096
++#endif
+ #include <sys/types.h>
+ #include <errno.h>
+ #include <sys/file.h>
+$ diff -u krb5-1.18/src/lib/krb5/os/hostrealm.c.orig krb5-1.18/src/lib/krb5/os/hostrealm.c
+--- krb5-1.18/src/lib/krb5/os/hostrealm.c.orig 2020-03-07 23:33:19.931420994 +0100
++++ krb5-1.18/src/lib/krb5/os/hostrealm.c 2020-03-07 23:33:58.628026424 +0100
+@@ -42,6 +42,10 @@
+ #endif
+ #endif
+
++#ifndef MAXHOSTNAMELEN
++#define MAXHOSTNAMELEN 256
++#endif
++
+ struct hostrealm_module_handle {
+ struct krb5_hostrealm_vtable_st vt;
+ krb5_hostrealm_moddata data;
+diff --git a/src/clients/ksu/ksu.h b/src/clients/ksu/ksu.h
+index 3bf0bd4..f680b33 100644
+--- a/src/clients/ksu/ksu.h
++++ b/src/clients/ksu/ksu.h
+@@ -56,6 +56,10 @@
+ #define MAX_CMD 2048 /* this is temp, should use realloc instead,
+ as done in most of the code */
+
++#ifndef MAXPATHLEN
++# define MAXPATHLEN 4096
++#endif
++
+
+ extern int optind;
+ extern char * optarg;
+diff --git a/src/include/k5-int.h b/src/include/k5-int.h
+index 6522422..e4f1678 100644
+--- a/src/include/k5-int.h
++++ b/src/include/k5-int.h
+@@ -589,6 +589,9 @@ extern char *strdup (const char *);
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h> /* MAXPATHLEN */
+ #endif
++#ifndef MAXPATHLEN
++# define MAXPATHLEN 4096
++#endif
+
+ #ifdef HAVE_SYS_FILE_H
+ #include <sys/file.h> /* prototypes for file-related
+diff --git a/src/kadmin/ktutil/ktutil_funcs.c b/src/kadmin/ktutil/ktutil_funcs.c
+index 6d119a2..fb7fa22 100644
+--- a/src/kadmin/ktutil/ktutil_funcs.c
++++ b/src/kadmin/ktutil/ktutil_funcs.c
+@@ -34,6 +34,10 @@
+ #include <string.h>
+ #include <ctype.h>
+
++#ifndef MAXPATHLEN
++# define MAXPATHLEN 4096
++#endif
++
+ /*
+ * Free a kt_list
+ */
+diff --git a/src/kprop/kprop_util.c b/src/kprop/kprop_util.c
+index c32d174..d72ab18 100644
+--- a/src/kprop/kprop_util.c
++++ b/src/kprop/kprop_util.c
+@@ -32,6 +32,10 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+
++#ifndef MAXHOSTNAMELEN
++#define MAXHOSTNAMELEN 256
++#endif
++
+ /*
+ * Convert an IPv4 or IPv6 socket address to a newly allocated krb5_address.
+ * There is similar code elsewhere in the tree, so this should possibly become
+diff --git a/src/lib/gssapi/spnego/spnego_mech.c b/src/lib/gssapi/spnego/spnego_mech.c
+index 9d6027c..585d8a6 100644
+--- a/src/lib/gssapi/spnego/spnego_mech.c
++++ b/src/lib/gssapi/spnego/spnego_mech.c
+@@ -65,6 +65,9 @@
+ #include "gssapiP_spnego.h"
+ #include <gssapi_err_generic.h>
+
++#ifndef MAXHOSTNAMELEN
++#define MAXHOSTNAMELEN 256
++#endif
+
+ #undef g_token_size
+ #undef g_verify_token_header
+diff --git a/src/lib/krb5/os/sn2princ.c b/src/lib/krb5/os/sn2princ.c
+index 5932fd9..187daa8 100644
+--- a/src/lib/krb5/os/sn2princ.c
++++ b/src/lib/krb5/os/sn2princ.c
+@@ -126,6 +126,10 @@ find_trailer(const char *hostname)
+ return p;
+ }
+
++#ifndef MAXHOSTNAMELEN
++# define MAXHOSTNAMELEN 256
++#endif
++
+ krb5_error_code KRB5_CALLCONV
+ krb5_sname_to_principal(krb5_context context, const char *hostname,
+ const char *sname, krb5_int32 type,
+diff --git a/src/plugins/kdb/db2/libdb2/include/db-int.h b/src/plugins/kdb/db2/libdb2/include/db-int.h
+index 7e981d4..d83b3b6 100644
+--- a/src/plugins/kdb/db2/libdb2/include/db-int.h
++++ b/src/plugins/kdb/db2/libdb2/include/db-int.h
+@@ -280,4 +280,8 @@ void __dbpanic __P((DB *dbp));
+ #ifndef O_BINARY
+ #define O_BINARY 0 /* Needed for Win32 compiles */
+ #endif
++
++#ifndef MAXPATHLEN
++# define MAXPATHLEN 4096
++#endif
+ #endif /* _DB_INT_H_ */
+diff --git a/src/tests/resolve/resolve.c b/src/tests/resolve/resolve.c
+index 7339d21..38f7253 100644
+--- a/src/tests/resolve/resolve.c
++++ b/src/tests/resolve/resolve.c
+@@ -73,6 +73,10 @@ char *strchr();
+ #include <netinet/in.h>
+ #include <netdb.h>
+
++#ifndef MAXHOSTNAMELEN
++# define MAXHOSTNAMELEN 256
++#endif
++
+ int
+ main(argc, argv)
+ int argc;
diff --git a/gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch b/gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch
new file mode 100644
index 0000000000..491a358731
--- /dev/null
+++ b/gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch
@@ -0,0 +1,29 @@
+Fix a null pointer dereference when no DNS search path is configured.
+This showed up as a segfault while running the gsasl test suite.
+
+Taken from upstream:
+https://github.com/krb5/krb5/commit/cd82bf377e7fad2409c76bf8b241920692f34fda
+
+diff --git a/src/lib/krb5/os/dnsglue.c b/src/lib/krb5/os/dnsglue.c
+index e35ca9d76c..0cd213fdd7 100644
+--- a/src/lib/krb5/os/dnsglue.c
++++ b/src/lib/krb5/os/dnsglue.c
+@@ -91,7 +91,7 @@ static int initparse(struct krb5int_dns_state *);
+ #define DECLARE_HANDLE(h) struct __res_state h
+ #define INIT_HANDLE(h) (memset(&h, 0, sizeof(h)), res_ninit(&h) == 0)
+ #define SEARCH(h, n, c, t, a, l) res_nsearch(&h, n, c, t, a, l)
+-#define PRIMARY_DOMAIN(h) strdup(h.dnsrch[0])
++#define PRIMARY_DOMAIN(h) ((h.dnsrch[0] == NULL) ? NULL : strdup(h.dnsrch[0]))
+ #if HAVE_RES_NDESTROY
+ #define DESTROY_HANDLE(h) res_ndestroy(&h)
+ #else
+@@ -104,7 +104,8 @@ static int initparse(struct krb5int_dns_state *);
+ #define DECLARE_HANDLE(h)
+ #define INIT_HANDLE(h) (res_init() == 0)
+ #define SEARCH(h, n, c, t, a, l) res_search(n, c, t, a, l)
+-#define PRIMARY_DOMAIN(h) strdup(_res.defdname)
++#define PRIMARY_DOMAIN(h) \
++ ((_res.defdname == NULL) ? NULL : strdup(_res.defdname))
+ #define DESTROY_HANDLE(h)
+
+ #endif
diff --git a/gnu/packages/patches/openssh-hurd.patch b/gnu/packages/patches/openssh-hurd.patch
new file mode 100644
index 0000000000..1ad09a7ee6
--- /dev/null
+++ b/gnu/packages/patches/openssh-hurd.patch
@@ -0,0 +1,30 @@
+Author: Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
+Not upstreamed.
+
+From 1ddae040d67e9a4ebcc3e1b95af1bff12c0f086b Mon Sep 17 00:00:00 2001
+From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
+Date: Tue, 7 Apr 2020 17:41:05 +0200
+Subject: [PATCH] Build fix for the Hurd.
+
+* gss-serv.c (ssh_gssapi_acquire_cred): Use HOST_NAME_MAX instead of
+MAXHOSTNAMELEN.
+---
+ gss-serv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gss-serv.c b/gss-serv.c
+index 1d47870e7..22081c6f1 100644
+--- a/gss-serv.c
++++ b/gss-serv.c
+@@ -107,7 +107,7 @@ ssh_gssapi_acquire_cred(Gssctxt *ctx)
+ gss_create_empty_oid_set(&status, &oidset);
+ gss_add_oid_set_member(&status, ctx->oid, &oidset);
+
+- if (gethostname(lname, MAXHOSTNAMELEN)) {
++ if (gethostname(lname, HOST_NAME_MAX)) {
+ gss_release_oid_set(&status, &oidset);
+ return (-1);
+ }
+--
+2.26.0
+
diff --git a/gnu/packages/patches/pango-skip-libthai-test.patch b/gnu/packages/patches/pango-skip-libthai-test.patch
new file mode 100644
index 0000000000..98732b5391
--- /dev/null
+++ b/gnu/packages/patches/pango-skip-libthai-test.patch
@@ -0,0 +1,23 @@
+Skip Thai character test when libthai is unavailable.
+
+Taken from upstream bug tracker:
+https://gitlab.gnome.org/GNOME/pango/merge_requests/161
+https://gitlab.gnome.org/GNOME/pango/commit/b73284747ac937e31dc9191f84ed6e24284c88ee
+
+diff --git a/tests/test-break.c b/tests/test-break.c
+index 8549b678bba69360d07dce3af21d915412f20d51..47fa3009165e19a331aa04a0df4351ae2323933b 100644
+--- a/tests/test-break.c
++++ b/tests/test-break.c
+@@ -305,6 +305,12 @@ main (int argc, char *argv[])
+ if (!strstr (name, "break"))
+ continue;
+
++#ifndef HAVE_LIBTHAI
++ /* four.break involves Thai, so only test it when we have libthai */
++ if (strstr (name, "four.break"))
++ continue;
++#endif
++
+ path = g_strdup_printf ("/break/%s", name);
+ g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DIST, "breaks", name, NULL),
+ test_break, g_free);
diff --git a/gnu/packages/patches/pciutils-hurd-configure.patch b/gnu/packages/patches/pciutils-hurd-configure.patch
new file mode 100644
index 0000000000..226891a995
--- /dev/null
+++ b/gnu/packages/patches/pciutils-hurd-configure.patch
@@ -0,0 +1,35 @@
+Add ability to detect GNU/Hurd when configuring.
+
+Adapted from https://git.hadrons.org/cgit/debian/pkgs/pciutils.git/tree/debian/patches/00-configure-hurd.patch
+
+From e39a3af22501234a91cf28e8c57b45f9379f9101 Mon Sep 17 00:00:00 2001
+From: Damien Zammit <damien@zamaudio.com>
+Date: Fri, 26 Oct 2018 09:24:04 -0400
+Subject: [PATCH 2/2] Add ability to detect GNU/Hurd when configuring
+
+---
+ lib/configure | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/lib/configure
++++ b/lib/configure
+@@ -25,7 +25,7 @@ if [ -z "$HOST" ] ; then
+ proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
+ cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
+ else
+- cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
++ cpu=`uname -m | sed 's/^i.86-AT386/i386/;s/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
+ fi
+ if [ "$sys" = "DragonFly" ]
+ then
+@@ -39,6 +39,10 @@ if [ -z "$HOST" ] ; then
+ then
+ sys=cygwin
+ fi
++ if [ "$sys" = "GNU" ]
++ then
++ sys=gnu
++ fi
+ HOST=${3:-$cpu-$sys}
+ fi
+ [ -n "$RELEASE" ] && rel="${RELEASE}"
diff --git a/gnu/packages/patches/perl-cross.patch b/gnu/packages/patches/perl-cross.patch
new file mode 100644
index 0000000000..a7d10b4e1f
--- /dev/null
+++ b/gnu/packages/patches/perl-cross.patch
@@ -0,0 +1,60 @@
+Submitted upstream.
+
+From 4c3eb19a11dfe5c88c902481a8294c4f675fcd03 Mon Sep 17 00:00:00 2001
+From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
+Date: Sun, 19 Apr 2020 23:33:28 +0200
+Subject: [PATCH] Support cross-compiling to the Hurd.
+
+* cnf/hints/gnu: New file.
+* cnf/configure_tool.sh: Guess it.
+---
+ cnf/configure_tool.sh | 4 ++++
+ cnf/hints/gnu | 21 +++++++++++++++++++++
+ 2 files changed, 25 insertions(+)
+ create mode 100644 cnf/hints/gnu
+
+diff --git a/cnf/configure_tool.sh b/cnf/configure_tool.sh
+index 32201c0..7b0baa4 100644
+--- a/cnf/configure_tool.sh
++++ b/cnf/configure_tool.sh
+@@ -266,6 +266,10 @@ if not hinted 'osname'; then
+ define osname "bsd"
+ result "BSD"
+ ;;
++ *-gnu*)
++ define osname "gnu"
++ result "GNU"
++ ;;
+ *)
+ result "no"
+ ;;
+diff --git a/cnf/hints/gnu b/cnf/hints/gnu
+new file mode 100644
+index 0000000..a0583a2
+--- /dev/null
++++ b/cnf/hints/gnu
+@@ -0,0 +1,21 @@
++# Hurd syscalls
++d_voidsig='define'
++d_nanosleep='undef'
++d_clock_gettime='define'
++d_clock_getres='define'
++d_clock_nanosleep='define'
++d_clock='define'
++
++# From the original linux.sh
++usemallocwrap='define'
++
++# libraries to test
++libswanted='m crypt pthread nm ndbm gdbm dbm db dl gdbm_compat'
++
++d_procselfexe='undef'
++procselfexe='"undef"'
++
++st_ino_sign=1
++st_ino_size=8
++
++d_fcntl_can_lock='define'
+--
+2.26.0
+
diff --git a/gnu/packages/patches/potrace-tests.patch b/gnu/packages/patches/potrace-tests.patch
deleted file mode 100644
index 407be98dab..0000000000
--- a/gnu/packages/patches/potrace-tests.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-This relaxes the comparison threshold between the reference data
-and the bitmaps produced by Ghostscript interpreting the vectorized
-image. Apparently the threshold has become too low with the switch
-to from Ghostscript 2.21 to 2.22.
-
---- potrace-1.15/check/postscript-check.sh 2018-01-06 19:47:26.194900686 +0100
-+++ potrace-1.15/check/postscript-check.sh 2018-01-06 19:51:35.937503739 +0100
-@@ -70,15 +70,15 @@ if test $? -ne 0; then
- echo "Something is wrong with $GS; skipping this test" >& 2
- exit 77
- fi
--actiondiff "$TMP2" "$REFDATA" 1000
-+actiondiff "$TMP2" "$REFDATA" 1500
-
- action $POTRACE -r50 -p -L 0 -B 0 --opaque -o "$TMP1" "$DATA"
- action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g460x394 -r100x100 -sOutputFile="$TMP2" -- "$TMP1"
--actiondiff "$TMP2" "$REFDATA" 1200
-+actiondiff "$TMP2" "$REFDATA" 1500
-
- action $POTRACE -r50 -p -L 0 -B 0 -A 160 -o "$TMP1" "$DATA"
- action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g568x528 -r100x100 -sOutputFile="$TMP2" -- "$TMP1"
--actiondiff "$TMP2" "$REFDATAROT" 1200
-+actiondiff "$TMP2" "$REFDATAROT" 1500
-
- action rm -f "$TMP1"
- action rm -f "$TMP2"
-
---- potrace-1.15/check/pdf-check.sh 2018-01-06 19:47:28.698886663 +0100
-+++ potrace-1.15/check/pdf-check.sh 2018-01-06 20:54:14.895460329 +0100
-@@ -72,15 +72,15 @@ if test $? -ne 0 -o ! -f "$TMP2"; then
- echo "GS does not understand PDF; skipping this test" >& 2
- exit 77
- fi
--actiondiff "$TMP2" "$REFDATA" 1000
-+actiondiff "$TMP2" "$REFDATA" 1500
-
- action $POTRACE -r50 -p -L 0 -B 0 --opaque -b pdf -o "$TMP1" "$DATA"
- action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g460x394 -r100x100 -sOutputFile="$TMP2" -- "$TMP1"
--actiondiff "$TMP2" "$REFDATA" 1200
-+actiondiff "$TMP2" "$REFDATA" 1500
-
- action $POTRACE -r50 -p -L 0 -B 0 -A 160 -b pdf -o "$TMP1" "$DATA"
- action "$GS" -q -dNOPAUSE -sDEVICE=pbmraw -g568x528 -r100x100 -sOutputFile="$TMP2" -- "$TMP1"
--actiondiff "$TMP2" "$REFDATAROT" 1200
-+actiondiff "$TMP2" "$REFDATAROT" 1500
-
- action rm -f "$TMP1"
- action rm -f "$TMP2"
-
-Diff finished. Sat Jan 6 20:54:50 2018
diff --git a/gnu/packages/patches/python-2.7-search-paths.patch b/gnu/packages/patches/python-2.7-search-paths.patch
index a012bc8fe0..3318f44d23 100644
--- a/gnu/packages/patches/python-2.7-search-paths.patch
+++ b/gnu/packages/patches/python-2.7-search-paths.patch
@@ -1,15 +1,19 @@
-Make sure the build system honors CPATH and LIBRARY_PATH when
+Make sure the build system honors C_INCLUDE_PATH and LIBRARY_PATH when
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('C_INCLUDE_PATH', '').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-arm-alignment.patch b/gnu/packages/patches/python-3-arm-alignment.patch
new file mode 100644
index 0000000000..065c1a7bb2
--- /dev/null
+++ b/gnu/packages/patches/python-3-arm-alignment.patch
@@ -0,0 +1,21 @@
+Ensure memory accesses in the sha3 module are aligned on ARM as it causes
+problems when running 32-bit code on a 64-bit kernel.
+
+Patch taken from upstream bug report:
+https://bugs.python.org/issue36515
+
+--- a/Modules/_sha3/sha3module.c
++++ b/Modules/_sha3/sha3module.c
+@@ -64,6 +64,12 @@
+ #define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
+ #endif
+
++/* Bus error on 32-bit ARM due to un-aligned memory accesses; 64-bit ARM
++ * doesn't complain but un-aligned memory accesses are sub-optimal */
++#if defined(__arm__) || defined(__aarch64__)
++#define NO_MISALIGNED_ACCESSES
++#endif
++
+ /* mangle names */
+ #define KeccakF1600_FastLoop_Absorb _PySHA3_KeccakF1600_FastLoop_Absorb
+ #define Keccak_HashFinal _PySHA3_Keccak_HashFinal
diff --git a/gnu/packages/patches/python-3-search-paths.patch b/gnu/packages/patches/python-3-search-paths.patch
index 5fea9c66b6..df01d3b933 100644
--- a/gnu/packages/patches/python-3-search-paths.patch
+++ b/gnu/packages/patches/python-3-search-paths.patch
@@ -1,16 +1,25 @@
-Make sure the build system honors CPATH and LIBRARY_PATH when
+Make sure the build system honors C_INCLUDE_PATH and LIBRARY_PATH when
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 @@
+@@ -676,15 +676,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:
-- lib_dirs = self.compiler.library_dirs + system_lib_dirs
-- inc_dirs = self.compiler.include_dirs + system_include_dirs
-+ lib_dirs = os.getenv('LIBRARY_PATH', '').split(os.pathsep)
-+ inc_dirs = os.getenv('CPATH', '').split(os.pathsep)
+ if not CROSS_COMPILING:
+- self.lib_dirs = self.compiler.library_dirs + system_lib_dirs
+- self.inc_dirs = self.compiler.include_dirs + system_include_dirs
++ self.lib_dirs = os.getenv('LIBRARY_PATH', '').split(os.pathsep)
++ self.inc_dirs = os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
else:
# Add the sysroot paths. 'sysroot' is a compiler option used to
# set the logical path of the standard system headers and
+ # libraries.
+- self.lib_dirs = (self.compiler.library_dirs +
++ self.lib_dirs = (os.getenv('CROSS_LIBRARY_PATH', '').split(os.pathsep) +
+ sysroot_paths(('LDFLAGS', 'CC'), system_lib_dirs))
+- self.inc_dirs = (self.compiler.include_dirs +
++ self.inc_dirs = (os.getenv('CROSS_C_INCLUDE_PATH', '').split(os.pathsep) +
+ sysroot_paths(('CPPFLAGS', 'CFLAGS', 'CC'),
+ system_include_dirs))
+
diff --git a/gnu/packages/patches/python-3.8-search-paths.patch b/gnu/packages/patches/python-3.8-search-paths.patch
deleted file mode 100644
index 88f19850bf..0000000000
--- a/gnu/packages/patches/python-3.8-search-paths.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/setup.py b/setup.py
-index 20d7f35..5751083 100644
---- a/setup.py
-+++ b/setup.py
-@@ -676,8 +676,8 @@ class PyBuildExt(build_ext):
- # 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:
-- self.lib_dirs = self.compiler.library_dirs + system_lib_dirs
-- self.inc_dirs = self.compiler.include_dirs + system_include_dirs
-+ self.lib_dirs = os.getenv('LIBRARY_PATH', '').split(os.pathsep)
-+ self.inc_dirs = os.getenv('CPATH', '').split(os.pathsep)
- else:
- # Add the sysroot paths. 'sysroot' is a compiler option used to
- # set the logical path of the standard system headers and
---
-2.23.0
diff --git a/gnu/packages/patches/python-cffi-x87-stack-clean.patch b/gnu/packages/patches/python-cffi-x87-stack-clean.patch
deleted file mode 100644
index 50243505ee..0000000000
--- a/gnu/packages/patches/python-cffi-x87-stack-clean.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Fix test that fails on i686:
-
-https://bitbucket.org/cffi/cffi/issues/382
-
-This is a squashed version of these commits:
-https://bitbucket.org/cffi/cffi/commits/ef09637b2314
-https://bitbucket.org/cffi/cffi/commits/7a76a3815340
-
-diff -r 99940f1f5402 testing/cffi0/test_function.py
---- a/testing/cffi0/test_function.py Tue Feb 27 21:18:33 2018 +0100
-+++ b/testing/cffi0/test_function.py Sun Nov 11 16:26:23 2018 +0100
-@@ -45,14 +45,14 @@
- assert x != math.sin(1.23) # rounding effects
- assert abs(x - math.sin(1.23)) < 1E-6
-
-- def test_sin_no_return_value(self):
-+ def test_lround_no_return_value(self):
- # check that 'void'-returning functions work too
- ffi = FFI(backend=self.Backend())
- ffi.cdef("""
-- void sin(double x);
-+ void lround(double x);
- """)
- m = ffi.dlopen(lib_m)
-- x = m.sin(1.23)
-+ x = m.lround(1.23)
- assert x is None
-
- def test_dlopen_filename(self):
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/patches/python-gst-fix-build-with-python-3.8.patch b/gnu/packages/patches/python-gst-fix-build-with-python-3.8.patch
new file mode 100644
index 0000000000..affa0e1317
--- /dev/null
+++ b/gnu/packages/patches/python-gst-fix-build-with-python-3.8.patch
@@ -0,0 +1,36 @@
+Fix build with Python 3.8 by also checking for python-3.X-embed.pc. Since
+Python 3.8 the normal checks don't include the Python libraries anymore and
+linking of the gst-python module would fail.
+
+See also https://github.com/mesonbuild/meson/issues/5629
+Fixes https://gitlab.freedesktop.org/gstreamer/gst-python/issues/28
+
+Patch based on upstream commit:
+
+https://gitlab.freedesktop.org/gstreamer/gst-python/-/commit/10707f437f2fc3632067c6a0efa4432f7ebaf362
+
+diff --git a/meson.build b/meson.build
+index 5f13b48..d7c7e66 100644
+--- a/meson.build
++++ b/meson.build
+@@ -23,7 +23,17 @@ pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_d
+
+ pymod = import('python')
+ python = pymod.find_installation(get_option('python'))
+-python_dep = python.dependency(required : true)
++pythonver = python.language_version()
++if pythonver.version_compare('<3.0')
++ error('Python2 is not supported anymore, please port your code to python3 (@0@ specified)'.format(python.language_version()))
++endif
++
++# Workaround for https://github.com/mesonbuild/meson/issues/5629
++# https://gitlab.freedesktop.org/gstreamer/gst-python/issues/28
++python_dep = dependency('python-@0@-embed'.format(pythonver), version: '>=3', required: false)
++if not python_dep.found()
++ python_dep = python.dependency(required : true)
++endif
+
+ python_abi_flags = python.get_variable('ABIFLAGS', '')
+ pylib_loc = get_option('libpython-dir')
+--
+2.26.2
diff --git a/gnu/packages/patches/python-pycrypto-time-clock.patch b/gnu/packages/patches/python-pycrypto-time-clock.patch
new file mode 100644
index 0000000000..9b7a8232a2
--- /dev/null
+++ b/gnu/packages/patches/python-pycrypto-time-clock.patch
@@ -0,0 +1,23 @@
+Drop use of the deprecated time.clock which was removed in Python 3.8.
+
+Adapted from upstream pull request:
+
+https://github.com/dlitz/pycrypto/pull/296
+
+diff --git a/lib/Crypto/Random/_UserFriendlyRNG.py b/lib/Crypto/Random/_UserFriendlyRNG.py
+--- a/lib/Crypto/Random/_UserFriendlyRNG.py
++++ b/lib/Crypto/Random/_UserFriendlyRNG.py
+@@ -73,8 +73,11 @@ class _EntropyCollector(object):
+ t = time.time()
+ self._time_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+
+- # Add the fractional part of time.clock()
+- t = time.clock()
++ # Add the fractional part of time.process_time()
++ try:
++ t = time.process_time()
++ except AttributeError:
++ t = time.clock()
+ self._clock_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+
+
diff --git a/gnu/packages/patches/qtbase-moc-ignore-gcc-macro.patch b/gnu/packages/patches/qtbase-moc-ignore-gcc-macro.patch
new file mode 100644
index 0000000000..b296cf0b72
--- /dev/null
+++ b/gnu/packages/patches/qtbase-moc-ignore-gcc-macro.patch
@@ -0,0 +1,17 @@
+The moc executable loops through headers on CPLUS_INCLUDE_PATH and stumbles
+on the GCC internal _GLIBCXX_VISIBILITY macro. Tell it to ignore it as it is
+not supposed to be looking there to begin with.
+
+Upstream report: https://bugreports.qt.io/browse/QTBUG-83160
+
+diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
+--- a/src/tools/moc/main.cpp
++++ b/src/tools/moc/main.cpp
+@@ -188,6 +188,7 @@ int runMoc(int argc, char **argv)
+ dummyVariadicFunctionMacro.arguments += Symbol(0, PP_IDENTIFIER, "__VA_ARGS__");
+ pp.macros["__attribute__"] = dummyVariadicFunctionMacro;
+ pp.macros["__declspec"] = dummyVariadicFunctionMacro;
++ pp.macros["_GLIBCXX_VISIBILITY"] = dummyVariadicFunctionMacro;
+
+ QString filename;
+ QString output;
diff --git a/gnu/packages/patches/screen-hurd-path-max.patch b/gnu/packages/patches/screen-hurd-path-max.patch
new file mode 100644
index 0000000000..e906f154f3
--- /dev/null
+++ b/gnu/packages/patches/screen-hurd-path-max.patch
@@ -0,0 +1,42 @@
+Workaround for PATH_MAX usage on the Hurd.
+
+Taken from https://salsa.debian.org/debian/screen/-/blob/master/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch
+
+Description: Set PATH_MAX to 4096 if undefined
+ Fixes FTBFS since 4.4.0 on GNU/Hurd. Updated to add one more occurrence for 4.5.0.
+Author: Axel Beckert <abe@debian.org>
+Bug: https://savannah.gnu.org/bugs/?50089
+Last-Updated: 2017-01-18
+
+--- a/tty.sh
++++ b/tty.sh
+@@ -1478,6 +1478,13 @@
+ return 0;
+ }
+
++/*
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd
++ */
++
++#ifndef PATH_MAX
++#define PATH_MAX 4096
++#endif
+
+ int CheckTtyname (char *tty)
+ {
+--- a/screen.h
++++ b/screen.h
+@@ -109,6 +109,13 @@
+ # define DEFAULT_BUFFERFILE "/tmp/screen-exchange"
+ #endif
+
++/*
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd
++ */
++
++#ifndef PATH_MAX
++#define PATH_MAX 4096
++#endif
+
+ #if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT))
+ # define HPUX_LTCHARS_HACK
diff --git a/gnu/packages/patches/seahorse-gkr-use-0-on-empty-flags.patch b/gnu/packages/patches/seahorse-gkr-use-0-on-empty-flags.patch
deleted file mode 100644
index 55866d2973..0000000000
--- a/gnu/packages/patches/seahorse-gkr-use-0-on-empty-flags.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Patch from <https://gitlab.gnome.org/GNOME/seahorse/commit/d9db29db567012b7c72e85e1be1fbf55fcc9b667>.
-
-From d9db29db567012b7c72e85e1be1fbf55fcc9b667 Mon Sep 17 00:00:00 2001
-From: Niels De Graef <nielsdegraef@gmail.com>
-Date: Sat, 11 May 2019 09:02:34 +0200
-Subject: [PATCH] gkr: Use 0 on empty flags
-
-A Flags-type variable without any flag set can be replaced with 0, so
-this is a safe thing to do. It also prevents us from having to deal with
-the accidental API break in libsecret (see
-https://gitlab.gnome.org/GNOME/libsecret/merge_requests/19)
----
- gkr/gkr-keyring-add.vala | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/gkr/gkr-keyring-add.vala b/gkr/gkr-keyring-add.vala
-index 4e92a520..f60c9a22 100644
---- a/gkr/gkr-keyring-add.vala
-+++ b/gkr/gkr-keyring-add.vala
-@@ -41,8 +41,7 @@ public class Seahorse.Gkr.KeyringAdd : Gtk.Dialog {
-
- var cancellable = Dialog.begin_request(this);
- var service = Backend.instance().service;
-- Secret.Collection.create.begin(service, this.name_entry.text, null,
-- Secret.CollectionCreateFlags.COLLECTION_CREATE_NONE,
-+ Secret.Collection.create.begin(service, this.name_entry.text, null, 0,
- cancellable, (obj, res) => {
- /* Clear the operation without cancelling it since it is complete */
- Dialog.complete_request(this, false);
---
-2.23.0
-
diff --git a/gnu/packages/patches/shadow-hurd-pctrl.patch b/gnu/packages/patches/shadow-hurd-pctrl.patch
new file mode 100644
index 0000000000..2e376e19a9
--- /dev/null
+++ b/gnu/packages/patches/shadow-hurd-pctrl.patch
@@ -0,0 +1,16 @@
+Avoid including sys/prctl.h on the Hurd.
+
+Upstream status: Not submitted.
+
+--- shadow-4.8.1/libmisc/idmapping.c.orig 2020-03-07 16:32:05.000000000 -0500
++++ shadow-4.8.1/libmisc/idmapping.c 2020-03-07 16:32:27.000000000 -0500
+@@ -36,8 +36,8 @@
+ #include <stdio.h>
+ #include "prototypes.h"
+ #include "idmapping.h"
+-#include <sys/prctl.h>
+ #if HAVE_SYS_CAPABILITY_H
++#include <sys/prctl.h>
+ #include <sys/capability.h>
+ #endif
+
diff --git a/gnu/packages/patches/swig-guile-gc.patch b/gnu/packages/patches/swig-guile-gc.patch
deleted file mode 100644
index 0e745a6247..0000000000
--- a/gnu/packages/patches/swig-guile-gc.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-Fix garbage collection for Guile versions >= 2.0.12. This issue showed
-up when running the tests on i686-linux.
-
-Taken from this upstream commit:
-https://github.com/swig/swig/commit/38f2ab0c30e369e63bbd0a6152108488d0de68e1
-
-diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg
-index 274f197158..0d04cb7c62 100644
---- a/Lib/guile/guile_scm_run.swg
-+++ b/Lib/guile/guile_scm_run.swg
-@@ -99,6 +99,7 @@ SWIG_Guile_scm2newstr(SCM str, size_t *len) {
- static int swig_initialized = 0;
- static scm_t_bits swig_tag = 0;
- static scm_t_bits swig_collectable_tag = 0;
-+static scm_t_bits swig_finalized_tag = 0;
- static scm_t_bits swig_destroyed_tag = 0;
- static scm_t_bits swig_member_function_tag = 0;
- static SCM swig_make_func = SCM_EOL;
-@@ -163,7 +164,19 @@ SWIG_Guile_PointerType(SCM object)
- }
- else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object);
- }
--
-+
-+SWIGINTERN int
-+SWIG_Guile_IsValidSmob(SCM smob)
-+{
-+ /* We do not accept smobs representing destroyed pointers, but we have to
-+ allow finalized smobs because Guile >= 2.0.12 sets all smob instances
-+ to the 'finalized' type before calling their 'free' function. This change
-+ was introduced to Guile in commit 8dff3af087c6eaa83ae0d72aa8b22aef5c65d65d */
-+ return SCM_SMOB_PREDICATE(swig_tag, smob)
-+ || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
-+ || SCM_SMOB_PREDICATE(swig_finalized_tag, smob);
-+}
-+
- SWIGINTERN int
- SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
- {
-@@ -179,8 +192,7 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
- *result = SCM_POINTER_VALUE(s);
- return SWIG_OK;
- #endif /* if SCM_MAJOR_VERSION >= 2 */
-- } else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
-- /* we do not accept smobs representing destroyed pointers */
-+ } else if (SWIG_Guile_IsValidSmob(smob)) {
- from = (swig_type_info *) SCM_CELL_WORD_2(smob);
- if (!from) return SWIG_ERROR;
- if (type) {
-@@ -239,7 +251,7 @@ SWIG_Guile_MarkPointerNoncollectable(SCM s)
- {
- SCM smob = SWIG_Guile_GetSmob(s);
- if (!SCM_NULLP(smob)) {
-- if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
-+ if (SWIG_Guile_IsValidSmob(smob)) {
- SCM_SET_CELL_TYPE(smob, swig_tag);
- }
- else scm_wrong_type_arg(NULL, 0, s);
-@@ -252,7 +264,7 @@ SWIG_Guile_MarkPointerDestroyed(SCM s)
- {
- SCM smob = SWIG_Guile_GetSmob(s);
- if (!SCM_NULLP(smob)) {
-- if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
-+ if (SWIG_Guile_IsValidSmob(smob)) {
- SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
- }
- else scm_wrong_type_arg(NULL, 0, s);
-@@ -419,6 +431,8 @@ SWIG_Guile_Init ()
- scm_set_smob_print(swig_collectable_tag, print_collectable_swig);
- scm_set_smob_equalp(swig_collectable_tag, equalp_swig);
- scm_set_smob_free(swig_collectable_tag, free_swig);
-+ /* For Guile >= 2.0.12. See libguile/smob.c:clear_smobnum */
-+ swig_finalized_tag = swig_collectable_tag & ~0xff00;
- }
- if (ensure_smob_tag(swig_module, &swig_destroyed_tag,
- "destroyed-swig-pointer", "destroyed-swig-pointer-tag")) {
diff --git a/gnu/packages/patches/tcl-fix-cross-compilation.patch b/gnu/packages/patches/tcl-fix-cross-compilation.patch
new file mode 100644
index 0000000000..00c36b8f27
--- /dev/null
+++ b/gnu/packages/patches/tcl-fix-cross-compilation.patch
@@ -0,0 +1,39 @@
+From f7fa48c4c75a1e748dc5071e709c0b62ff739eaa Mon Sep 17 00:00:00 2001
+From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
+Date: Mon, 9 Dec 2019 10:02:20 +0000
+Subject: [PATCH] Fix [abd4abedd2]: Failed to build tk 8.6.10 with cross
+ compile
+
+Patch taken from upstream to fix cross-compilation. To be removed on next Tcl release.
+
+---
+ compat/strtol.c | 2 +-
+ compat/strtoul.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/compat/strtol.c b/compat/strtol.c
+index b7f69196ce2..811006a64c3 100644
+--- a/compat/strtol.c
++++ b/compat/strtol.c
+@@ -53,7 +53,7 @@ strtol(
+ */
+
+ p = string;
+- while (TclIsSpaceProc(*p)) {
++ while (isspace(UCHAR(*p))) {
+ p += 1;
+ }
+
+diff --git a/compat/strtoul.c b/compat/strtoul.c
+index e37eb05f823..15587f1da1a 100644
+--- a/compat/strtoul.c
++++ b/compat/strtoul.c
+@@ -74,7 +74,7 @@ strtoul(
+ */
+
+ p = string;
+- while (TclIsSpaceProc(*p)) {
++ while (isspace(UCHAR(*p))) {
+ p += 1;
+ }
+ if (*p == '-') {
diff --git a/gnu/packages/patches/tcsh-fix-autotest.patch b/gnu/packages/patches/tcsh-fix-autotest.patch
index 78444a1b2a..200867cb9b 100644
--- a/gnu/packages/patches/tcsh-fix-autotest.patch
+++ b/gnu/packages/patches/tcsh-fix-autotest.patch
@@ -63,38 +63,14 @@
AT_DATA([comment2.csh],
[[echo testing...@%:@\
-@@ -567,10 +567,10 @@ run=3
-# Adapt to changes in sed 4.3:
-# https://github.com/tcsh-org/tcsh/commit/2ad4fc1705893207598ed5cd21713ddf3f17bba0
- ]])
- AT_DATA([uniformity_test.csh],
- [[
--set SERVICE_NAME_LOG = `cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[:blank:]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g'`
-+set SERVICE_NAME_LOG = `cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g'`
- echo -n "$SERVICE_NAME_LOG" > ./output1
-
--cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[:blank:]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g' > ./output2
-+cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g' > ./output2
-
- diff -uprN ./output1 ./output2 >& /dev/null
-
-@@ -587,7 +587,7 @@ AT_DATA([quoting_result_test.csh],
- echo "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP\)(HOST=db\)(PORT=1521\)\)(CONNECT_DATA=(SERVER=DEDICATED\)(SERVICE_NAME=bns03\)\)\)" > ./expected_result
-
- set string = "jdbc_url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bns03)))"
--set SERVICE_NAME_LOG = `echo "$string" | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[:blank:]*\([^$]*\)$/\1/p' | perl -pe 's/\)/\\\)/g'`
-+set SERVICE_NAME_LOG = `echo "$string" | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\)/\\\)/g'`
-
- echo "$SERVICE_NAME_LOG" > ./actual_result
-
--- tests/subst.at
+++ tests/subst.at
-@@ -54,7 +54,7 @@ AT_CHECK([echo 'echo ~; echo "$HOME"' | tcsh -f | uniq | wc -l | tr -d ' \t'],
+@@ -54,7 +54,7 @@ AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
, [1
])
--AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | uniq dnl
-+AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | grep -v "/homeless-shelter" | uniq dnl
+-AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo "echo ~$(id -un)/foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl
++AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo "echo ~$(id -un)//foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl
| wc -l | tr -d ' \t'], , [1
])
@@ -110,21 +86,6 @@
]])
chmod a+x args.sh
AT_CHECK([tcsh -f listflags.csh], ,
-@@ -704,9 +705,9 @@ AT_CHECK([tcsh -f mail.csh], ,
-# This test fails by trying to change to the build user's home
-# directory, which does not exist.
- AT_CLEANUP
-
-
--AT_SETUP([$ cdtohome])
--AT_CHECK([tcsh -f -c 'cd'], 0)
--AT_CLEANUP
-+#AT_SETUP([$ cdtohome])
-+#AT_CHECK([tcsh -f -c 'cd'], 0)
-+#AT_CLEANUP
- AT_SETUP([$ noimplicithome])
- AT_CHECK([tcsh -f -c 'unset cdtohome; cd'], 1, , [cd: Too few arguments.
- ])
@@ -728,55 +729,57 @@ TCSH_UNTESTED([$ oid])
AT_SETUP([$ owd])
diff --git a/gnu/packages/patches/tcsh-fix-out-of-bounds-read.patch b/gnu/packages/patches/tcsh-fix-out-of-bounds-read.patch
deleted file mode 100644
index 48c294f78e..0000000000
--- a/gnu/packages/patches/tcsh-fix-out-of-bounds-read.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Fix out-of-bounds read in c_substitute():
-
-http://seclists.org/oss-sec/2016/q4/612
-
-Patch copied from upstream source repository:
-
-https://github.com/tcsh-org/tcsh/commit/6a542dc4fb2ba26518a47e9b3a9bcd6a91b94596
-
-From 6a542dc4fb2ba26518a47e9b3a9bcd6a91b94596 Mon Sep 17 00:00:00 2001
-From: christos <christos>
-Date: Fri, 2 Dec 2016 16:59:28 +0000
-Subject: [PATCH] Fix out of bounds read (Brooks Davis) (reproduce by starting
- tcsh and hitting tab at the prompt)
-
----
- ed.chared.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ed.chared.c b/ed.chared.c
-index 1277e53..310393e 100644
---- ed.chared.c
-+++ ed.chared.c
-@@ -750,7 +750,7 @@ c_substitute(void)
- /*
- * If we found a history character, go expand it.
- */
-- if (HIST != '\0' && *p == HIST)
-+ if (p >= InputBuf && HIST != '\0' && *p == HIST)
- nr_exp = c_excl(p);
- else
- nr_exp = 0;
diff --git a/gnu/packages/patches/telepathy-glib-channel-memory-leak.patch b/gnu/packages/patches/telepathy-glib-channel-memory-leak.patch
new file mode 100644
index 0000000000..fe07548ec0
--- /dev/null
+++ b/gnu/packages/patches/telepathy-glib-channel-memory-leak.patch
@@ -0,0 +1,19 @@
+Prevent a memory leak in call-channel, which otherwise would cause a
+test failure in file-transfer-channel.c.
+
+Taken from upstream:
+https://gitlab.freedesktop.org/telepathy/telepathy-glib/commit/2e8b2cc0db09b781d99e3755bb6d01548037fe7b
+
+diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c
+index 8ed76323be32f83c5f4d6045a50bc1698d8093fd..2a1fa203d4be9f0c8b99344225f4ba9900666ffc 100644
+--- a/telepathy-glib/call-channel.c
++++ b/telepathy-glib/call-channel.c
+@@ -525,6 +525,8 @@ update_call_members (TpCallChannel *self,
+
+ _tp_channel_contacts_queue_prepare_async ((TpChannel *) self,
+ contacts, update_call_members_prepared_cb, data);
++
++ g_ptr_array_unref (contacts);
+ }
+
+ static void
diff --git a/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch b/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch
deleted file mode 100644
index 63646d420c..0000000000
--- a/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch
+++ /dev/null
@@ -1,249 +0,0 @@
-This patch adds support for newer versions of Poppler and some upstream
-TexLive fixes, including one for CVE-2018-17407.
-
-It is taken from Linux From Scratch:
-<http://www.linuxfromscratch.org/patches/blfs/svn/texlive-20180414-source-upstream_fixes-3.patch>.
-
-Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
-Date: 2018-12-26
-Initial Package Version: 20180414
-Upstream Status: Applied
-Origin: Upstream
-Description: Two fixes, cherry-picked from svn plus a CVE fix.
-I have removed the partial fixes for various system versions of poppler.
-
-r47469 Fix segfault in dvipdfm-x (XeTeX) on 1/2/4-bit transparent indexed PNGs.
-
-r47477 Fix a ptex regression for discontinuous kinsoku table.
-
-Also, via fedora (I got lost in svn) a critical fix for CVE-2018-17407
-
-"A buffer overflow in the handling of Type 1 fonts allows arbitrary code
-execution when a malicious font is loaded by one of the vulnerable tools:
-pdflatex, pdftex, dvips, or luatex."
-
-diff -Naur a/texk/dvipdfm-x/pngimage.c b/texk/dvipdfm-x/pngimage.c
---- a/texk/dvipdfm-x/pngimage.c 2018-02-17 08:41:35.000000000 +0000
-+++ b/texk/dvipdfm-x/pngimage.c 2018-10-09 01:52:01.648670875 +0100
-@@ -964,12 +964,16 @@
- png_bytep trans;
- int num_trans;
- png_uint_32 i;
-+ png_byte bpc, mask, shift;
-
- if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ||
- !png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)) {
- WARN("%s: PNG does not have valid tRNS chunk but tRNS is requested.", PNG_DEBUG_STR);
- return NULL;
- }
-+ bpc = png_get_bit_depth(png_ptr, info_ptr);
-+ mask = 0xff >> (8 - bpc);
-+ shift = 8 - bpc;
-
- smask = pdf_new_stream(STREAM_COMPRESS);
- dict = pdf_stream_dict(smask);
-@@ -981,7 +985,8 @@
- pdf_add_dict(dict, pdf_new_name("ColorSpace"), pdf_new_name("DeviceGray"));
- pdf_add_dict(dict, pdf_new_name("BitsPerComponent"), pdf_new_number(8));
- for (i = 0; i < width*height; i++) {
-- png_byte idx = image_data_ptr[i];
-+ /* data is packed for 1/2/4 bpc formats, msb first */
-+ png_byte idx = (image_data_ptr[bpc * i / 8] >> (shift - bpc * i % 8)) & mask;
- smask_data_ptr[i] = (idx < num_trans) ? trans[idx] : 0xff;
- }
- pdf_add_stream(smask, (char *)smask_data_ptr, width*height);
-diff -Naur a/texk/dvipsk/writet1.c b/texk/dvipsk/writet1.c
---- a/texk/dvipsk/writet1.c 2016-11-25 18:24:26.000000000 +0000
-+++ b/texk/dvipsk/writet1.c 2018-10-09 01:52:01.648670875 +0100
-@@ -1449,7 +1449,9 @@
- *(strend(t1_buf_array) - 1) = ' ';
-
- t1_getline();
-+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcat(t1_buf_array, t1_line_array);
-+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcpy(t1_line_array, t1_buf_array);
- t1_line_ptr = eol(t1_line_array);
- }
-diff -Naur a/texk/web2c/luatexdir/font/writet1.w b/texk/web2c/luatexdir/font/writet1.w
---- a/texk/web2c/luatexdir/font/writet1.w 2016-11-25 18:24:34.000000000 +0000
-+++ b/texk/web2c/luatexdir/font/writet1.w 2018-10-09 01:52:01.648670875 +0100
-@@ -1625,7 +1625,9 @@
- if (sscanf(p, "%i", &i) != 1) {
- strcpy(t1_buf_array, t1_line_array);
- t1_getline();
-+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcat(t1_buf_array, t1_line_array);
-+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcpy(t1_line_array, t1_buf_array);
- t1_line_ptr = eol(t1_line_array);
- }
-diff -Naur a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
---- a/texk/web2c/luatexdir/image/pdftoepdf.w 2018-01-17 18:00:12.000000000 +0000
-+++ b/texk/web2c/luatexdir/image/pdftoepdf.w 2018-10-09 01:52:01.648670875 +0100
-@@ -472,10 +472,10 @@
- break;
- */
- case objString:
-- copyString(pdf, obj->getString());
-+ copyString(pdf, (GooString *)obj->getString());
- break;
- case objName:
-- copyName(pdf, obj->getName());
-+ copyName(pdf, (char *)obj->getName());
- break;
- case objNull:
- pdf_add_null(pdf);
-diff -Naur a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
---- a/texk/web2c/luatexdir/lua/lepdflib.cc 2018-02-14 14:44:38.000000000 +0000
-+++ b/texk/web2c/luatexdir/lua/lepdflib.cc 2018-10-09 01:52:01.649670868 +0100
-@@ -674,7 +674,7 @@
- uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
- if (uin->pd != NULL && uin->pd->pc != uin->pc) \
- pdfdoc_changed_error(L); \
-- gs = ((in *) uin->d)->function(); \
-+ gs = (GooString *)((in *) uin->d)->function(); \
- if (gs != NULL) \
- lua_pushlstring(L, gs->getCString(), gs->getLength()); \
- else \
-@@ -1813,7 +1813,7 @@
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- if (((Object *) uin->d)->isString()) {
-- gs = ((Object *) uin->d)->getString();
-+ gs = (GooString *)((Object *) uin->d)->getString();
- lua_pushlstring(L, gs->getCString(), gs->getLength());
- } else
- lua_pushnil(L);
-diff -Naur a/texk/web2c/pdftexdir/writet1.c b/texk/web2c/pdftexdir/writet1.c
---- a/texk/web2c/pdftexdir/writet1.c 2016-11-25 18:24:37.000000000 +0000
-+++ b/texk/web2c/pdftexdir/writet1.c 2018-10-09 01:52:01.649670868 +0100
-@@ -1598,7 +1598,9 @@
- *(strend(t1_buf_array) - 1) = ' ';
-
- t1_getline();
-+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcat(t1_buf_array, t1_line_array);
-+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE);
- strcpy(t1_line_array, t1_buf_array);
- t1_line_ptr = eol(t1_line_array);
- }
-diff -Naur a/texk/web2c/ptexdir/ptex_version.h b/texk/web2c/ptexdir/ptex_version.h
---- a/texk/web2c/ptexdir/ptex_version.h 2018-01-21 03:48:06.000000000 +0000
-+++ b/texk/web2c/ptexdir/ptex_version.h 2018-10-09 01:52:01.649670868 +0100
-@@ -1 +1 @@
--#define PTEX_VERSION "p3.8.0"
-+#define PTEX_VERSION "p3.8.1"
-diff -Naur a/texk/web2c/ptexdir/tests/free_ixsp.tex b/texk/web2c/ptexdir/tests/free_ixsp.tex
---- a/texk/web2c/ptexdir/tests/free_ixsp.tex 1970-01-01 01:00:00.000000000 +0100
-+++ b/texk/web2c/ptexdir/tests/free_ixsp.tex 2018-10-09 01:52:01.649670868 +0100
-@@ -0,0 +1,53 @@
-+%#!eptex -ini -etex
-+\let\dump\relax
-+\batchmode
-+\input plain
-+
-+\errorstopmode
-+\catcode`@=11
-+\newcount\@tempcnta
-+\newcount\@tempcntb
-+\newcount\@tempcntc
-+\mathchardef\LIM=256
-+
-+\def\MYCHAR#1{%
-+ \@tempcntc=\numexpr7*#1+"101\relax
-+ \@tempcnta=\@tempcntc\divide\@tempcnta 94
-+ \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax
-+ \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi
-+ \advance\@tempcnta18 % 18区以降
-+ \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax
-+}
-+
-+\newcount\CNT\newcount\CNTA
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \message{\the\CNT.}
-+ \inhibitxspcode\CNTA=1\relax
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+
-+\newcount\CNTB
-+
-+\loop
-+ \MYCHAR\CNTB
-+ \global\inhibitxspcode\CNTA=3
-+{%
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \count@=\numexpr 1-\inhibitxspcode\CNTA\relax
-+ \ifnum\count@=0\else\ifnum\CNTB=\CNT\else
-+ \errmessage{<\the\CNTB, \the\CNT, \the\inhibitxspcode\CNTA>}\fi\fi
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+}
-+ \MYCHAR\CNTB
-+ \global\inhibitxspcode\CNTA=1\relax
-+ \advance\CNTB1\relax
-+ \ifnum\CNTB<\LIM
-+\repeat
-+\bye
-diff -Naur a/texk/web2c/ptexdir/tests/free_pena.tex b/texk/web2c/ptexdir/tests/free_pena.tex
---- a/texk/web2c/ptexdir/tests/free_pena.tex 1970-01-01 01:00:00.000000000 +0100
-+++ b/texk/web2c/ptexdir/tests/free_pena.tex 2018-10-09 01:52:01.649670868 +0100
-@@ -0,0 +1,52 @@
-+%#!eptex -ini -etex
-+\let\dump\relax
-+\batchmode
-+\input plain
-+
-+\errorstopmode
-+\catcode`@=11
-+\newcount\@tempcnta
-+\newcount\@tempcntb
-+\newcount\@tempcntc
-+\mathchardef\LIM=256
-+
-+\def\MYCHAR#1{%
-+ \@tempcntc=\numexpr7*#1+"101\relax
-+ \@tempcnta=\@tempcntc\divide\@tempcnta 94
-+ \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax
-+ \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi
-+ \advance\@tempcnta18 % 18区以降
-+ \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax
-+}
-+
-+\newcount\CNT\newcount\CNTA
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \message{\the\CNT.}
-+ \prebreakpenalty\CNTA=\numexpr\CNT+1\relax
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+
-+\newcount\CNTB
-+
-+\loop
-+ \MYCHAR\CNTB
-+ \global\prebreakpenalty\CNTA=0
-+{%
-+\CNT=0
-+\loop
-+ \MYCHAR\CNT
-+ \count@=\numexpr -\CNT-1+\prebreakpenalty\CNTA\relax
-+ \ifnum\count@=0\else\ifnum\CNTB=\CNT\else\errmessage{<\the\CNTB, \the\CNT>}\fi\fi
-+ \advance\CNT1\relax
-+ \ifnum\CNT<\LIM
-+\repeat
-+}
-+ \MYCHAR\CNTB
-+ \global\prebreakpenalty\CNTA=\numexpr\CNTB+1\relax
-+ \advance\CNTB1\relax
-+ \ifnum\CNTB<\LIM
-+\repeat
-+\bye
diff --git a/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch b/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch
deleted file mode 100644
index 024ff416af..0000000000
--- a/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch
+++ /dev/null
@@ -1,293 +0,0 @@
-Fix LuaTeX compatibility with Poppler 0.75.
-
-Upstream LuaTeX have moved from Poppler to "pplib" and thus upstream
-fixes are unavailable. This is based on Archs patch, with minor
-tweaks to comply with texlive-bin-CVE-2018-17407.patch.
-https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/texlive-bin&id=418dd6f008c3d41a461353fdb60f2d73d87c58ed
-
-diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
---- a/texk/web2c/luatexdir/image/pdftoepdf.w
-+++ b/texk/web2c/luatexdir/image/pdftoepdf.w
-@@ -363,7 +363,7 @@ void copyReal(PDF pdf, double d)
-
- static void copyString(PDF pdf, GooString * string)
- {
-- char *p;
-+ const char *p;
- unsigned char c;
- size_t i, l;
- p = string->getCString();
-@@ -393,7 +393,7 @@ static void copyString(PDF pdf, GooString * string)
- pdf->cave = true;
- }
-
--static void copyName(PDF pdf, char *s)
-+static void copyName(PDF pdf, const char *s)
- {
- pdf_out(pdf, '/');
- for (; *s != 0; s++) {
-@@ -412,7 +412,7 @@ static void copyArray(PDF pdf, PdfDocument * pdf_doc, Array * array)
- Object obj1;
- pdf_begin_array(pdf);
- for (i = 0, l = array->getLength(); i < l; ++i) {
-- obj1 = array->getNF(i);
-+ obj1 = array->getNF(i).copy();
- copyObject(pdf, pdf_doc, &obj1);
- }
- pdf_end_array(pdf);
-@@ -425,7 +425,7 @@ static void copyDict(PDF pdf, PdfDocument * pdf_doc, Dict * dict)
- pdf_begin_dict(pdf);
- for (i = 0, l = dict->getLength(); i < l; ++i) {
- copyName(pdf, dict->getKey(i));
-- obj1 = dict->getValNF(i);
-+ obj1 = dict->getValNF(i).copy();
- copyObject(pdf, pdf_doc, &obj1);
- }
- pdf_end_dict(pdf);
-@@ -475,7 +475,7 @@ static void copyObject(PDF pdf, PdfDocument * pdf_doc, Object * obj)
- copyString(pdf, (GooString *)obj->getString());
- break;
- case objName:
-- copyName(pdf, (char *)obj->getName());
-+ copyName(pdf, obj->getName());
- break;
- case objNull:
- pdf_add_null(pdf);
-@@ -531,22 +531,22 @@ static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
- {
- switch (pagebox_spec) {
- case PDF_BOX_SPEC_MEDIA:
-- return page->getMediaBox();
-+ return (PDFRectangle *) page->getMediaBox();
- break;
- case PDF_BOX_SPEC_CROP:
-- return page->getCropBox();
-+ return (PDFRectangle *) page->getCropBox();
- break;
- case PDF_BOX_SPEC_BLEED:
-- return page->getBleedBox();
-+ return (PDFRectangle *) page->getBleedBox();
- break;
- case PDF_BOX_SPEC_TRIM:
-- return page->getTrimBox();
-+ return (PDFRectangle *) page->getTrimBox();
- break;
- case PDF_BOX_SPEC_ART:
-- return page->getArtBox();
-+ return (PDFRectangle *) page->getArtBox();
- break;
- default:
-- return page->getMediaBox();
-+ return (PDFRectangle *) page->getMediaBox();
- break;
- }
- }
-@@ -788,12 +788,12 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
- Now all relevant parts of the Page dictionary are copied. Metadata validity
- check is needed(as a stream it must be indirect).
- */
-- obj1 = pageDict->lookupNF("Metadata");
-+ obj1 = pageDict->lookupNF("Metadata").copy();
- if (!obj1.isNull() && !obj1.isRef())
- formatted_warning("pdf inclusion","/Metadata must be indirect object");
- /* copy selected items in Page dictionary */
- for (i = 0; pagedictkeys[i] != NULL; i++) {
-- obj1 = pageDict->lookupNF(pagedictkeys[i]);
-+ obj1 = pageDict->lookupNF(pagedictkeys[i]).copy();
- if (!obj1.isNull()) {
- pdf_add_name(pdf, pagedictkeys[i]);
- /* preserves indirection */
-@@ -806,13 +806,13 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
- PDF file, climbing up the tree until the Resources are found.
- (This fixes a problem with Scribus 1.3.3.14.)
- */
-- obj1 = pageDict->lookupNF("Resources");
-+ obj1 = pageDict->lookupNF("Resources").copy();
- if (obj1.isNull()) {
- op1 = &pagesobj1;
- op2 = &pagesobj2;
- *op1 = pageDict->lookup("Parent");
- while (op1->isDict()) {
-- obj1 = op1->dictLookupNF("Resources");
-+ obj1 = op1->dictLookupNF("Resources").copy();
- if (!obj1.isNull()) {
- pdf_add_name(pdf, "Resources");
- copyObject(pdf, pdf_doc, &obj1);
-diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
---- a/texk/web2c/luatexdir/lua/lepdflib.cc
-+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
-@@ -240,7 +240,7 @@ static int l_new_Attribute(lua_State * L)
- if (uobj->pd != NULL && uobj->pd->pc != uobj->pc)
- pdfdoc_changed_error(L);
- uout = new_Attribute_userdata(L);
-- uout->d = new Attribute(n, nlen, (Object *)uobj->d);
-+ uout->d = new Attribute((GooString)n, (Object *)uobj->d);
- uout->atype = ALLOC_LEPDF;
- uout->pc = uobj->pc;
- uout->pd = uobj->pd;
-@@ -496,7 +496,7 @@ static int l_new_Object(lua_State * L)
- double numA = lua_tonumber(L,1);
- double genA = lua_tonumber(L,2);
- if ( ((numA)==(int)(numA)) && ((genA)==(int)(genA)) ){
-- uout->d = new Object((int)(numA), (int)(genA));
-+ uout->d = new Object({(int)(numA), (int)(genA)});
- uout->atype = ALLOC_LEPDF;
- uout->pc = 0;
- uout->pd = NULL;
-@@ -596,7 +596,7 @@ static int m_##in##_##function(lua_State * L) \
- uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
- if (uin->pd != NULL && uin->pd->pc != uin->pc) \
- pdfdoc_changed_error(L); \
-- o = ((in *) uin->d)->function(); \
-+ o = (out *) ((in *) uin->d)->function(); \
- if (o != NULL) { \
- uout = new_##out##_userdata(L); \
- uout->d = o; \
-@@ -889,7 +889,7 @@ static int m_Array_getNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1);
-+ *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -1125,12 +1125,12 @@ m_poppler_get_INT(Dict, getLength);
-
- static int m_Dict_add(lua_State * L)
- {
-- char *s;
-+ const char *s;
- udstruct *uin, *uobj;
- uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
-- s = copyString(luaL_checkstring(L, 2));
-+ s = luaL_checkstring(L, 2);
- uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
- ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d)));
- return 0;
-@@ -1190,7 +1190,7 @@ static int m_Dict_lookupNF(lua_State * L)
- s = luaL_checkstring(L, 2);
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s);
-+ *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -1263,7 +1263,7 @@ static int m_Dict_getValNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1);
-+ *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -1653,7 +1653,7 @@ static int m_Object_initRef(lua_State * L)
- pdfdoc_changed_error(L);
- num = luaL_checkint(L, 2);
- gen = luaL_checkint(L, 3);
-- *((Object *) uin->d) = Object(num, gen);
-+ *((Object *) uin->d) = Object({num, gen});
- return 0;
- }
-
-@@ -2011,7 +2011,7 @@ static int m_Object_arrayGetNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1);
-+ *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -2051,7 +2051,7 @@ static int m_Object_dictAdd(lua_State * L)
- pdfdoc_changed_error(L);
- if (!((Object *) uin->d)->isDict())
- luaL_error(L, "Object is not a Dict");
-- ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d)));
-+ ((Object *) uin->d)->dictAdd(s, std::move(*((Object *) uobj->d)));
- return 0;
- }
-
-@@ -2104,7 +2104,7 @@ static int m_Object_dictLookupNF(lua_State * L)
- if (((Object *) uin->d)->isDict()) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s);
-+ *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -2169,7 +2169,7 @@ static int m_Object_dictGetValNF(lua_State * L)
- if (i > 0 && i <= len) {
- uout = new_Object_userdata(L);
- uout->d = new Object();
-- *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1);
-+ *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1).copy();
- uout->atype = ALLOC_LEPDF;
- uout->pc = uin->pc;
- uout->pd = uin->pd;
-@@ -2470,7 +2470,7 @@ static int m_PDFDoc_getFileName(lua_State * L)
- uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
-- gs = ((PdfDocument *) uin->d)->doc->getFileName();
-+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->getFileName();
- if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
- else
-@@ -2559,7 +2559,7 @@ static int m_PDFDoc_readMetadata(lua_State * L)
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-- gs = ((PdfDocument *) uin->d)->doc->readMetadata();
-+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->readMetadata();
- if (gs != NULL)
- lua_pushlstring(L, gs->getCString(), gs->getLength());
- else
-@@ -2577,7 +2577,7 @@ static int m_PDFDoc_getStructTreeRoot(lua_State * L)
- if (uin->pd != NULL && uin->pd->pc != uin->pc)
- pdfdoc_changed_error(L);
- if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-- obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
-+ obj = (StructTreeRoot *) ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
- uout = new_StructTreeRoot_userdata(L);
- uout->d = obj;
- uout->pc = uin->pc;
---- texlive-source/texk/web2c/luatexdir/lua/lepdflib.cc.orig 2019-04-24 09:41:05.090522664 +0000
-+++ texlive-source/texk/web2c/luatexdir/lua/lepdflib.cc 2019-04-24 09:43:37.119184926 +0000
-@@ -994,7 +994,8 @@
- pdfdoc_changed_error(L);
- num = luaL_checkint(L, 2);
- gen = luaL_checkint(L, 3);
-- i = ((Catalog *) uin->d)->findPage(num, gen);
-+ Ref numgen = {num, gen};
-+ i = ((Catalog *) uin->d)->findPage(numgen);
- if (i > 0)
- lua_pushinteger(L, i);
- else
-@@ -2596,8 +2597,9 @@
- pdfdoc_changed_error(L);
- num = luaL_checkint(L, 2);
- gen = luaL_checkint(L, 3);
-+ Ref numgen = {num, gen};
- if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-- i = ((PdfDocument *) uin->d)->doc->findPage(num, gen);
-+ i = ((PdfDocument *) uin->d)->doc->findPage(numgen);
- if (i > 0)
- lua_pushinteger(L, i);
- else
---- texlive-source/texk/web2c/luatexdir/image/pdftoepdf.w.orig 2019-04-24 09:56:38.406498975 +0000
-+++ texlive-source/texk/web2c/luatexdir/image/pdftoepdf.w 2019-04-24 09:56:57.020081327 +0000
-@@ -630,7 +630,7 @@
- if (link == NULL || !link->isOk())
- formatted_error("pdf inclusion","invalid destination '%s'",img_pagename(idict));
- Ref ref = link->getPageRef();
-- img_pagenum(idict) = catalog->findPage(ref.num, ref.gen);
-+ img_pagenum(idict) = catalog->findPage(ref);
- if (img_pagenum(idict) == 0)
- formatted_error("pdf inclusion","destination is not a page '%s'",img_pagename(idict));
- delete link;
diff --git a/gnu/packages/patches/texlive-bin-poppler-0.83.patch b/gnu/packages/patches/texlive-bin-poppler-0.83.patch
new file mode 100644
index 0000000000..5e57e3efac
--- /dev/null
+++ b/gnu/packages/patches/texlive-bin-poppler-0.83.patch
@@ -0,0 +1,52 @@
+Fix build with Poppler 0.83 and later.
+
+Taken from Arch Linux, but adjusted to patch the versioned Poppler
+files, as upstream applies it after copying them in place.
+https://git.archlinux.org/svntogit/packages.git/tree/trunk/texlive-poppler-0.83.patch?h=packages/texlive-bin
+
+diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
+--- texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
++++ texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
+@@ -723,7 +723,7 @@
+ #endif
+ // initialize
+ if (!isInit) {
+- globalParams = new GlobalParams();
++ globalParams.reset(new GlobalParams());
+ globalParams->setErrQuiet(false);
+ isInit = true;
+ }
+@@ -1108,6 +1108,5 @@
+ delete_document(p);
+ }
+ // see above for globalParams
+- delete globalParams;
+ }
+ }
+diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
+--- texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
++++ texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
+@@ -79,7 +79,7 @@
+ exit(1);
+ }
+ fileName = new GString(argv[1]);
+- globalParams = new GlobalParams();
++ globalParams.reset(new GlobalParams());
+ doc = new PDFDoc(fileName);
+ if (!doc->isOk()) {
+ fprintf(stderr, "Invalid PDF file\n");
+@@ -100,7 +100,7 @@
+ if (objnum == 0) {
+ srcStream = catalogDict.dictLookup("SourceObject");
+ static char const_SourceFile[] = "SourceFile";
+- if (!srcStream.isStream(const_SourceFile)) {
++ if (!srcStream.isDict(const_SourceFile)) {
+ fprintf(stderr, "No SourceObject found\n");
+ exit(1);
+ }
+@@ -202,5 +202,4 @@
+ fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
+ fclose(outfile);
+ delete doc;
+- delete globalParams;
+ }
diff --git a/gnu/packages/patches/texlive-bin-poppler-0.86.patch b/gnu/packages/patches/texlive-bin-poppler-0.86.patch
new file mode 100644
index 0000000000..b1adca657b
--- /dev/null
+++ b/gnu/packages/patches/texlive-bin-poppler-0.86.patch
@@ -0,0 +1,17 @@
+Fix build with Poppler 0.86 and later.
+
+Taken from Arch Linux, but adjusted to patch the versioned Poppler
+files, as upstream applies it after copying them in place.
+https://git.archlinux.org/svntogit/packages.git/tree/trunk/texlive-poppler-0.86.patch?h=packages/texlive-bin
+
+--- a/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc 2020-03-03 21:11:35.102711802 +0000
++++ b/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc 2020-03-03 21:13:13.057420111 +0000
+@@ -757,7 +757,7 @@
+ if (page_name) {
+ // get page by name
+ GString name(page_name);
+- LinkDest *link = pdf_doc->doc->findDest(&name);
++ LinkDest *link = pdf_doc->doc->findDest(&name).get();
+ if (link == 0 || !link->isOk())
+ pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+ Ref ref = link->getPageRef();
diff --git a/gnu/packages/patches/vigra-python-compat.patch b/gnu/packages/patches/vigra-python-compat.patch
new file mode 100644
index 0000000000..63c6abb326
--- /dev/null
+++ b/gnu/packages/patches/vigra-python-compat.patch
@@ -0,0 +1,18 @@
+Fix build with Boost + Python 3.7.
+
+Taken from upstream:
+https://github.com/ukoethe/vigra/commit/a6fa62663c6a6b752ed0707e95f643e25867a0f9
+
+diff --git a/vigranumpy/src/core/vigranumpycore.cxx b/vigranumpy/src/core/vigranumpycore.cxx
+index ec38d3636..c81c6ae52 100644
+--- a/vigranumpy/src/core/vigranumpycore.cxx
++++ b/vigranumpy/src/core/vigranumpycore.cxx
+@@ -61,7 +61,7 @@ UInt32 pychecksum(python::str const & s)
+ return checksum(data, size);
+ #else
+ Py_ssize_t size = 0;
+- char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size);
++ const char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size);
+ return checksum(data, size);
+ #endif
+ }