summaryrefslogtreecommitdiff
path: root/distro/packages/patches
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-10-27 15:30:08 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-27 15:32:40 +0200
commitbfb3c3d03a168002d77631a653457556a96d9bdd (patch)
tree472c34a4351fd2d54bdea590c50b6b7d5b567f02 /distro/packages/patches
parentfc2f38023bf95604b2eac73bee336b4c3909b480 (diff)
build: Move `distro/patches' to `distro/packages/patches'.
* distro/patches: Move directory to... * distro/packages/patches: ... here. * Makefile.am (dist_patch_DATA): Adjust accordingly. * pre-inst-env.in (DISTRO_PATCH_DIRECTORY): Likewise.
Diffstat (limited to 'distro/packages/patches')
-rw-r--r--distro/packages/patches/binutils-ld-new-dtags.patch16
-rw-r--r--distro/packages/patches/diffutils-gets-undeclared.patch71
-rw-r--r--distro/packages/patches/findutils-absolute-paths.patch29
-rw-r--r--distro/packages/patches/guile-1.8-cpp-4.5.patch24
-rw-r--r--distro/packages/patches/guile-default-utf8.patch111
-rw-r--r--distro/packages/patches/guile-relocatable.patch70
-rw-r--r--distro/packages/patches/libtool-skip-tests.patch37
-rw-r--r--distro/packages/patches/m4-gets-undeclared.patch45
-rw-r--r--distro/packages/patches/m4-readlink-EINVAL.patch18
-rw-r--r--distro/packages/patches/m4-s_isdir.patch14
-rw-r--r--distro/packages/patches/make-impure-dirs.patch40
-rw-r--r--distro/packages/patches/perl-no-sys-dirs.patch156
-rw-r--r--distro/packages/patches/readline-link-ncurses.patch18
-rw-r--r--distro/packages/patches/tar-gets-undeclared.patch26
14 files changed, 675 insertions, 0 deletions
diff --git a/distro/packages/patches/binutils-ld-new-dtags.patch b/distro/packages/patches/binutils-ld-new-dtags.patch
new file mode 100644
index 0000000000..5f7a03fc38
--- /dev/null
+++ b/distro/packages/patches/binutils-ld-new-dtags.patch
@@ -0,0 +1,16 @@
+Turn on --enable-new-dtags by default to make the linker set RUNPATH
+instead of RPATH on binaries. This is important because RUNPATH can
+be overriden using LD_LIBRARY_PATH at runtime.
+
+Patch from Nixpkgs by Eelco Dolstra <eelco.dolstra@logicblox.com>.
+
+--- binutils/ld/ldmain.c
++++ binutils/ld/ldmain.c
+@@ -296,6 +296,7 @@ main (int argc, char **argv)
+
+ link_info.allow_undefined_version = TRUE;
+ link_info.keep_memory = TRUE;
++ link_info.new_dtags = TRUE;
+ link_info.combreloc = TRUE;
+ link_info.strip_discarded = TRUE;
+ link_info.callbacks = &link_callbacks;
diff --git a/distro/packages/patches/diffutils-gets-undeclared.patch b/distro/packages/patches/diffutils-gets-undeclared.patch
new file mode 100644
index 0000000000..b6cdc77caa
--- /dev/null
+++ b/distro/packages/patches/diffutils-gets-undeclared.patch
@@ -0,0 +1,71 @@
+This patch is needed to allow builds with newer versions of
+the GNU libc (2.16+).
+
+
+commit 66712c23388e93e5c518ebc8515140fa0c807348
+Author: Eric Blake <eblake@redhat.com>
+Date: Thu Mar 29 13:30:41 2012 -0600
+
+ stdio: don't assume gets any more
+
+ Gnulib intentionally does not have a gets module, and now that C11
+ and glibc have dropped it, we should be more proactive about warning
+ any user on a platform that still has a declaration of this dangerous
+ interface.
+
+ * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
+ support.
+ * modules/stdio (Makefile.am): Likewise.
+ * lib/stdio-read.c (gets): Likewise.
+ * tests/test-stdio-c++.cc: Likewise.
+ * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
+ * lib/stdio.in.h (gets): Make warning occur in more places.
+ * doc/posix-functions/gets.texi (gets): Update documentation.
+ Reported by Christer Solskogen.
+
+ Signed-off-by: Eric Blake <eblake@redhat.com>
+
+diff --git a/lib/stdio.in.h b/lib/stdio.in.h
+index aa7b599..c377b6e 100644
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
+ # endif
+ #endif
+
+-#if @GNULIB_GETS@
+-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+-# undef gets
+-# define gets rpl_gets
+-# endif
+-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
+-_GL_CXXALIAS_RPL (gets, char *, (char *s));
+-# else
+-_GL_CXXALIAS_SYS (gets, char *, (char *s));
+-# undef gets
+-# endif
+-_GL_CXXALIASWARN (gets);
+ /* It is very rare that the developer ever has full control of stdin,
+- so any use of gets warrants an unconditional warning. Assume it is
+- always declared, since it is required by C89. */
++ so any use of gets warrants an unconditional warning; besides, C11
++ removed it. */
++#undef gets
++#if HAVE_RAW_DECL_GETS
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ #endif
+
+@@ -1053,9 +1042,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+ # endif
+ #endif
+
+-/* Some people would argue that sprintf should be handled like gets
+- (for example, OpenBSD issues a link warning for both functions),
+- since both can cause security holes due to buffer overruns.
++/* Some people would argue that all sprintf uses should be warned about
++ (for example, OpenBSD issues a link warning for it),
++ since it can cause security holes due to buffer overruns.
+ However, we believe that sprintf can be used safely, and is more
+ efficient than snprintf in those safe cases; and as proof of our
+ belief, we use sprintf in several gnulib modules. So this header
diff --git a/distro/packages/patches/findutils-absolute-paths.patch b/distro/packages/patches/findutils-absolute-paths.patch
new file mode 100644
index 0000000000..96341e281f
--- /dev/null
+++ b/distro/packages/patches/findutils-absolute-paths.patch
@@ -0,0 +1,29 @@
+Fix use of LFS-style absolute paths.
+
+Patches from Nixpkgs by Armijn Hemel <armijn@gpl-violations.org>
+and Wouter den Breejen <uu@denbreejen.net>.
+
+diff -ruN findutils-4.2.20/locate/updatedb.sh findutils-4.2.20.new/locate/updatedb.sh
+--- findutils-4.2.20/locate/updatedb.sh 2005-01-24 17:12:35.000000000 +0100
++++ findutils-4.2.20.new/locate/updatedb.sh 2005-08-23 14:37:10.000000000 +0200
+@@ -141,7 +141,7 @@
+ : ${code:=${LIBEXECDIR}/@code@}
+
+
+-PATH=/bin:/usr/bin:${BINDIR}; export PATH
++PATH=/bin:/usr/bin:${BINDIR}:${PATH}; export PATH
+
+ : ${PRUNEFS="nfs NFS proc afs proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs sysfs shfs"}
+
+diff -Naur findutils-4.2.30/xargs/xargs.c findutils-4.2.30_new/xargs/xargs.c
+--- findutils-4.2.30/xargs/xargs.c 2007-02-27 11:21:08.000000000 +0100
++++ findutils-4.2.30_new/xargs/xargs.c 2007-07-17 19:02:05.000000000 +0200
+@@ -402,7 +402,7 @@
+ int show_limits = 0; /* --show-limits */
+ int always_run_command = 1;
+ char *input_file = "-"; /* "-" is stdin */
+- char *default_cmd = "/bin/echo";
++ char *default_cmd = "echo";
+ int (*read_args) PARAMS ((void)) = read_line;
+ void (*act_on_init_result)(void) = noop;
+ int env_too_big = 0;
diff --git a/distro/packages/patches/guile-1.8-cpp-4.5.patch b/distro/packages/patches/guile-1.8-cpp-4.5.patch
new file mode 100644
index 0000000000..638d071baf
--- /dev/null
+++ b/distro/packages/patches/guile-1.8-cpp-4.5.patch
@@ -0,0 +1,24 @@
+Fix doc snarfing with GCC 4.5+.
+From <http://git.savannah.gnu.org/cgit/guile.git/commit/?h=branch_release-1-8&id=aac41d28358cea594bb30f6e547afb82bb6004a6>.
+
+diff --git a/scripts/snarf-check-and-output-texi b/scripts/snarf-check-and-output-texi
+index ea33e17..8cd42e8 100755
+--- a/scripts/snarf-check-and-output-texi
++++ b/scripts/snarf-check-and-output-texi
+@@ -267,6 +267,17 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
+ (set! *file* file)
+ (set! *line* line))
+
++ ;; newer gccs like to throw around more location markers into the
++ ;; preprocessed source; these (hash . hash) bits are what they translate to
++ ;; in snarfy terms.
++ (('location ('string . file) ('int . line) ('hash . 'hash))
++ (set! *file* file)
++ (set! *line* line))
++
++ (('location ('hash . 'hash) ('string . file) ('int . line) ('hash . 'hash))
++ (set! *file* file)
++ (set! *line* line))
++
+ (('arglist rest ...)
+ (set! *args* (do-arglist rest)))
diff --git a/distro/packages/patches/guile-default-utf8.patch b/distro/packages/patches/guile-default-utf8.patch
new file mode 100644
index 0000000000..409f435161
--- /dev/null
+++ b/distro/packages/patches/guile-default-utf8.patch
@@ -0,0 +1,111 @@
+This hack makes Guile default to UTF-8. This avoids calls to
+`iconv_open'; `iconv_open' tries to open shared objects that aren't
+available during bootstrap, so using UTF-8 avoids that (and UTF-8 has
+built-in conversions in glibc, too.)
+
+diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
+index cf41f2f..facfb91 100644
+--- a/libguile/bytevectors.c
++++ b/libguile/bytevectors.c
+@@ -1887,7 +1887,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness)
+ if (scm_i_is_narrow_string (str)) \
+ { \
+ err = mem_iconveh (scm_i_string_chars (str), c_strlen, \
+- "ISO-8859-1", c_utf_name, \
++ "UTF-8", c_utf_name, \
+ iconveh_question_mark, NULL, \
+ &c_utf, &c_utf_len); \
+ if (SCM_UNLIKELY (err)) \
+diff --git a/libguile/ports.c b/libguile/ports.c
+index 301bc44..b0ea2e6 100644
+--- a/libguile/ports.c
++++ b/libguile/ports.c
+@@ -1750,7 +1750,7 @@ scm_ungetc (scm_t_wchar c, SCM port)
+ if (pt->encoding != NULL)
+ encoding = pt->encoding;
+ else
+- encoding = "ISO-8859-1";
++ encoding = "UTF-8";
+
+ len = sizeof (result_buf);
+ result = u32_conv_to_encoding (encoding,
+@@ -2212,7 +2212,7 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding)
+ pt = SCM_PTAB_ENTRY (port);
+
+ if (encoding == NULL)
+- encoding = "ISO-8859-1";
++ encoding = "UTF-8";
+
+ if (pt->encoding != encoding)
+ pt->encoding = scm_gc_strdup (encoding, "port");
+diff --git a/libguile/posix.c b/libguile/posix.c
+index 4f8b8ac..fea7f74 100644
+--- a/libguile/posix.c
++++ b/libguile/posix.c
+@@ -1740,7 +1740,7 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0,
+ SCM_SYSERROR;
+ }
+
+- enc = locale_charset ();
++ enc = "UTF-8";
+
+ /* Set the default encoding for new ports. */
+ scm_i_set_default_port_encoding (enc);
+diff --git a/libguile/script.c b/libguile/script.c
+index 83daf8a..083891e 100644
+--- a/libguile/script.c
++++ b/libguile/script.c
+@@ -387,7 +387,7 @@ locale_arguments_to_string_list (int argc, char **const argv)
+ SCM lst;
+ const char *encoding;
+
+- encoding = environ_locale_charset ();
++ encoding = "UTF-8";
+ for (i = argc - 1, lst = SCM_EOL;
+ i >= 0;
+ i--)
+diff --git a/libguile/strings.c b/libguile/strings.c
+index 5d0db23..8266247 100644
+--- a/libguile/strings.c
++++ b/libguile/strings.c
+@@ -1576,7 +1576,7 @@ scm_from_locale_string (const char *str)
+ SCM
+ scm_from_locale_stringn (const char *str, size_t len)
+ {
+- return scm_from_stringn (str, len, locale_charset (),
++ return scm_from_stringn (str, len, "UTF-8",
+ scm_i_default_port_conversion_handler ());
+ }
+
+@@ -1803,7 +1803,7 @@ char *
+ scm_to_locale_stringn (SCM str, size_t *lenp)
+ {
+ return scm_to_stringn (str, lenp,
+- locale_charset (),
++ "UTF-8",
+ scm_i_default_port_conversion_handler ());
+ }
+
+@@ -2054,7 +2054,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
+ "string contains #\\nul character: ~S",
+ scm_list_1 (str));
+
+- if (scm_i_is_narrow_string (str) && (encoding == NULL))
++ if (scm_i_is_narrow_string (str))
+ {
+ /* If using native Latin-1 encoding, just copy the string
+ contents. */
+@@ -2079,11 +2079,11 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
+ len = 0;
+ enc = encoding;
+ if (enc == NULL)
+- enc = "ISO-8859-1";
++ enc = "UTF-8";
+ if (scm_i_is_narrow_string (str))
+ {
+ ret = mem_iconveh (scm_i_string_chars (str), ilen,
+- "ISO-8859-1", enc,
++ "UTF-8", enc,
+ (enum iconv_ilseq_handler) handler, NULL,
+ &buf, &len);
+
diff --git a/distro/packages/patches/guile-relocatable.patch b/distro/packages/patches/guile-relocatable.patch
new file mode 100644
index 0000000000..077394cdde
--- /dev/null
+++ b/distro/packages/patches/guile-relocatable.patch
@@ -0,0 +1,70 @@
+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
+index af2ca45..19dd338 100644
+--- a/libguile/load.c
++++ b/libguile/load.c
+@@ -26,6 +26,7 @@
+
+ #include <string.h>
+ #include <stdio.h>
++#include <libgen.h>
+
+ #include "libguile/_scm.h"
+ #include "libguile/private-gc.h" /* scm_getenv_int */
+@@ -255,6 +256,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/2.0");
++
++ ccache_dir = scm_gc_malloc_pointerless (strlen (prefix) + 50, "string");
++ strcpy (ccache_dir, prefix);
++ strcat (ccache_dir, "/lib/guile/2.0/ccache");
++
+ env = getenv ("GUILE_SYSTEM_PATH");
+ if (env && strcmp (env, "") == 0)
+ /* special-case interpret system-path=="" as meaning no system path instead
+@@ -263,10 +290,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_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 = getenv ("GUILE_SYSTEM_COMPILED_PATH");
+ if (env && strcmp (env, "") == 0)
+@@ -276,8 +300,7 @@ scm_init_load_path ()
+ cpath = scm_parse_path (scm_from_locale_string (env), cpath);
+ else
+ {
+- 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 */
diff --git a/distro/packages/patches/libtool-skip-tests.patch b/distro/packages/patches/libtool-skip-tests.patch
new file mode 100644
index 0000000000..6e12615d51
--- /dev/null
+++ b/distro/packages/patches/libtool-skip-tests.patch
@@ -0,0 +1,37 @@
+Because our GCC `lib' spec automatically adds `-rpath' for each `-L'
+and a couple more `-rpath, there are two test failures:
+demo-hardcode.test, and destdir.at. Disable these.
+
+--- libtool-2.4.2/Makefile.in 2011-10-17 12:18:55.000000000 +0200
++++ libtool-2.4.2/Makefile.in 2012-09-13 23:50:37.000000000 +0200
+@@ -909,7 +908,7 @@ COMMON_TESTS = \
+ # but they depend on the other tests being run beforehand.
+ INTERACTIVE_TESTS = tests/demo-shared.test tests/demo-shared-make.test \
+ tests/demo-shared-exec.test tests/demo-shared-inst.test \
+- tests/demo-hardcode.test tests/demo-relink.test \
++ tests/demo-relink.test \
+ tests/demo-noinst-link.test tests/demo-shared-unst.test \
+ tests/depdemo-shared.test tests/depdemo-shared-make.test \
+ tests/depdemo-shared-exec.test tests/depdemo-shared-inst.test \
+@@ -2580,8 +2579,7 @@ tests/cdemo-static-make.log: tests/cdemo
+
+ tests/demo-shared-unst.log: tests/demo-noinst-link.log
+ tests/demo-noinst-link.log: tests/demo-relink.log
+-tests/demo-relink.log: tests/demo-hardcode.log
+-tests/demo-hardcode.log: tests/demo-shared-inst.log
++tests/demo-relink.log: tests/demo-shared-inst.log
+ tests/demo-shared-inst.log: tests/demo-shared-exec.log
+ tests/demo-shared-exec.log: tests/demo-shared-make.log
+ tests/demo-shared-make.log: tests/demo-shared.log
+
+--- libtool-2.4.2/tests/testsuite 2011-10-17 12:19:52.000000000 +0200
++++ libtool-2.4.2/tests/testsuite 2012-09-14 00:28:45.000000000 +0200
+@@ -14443,6 +14443,6 @@ read at_status <"$at_status_file"
+ #AT_START_69
+ at_fn_group_banner 69 'destdir.at:75' \
+ "DESTDIR with in-package deplibs" " " 4
+-at_xfail=no
++at_xfail=yes
+ eval `$LIBTOOL --config | grep '^fast_install='`
+ case $fast_install in no) :;; *) false;; esac && at_xfail=yes
+
diff --git a/distro/packages/patches/m4-gets-undeclared.patch b/distro/packages/patches/m4-gets-undeclared.patch
new file mode 100644
index 0000000000..d28f0cdcc4
--- /dev/null
+++ b/distro/packages/patches/m4-gets-undeclared.patch
@@ -0,0 +1,45 @@
+This patch is needed to allow builds with newer versions of
+the GNU libc (2.16+).
+
+The upstream fix was:
+
+ commit 66712c23388e93e5c518ebc8515140fa0c807348
+ Author: Eric Blake <eblake@redhat.com>
+ Date: Thu Mar 29 13:30:41 2012 -0600
+
+ stdio: don't assume gets any more
+
+ Gnulib intentionally does not have a gets module, and now that C11
+ and glibc have dropped it, we should be more proactive about warning
+ any user on a platform that still has a declaration of this dangerous
+ interface.
+
+ * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
+ support.
+ * modules/stdio (Makefile.am): Likewise.
+ * lib/stdio-read.c (gets): Likewise.
+ * tests/test-stdio-c++.cc: Likewise.
+ * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
+ * lib/stdio.in.h (gets): Make warning occur in more places.
+ * doc/posix-functions/gets.texi (gets): Update documentation.
+ Reported by Christer Solskogen.
+
+ Signed-off-by: Eric Blake <eblake@redhat.com>
+
+This patch just gets rid of the offending part.
+
+--- m4-1.4.16/lib/stdio.in.h.orig 2012-09-01 01:05:36.000000000 +0200
++++ m4-1.4.16/lib/stdio.in.h 2012-09-01 01:05:42.000000000 +0200
+@@ -158,12 +158,6 @@ _GL_WARN_ON_USE (fflush, "fflush is not
+ "use gnulib module fflush for portable POSIX compliance");
+ #endif
+
+-/* It is very rare that the developer ever has full control of stdin,
+- so any use of gets warrants an unconditional warning. Assume it is
+- always declared, since it is required by C89. */
+-#undef gets
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+-
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
+ # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/distro/packages/patches/m4-readlink-EINVAL.patch b/distro/packages/patches/m4-readlink-EINVAL.patch
new file mode 100644
index 0000000000..dd371584a7
--- /dev/null
+++ b/distro/packages/patches/m4-readlink-EINVAL.patch
@@ -0,0 +1,18 @@
+Newer Linux kernels would return EINVAL instead of ENOENT.
+The patch below, taken from Gnulib, allows the test to pass when
+these Linux versions are in use:
+https://lists.gnu.org/archive/html/bug-gnulib/2011-03/msg00308.html .
+
+diff --git a/tests/test-readlink.h b/tests/test-readlink.h
+index 08d5662..7247fc4 100644
+--- a/tests/test-readlink.h
++++ b/tests/test-readlink.h
+@@ -38,7 +38,7 @@ test_readlink (ssize_t (*func) (char const *, char *, size_t), bool print)
+ ASSERT (errno == ENOENT);
+ errno = 0;
+ ASSERT (func ("", buf, sizeof buf) == -1);
+- ASSERT (errno == ENOENT);
++ ASSERT (errno == ENOENT || errno == EINVAL);
+ errno = 0;
+ ASSERT (func (".", buf, sizeof buf) == -1);
+ ASSERT (errno == EINVAL);
diff --git a/distro/packages/patches/m4-s_isdir.patch b/distro/packages/patches/m4-s_isdir.patch
new file mode 100644
index 0000000000..a009a4ba44
--- /dev/null
+++ b/distro/packages/patches/m4-s_isdir.patch
@@ -0,0 +1,14 @@
+Fails to build with glibc 2.12.1 without this patch.
+
+http://lists.gnu.org/archive/html/bug-m4/2010-05/msg00002.html
+
+--- a/src/path.c
++++ b/src/path.c
+@@ -22,6 +22,7 @@
+ /* Handling of path search of included files via the builtins "include"
+ and "sinclude". */
+
+ #include "m4.h"
++#include "sys/stat.h"
+
+ struct includes
diff --git a/distro/packages/patches/make-impure-dirs.patch b/distro/packages/patches/make-impure-dirs.patch
new file mode 100644
index 0000000000..83a5fbe3a5
--- /dev/null
+++ b/distro/packages/patches/make-impure-dirs.patch
@@ -0,0 +1,40 @@
+Purity: don't look for library dependencies (of the form `-lfoo') in
+/lib and /usr/lib. Likewise, when searching for included Makefiles,
+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
+***************
+*** 99,107 ****
+--- 99,109 ----
+ #endif
+ INCLUDEDIR,
+ #ifndef _AMIGA
++ #if 0
+ "/usr/gnu/include",
+ "/usr/local/include",
+ "/usr/include",
++ #endif
+ #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
+***************
+*** 1452,1460 ****
+--- 1452,1462 ----
+ static char *dirs[] =
+ {
+ #ifndef _AMIGA
++ #if 0
+ "/lib",
+ "/usr/lib",
+ #endif
++ #endif
+ #if defined(WINDOWS32) && !defined(LIBDIR)
+ /*
+ * This is completely up to the user at product install time. Just define
diff --git a/distro/packages/patches/perl-no-sys-dirs.patch b/distro/packages/patches/perl-no-sys-dirs.patch
new file mode 100644
index 0000000000..3aba4d7529
--- /dev/null
+++ b/distro/packages/patches/perl-no-sys-dirs.patch
@@ -0,0 +1,156 @@
+Don't long for headers and libraries in "traditional" locations.
+
+Patch from Nixpkgs by Eelco Dolstra <eelco.dolstra@logicblox.com>.
+
+diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
+--- perl-5.14.2-orig/Configure 2011-09-26 11:44:34.000000000 +0200
++++ perl-5.14.2/Configure 2012-01-20 17:05:23.089223129 +0100
+@@ -106,15 +106,7 @@
+ fi
+
+ : Proper PATH setting
+-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
+-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
+-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
+-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
+-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
+-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
+-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
+-paths="$paths /sbin /usr/sbin /usr/libexec"
+-paths="$paths /system/gnu_library/bin"
++paths=''
+
+ for p in $paths
+ do
+@@ -1311,8 +1303,7 @@
+ archname=''
+ : Possible local include directories to search.
+ : Set locincpth to "" in a hint file to defeat local include searches.
+-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
+-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
++locincpth=""
+ :
+ : no include file wanted by default
+ inclwanted=''
+@@ -1328,17 +1319,12 @@
+ archobjs=''
+ libnames=''
+ : change the next line if compiling for Xenix/286 on Xenix/386
+-xlibpth='/usr/lib/386 /lib/386'
++xlibpth=''
+ : Possible local library directories to search.
+-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
+-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
++loclibpth=""
+
+ : general looking path for locating libraries
+-glibpth="/lib /usr/lib $xlibpth"
+-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
+-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
+-test -f /shlib/libc.so && glibpth="/shlib $glibpth"
+-test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
++glibpth=""
+
+ : Private path used by Configure to find libraries. Its value
+ : is prepended to libpth. This variable takes care of special
+@@ -1371,8 +1357,6 @@
+ libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
+-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
+-glibpth="/usr/shlib $glibpth"
+ : Do not use vfork unless overridden by a hint file.
+ usevfork=false
+
+@@ -2380,7 +2364,6 @@
+ zip
+ "
+ pth=`echo $PATH | sed -e "s/$p_/ /g"`
+-pth="$pth /lib /usr/lib"
+ for file in $loclist; do
+ eval xxx=\$$file
+ case "$xxx" in
+@@ -4785,7 +4768,7 @@
+ : Set private lib path
+ case "$plibpth" in
+ '') if ./mips; then
+- plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
++ plibpth="$incpath/usr/lib"
+ fi;;
+ esac
+ case "$libpth" in
+@@ -8390,13 +8373,8 @@
+ echo " "
+ case "$sysman" in
+ '')
+- syspath='/usr/share/man/man1 /usr/man/man1'
+- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
+- syspath="$syspath /usr/man/u_man/man1"
+- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
+- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
+- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
+- sysman=`./loc . /usr/man/man1 $syspath`
++ syspath=''
++ sysman=''
+ ;;
+ esac
+ if $test -d "$sysman"; then
+@@ -19721,9 +19699,10 @@
+ case "$full_ar" in
+ '') full_ar=$ar ;;
+ esac
++full_ar=ar
+
+ : Store the full pathname to the sed program for use in the C program
+-full_sed=$sed
++full_sed=sed
+
+ : see what type gids are declared as in the kernel
+ echo " "
+diff -ru -x '*~' perl-5.14.2-orig/ext/Errno/Errno_pm.PL perl-5.14.2/ext/Errno/Errno_pm.PL
+--- perl-5.14.2-orig/ext/Errno/Errno_pm.PL 2011-09-26 11:44:34.000000000 +0200
++++ perl-5.14.2/ext/Errno/Errno_pm.PL 2012-01-20 17:02:07.938138311 +0100
+@@ -137,11 +137,7 @@
+ if ($dep =~ /(\S+errno\.h)/) {
+ $file{$1} = 1;
+ }
+- } elsif ($^O eq 'linux' &&
+- $Config{gccversion} ne '' &&
+- $Config{gccversion} !~ /intel/i
+- # might be using, say, Intel's icc
+- ) {
++ } elsif (0) {
+ # Some Linuxes have weird errno.hs which generate
+ # no #file or #line directives
+ my $linux_errno_h = -e '/usr/include/errno.h' ?
+diff -ru -x '*~' perl-5.14.2-orig/hints/freebsd.sh perl-5.14.2/hints/freebsd.sh
+--- perl-5.14.2-orig/hints/freebsd.sh 2011-09-19 15:18:22.000000000 +0200
++++ perl-5.14.2/hints/freebsd.sh 2012-01-20 17:10:37.267924044 +0100
+@@ -118,21 +118,21 @@
+ objformat=`/usr/bin/objformat`
+ if [ x$objformat = xaout ]; then
+ if [ -e /usr/lib/aout ]; then
+- libpth="/usr/lib/aout /usr/local/lib /usr/lib"
+- glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
++ libpth=""
++ glibpth=""
+ fi
+ lddlflags='-Bshareable'
+ else
+- libpth="/usr/lib /usr/local/lib"
+- glibpth="/usr/lib /usr/local/lib"
++ libpth=""
++ glibpth=""
+ ldflags="-Wl,-E "
+ lddlflags="-shared "
+ fi
+ cccdlflags='-DPIC -fPIC'
+ ;;
+ *)
+- libpth="/usr/lib /usr/local/lib"
+- glibpth="/usr/lib /usr/local/lib"
++ libpth=""
++ glibpth=""
+ ldflags="-Wl,-E "
+ lddlflags="-shared "
+ cccdlflags='-DPIC -fPIC'
diff --git a/distro/packages/patches/readline-link-ncurses.patch b/distro/packages/patches/readline-link-ncurses.patch
new file mode 100644
index 0000000000..0fd0598f46
--- /dev/null
+++ b/distro/packages/patches/readline-link-ncurses.patch
@@ -0,0 +1,18 @@
+This patch is to make sure that `libncurses' is among the `NEEDED'
+dependencies of `libreadline.so' and `libhistory.so'.
+
+Failing to do that, applications linking against Readline are
+forced to explicitly link against libncurses as well; in addition,
+this trick doesn't work when using GNU ld's `--as-needed'.
+
+--- shlib/Makefile.in 2009-01-06 18:03:22.000000000 +0100
++++ shlib/Makefile.in 2009-07-27 14:43:25.000000000 +0200
+@@ -84,7 +84,7 @@ SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
+ SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
+ SHOBJ_LIBS = @SHOBJ_LIBS@
+
+-SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@
++SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@ -lncurses
+ SHLIB_LIBS = @SHLIB_LIBS@
+
+ SHLIB_DOT = @SHLIB_DOT@
diff --git a/distro/packages/patches/tar-gets-undeclared.patch b/distro/packages/patches/tar-gets-undeclared.patch
new file mode 100644
index 0000000000..301a09dde1
--- /dev/null
+++ b/distro/packages/patches/tar-gets-undeclared.patch
@@ -0,0 +1,26 @@
+This patch is needed to allow builds with newer versions of
+the GNU libc (2.16+).
+
+This is a backport of this patch:
+
+commit 66712c23388e93e5c518ebc8515140fa0c807348
+Author: Eric Blake <eblake@redhat.com>
+Date: Thu Mar 29 13:30:41 2012 -0600
+
+ stdio: don't assume gets any more
+
+--- tar-1.26/gnu/stdio.in.h 2012-07-02 14:28:45.000000000 +0200
++++ tar-1.26/gnu/stdio.in.h 2012-07-02 14:28:50.000000000 +0200
+@@ -160,12 +160,6 @@ _GL_WARN_ON_USE (fflush, "fflush is not
+ "use gnulib module fflush for portable POSIX compliance");
+ #endif
+
+-/* It is very rare that the developer ever has full control of stdin,
+- so any use of gets warrants an unconditional warning. Assume it is
+- always declared, since it is required by C89. */
+-#undef gets
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+-
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
+ # if !(defined __cplusplus && defined GNULIB_NAMESPACE)