summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/audacity-fix-ffmpeg-binding.patch32
-rw-r--r--gnu/packages/patches/bitlbee-configure-doc-fix.patch15
-rw-r--r--gnu/packages/patches/calibre-no-updates-dialog.patch18
-rw-r--r--gnu/packages/patches/cmake-fix-tests.patch40
-rw-r--r--gnu/packages/patches/curl-gss-api-fix.patch38
-rw-r--r--gnu/packages/patches/elfutils-tests-ptrace.patch64
-rw-r--r--gnu/packages/patches/emacs-exec-path.patch18
-rw-r--r--gnu/packages/patches/fltk-shared-lib-defines.patch51
-rw-r--r--gnu/packages/patches/fuse-CVE-2015-3202.patch65
-rw-r--r--gnu/packages/patches/gcc-5.0-libvtv-runpath.patch15
-rw-r--r--gnu/packages/patches/gcc-arm-link-spec-fix.patch16
-rw-r--r--gnu/packages/patches/gcc-libvtv-runpath.patch15
-rw-r--r--gnu/packages/patches/geoclue-config.patch25
-rw-r--r--gnu/packages/patches/ghostscript-runpath.patch17
-rw-r--r--gnu/packages/patches/gitolite-openssh-6.8-compat.patch25
-rw-r--r--gnu/packages/patches/gnutls-fix-duplicate-manpages.patch30
-rw-r--r--gnu/packages/patches/gobject-introspection-cc.patch25
-rw-r--r--gnu/packages/patches/gstreamer-0.10-bison3.patch32
-rw-r--r--gnu/packages/patches/gstreamer-0.10-silly-test.patch14
-rw-r--r--gnu/packages/patches/guix-test-networking.patch15
-rw-r--r--gnu/packages/patches/hop-linker-flags.patch60
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-0797.patch35
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2708-pt1.patch240
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2708-pt2.patch284
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2708-pt3.patch228
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2708-pt4.patch26
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2710-pt1.patch199
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2710-pt2.patch64
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2710-pt3.patch50
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2713-pt1.patch102
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2713-pt2.patch47
-rw-r--r--gnu/packages/patches/icecat-CVE-2015-2716.patch62
-rw-r--r--gnu/packages/patches/librep-rules.mk.patch30
-rw-r--r--gnu/packages/patches/libtool-skip-tests2.patch (renamed from gnu/packages/patches/libtool-skip-tests.patch)24
-rw-r--r--gnu/packages/patches/lirc-localstatedir.patch13
-rw-r--r--gnu/packages/patches/mplayer2-theora-fix.patch286
-rw-r--r--gnu/packages/patches/openssl-runpath.patch15
-rw-r--r--gnu/packages/patches/perl-gd-options-passthrough-and-fontconfig.patch53
-rw-r--r--gnu/packages/patches/perl-module-pluggable-search.patch25
-rw-r--r--gnu/packages/patches/perl-net-amazon-s3-moose-warning.patch17
-rw-r--r--gnu/packages/patches/portaudio-audacity-compat.patch324
-rw-r--r--gnu/packages/patches/pulseaudio-longer-test-timeout.patch13
-rw-r--r--gnu/packages/patches/pycairo-wscript.patch31
-rw-r--r--gnu/packages/patches/python-fix-tests.patch53
-rw-r--r--gnu/packages/patches/python-sqlite-3.8.4-test-fix.patch15
-rw-r--r--gnu/packages/patches/qemu-CVE-2015-3456.patch85
-rw-r--r--gnu/packages/patches/qt4-ldflags.patch18
-rw-r--r--gnu/packages/patches/qt5-conflicting-typedefs.patch70
-rw-r--r--gnu/packages/patches/qt5-runpath.patch25
-rw-r--r--gnu/packages/patches/r-fix-15899.patch17
-rw-r--r--gnu/packages/patches/rsem-makefile.patch682
-rw-r--r--gnu/packages/patches/serf-comment-style-fix.patch23
-rw-r--r--gnu/packages/patches/serf-deflate-buckets-test-fix.patch69
-rw-r--r--gnu/packages/patches/source-highlight-regexrange-test.patch15
-rw-r--r--gnu/packages/patches/subversion-sqlite-3.8.9-fix.patch59
-rw-r--r--gnu/packages/patches/tvtime-gcc41.patch58
-rw-r--r--gnu/packages/patches/tvtime-pngoutput.patch15
-rw-r--r--gnu/packages/patches/tvtime-videodev2.patch15
-rw-r--r--gnu/packages/patches/tvtime-xmltv.patch28
-rw-r--r--gnu/packages/patches/udev-gir-libtool.patch17
-rw-r--r--gnu/packages/patches/upower-builddir.patch44
-rw-r--r--gnu/packages/patches/webkitgtk-2.4.8-gmutexlocker.patch289
-rw-r--r--gnu/packages/patches/wicd-template-instantiation.patch29
-rw-r--r--gnu/packages/patches/wpa-supplicant-2015-2-fix.patch51
-rw-r--r--gnu/packages/patches/wpa-supplicant-2015-3-fix.patch43
-rw-r--r--gnu/packages/patches/wpa-supplicant-2015-4-fix-pt1.patch75
-rw-r--r--gnu/packages/patches/wpa-supplicant-2015-4-fix-pt2.patch68
-rw-r--r--gnu/packages/patches/wpa-supplicant-2015-4-fix-pt3.patch54
-rw-r--r--gnu/packages/patches/wpa-supplicant-2015-4-fix-pt4.patch52
-rw-r--r--gnu/packages/patches/wpa-supplicant-2015-4-fix-pt5.patch34
-rw-r--r--gnu/packages/patches/wpa-supplicant-CVE-2015-1863.patch42
-rw-r--r--gnu/packages/patches/xf86-video-sis-fix-exa-crash.patch45
72 files changed, 4654 insertions, 234 deletions
diff --git a/gnu/packages/patches/audacity-fix-ffmpeg-binding.patch b/gnu/packages/patches/audacity-fix-ffmpeg-binding.patch
new file mode 100644
index 0000000000..d6d65338d9
--- /dev/null
+++ b/gnu/packages/patches/audacity-fix-ffmpeg-binding.patch
@@ -0,0 +1,32 @@
+This resolves some "declaration of C function conflicts with previous
+declaration" errors during compilation.
+
+--- a/src/FFmpeg.h	2015-02-21 00:33:33.853857529 +0100
++++ b/src/FFmpeg.h	2015-02-21 00:35:09.626497205 +0100
+@@ -688,7 +688,7 @@
+    FFMPEG_FUNCTION_WITH_RETURN(
+       AVOutputFormat*,
+       av_oformat_next,
+-      (AVOutputFormat *f),
++      (const AVOutputFormat *f),
+       (f)
+    );
+    FFMPEG_FUNCTION_WITH_RETURN(
+@@ -755,7 +755,7 @@
+    FFMPEG_FUNCTION_WITH_RETURN(
+       int,
+       av_fifo_size,
+-      (AVFifoBuffer *f),
++      (const AVFifoBuffer *f),
+       (f)
+    );
+    FFMPEG_FUNCTION_WITH_RETURN(
+@@ -801,7 +801,7 @@
+    FFMPEG_FUNCTION_WITH_RETURN(
+       AVDictionaryEntry *,
+       av_dict_get,
+-      (AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags),
++      (const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags),
+       (m, key, prev, flags)
+    );
+    FFMPEG_FUNCTION_WITH_RETURN(
diff --git a/gnu/packages/patches/bitlbee-configure-doc-fix.patch b/gnu/packages/patches/bitlbee-configure-doc-fix.patch
new file mode 100644
index 0000000000..ade0b7f25c
--- /dev/null
+++ b/gnu/packages/patches/bitlbee-configure-doc-fix.patch
@@ -0,0 +1,15 @@
+Fix the check for the prebuilt helpfile when xsltproc is not available.
+
+--- bitlbee-3.4/configure.orig	2015-03-25 18:09:10.000000000 -0400
++++ bitlbee-3.4/configure	2015-05-20 14:51:33.627975970 -0400
+@@ -650,8 +650,8 @@
+ 
+ if [ "$doc" = "1" ]; then
+ 	if [ ! -e doc/user-guide/help.txt ] && \
+-	     ! type xmlto > /dev/null 2> /dev/null || \
+-	     ! type xsltproc > /dev/null 2> /dev/null
++	     (! type xmlto > /dev/null 2> /dev/null || \
++	      ! type xsltproc > /dev/null 2> /dev/null)
+ 	then
+ 		echo
+ 		echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.'
diff --git a/gnu/packages/patches/calibre-no-updates-dialog.patch b/gnu/packages/patches/calibre-no-updates-dialog.patch
new file mode 100644
index 0000000000..1d8d79660e
--- /dev/null
+++ b/gnu/packages/patches/calibre-no-updates-dialog.patch
@@ -0,0 +1,18 @@
+Taken from debian.
+
+# Description: Disable update check by default.
+Index: calibre/src/calibre/gui2/main.py
+===================================================================
+--- calibre.orig/src/calibre/gui2/main.py	2014-02-02 10:41:28.470954623 +0100
++++ calibre/src/calibre/gui2/main.py	2014-02-02 10:41:56.546954247 +0100
+@@ -37,8 +37,8 @@
+                       help=_('Start minimized to system tray.'))
+     parser.add_option('-v', '--verbose', default=0, action='count',
+                       help=_('Ignored, do not use. Present only for legacy reasons'))
+-    parser.add_option('--no-update-check', default=False, action='store_true',
+-            help=_('Do not check for updates'))
++    parser.add_option('--update-check', dest='no_update_check', default=True, action='store_false',
++            help=_('Check for updates'))
+     parser.add_option('--ignore-plugins', default=False, action='store_true',
+             help=_('Ignore custom plugins, useful if you installed a plugin'
+                 ' that is preventing calibre from starting'))
diff --git a/gnu/packages/patches/cmake-fix-tests.patch b/gnu/packages/patches/cmake-fix-tests.patch
index 5327f3749a..f59e2cd625 100644
--- a/gnu/packages/patches/cmake-fix-tests.patch
+++ b/gnu/packages/patches/cmake-fix-tests.patch
@@ -1,6 +1,23 @@
---- a/Tests/CMakeLists.txt	2013-03-20 22:57:13.000000000 +0100
-+++ b/Tests/CMakeLists.txt	2013-03-20 22:58:02.000000000 +0100
-@@ -1706,16 +1706,17 @@
+--- cmake-3.2.2.orig/Tests/CMakeLists.txt	2015-04-14 01:09:00.000000000 +0800
++++ cmake-3.2.2/Tests/CMakeLists.txt	2015-04-28 15:02:34.913039742 +0800
+@@ -342,10 +342,12 @@
+   endif()
+ 
+   # run test for BundleUtilities on supported platforms/compilers
+-  if(MSVC OR
+-     MINGW OR
+-     CMAKE_SYSTEM_NAME MATCHES "Linux" OR
+-     CMAKE_SYSTEM_NAME MATCHES "Darwin")
++#  if(MSVC OR
++#     MINGW OR
++#     CMAKE_SYSTEM_NAME MATCHES "Linux" OR
++#     CMAKE_SYSTEM_NAME MATCHES "Darwin")
++# This test fails on Guix: skip it.
++  if(FALSE)
+   if(NOT "${CMAKE_GENERATOR}" STREQUAL "Watcom WMake")
+ 
+     add_test(BundleUtilities ${CMAKE_CTEST_COMMAND}
+@@ -2257,16 +2259,17 @@
      PASS_REGULAR_EXPRESSION "Could not find executable"
      FAIL_REGULAR_EXPRESSION "SegFault")
  
@@ -27,19 +44,4 @@
 +#    PASS_REGULAR_EXPRESSION "Upload\\.xml")
  
    configure_file(
-     "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in"
---- a/Utilities/cmcurl/CMakeLists.txt	2013-03-20 22:57:13.000000000 +0100
-+++ b/Utilities/cmcurl/CMakeLists.txt	2013-03-20 23:08:41.000000000 +0100
-@@ -729,8 +729,9 @@
- ADD_EXECUTABLE(LIBCURL Testing/curltest.c)
- TARGET_LINK_LIBRARIES(LIBCURL cmcurl ${CMAKE_DL_LIBS})
- 
--IF(CMAKE_CURL_TEST_URL)
--  ADD_TEST(curl LIBCURL ${CMAKE_CURL_TEST_URL})
--ENDIF(CMAKE_CURL_TEST_URL)
-+# This test requires network connectivity: skip it.
-+#IF(CMAKE_CURL_TEST_URL)
-+#  ADD_TEST(curl LIBCURL ${CMAKE_CURL_TEST_URL})
-+#ENDIF(CMAKE_CURL_TEST_URL)
- 
- INSTALL(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmcurl)
+     "${CMake_SOURCE_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake.in"
diff --git a/gnu/packages/patches/curl-gss-api-fix.patch b/gnu/packages/patches/curl-gss-api-fix.patch
deleted file mode 100644
index ea838ae8c7..0000000000
--- a/gnu/packages/patches/curl-gss-api-fix.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-Copied from upstream:
-https://github.com/bagder/curl/commit/5c0e66d63214e0306197c5a3f162441e074f3401.patch
-
-From 5c0e66d63214e0306197c5a3f162441e074f3401 Mon Sep 17 00:00:00 2001
-From: Steve Holme <steve_holme@hotmail.com>
-Date: Thu, 8 Jan 2015 19:23:53 +0000
-Subject: [PATCH] sasl_gssapi: Fixed build on NetBSD with built-in GSS-API
-
-Bug: http://curl.haxx.se/bug/view.cgi?id=1469
-Reported-by: Thomas Klausner
----
- lib/curl_sasl_gssapi.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/lib/curl_sasl_gssapi.c b/lib/curl_sasl_gssapi.c
-index 6dda0e9..a50646a 100644
---- a/lib/curl_sasl_gssapi.c
-+++ b/lib/curl_sasl_gssapi.c
-@@ -6,6 +6,7 @@
-  *                             \___|\___/|_| \_\_____|
-  *
-  * Copyright (C) 2014, Steve Holme, <steve_holme@hotmail.com>.
-+ * Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
-  *
-  * This software is licensed as described in the file COPYING, which
-  * you should have received as part of this distribution. The terms
-@@ -126,7 +127,7 @@ CURLcode Curl_sasl_create_gssapi_user_message(struct SessionHandle *data,
- 
-     /* Import the SPN */
-     gss_major_status = gss_import_name(&gss_minor_status, &spn_token,
--                                       gss_nt_service_name, &krb5->spn);
-+                                       GSS_C_NT_HOSTBASED_SERVICE, &krb5->spn);
-     if(GSS_ERROR(gss_major_status)) {
-       Curl_gss_log_error(data, gss_minor_status, "gss_import_name() failed: ");
- 
--- 
-2.2.1
-
diff --git a/gnu/packages/patches/elfutils-tests-ptrace.patch b/gnu/packages/patches/elfutils-tests-ptrace.patch
new file mode 100644
index 0000000000..cd46999063
--- /dev/null
+++ b/gnu/packages/patches/elfutils-tests-ptrace.patch
@@ -0,0 +1,64 @@
+This patch allows us to skip tests that require PTRACE_ATTACH in situations
+where PTRACE_ATTACH is only allowed when CAP_SYS_PTRACE is held (i.e., for
+root, by default.)
+
+Reported at <https://bugzilla.redhat.com/show_bug.cgi?id=1210966>.
+
+--- elfutils-0.161/tests/run-deleted.sh	2015-04-11 16:38:33.028556235 +0200
++++ elfutils-0.161/tests/run-deleted.sh	2015-04-11 16:46:15.012442185 +0200
+@@ -17,6 +17,15 @@
+ 
+ . $srcdir/backtrace-subr.sh
+ 
++# Check whether the Yama policy allows us to use PTRACE_ATTACH.
++if [ -f /proc/sys/kernel/yama/ptrace_scope ]
++then
++    if [ `cat /proc/sys/kernel/yama/ptrace_scope` -ne 0 ]
++    then
++	exit 77
++    fi
++fi
++
+ tempfiles deleted deleted-lib.so
+ cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so .
+ 
+--- elfutils-0.161/tests/vdsosyms.c	2015-04-11 16:40:20.633461110 +0200
++++ elfutils-0.161/tests/vdsosyms.c	2015-04-11 16:45:06.611866677 +0200
+@@ -23,6 +23,8 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #include <unistd.h>
+ #include ELFUTILS_HEADER(dwfl)
+ 
+@@ -68,6 +70,7 @@ module_callback (Dwfl_Module *mod, void
+ int
+ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
+ {
++  static const char ptrace_scope_file[] = "/proc/sys/kernel/yama/ptrace_scope";
+   static char *debuginfo_path;
+   static const Dwfl_Callbacks proc_callbacks =
+     {
+@@ -76,6 +79,20 @@ main (int argc __attribute__ ((unused)),
+ 
+       .find_elf = dwfl_linux_proc_find_elf,
+     };
++
++  /* Check whether the Yama policy allows us to use PTRACE_ATTACH.  */
++  int ptrace_scope = open (ptrace_scope_file, O_RDONLY);
++  if (ptrace_scope >= 0)
++    {
++      char buf[10];
++      int count = read (ptrace_scope, buf, sizeof buf);
++      assert (count > 0);
++      if (buf[0] != '0')
++	/* We're not allowed, so skip this test.  */
++	return 77;
++      close (ptrace_scope);
++    }
++
+   Dwfl *dwfl = dwfl_begin (&proc_callbacks);
+   if (dwfl == NULL)
+     error (2, 0, "dwfl_begin: %s", dwfl_errmsg (-1));
diff --git a/gnu/packages/patches/emacs-exec-path.patch b/gnu/packages/patches/emacs-exec-path.patch
new file mode 100644
index 0000000000..884fa94a64
--- /dev/null
+++ b/gnu/packages/patches/emacs-exec-path.patch
@@ -0,0 +1,18 @@
+Do not capture the build-time value of $PATH in the 'emacs' executable
+since this can noticeably increase the size of the closure of Emacs
+with things like GCC being referenced.
+
+--- a/lisp/loadup.el
++++ b/lisp/loadup.el
+@@ -64,6 +64,11 @@
+ 			    (expand-file-name "textmodes" dir)
+ 			    (expand-file-name "vc" dir)))))
+ 
++;; Reset 'exec-path' so we don't capture the build-time $PATH in the
++;; 'emacs' executable.
++(setq-default exec-path nil)
++(setq exec-path nil)
++
+ (if (eq t purify-flag)
+     ;; Hash consing saved around 11% of pure space in my tests.
+     (setq purify-flag (make-hash-table :test 'equal :size 70000)))
diff --git a/gnu/packages/patches/fltk-shared-lib-defines.patch b/gnu/packages/patches/fltk-shared-lib-defines.patch
new file mode 100644
index 0000000000..d36a50ff5e
--- /dev/null
+++ b/gnu/packages/patches/fltk-shared-lib-defines.patch
@@ -0,0 +1,51 @@
+This patch from upstream revision 10588.
+
+--- fltk-1.3.3/src/Xutf8.h
++++ fltk-1.3.3/src/Xutf8.h
+@@ -25,6 +25,7 @@
+ #include <X11/Xlib.h>
+ #include <X11/Xlocale.h>
+ #include <X11/Xutil.h>
++#include <FL/Fl_Export.H>
+ 
+ typedef struct {
+ 	int nb_font;
+@@ -98,8 +99,8 @@
+ 	XUtf8FontStruct  *font_set,
+ 	unsigned int            ucs);
+ 
+-int
+-XGetUtf8FontAndGlyph(
++FL_EXPORT int
++fl_XGetUtf8FontAndGlyph(
+         XUtf8FontStruct  *font_set,
+         unsigned int            ucs,
+         XFontStruct     **fnt,
+--- fltk-1.3.3/src/gl_draw.cxx
++++ fltk-1.3.3/src/gl_draw.cxx
+@@ -114,7 +114,7 @@
+   for (int i = 0; i < 0x400; i++) {
+     XFontStruct *font = NULL;
+     unsigned short id;
+-    XGetUtf8FontAndGlyph(gl_fontsize->font, ii, &font, &id);
++    fl_XGetUtf8FontAndGlyph(gl_fontsize->font, ii, &font, &id);
+     if (font) glXUseXFont(font->fid, id, 1, gl_fontsize->listbase+ii);
+     ii++;
+    }
+--- fltk-1.3.3/src/xutf8/utf8Wrap.c
++++ fltk-1.3.3/src/xutf8/utf8Wrap.c
+@@ -816,10 +816,10 @@
+ /**  get the X font and glyph ID of a UCS char                              **/
+ /*****************************************************************************/
+ int
+-XGetUtf8FontAndGlyph(XUtf8FontStruct  *font_set,
+-		     unsigned int     ucs,
+-		     XFontStruct      **fnt,
+-		     unsigned short   *id) {
++fl_XGetUtf8FontAndGlyph(XUtf8FontStruct  *font_set,
++			unsigned int     ucs,
++			XFontStruct      **fnt,
++			unsigned short   *id) {
+ 
+   /* int             x; */
+   int             *encodings; /* encodings array */
diff --git a/gnu/packages/patches/fuse-CVE-2015-3202.patch b/gnu/packages/patches/fuse-CVE-2015-3202.patch
new file mode 100644
index 0000000000..7c64de7683
--- /dev/null
+++ b/gnu/packages/patches/fuse-CVE-2015-3202.patch
@@ -0,0 +1,65 @@
+The following patch was copied from Debian.
+
+Description: Fix CVE-2015-3202
+ Missing scrubbing of the environment before executing a mount or umount
+ of a filesystem.
+Origin: upstream
+Author: Miklos Szeredi <miklos@szeredi.hu>
+Last-Update: 2015-05-19
+
+---
+ lib/mount_util.c |   23 +++++++++++++++++------
+ 1 file changed, 17 insertions(+), 6 deletions(-)
+
+--- a/lib/mount_util.c
++++ b/lib/mount_util.c
+@@ -95,10 +95,12 @@ static int add_mount(const char *prognam
+ 		goto out_restore;
+ 	}
+ 	if (res == 0) {
++		char *env = NULL;
++
+ 		sigprocmask(SIG_SETMASK, &oldmask, NULL);
+ 		setuid(geteuid());
+-		execl("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
+-		      "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
++		execle("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
++		       "-f", "-t", type, "-o", opts, fsname, mnt, NULL, &env);
+ 		fprintf(stderr, "%s: failed to execute /bin/mount: %s\n",
+ 			progname, strerror(errno));
+ 		exit(1);
+@@ -146,10 +148,17 @@ static int exec_umount(const char *progn
+ 		goto out_restore;
+ 	}
+ 	if (res == 0) {
++		char *env = NULL;
++
+ 		sigprocmask(SIG_SETMASK, &oldmask, NULL);
+ 		setuid(geteuid());
+-		execl("/bin/umount", "/bin/umount", "-i", rel_mnt,
+-		      lazy ? "-l" : NULL, NULL);
++		if (lazy) {
++			execle("/bin/umount", "/bin/umount", "-i", rel_mnt,
++			       "-l", NULL, &env);
++		} else {
++			execle("/bin/umount", "/bin/umount", "-i", rel_mnt,
++			       NULL, &env);
++		}
+ 		fprintf(stderr, "%s: failed to execute /bin/umount: %s\n",
+ 			progname, strerror(errno));
+ 		exit(1);
+@@ -205,10 +214,12 @@ static int remove_mount(const char *prog
+ 		goto out_restore;
+ 	}
+ 	if (res == 0) {
++		char *env = NULL;
++
+ 		sigprocmask(SIG_SETMASK, &oldmask, NULL);
+ 		setuid(geteuid());
+-		execl("/bin/umount", "/bin/umount", "--no-canonicalize", "-i",
+-		      "--fake", mnt, NULL);
++		execle("/bin/umount", "/bin/umount", "--no-canonicalize", "-i",
++		       "--fake", mnt, NULL, &env);
+ 		fprintf(stderr, "%s: failed to execute /bin/umount: %s\n",
+ 			progname, strerror(errno));
+ 		exit(1);
diff --git a/gnu/packages/patches/gcc-5.0-libvtv-runpath.patch b/gnu/packages/patches/gcc-5.0-libvtv-runpath.patch
new file mode 100644
index 0000000000..9a9bc5ca53
--- /dev/null
+++ b/gnu/packages/patches/gcc-5.0-libvtv-runpath.patch
@@ -0,0 +1,15 @@
+GCC 4.9 and later have libvtv and, just like libstdc++ (see
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354), it doesn't
+have $libdir in its RUNPATH, but it NEEDs libgcc_s.  This patch
+fixes that.
+
+--- gcc-5.1.0/libvtv/Makefile.in	2014-10-30 09:28:58.000000000 +0100
++++ gcc-5.1.0/libvtv/Makefile.in	2015-04-30 09:51:04.161129705 +0200
+@@ -15,6 +15,7 @@
+ 
+ @SET_MAKE@
+ 
++libvtv_la_LDFLAGS = -Wl,-rpath=$(libdir)
+ 
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/gnu/packages/patches/gcc-arm-link-spec-fix.patch b/gnu/packages/patches/gcc-arm-link-spec-fix.patch
new file mode 100644
index 0000000000..0ffe8a1810
--- /dev/null
+++ b/gnu/packages/patches/gcc-arm-link-spec-fix.patch
@@ -0,0 +1,16 @@
+Do not pass -dynamic-linker to linker when !shared.
+Fixes <http://bugs.gnu.org/20102>.
+
+Patch by Ludovic Courtès <ludo@gnu.org>.
+
+--- gcc-4.8.4/gcc/config/arm/linux-elf.h.orig	2015-04-08 20:31:20.376900478 +0200
++++ gcc-4.8.4/gcc/config/arm/linux-elf.h	2015-04-08 20:31:36.437014437 +0200
+@@ -65,7 +65,7 @@
+    %{symbolic:-Bsymbolic} \
+    %{!static: \
+      %{rdynamic:-export-dynamic} \
+-     -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
++     %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
+    -X \
+    %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
+    SUBTARGET_EXTRA_LINK_SPEC
diff --git a/gnu/packages/patches/gcc-libvtv-runpath.patch b/gnu/packages/patches/gcc-libvtv-runpath.patch
new file mode 100644
index 0000000000..df74363c83
--- /dev/null
+++ b/gnu/packages/patches/gcc-libvtv-runpath.patch
@@ -0,0 +1,15 @@
+GCC 4.9 and later have libvtv and, just like libstdc++ (see
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354), it doesn't
+have $libdir in its RUNPATH, but it NEEDs libgcc_s.  This patch
+fixes that.
+
+--- gcc-4.9.2/libvtv/Makefile.in	2014-10-30 09:28:58.000000000 +0100
++++ gcc-4.9.2/libvtv/Makefile.in	2015-04-30 09:51:04.161129705 +0200
+@@ -15,6 +15,7 @@
+ 
+ @SET_MAKE@
+ 
++AM_LDFLAGS = -Wl,-rpath=$(libdir)
+ 
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/gnu/packages/patches/geoclue-config.patch b/gnu/packages/patches/geoclue-config.patch
new file mode 100644
index 0000000000..dd35b90be5
--- /dev/null
+++ b/gnu/packages/patches/geoclue-config.patch
@@ -0,0 +1,25 @@
+Allow the configuration file to be specified via an environment variable.
+
+--- geoclue-2.1.10/src/gclue-config.c	2015-04-07 09:50:07.721074380 +0200
++++ geoclue-2.1.10/src/gclue-config.c	2015-04-07 10:27:26.613171960 +0200
+@@ -235,6 +235,11 @@
+ gclue_config_init (GClueConfig *config)
+ {
+         GError *error = NULL;
++	const char *config_file_path;
++
++	config_file_path = g_getenv ("GEOCLUE_CONFIG_FILE");
++	if (config_file_path == NULL)
++	  config_file_path = CONFIG_FILE_PATH;
+ 
+         config->priv =
+                 G_TYPE_INSTANCE_GET_PRIVATE (config,
+@@ -242,7 +247,7 @@
+                                             GClueConfigPrivate);
+         config->priv->key_file = g_key_file_new ();
+         g_key_file_load_from_file (config->priv->key_file,
+-                                   CONFIG_FILE_PATH,
++                                   config_file_path,
+                                    0,
+                                    &error);
+         if (error != NULL) {
diff --git a/gnu/packages/patches/ghostscript-runpath.patch b/gnu/packages/patches/ghostscript-runpath.patch
new file mode 100644
index 0000000000..c7dcfd4529
--- /dev/null
+++ b/gnu/packages/patches/ghostscript-runpath.patch
@@ -0,0 +1,17 @@
+This patch adds $(libdir) to the RUNPATH of 'gsc' and 'gsx'.
+
+--- gnu-ghostscript-9.14.0/base/unix-dll.mak	2015-04-05 15:12:45.386957927 +0200
++++ gnu-ghostscript-9.14.0/base/unix-dll.mak	2015-04-05 15:12:49.222982359 +0200
+@@ -91,11 +91,11 @@ $(GS_SO_MAJOR): $(GS_SO_MAJOR_MINOR)
+ # Build the small Ghostscript loaders, with Gtk+ and without
+ $(GSSOC_XE): $(GS_SO) $(PSSRC)$(SOC_LOADER)
+ 	$(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c \
+-	-L$(BINDIR) -l$(GS_SO_BASE)
++	-L$(BINDIR) -l$(GS_SO_BASE) -Wl,-rpath=$(libdir)
+ 
+ $(GSSOX_XE): $(GS_SO) $(PSSRC)$(SOC_LOADER)
+ 	$(GLCC) -g $(SOC_CFLAGS) -o $(GSSOX_XE) $(PSSRC)$(SOC_LOADER) \
+-	-L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS)
++	-L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS) -Wl,-rpath=$(libdir)
+ 
+ # ------------------------- Recursive make targets ------------------------- #
diff --git a/gnu/packages/patches/gitolite-openssh-6.8-compat.patch b/gnu/packages/patches/gitolite-openssh-6.8-compat.patch
new file mode 100644
index 0000000000..d7fc2e6b12
--- /dev/null
+++ b/gnu/packages/patches/gitolite-openssh-6.8-compat.patch
@@ -0,0 +1,25 @@
+From ed807a40c6683960e357bc995b3acf721ec088b4 Mon Sep 17 00:00:00 2001
+From: Sitaram Chamarty <sitaram@atc.tcs.com>
+Date: Thu, 19 Mar 2015 05:17:59 +0530
+Subject: [PATCH] openssh 6.8 compat
+
+---
+ src/triggers/post-compile/ssh-authkeys | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/triggers/post-compile/ssh-authkeys b/src/triggers/post-compile/ssh-authkeys
+index 84dda73..d5f5d8b 100755
+--- a/src/triggers/post-compile/ssh-authkeys
++++ b/src/triggers/post-compile/ssh-authkeys
+@@ -115,7 +115,7 @@ sub fp_file {
+     my $f  = shift;
+     my $fp = `ssh-keygen -l -f '$f'`;
+     chomp($fp);
+-    _die "fingerprinting failed for '$f'" unless $fp =~ /([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f])+)/;
++    _die "fingerprinting failed for '$f'" unless $fp =~ /([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f])+)/ or $fp =~ m(SHA256:([A-ZA-z0-9+/]+));
+     $fp = $1;
+     return $fp;
+ }
+--
+2.2.1
+
diff --git a/gnu/packages/patches/gnutls-fix-duplicate-manpages.patch b/gnu/packages/patches/gnutls-fix-duplicate-manpages.patch
new file mode 100644
index 0000000000..95a25560e5
--- /dev/null
+++ b/gnu/packages/patches/gnutls-fix-duplicate-manpages.patch
@@ -0,0 +1,30 @@
+Remove duplicate manpage entries from Makefile.
+
+--- gnutls-3.4.0/doc/manpages/Makefile.am.orig	2015-04-06 04:48:30.000000000 -0400
++++ gnutls-3.4.0/doc/manpages/Makefile.am	2015-04-12 16:52:58.029694525 -0400
+@@ -134,11 +134,8 @@
+ APIMANS += gnutls_certificate_get_peers_subkey_id.3
+ APIMANS += gnutls_certificate_get_trust_list.3
+ APIMANS += gnutls_certificate_get_verify_flags.3
+-APIMANS += gnutls_certificate_get_verify_flags.3
+-APIMANS += gnutls_certificate_get_x509_crt.3
+ APIMANS += gnutls_certificate_get_x509_crt.3
+ APIMANS += gnutls_certificate_get_x509_key.3
+-APIMANS += gnutls_certificate_get_x509_key.3
+ APIMANS += gnutls_certificate_send_x509_rdn_sequence.3
+ APIMANS += gnutls_certificate_server_set_request.3
+ APIMANS += gnutls_certificate_set_dh_params.3
+--- gnutls-3.4.0/doc/manpages/Makefile.in.orig	2015-04-08 02:08:30.000000000 -0400
++++ gnutls-3.4.0/doc/manpages/Makefile.in	2015-04-12 16:53:13.319694530 -0400
+@@ -1275,11 +1275,8 @@
+ 	gnutls_certificate_get_peers_subkey_id.3 \
+ 	gnutls_certificate_get_trust_list.3 \
+ 	gnutls_certificate_get_verify_flags.3 \
+-	gnutls_certificate_get_verify_flags.3 \
+-	gnutls_certificate_get_x509_crt.3 \
+ 	gnutls_certificate_get_x509_crt.3 \
+ 	gnutls_certificate_get_x509_key.3 \
+-	gnutls_certificate_get_x509_key.3 \
+ 	gnutls_certificate_send_x509_rdn_sequence.3 \
+ 	gnutls_certificate_server_set_request.3 \
+ 	gnutls_certificate_set_dh_params.3 \
diff --git a/gnu/packages/patches/gobject-introspection-cc.patch b/gnu/packages/patches/gobject-introspection-cc.patch
index 38b919a746..d9cacf4ca7 100644
--- a/gnu/packages/patches/gobject-introspection-cc.patch
+++ b/gnu/packages/patches/gobject-introspection-cc.patch
@@ -1,14 +1,11 @@
---- a/giscanner/sourcescanner.py	2013-12-15 23:03:54.002937000 +0100
-+++ b/giscanner/sourcescanner.py	2013-12-15 23:04:50.322937000 +0100
-@@ -277,6 +277,11 @@
-         defines = ['__GI_SCANNER__']
-         undefs = []
-         cpp_args = os.environ.get('CC', 'cc').split()  # support CC="ccache gcc"
-+        if (cpp_args == ['cc'] and
-+            not any(map(lambda x: os.access(os.path.join(x, 'cc'), os.X_OK),
-+                        os.environ.get('PATH').split(':')))):
-+            cpp_args = ['GUIX_GCC_PATH']
-+
-         if 'cl' in cpp_args:
-             # The Microsoft compiler/preprocessor (cl) does not accept
-             # source input from stdin (the '-' flag), so we need
+Use gcc as the default C compiler if CC is not set.
+
+
+--- gobject-introspection-1.44.0.orig/giscanner/__init__.py	2014-08-04 22:37:07.000000000 +0800
++++ gobject-introspection-1.44.0/giscanner/__init__.py	2015-04-20 17:30:26.507697234 +0800
+@@ -22,3 +22,5 @@
+ builddir = os.environ.get('UNINSTALLED_INTROSPECTION_BUILDDIR')
+ if builddir is not None:
+     __path__.append(os.path.join(builddir, 'giscanner'))
++if not 'CC' in os.environ:
++    os.environ['CC'] = 'gcc'
diff --git a/gnu/packages/patches/gstreamer-0.10-bison3.patch b/gnu/packages/patches/gstreamer-0.10-bison3.patch
deleted file mode 100644
index f6eb90cb02..0000000000
--- a/gnu/packages/patches/gstreamer-0.10-bison3.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-See https://bugzilla.gnome.org/show_bug.cgi?id=706462
-
-Subject: [PATCH] Make grammar.y work with Bison 3
-
-YYLEX_PARAM is no longer supported in Bison 3.
----
- gst/parse/grammar.y | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y
-index 8a9019c..f533389 100644
---- a/gst/parse/grammar.y
-+++ b/gst/parse/grammar.y
-@@ -26,7 +26,6 @@
-  */
- 
- #define YYERROR_VERBOSE 1
--#define YYLEX_PARAM scanner
- 
- #define YYENABLE_NLS 0
- 
-@@ -659,6 +658,7 @@ static int yyerror (void *scanner, graph_t *graph, const char *s);
- %right '.'
- %left '!' '='
- 
-+%lex-param { void *scanner }
- %parse-param { void *scanner }
- %parse-param { graph_t *graph }
- %pure-parser
--- 
-1.8.3.4
-
diff --git a/gnu/packages/patches/gstreamer-0.10-silly-test.patch b/gnu/packages/patches/gstreamer-0.10-silly-test.patch
deleted file mode 100644
index 678dd7b122..0000000000
--- a/gnu/packages/patches/gstreamer-0.10-silly-test.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-See http://lists.freedesktop.org/archives/gstreamer-bugs/2013-January/098461.html
-
-diff -ru gstreamer-0.10.36.orig/tests/check/Makefile.in gstreamer-0.10.36/tests/check/Makefile.in
---- gstreamer-0.10.36.orig/tests/check/Makefile.in	2012-02-20 23:48:29.000000000 +0100
-+++ gstreamer-0.10.36/tests/check/Makefile.in	2013-10-30 21:55:48.000000000 +0100
-@@ -42,7 +42,7 @@
- 	gst/gstbus$(EXEEXT) gst/gstcaps$(EXEEXT) $(am__EXEEXT_2) \
- 	gst/gstdatetime$(EXEEXT) gst/gstinfo$(EXEEXT) \
- 	gst/gstiterator$(EXEEXT) gst/gstmessage$(EXEEXT) \
--	gst/gstminiobject$(EXEEXT) gst/gstobject$(EXEEXT) \
-+	gst/gstminiobject$(EXEEXT) \
- 	gst/gstpad$(EXEEXT) gst/gstparamspecs$(EXEEXT) \
- 	gst/gstpoll$(EXEEXT) gst/gstsegment$(EXEEXT) \
- 	gst/gstsystemclock$(EXEEXT) gst/gstclock$(EXEEXT) \
diff --git a/gnu/packages/patches/guix-test-networking.patch b/gnu/packages/patches/guix-test-networking.patch
deleted file mode 100644
index a8d1f4fd2f..0000000000
--- a/gnu/packages/patches/guix-test-networking.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Skip that test when the network is unreachable.
-
-diff --git a/tests/packages.scm b/tests/packages.scm
-index 04e3b0b..6ac215b 100644
---- a/tests/packages.scm
-+++ b/tests/packages.scm
-@@ -139,6 +139,8 @@
-     (and (direct-store-path? source)
-          (string-suffix? "utils.scm" source))))
- 
-+(unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))
-+  (test-skip 1))
- (test-equal "package-source-derivation, snippet"
-   "OK"
-   (let* ((file   (search-bootstrap-binary "guile-2.0.9.tar.xz"
diff --git a/gnu/packages/patches/hop-linker-flags.patch b/gnu/packages/patches/hop-linker-flags.patch
new file mode 100644
index 0000000000..f1f5dbfbd9
--- /dev/null
+++ b/gnu/packages/patches/hop-linker-flags.patch
@@ -0,0 +1,60 @@
+Make hop's link rules honor flags set by the --blflags configure argument.
+
+--- hop-2.4.0/src/Makefile	2015-05-05 19:41:04.800151036 -0500
++++ hop-2.4.0/src/Makefile	2015-05-05 19:40:40.916150417 -0500
+@@ -69,10 +69,10 @@
+ 	$(MAKE) link.$(LINK) DEST=$@
+ 
+ link.dynamic:
+-	@ $(call link,$(BIGLOO),$(BCFLAGS),$(BCFLAGSDEV),$(OBJECTS),-o,$(DEST))
++	@ $(call link,$(BIGLOO),$(BCFLAGS) $(BLFLAGS),$(BCFLAGSDEV),$(OBJECTS),-o,$(DEST))
+ 
+ link.static:
+-	@ $(call link,$(BIGLOO),$(BCFLAGS),$(BCFLAGSDEV),-static-all-bigloo $(OBJECTS),-o,$(DEST))
++	@ $(call link,$(BIGLOO),$(BCFLAGS) $(BLFLAGS),$(BCFLAGSDEV),-static-all-bigloo $(OBJECTS),-o,$(DEST))
+ 
+ link.library:
+ 	echo "***ERROR: link.library not currently supported!"
+--- hop-2.4.0/hopc/Makefile	2013-01-30 07:17:59.000000000 -0600
++++ hop-2.4.0/hopc/Makefile	2015-05-05 19:45:21.876157699 -0500
+@@ -62,7 +62,7 @@
+ 	mkdir -p $@
+ 
+ $(BUILDBINDIR)/$(EXEC): .afile .etags $(OBJECTS)
+-	@ $(call link,$(BIGLOO),$(BCFLAGS),,$(OBJECTS),-o,$@)
++	@ $(call link,$(BIGLOO),$(BCFLAGS) $(BLFLAGS),$(BCFLAGSDEV),$(OBJECTS),-o,$@)
+ 
+ $(BUILDBINDIR)/$(EXEC).jar: .afile .etags .jfile $(BGL_CLASSES) META-INF/MANIFEST.MF jvm-stdlibs jvm-share jvm-lib
+ 	$(JAR) $@ META-INF/MANIFEST.MF -C o/class_s .
+--- hop-2.4.0/hophz/Makefile	2013-01-30 07:17:59.000000000 -0600
++++ hop-2.4.0/hophz/Makefile	2015-05-05 19:59:42.996180030 -0500
+@@ -16,9 +16,6 @@
+ -include ../etc/Makefile.hopconfig
+ -include ../etc/Makefile.version
+ 
+-BLFLAGS		= 
+-BLINKFLAGS 	= -suffix hop
+-
+ #*---------------------------------------------------------------------*/
+ #*    Target and Project                                               */
+ #*---------------------------------------------------------------------*/
+@@ -72,7 +69,7 @@
+ 	mkdir -p $@
+ 
+ $(BUILDBINDIR)/$(EXEC): .afile .etags $(OBJECTS)
+-	@ $(call link,$(BIGLOO),$(BCFLAGS),$(BLINKFLAGS),$(OBJECTS),-o,$@)
++	@ $(call link,$(BIGLOO),$(BCFLAGS) $(BLFLAGS),$(BCFLAGSDEV),$(OBJECTS),-o,$@)
+ 
+ $(BUILDBINDIR)/$(EXEC).jar: .afile .etags .jfile $(BGL_CLASSES) META-INF/MANIFEST.MF jvm-stdlibs jvm-share jvm-lib
+ 	@ $(JAR) $@ META-INF/MANIFEST.MF -C o/class_s .
+--- hop-2.4.0/hopsh/Makefile	2013-01-30 07:17:59.000000000 -0600
++++ hop-2.4.0/hopsh/Makefile	2015-05-05 19:46:36.060159626 -0500
+@@ -60,7 +60,7 @@
+ 	mkdir -p $@
+ 
+ $(BUILDBINDIR)/$(EXEC): .afile .etags $(OBJECTS)
+-	@ $(call link,$(BIGLOO),$(BCFLAGS),$(BCFLAGSDEV),$(OBJECTS),-o,$@)
++	@ $(call link,$(BIGLOO),$(BCFLAGS) $(BLFLAGS),$(BCFLAGSDEV),$(OBJECTS),-o,$@)
+ 
+ $(BUILDBINDIR)/$(EXEC).jar: .afile .etags .jfile $(BGL_CLASSES) META-INF/MANIFEST.MF jvm-stdlibs jvm-share jvm-lib
+ 	@ $(JAR) $@ META-INF/MANIFEST.MF -C o/class_s .
diff --git a/gnu/packages/patches/icecat-CVE-2015-0797.patch b/gnu/packages/patches/icecat-CVE-2015-0797.patch
new file mode 100644
index 0000000000..5727ed753c
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-0797.patch
@@ -0,0 +1,35 @@
+From 147543038273042f71284fa8487c71670163da5f Mon Sep 17 00:00:00 2001
+From: Ralph Giles <giles@mozilla.com>
+Date: Tue, 31 Mar 2015 16:18:22 -0700
+Subject: [PATCH] Bug 1080995 - Don't use the h264parser gstreamer element.
+ r=kinetik, a=sledru
+
+---
+ content/media/gstreamer/GStreamerFormatHelper.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/content/media/gstreamer/GStreamerFormatHelper.cpp b/content/media/gstreamer/GStreamerFormatHelper.cpp
+index 25095e7..ebd12c2 100644
+--- a/content/media/gstreamer/GStreamerFormatHelper.cpp
++++ b/content/media/gstreamer/GStreamerFormatHelper.cpp
+@@ -67,6 +67,7 @@ static char const * const sDefaultCodecCaps[][2] = {
+ 
+ static char const * const sPluginBlacklist[] = {
+   "flump3dec",
++  "h264parse",
+ };
+ 
+ GStreamerFormatHelper::GStreamerFormatHelper()
+@@ -251,7 +252,8 @@ static gboolean FactoryFilter(GstPluginFeature *aFeature, gpointer)
+   const gchar *className =
+     gst_element_factory_get_klass(GST_ELEMENT_FACTORY_CAST(aFeature));
+ 
+-  if (!strstr(className, "Decoder") && !strstr(className, "Demux")) {
++  if (!strstr(className, "Decoder") && !strstr(className, "Demux") &&
++      !strstr(className, "Parser")) {
+     return FALSE;
+   }
+ 
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2708-pt1.patch b/gnu/packages/patches/icecat-CVE-2015-2708-pt1.patch
new file mode 100644
index 0000000000..e755d7531a
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2708-pt1.patch
@@ -0,0 +1,240 @@
+From 5f61ae17ec82d288a3fe4892ec999c0e20c486c0 Mon Sep 17 00:00:00 2001
+From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
+Date: Mon, 6 Apr 2015 11:52:28 -0700
+Subject: [PATCH] Bug 1151139 - Simplify how we choose which streams to gather
+ stats from. r=mt, a=abillings
+
+---
+ ...t_peerConnection_offerRequiresReceiveAudio.html |  2 +
+ ...t_peerConnection_offerRequiresReceiveVideo.html |  2 +
+ ...rConnection_offerRequiresReceiveVideoAudio.html |  2 +
+ media/mtransport/nricectx.h                        | 13 +++++
+ media/mtransport/nricemediastream.cpp              |  1 +
+ media/mtransport/nricemediastream.h                |  5 +-
+ .../src/peerconnection/PeerConnectionImpl.cpp      | 66 ++++++++++------------
+ .../src/peerconnection/PeerConnectionImpl.h        |  2 +-
+ 8 files changed, 54 insertions(+), 39 deletions(-)
+
+diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
+index 69d7e49..d68c078 100644
+--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
++++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
+@@ -17,6 +17,8 @@
+ 
+   runTest(function() {
+     var test = new PeerConnectionTest();
++    test.chain.remove('PC_LOCAL_CHECK_STATS');
++    test.chain.remove('PC_REMOTE_CHECK_STATS');
+     test.setOfferConstraints({ mandatory: { OfferToReceiveAudio: true } });
+     test.run();
+   });
+diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
+index 5f1d0e5..0ecb0b7 100644
+--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
++++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
+@@ -17,6 +17,8 @@
+ 
+   runTest(function() {
+     var test = new PeerConnectionTest();
++    test.chain.remove('PC_LOCAL_CHECK_STATS');
++    test.chain.remove('PC_REMOTE_CHECK_STATS');
+     test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true } });
+     test.run();
+   });
+diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
+index c3dea10..78eb0d4 100644
+--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
++++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
+@@ -17,6 +17,8 @@
+ 
+   runTest(function() {
+     var test = new PeerConnectionTest();
++    test.chain.remove('PC_LOCAL_CHECK_STATS');
++    test.chain.remove('PC_REMOTE_CHECK_STATS');
+     test.setOfferConstraints({ mandatory: {
+       OfferToReceiveVideo: true,
+       OfferToReceiveAudio: true
+diff --git a/media/mtransport/nricectx.h b/media/mtransport/nricectx.h
+index d1209a7..7350666 100644
+--- a/media/mtransport/nricectx.h
++++ b/media/mtransport/nricectx.h
+@@ -196,6 +196,19 @@ class NrIceCtx {
+   RefPtr<NrIceMediaStream> CreateStream(const std::string& name,
+                                                  int components);
+ 
++  RefPtr<NrIceMediaStream> GetStream(size_t index) {
++    if (index < streams_.size()) {
++      return streams_[index];
++    }
++    return nullptr;
++  }
++
++  // Some might be null
++  size_t GetStreamCount() const
++  {
++    return streams_.size();
++  }
++
+   // The name of the ctx
+   const std::string& name() const { return name_; }
+ 
+diff --git a/media/mtransport/nricemediastream.cpp b/media/mtransport/nricemediastream.cpp
+index 9e96cb5..d2b6429 100644
+--- a/media/mtransport/nricemediastream.cpp
++++ b/media/mtransport/nricemediastream.cpp
+@@ -209,6 +209,7 @@ nsresult NrIceMediaStream::ParseAttributes(std::vector<std::string>&
+     return NS_ERROR_FAILURE;
+   }
+ 
++  has_parsed_attrs_ = true;
+   return NS_OK;
+ }
+ 
+diff --git a/media/mtransport/nricemediastream.h b/media/mtransport/nricemediastream.h
+index aba5fc3..2494ecf 100644
+--- a/media/mtransport/nricemediastream.h
++++ b/media/mtransport/nricemediastream.h
+@@ -149,6 +149,7 @@ class NrIceMediaStream {
+ 
+   // Parse remote attributes
+   nsresult ParseAttributes(std::vector<std::string>& candidates);
++  bool HasParsedAttributes() const { return has_parsed_attrs_; }
+ 
+   // Parse trickle ICE candidate
+   nsresult ParseTrickleCandidate(const std::string& candidate);
+@@ -204,7 +205,8 @@ class NrIceMediaStream {
+       name_(name),
+       components_(components),
+       stream_(nullptr),
+-      opaque_(nullptr) {}
++      opaque_(nullptr),
++      has_parsed_attrs_(false) {}
+ 
+   DISALLOW_COPY_ASSIGN(NrIceMediaStream);
+ 
+@@ -214,6 +216,7 @@ class NrIceMediaStream {
+   const int components_;
+   nr_ice_media_stream *stream_;
+   ScopedDeletePtr<NrIceOpaque> opaque_;
++  bool has_parsed_attrs_;
+ };
+ 
+ 
+diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+index ebcc17d..c70e3e4 100644
+--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
++++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+@@ -149,7 +149,8 @@ PRLogModuleInfo *signalingLogInfo() {
+ namespace sipcc {
+ 
+ #ifdef MOZILLA_INTERNAL_API
+-RTCStatsQuery::RTCStatsQuery(bool internal) : internalStats(internal) {
++RTCStatsQuery::RTCStatsQuery(bool internal) : internalStats(internal),
++  grabAllLevels(false) {
+ }
+ 
+ RTCStatsQuery::~RTCStatsQuery() {
+@@ -2037,32 +2038,8 @@ PeerConnectionImpl::BuildStatsQuery_m(
+ 
+   query->iceCtx = mMedia->ice_ctx();
+ 
+-  // From the list of MediaPipelines, determine the set of NrIceMediaStreams
+-  // we are interested in.
+-  std::set<size_t> levelsToGrab;
+-  if (trackId) {
+-    for (size_t p = 0; p < query->pipelines.Length(); ++p) {
+-      size_t level = query->pipelines[p]->level();
+-      MOZ_ASSERT(level);
+-      levelsToGrab.insert(level);
+-    }
+-  } else {
+-    // We want to grab all streams, so ignore the pipelines (this also ends up
+-    // grabbing DataChannel streams, which is what we want)
+-    for (size_t s = 0; s < mMedia->num_ice_media_streams(); ++s) {
+-      levelsToGrab.insert(s + 1); // mIceStreams is 0-indexed
+-    }
+-  }
+-
+-  for (auto s = levelsToGrab.begin(); s != levelsToGrab.end(); ++s) {
+-    // TODO(bcampen@mozilla.com): I may need to revisit this for bundle.
+-    // (Bug 786234)
+-    RefPtr<NrIceMediaStream> temp(mMedia->ice_media_stream(*s - 1));
+-    RefPtr<TransportFlow> flow(mMedia->GetTransportFlow(*s, false));
+-    // flow can be null for unused levels, such as unused DataChannels
+-    if (temp && flow) {
+-      query->streams.AppendElement(temp);
+-    }
++  if (!trackId) {
++    query->grabAllLevels = true;
+   }
+ 
+   return rv;
+@@ -2103,6 +2080,9 @@ static void RecordIceStats_s(
+     bool internalStats,
+     DOMHighResTimeStamp now,
+     RTCStatsReportInternal* report) {
++  if (!mediaStream.HasParsedAttributes()) {
++    return;
++  }
+ 
+   NS_ConvertASCIItoUTF16 componentId(mediaStream.name().c_str());
+   if (internalStats) {
+@@ -2292,20 +2272,32 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
+         break;
+       }
+     }
++
++    if (!query->grabAllLevels) {
++      // If we're grabbing all levels, that means we want datachannels too,
++      // which don't have pipelines.
++      if (query->iceCtx->GetStream(p - 1)) {
++        RecordIceStats_s(*query->iceCtx->GetStream(p - 1),
++                         query->internalStats,
++                         query->now,
++                         &(query->report));
++      }
++    }
+   }
+ 
+-  // Gather stats from ICE
+-  for (size_t s = 0; s != query->streams.Length(); ++s) {
+-    RecordIceStats_s(*query->streams[s],
+-                     query->internalStats,
+-                     query->now,
+-                     &(query->report));
++  if (query->grabAllLevels) {
++    for (size_t i = 0; i < query->iceCtx->GetStreamCount(); ++i) {
++      if (query->iceCtx->GetStream(i)) {
++        RecordIceStats_s(*query->iceCtx->GetStream(i),
++                         query->internalStats,
++                         query->now,
++                         &(query->report));
++      }
++    }
+   }
+ 
+-  // NrIceCtx and NrIceMediaStream must be destroyed on STS, so it is not safe
+-  // to dispatch them back to main.
+-  // We clear streams first to maintain destruction order
+-  query->streams.Clear();
++  // NrIceCtx must be destroyed on STS, so it is not safe
++  // to dispatch it back to main.
+   query->iceCtx = nullptr;
+   return NS_OK;
+ }
+diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+index 847085c..497230a 100644
+--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
++++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+@@ -174,7 +174,7 @@ class RTCStatsQuery {
+     bool internalStats;
+     nsTArray<mozilla::RefPtr<mozilla::MediaPipeline>> pipelines;
+     mozilla::RefPtr<NrIceCtx> iceCtx;
+-    nsTArray<mozilla::RefPtr<NrIceMediaStream>> streams;
++    bool grabAllLevels;
+     DOMHighResTimeStamp now;
+ };
+ #endif // MOZILLA_INTERNAL_API
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2708-pt2.patch b/gnu/packages/patches/icecat-CVE-2015-2708-pt2.patch
new file mode 100644
index 0000000000..9788806557
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2708-pt2.patch
@@ -0,0 +1,284 @@
+From 272c1ba11fac7a9ceede2f4f737bb27b4bbcad71 Mon Sep 17 00:00:00 2001
+From: Steve Fink <sfink@mozilla.com>
+Date: Thu, 19 Mar 2015 20:50:57 -0700
+Subject: [PATCH] Bug 1120655 - Suppress zone/compartment collection while
+ iterating. r=terrence, a=bkerensa
+
+---
+ js/src/gc/Zone.h      |  9 ++++----
+ js/src/jsgc.cpp       | 57 +++++++++++++++++++++++++++++++++++----------------
+ js/src/jsgc.h         | 11 +++++++++-
+ js/src/vm/Runtime.cpp |  1 +
+ js/src/vm/Runtime.h   |  3 +++
+ 5 files changed, 58 insertions(+), 23 deletions(-)
+
+diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h
+index e7f687a..dd058f0 100644
+--- a/js/src/gc/Zone.h
++++ b/js/src/gc/Zone.h
+@@ -353,10 +353,11 @@ enum ZoneSelector {
+ 
+ class ZonesIter {
+   private:
++    gc::AutoEnterIteration iterMarker;
+     JS::Zone **it, **end;
+ 
+   public:
+-    ZonesIter(JSRuntime *rt, ZoneSelector selector) {
++    ZonesIter(JSRuntime *rt, ZoneSelector selector) : iterMarker(rt) {
+         it = rt->zones.begin();
+         end = rt->zones.end();
+ 
+@@ -427,13 +428,13 @@ struct CompartmentsInZoneIter
+ template<class ZonesIterT>
+ class CompartmentsIterT
+ {
+-  private:
++    gc::AutoEnterIteration iterMarker;
+     ZonesIterT zone;
+     mozilla::Maybe<CompartmentsInZoneIter> comp;
+ 
+   public:
+     explicit CompartmentsIterT(JSRuntime *rt)
+-      : zone(rt)
++      : iterMarker(rt), zone(rt)
+     {
+         if (zone.done())
+             comp.construct();
+@@ -442,7 +443,7 @@ class CompartmentsIterT
+     }
+ 
+     CompartmentsIterT(JSRuntime *rt, ZoneSelector selector)
+-      : zone(rt, selector)
++      : iterMarker(rt), zone(rt, selector)
+     {
+         if (zone.done())
+             comp.construct();
+diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp
+index 15c86c8..1dfe0ab 100644
+--- a/js/src/jsgc.cpp
++++ b/js/src/jsgc.cpp
+@@ -2525,7 +2525,7 @@ ReleaseObservedTypes(JSRuntime* rt)
+  * arbitrary compartment in the zone.
+  */
+ static void
+-SweepCompartments(FreeOp *fop, Zone *zone, bool keepAtleastOne, bool lastGC)
++SweepCompartments(FreeOp *fop, Zone *zone, bool keepAtleastOne, bool destroyingRuntime)
+ {
+     JSRuntime *rt = zone->runtimeFromMainThread();
+     JSDestroyCompartmentCallback callback = rt->destroyCompartmentCallback;
+@@ -2543,7 +2543,7 @@ SweepCompartments(FreeOp *fop, Zone *zone, bool keepAtleastOne, bool lastGC)
+          * deleted and keepAtleastOne is true.
+          */
+         bool dontDelete = read == end && !foundOne && keepAtleastOne;
+-        if ((!comp->marked && !dontDelete) || lastGC) {
++        if ((!comp->marked && !dontDelete) || destroyingRuntime) {
+             if (callback)
+                 callback(fop, comp);
+             if (comp->principals)
+@@ -2559,9 +2559,13 @@ SweepCompartments(FreeOp *fop, Zone *zone, bool keepAtleastOne, bool lastGC)
+ }
+ 
+ static void
+-SweepZones(FreeOp *fop, bool lastGC)
++SweepZones(FreeOp *fop, bool destroyingRuntime)
+ {
+     JSRuntime *rt = fop->runtime();
++    MOZ_ASSERT_IF(destroyingRuntime, rt->numActiveZoneIters == 0);
++    if (rt->numActiveZoneIters)
++        return;
++
+     JSZoneCallback callback = rt->destroyZoneCallback;
+ 
+     /* Skip the atomsCompartment zone. */
+@@ -2576,17 +2580,17 @@ SweepZones(FreeOp* fop, bool lastGC)
+ 
+         if (zone->wasGCStarted()) {
+             if ((zone->allocator.arenas.arenaListsAreEmpty() && !zone->hasMarkedCompartments()) ||
+-                lastGC)
++                destroyingRuntime)
+             {
+                 zone->allocator.arenas.checkEmptyFreeLists();
+                 if (callback)
+                     callback(zone);
+-                SweepCompartments(fop, zone, false, lastGC);
++                SweepCompartments(fop, zone, false, destroyingRuntime);
+                 JS_ASSERT(zone->compartments.empty());
+                 fop->delete_(zone);
+                 continue;
+             }
+-            SweepCompartments(fop, zone, true, lastGC);
++            SweepCompartments(fop, zone, true, destroyingRuntime);
+         }
+         *write++ = zone;
+     }
+@@ -3787,7 +3791,7 @@ EndSweepingZoneGroup(JSRuntime *rt)
+ }
+ 
+ static void
+-BeginSweepPhase(JSRuntime *rt, bool lastGC)
++BeginSweepPhase(JSRuntime *rt, bool destroyingRuntime)
+ {
+     /*
+      * Sweep phase.
+@@ -3804,7 +3808,7 @@ BeginSweepPhase(JSRuntime *rt, bool lastGC)
+     gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP);
+ 
+ #ifdef JS_THREADSAFE
+-    rt->gcSweepOnBackgroundThread = !lastGC && rt->useHelperThreads();
++    rt->gcSweepOnBackgroundThread = !destroyingRuntime && rt->useHelperThreads();
+ #endif
+ 
+ #ifdef DEBUG
+@@ -3903,12 +3907,12 @@ SweepPhase(JSRuntime *rt, SliceBudget &sliceBudget)
+ }
+ 
+ static void
+-EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool lastGC)
++EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool destroyingRuntime)
+ {
+     gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP);
+     FreeOp fop(rt, rt->gcSweepOnBackgroundThread);
+ 
+-    JS_ASSERT_IF(lastGC, !rt->gcSweepOnBackgroundThread);
++    JS_ASSERT_IF(destroyingRuntime, !rt->gcSweepOnBackgroundThread);
+ 
+     JS_ASSERT(rt->gcMarker.isDrained());
+     rt->gcMarker.stop();
+@@ -3959,8 +3963,8 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool lastGC)
+          * This removes compartments from rt->compartment, so we do it last to make
+          * sure we don't miss sweeping any compartments.
+          */
+-        if (!lastGC)
+-            SweepZones(&fop, lastGC);
++        if (!destroyingRuntime)
++            SweepZones(&fop, destroyingRuntime);
+ 
+         if (!rt->gcSweepOnBackgroundThread) {
+             /*
+@@ -4001,8 +4005,8 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool lastGC)
+         rt->freeLifoAlloc.freeAll();
+ 
+         /* Ensure the compartments get swept if it's the last GC. */
+-        if (lastGC)
+-            SweepZones(&fop, lastGC);
++        if (destroyingRuntime)
++            SweepZones(&fop, destroyingRuntime);
+     }
+ 
+     for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
+@@ -4339,7 +4343,7 @@ IncrementalCollectSlice(JSRuntime *rt,
+     AutoCopyFreeListToArenasForGC copy(rt);
+     AutoGCSlice slice(rt);
+ 
+-    bool lastGC = (reason == JS::gcreason::DESTROY_RUNTIME);
++    bool destroyingRuntime = (reason == JS::gcreason::DESTROY_RUNTIME);
+ 
+     gc::State initialState = rt->gcIncrementalState;
+ 
+@@ -4384,7 +4388,7 @@ IncrementalCollectSlice(JSRuntime *rt,
+             return;
+         }
+ 
+-        if (!lastGC)
++        if (!destroyingRuntime)
+             PushZealSelectedObjects(rt);
+ 
+         rt->gcIncrementalState = MARK;
+@@ -4426,7 +4430,7 @@ IncrementalCollectSlice(JSRuntime *rt,
+          * This runs to completion, but we don't continue if the budget is
+          * now exhasted.
+          */
+-        BeginSweepPhase(rt, lastGC);
++        BeginSweepPhase(rt, destroyingRuntime);
+         if (sliceBudget.isOverBudget())
+             break;
+ 
+@@ -4445,7 +4449,7 @@ IncrementalCollectSlice(JSRuntime *rt,
+         if (!finished)
+             break;
+ 
+-        EndSweepPhase(rt, gckind, lastGC);
++        EndSweepPhase(rt, gckind, destroyingRuntime);
+ 
+         if (rt->gcSweepOnBackgroundThread)
+             rt->gcHelperThread.startBackgroundSweep(gckind == GC_SHRINK);
+@@ -5386,3 +5390,20 @@ JS::AutoAssertNoGC::~AutoAssertNoGC()
+         MOZ_ASSERT(gcNumber == runtime->gcNumber, "GC ran inside an AutoAssertNoGC scope.");
+ }
+ #endif
++
++namespace js {
++namespace gc {
++
++AutoEnterIteration::AutoEnterIteration(JSRuntime *rt_) : rt(rt_)
++{
++    ++rt->numActiveZoneIters;
++}
++
++AutoEnterIteration::~AutoEnterIteration()
++{
++    MOZ_ASSERT(rt->numActiveZoneIters);
++    --rt->numActiveZoneIters;
++}
++
++} /* namespace gc */
++} /* namespace js */
+diff --git a/js/src/jsgc.h b/js/src/jsgc.h
+index 825cff5..ca331c0 100644
+--- a/js/src/jsgc.h
++++ b/js/src/jsgc.h
+@@ -1077,7 +1077,7 @@ MaybeVerifyBarriers(JSContext* cx, bool always = false)
+ /*
+  * Instances of this class set the |JSRuntime::suppressGC| flag for the duration
+  * that they are live. Use of this class is highly discouraged. Please carefully
+- * read the comment in jscntxt.h above |suppressGC| and take all appropriate
++ * read the comment in vm/Runtime.h above |suppressGC| and take all appropriate
+  * precautions before instantiating this class.
+  */
+ class AutoSuppressGC
+@@ -1113,6 +1113,15 @@ class AutoEnterOOMUnsafeRegion
+ class AutoEnterOOMUnsafeRegion {};
+ #endif /* DEBUG */
+ 
++/* Prevent compartments and zones from being collected during iteration. */
++class AutoEnterIteration {
++    JSRuntime *rt;
++
++  public:
++    AutoEnterIteration(JSRuntime *rt_);
++    ~AutoEnterIteration();
++};
++
+ } /* namespace gc */
+ 
+ #ifdef DEBUG
+diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp
+index bb5c8680..0d8c6cd 100644
+--- a/js/src/vm/Runtime.cpp
++++ b/js/src/vm/Runtime.cpp
+@@ -195,6 +195,7 @@ JSRuntime::JSRuntime(JSRuntime *parentRuntime, JSUseHelperThreads useHelperThrea
+     gcShouldCleanUpEverything(false),
+     gcGrayBitsValid(false),
+     gcIsNeeded(0),
++    numActiveZoneIters(0),
+     gcStats(thisFromCtor()),
+     gcNumber(0),
+     gcStartNumber(0),
+diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h
+index 5aeb924..ba4180e 100644
+--- a/js/src/vm/Runtime.h
++++ b/js/src/vm/Runtime.h
+@@ -1061,6 +1061,9 @@ struct JSRuntime : public JS::shadow::Runtime,
+      */
+     volatile uintptr_t  gcIsNeeded;
+ 
++    mozilla::Atomic<size_t, mozilla::ReleaseAcquire> numActiveZoneIters;
++    friend class js::gc::AutoEnterIteration;
++
+     js::gcstats::Statistics gcStats;
+ 
+     /* Incremented on every GC slice. */
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2708-pt3.patch b/gnu/packages/patches/icecat-CVE-2015-2708-pt3.patch
new file mode 100644
index 0000000000..f684804d0b
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2708-pt3.patch
@@ -0,0 +1,228 @@
+From 4dcbca8b3c26b451e1376cd1b7c88ab984a45b39 Mon Sep 17 00:00:00 2001
+From: Mats Palmgren <mats@mozilla.com>
+Date: Tue, 14 Apr 2015 22:12:39 -0400
+Subject: [PATCH] Bug 1143299 - Make frame insertion methods deal with
+ aPrevFrame being on an overflow list. r=roc, a=bkerensa
+
+---
+ layout/generic/nsBlockFrame.cpp        | 18 ++++++++++++---
+ layout/generic/nsBlockFrame.h          | 14 ++++++++----
+ layout/generic/nsContainerFrame.cpp    | 41 +++++++++++++++++++---------------
+ layout/tables/nsTableFrame.cpp         |  2 ++
+ layout/tables/nsTableRowFrame.cpp      |  2 ++
+ layout/tables/nsTableRowGroupFrame.cpp |  2 ++
+ 6 files changed, 54 insertions(+), 25 deletions(-)
+
+diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp
+index a011bcf..70d5297 100644
+--- a/layout/generic/nsBlockFrame.cpp
++++ b/layout/generic/nsBlockFrame.cpp
+@@ -1049,7 +1049,7 @@ nsBlockFrame::Reflow(nsPresContext*           aPresContext,
+   state.mOverflowTracker = &tracker;
+ 
+   // Drain & handle pushed floats
+-  DrainPushedFloats(state);
++  DrainPushedFloats();
+   nsOverflowAreas fcBounds;
+   nsReflowStatus fcStatus = NS_FRAME_COMPLETE;
+   ReflowPushedFloats(state, fcBounds, fcStatus);
+@@ -4438,9 +4438,13 @@ nsBlockFrame::DrainSelfOverflowList()
+  * might push some of them on).  Floats with placeholders in this block
+  * are reflowed by (nsBlockReflowState/nsLineLayout)::AddFloat, which
+  * also maintains these invariants.
++ *
++ * DrainSelfPushedFloats moves any pushed floats from this block's own
++ * PushedFloats list back into mFloats.  DrainPushedFloats additionally
++ * moves frames from its prev-in-flow's PushedFloats list into mFloats.
+  */
+ void
+-nsBlockFrame::DrainPushedFloats(nsBlockReflowState& aState)
++nsBlockFrame::DrainSelfPushedFloats()
+ {
+ #ifdef DEBUG
+   // Between when we drain pushed floats and when we complete reflow,
+@@ -4503,12 +4507,18 @@ nsBlockFrame::DrainPushedFloats(nsBlockReflowState& aState)
+       RemovePushedFloats()->Delete(presContext->PresShell());
+     }
+   }
++}
++
++void
++nsBlockFrame::DrainPushedFloats()
++{
++  DrainSelfPushedFloats();
+ 
+   // After our prev-in-flow has completed reflow, it may have a pushed
+   // floats list, containing floats that we need to own.  Take these.
+   nsBlockFrame* prevBlock = static_cast<nsBlockFrame*>(GetPrevInFlow());
+   if (prevBlock) {
+-    AutoFrameListPtr list(presContext, prevBlock->RemovePushedFloats());
++    AutoFrameListPtr list(PresContext(), prevBlock->RemovePushedFloats());
+     if (list && list->NotEmpty()) {
+       mFloats.InsertFrames(this, nullptr, *list);
+     }
+@@ -4711,6 +4721,7 @@ nsBlockFrame::AppendFrames(ChildListID  aListID,
+       return nsContainerFrame::AppendFrames(aListID, aFrameList);
+     }
+     else if (kFloatList == aListID) {
++      DrainSelfPushedFloats(); // ensure the last frame is in mFloats
+       mFloats.AppendFrames(nullptr, aFrameList);
+       return NS_OK;
+     }
+@@ -4757,6 +4768,7 @@ nsBlockFrame::InsertFrames(ChildListID aListID,
+       return nsContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
+     }
+     else if (kFloatList == aListID) {
++      DrainSelfPushedFloats(); // ensure aPrevFrame is in mFloats
+       mFloats.InsertFrames(this, aPrevFrame, aFrameList);
+       return NS_OK;
+     }
+diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h
+index 1a6bb1e..07f7508 100644
+--- a/layout/generic/nsBlockFrame.h
++++ b/layout/generic/nsBlockFrame.h
+@@ -533,10 +533,16 @@ protected:
+     return GetStateBits() & NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS;
+   }
+ 
+-  /** grab pushed floats from this block's prevInFlow, and splice
+-    * them into this block's mFloats list.
+-    */
+-  void DrainPushedFloats(nsBlockReflowState& aState);
++  /**
++   * Moves frames from our PushedFloats list back into our mFloats list.
++   */
++  void DrainSelfPushedFloats();
++
++  /**
++   * First calls DrainSelfPushedFloats() then grabs pushed floats from this
++   * block's prev-in-flow, and splice them into this block's mFloats list too.
++   */
++  void DrainPushedFloats();
+ 
+   /** Load all our floats into the float manager (without reflowing them).
+    *  Assumes float manager is in our own coordinate system.
+diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp
+index 76f0748..3ffcba7 100644
+--- a/layout/generic/nsContainerFrame.cpp
++++ b/layout/generic/nsContainerFrame.cpp
+@@ -102,16 +102,18 @@ nsContainerFrame::AppendFrames(ChildListID  aListID,
+       return NS_ERROR_INVALID_ARG;
+     }
+   }
+-  if (aFrameList.NotEmpty()) {
+-    mFrames.AppendFrames(this, aFrameList);
+ 
+-    // Ask the parent frame to reflow me.
+-    if (aListID == kPrincipalList)
+-    {
+-      PresContext()->PresShell()->
+-        FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+-                         NS_FRAME_HAS_DIRTY_CHILDREN);
+-    }
++  if (MOZ_UNLIKELY(aFrameList.IsEmpty())) {
++    return NS_OK;
++  }
++
++  DrainSelfOverflowList(); // ensure the last frame is in mFrames
++  mFrames.AppendFrames(this, aFrameList);
++
++  if (aListID != kNoReflowPrincipalList) {
++    PresContext()->PresShell()->
++      FrameNeedsReflow(this, nsIPresShell::eTreeChange,
++                       NS_FRAME_HAS_DIRTY_CHILDREN);
+   }
+   return NS_OK;
+ }
+@@ -131,16 +133,19 @@ nsContainerFrame::InsertFrames(ChildListID aListID,
+       return NS_ERROR_INVALID_ARG;
+     }
+   }
+-  if (aFrameList.NotEmpty()) {
+-    // Insert frames after aPrevFrame
+-    mFrames.InsertFrames(this, aPrevFrame, aFrameList);
+ 
+-    if (aListID == kPrincipalList)
+-    {
+-      PresContext()->PresShell()->
+-        FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+-                         NS_FRAME_HAS_DIRTY_CHILDREN);
+-    }
++  if (MOZ_UNLIKELY(aFrameList.IsEmpty())) {
++    return NS_OK;
++  }
++
++  DrainSelfOverflowList(); // ensure aPrevFrame is in mFrames
++  mFrames.InsertFrames(this, aPrevFrame, aFrameList);
++
++  if (aListID != kNoReflowPrincipalList) {
++    PresContext()->PresShell()->
++      FrameNeedsReflow(this, nsIPresShell::eTreeChange,
++                       NS_FRAME_HAS_DIRTY_CHILDREN);
++
+   }
+   return NS_OK;
+ }
+diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
+index 60613ba..44088da 100644
+--- a/layout/tables/nsTableFrame.cpp
++++ b/layout/tables/nsTableFrame.cpp
+@@ -2232,6 +2232,7 @@ nsTableFrame::AppendFrames(ChildListID     aListID,
+       InsertColGroups(startColIndex,
+                       nsFrameList::Slice(mColGroups, f, f->GetNextSibling()));
+     } else if (IsRowGroup(display->mDisplay)) {
++      DrainSelfOverflowList(); // ensure the last frame is in mFrames
+       // Append the new row group frame to the sibling chain
+       mFrames.AppendFrame(nullptr, f);
+ 
+@@ -2404,6 +2405,7 @@ nsTableFrame::HomogenousInsertFrames(ChildListID     aListID,
+     InsertColGroups(startColIndex, newColgroups);
+   } else if (IsRowGroup(display->mDisplay)) {
+     NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
++    DrainSelfOverflowList(); // ensure aPrevFrame is in mFrames
+     // Insert the frames in the sibling chain
+     const nsFrameList::Slice& newRowGroups =
+       mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
+diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp
+index d1c493b..2351de3 100644
+--- a/layout/tables/nsTableRowFrame.cpp
++++ b/layout/tables/nsTableRowFrame.cpp
+@@ -182,6 +182,7 @@ nsTableRowFrame::AppendFrames(ChildListID     aListID,
+ {
+   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
+ 
++  DrainSelfOverflowList(); // ensure the last frame is in mFrames
+   const nsFrameList::Slice& newCells = mFrames.AppendFrames(nullptr, aFrameList);
+ 
+   // Add the new cell frames to the table
+@@ -208,6 +209,7 @@ nsTableRowFrame::InsertFrames(ChildListID     aListID,
+   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
+   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
+                "inserting after sibling frame with different parent");
++  DrainSelfOverflowList(); // ensure aPrevFrame is in mFrames
+   //Insert Frames in the frame list
+   const nsFrameList::Slice& newCells = mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
+ 
+diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp
+index 34aaf02..40b349b 100644
+--- a/layout/tables/nsTableRowGroupFrame.cpp
++++ b/layout/tables/nsTableRowGroupFrame.cpp
+@@ -1389,6 +1389,7 @@ nsTableRowGroupFrame::AppendFrames(ChildListID     aListID,
+ {
+   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
+ 
++  DrainSelfOverflowList(); // ensure the last frame is in mFrames
+   ClearRowCursor();
+ 
+   // collect the new row frames in an array
+@@ -1430,6 +1431,7 @@ nsTableRowGroupFrame::InsertFrames(ChildListID     aListID,
+   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
+                "inserting after sibling frame with different parent");
+ 
++  DrainSelfOverflowList(); // ensure aPrevFrame is in mFrames
+   ClearRowCursor();
+ 
+   // collect the new row frames in an array
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2708-pt4.patch b/gnu/packages/patches/icecat-CVE-2015-2708-pt4.patch
new file mode 100644
index 0000000000..eb2295f5ac
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2708-pt4.patch
@@ -0,0 +1,26 @@
+From e6082e031f0fa2a4a7a63ff124c6f22aeb75393d Mon Sep 17 00:00:00 2001
+From: Terrence Cole <terrence@mozilla.com>
+Date: Fri, 10 Apr 2015 08:58:26 -0700
+Subject: [PATCH] Bug 1152177 - Make jsid and Value pre barriers symetrical.
+ r=jonco, a=abillings
+
+---
+ js/src/gc/Barrier.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h
+index 7efd785..9fc6bd0 100644
+--- a/js/src/gc/Barrier.h
++++ b/js/src/gc/Barrier.h
+@@ -1062,6 +1062,8 @@ class BarrieredId
+                 JS_ASSERT(obj == JSID_TO_OBJECT(value));
+             }
+         } else if (JSID_IS_STRING(value)) {
++            if (StringIsPermanentAtom(JSID_TO_STRING(value)))
++                return;
+             JSString *str = JSID_TO_STRING(value);
+             JS::shadow::Zone *shadowZone = ShadowZoneOfStringFromAnyThread(str);
+             if (shadowZone->needsBarrier()) {
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2710-pt1.patch b/gnu/packages/patches/icecat-CVE-2015-2710-pt1.patch
new file mode 100644
index 0000000000..4f119f6fe9
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2710-pt1.patch
@@ -0,0 +1,199 @@
+From 0bd8486f4088c0845514986f61861688e0be011d Mon Sep 17 00:00:00 2001
+From: Cameron McCormack <cam@mcc.id.au>
+Date: Mon, 6 Apr 2015 09:11:55 -0400
+Subject: [PATCH] Bug 1149542 - Part 1: Return early from SVG text layout if we
+ discover mPositions is not long enough. r=dholbert, a=sledru
+
+---
+ layout/svg/SVGTextFrame.cpp | 59 +++++++++++++++++++++++++++++++--------------
+ layout/svg/SVGTextFrame.h   | 23 ++++++++++++------
+ 2 files changed, 56 insertions(+), 26 deletions(-)
+
+diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp
+index 721e699..45327881 100644
+--- a/layout/svg/SVGTextFrame.cpp
++++ b/layout/svg/SVGTextFrame.cpp
+@@ -14,6 +14,7 @@
+ #include "gfxTypes.h"
+ #include "LookAndFeel.h"
+ #include "mozilla/gfx/2D.h"
++#include "mozilla/Likely.h"
+ #include "nsAlgorithm.h"
+ #include "nsBlockFrame.h"
+ #include "nsCaret.h"
+@@ -4316,23 +4317,28 @@ ShouldStartRunAtIndex(const nsTArray<CharPosition>& aPositions,
+   return false;
+ }
+ 
+-uint32_t
+-SVGTextFrame::ResolvePositions(nsIContent* aContent,
+-                               uint32_t aIndex,
+-                               bool aInTextPath,
+-                               bool& aForceStartOfChunk,
+-                               nsTArray<gfxPoint>& aDeltas)
++bool
++SVGTextFrame::ResolvePositionsForNode(nsIContent* aContent,
++                                      uint32_t& aIndex,
++                                      bool aInTextPath,
++                                      bool& aForceStartOfChunk,
++                                      nsTArray<gfxPoint>& aDeltas)
+ {
+   if (aContent->IsNodeOfType(nsINode::eTEXT)) {
+     // We found a text node.
+     uint32_t length = static_cast<nsTextNode*>(aContent)->TextLength();
+     if (length) {
++      uint32_t end = aIndex + length;
++      if (MOZ_UNLIKELY(end > mPositions.Length())) {
++        MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
++                               "found by iterating content");
++        return false;
++      }
+       if (aForceStartOfChunk) {
+         // Note this character as starting a new anchored chunk.
+         mPositions[aIndex].mStartOfChunk = true;
+         aForceStartOfChunk = false;
+       }
+-      uint32_t end = aIndex + length;
+       while (aIndex < end) {
+         // Record whether each of these characters should start a new rendered
+         // run.  That is always the case for characters on a text path.
+@@ -4345,18 +4351,23 @@ SVGTextFrame::ResolvePositions(nsIContent* aContent,
+         aIndex++;
+       }
+     }
+-    return aIndex;
++    return true;
+   }
+ 
+   // Skip past elements that aren't text content elements.
+   if (!IsTextContentElement(aContent)) {
+-    return aIndex;
++    return true;
+   }
+ 
+   if (aContent->Tag() == nsGkAtoms::textPath) {
+     // <textPath> elements are as if they are specified with x="0" y="0", but
+     // only if they actually have some text content.
+     if (HasTextContent(aContent)) {
++      if (MOZ_UNLIKELY(aIndex >= mPositions.Length())) {
++        MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
++                               "found by iterating content");
++        return false;
++      }
+       mPositions[aIndex].mPosition = gfxPoint();
+       mPositions[aIndex].mStartOfChunk = true;
+     }
+@@ -4376,8 +4387,14 @@ SVGTextFrame::ResolvePositions(nsIContent* aContent,
+       rotate = &animatedRotate->GetAnimValue();
+     }
+ 
+-    uint32_t count = GetTextContentLength(aContent);
+     bool percentages = false;
++    uint32_t count = GetTextContentLength(aContent);
++
++    if (MOZ_UNLIKELY(aIndex + count > mPositions.Length())) {
++      MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
++                             "found by iterating content");
++      return false;
++    }
+ 
+     // New text anchoring chunks start at each character assigned a position
+     // with x="" or y="", or if we forced one with aForceStartOfChunk due to
+@@ -4456,8 +4473,11 @@ SVGTextFrame::ResolvePositions(nsIContent* aContent,
+   for (nsIContent* child = aContent->GetFirstChild();
+        child;
+        child = child->GetNextSibling()) {
+-    aIndex = ResolvePositions(child, aIndex, inTextPath, aForceStartOfChunk,
+-                              aDeltas);
++    bool ok = ResolvePositionsForNode(child, aIndex, inTextPath,
++                                      aForceStartOfChunk, aDeltas);
++    if (!ok) {
++      return false;
++    }
+   }
+ 
+   if (aContent->Tag() == nsGkAtoms::textPath) {
+@@ -4465,7 +4485,7 @@ SVGTextFrame::ResolvePositions(nsIContent* aContent,
+     aForceStartOfChunk = true;
+   }
+ 
+-  return aIndex;
++  return true;
+ }
+ 
+ bool
+@@ -4501,8 +4521,10 @@ SVGTextFrame::ResolvePositions(nsTArray<gfxPoint>& aDeltas,
+ 
+   // Recurse over the content and fill in character positions as we go.
+   bool forceStartOfChunk = false;
+-  return ResolvePositions(mContent, 0, aRunPerGlyph,
+-                          forceStartOfChunk, aDeltas) != 0;
++  index = 0;
++  bool ok = ResolvePositionsForNode(mContent, index, aRunPerGlyph,
++                                    forceStartOfChunk, aDeltas);
++  return ok && index > 0;
+ }
+ 
+ void
+@@ -4958,9 +4980,10 @@ SVGTextFrame::DoGlyphPositioning()
+   // Get the x, y, dx, dy, rotate values for the subtree.
+   nsTArray<gfxPoint> deltas;
+   if (!ResolvePositions(deltas, adjustingTextLength)) {
+-    // If ResolvePositions returned false, it means that there were some
+-    // characters in the DOM but none of them are displayed.  Clear out
+-    // mPositions so that we don't attempt to do any painting later.
++    // If ResolvePositions returned false, it means either there were some
++    // characters in the DOM but none of them are displayed, or there was
++    // an error in processing mPositions.  Clear out mPositions so that we don't
++    // attempt to do any painting later.
+     mPositions.Clear();
+     return;
+   }
+diff --git a/layout/svg/SVGTextFrame.h b/layout/svg/SVGTextFrame.h
+index 48951f7..912af8b 100644
+--- a/layout/svg/SVGTextFrame.h
++++ b/layout/svg/SVGTextFrame.h
+@@ -505,15 +505,18 @@ private:
+    * Recursive helper for ResolvePositions below.
+    *
+    * @param aContent The current node.
+-   * @param aIndex The current character index.
++   * @param aIndex (in/out) The current character index.
+    * @param aInTextPath Whether we are currently under a <textPath> element.
+-   * @param aForceStartOfChunk Whether the next character we find should start a
+-   *   new anchored chunk.
+-   * @return The character index we got up to.
++   * @param aForceStartOfChunk (in/out) Whether the next character we find
++   *   should start a new anchored chunk.
++   * @param aDeltas (in/out) Receives the resolved dx/dy values for each
++   *   character.
++   * @return false if we discover that mPositions did not have enough
++   *   elements; true otherwise.
+    */
+-  uint32_t ResolvePositions(nsIContent* aContent, uint32_t aIndex,
+-                            bool aInTextPath, bool& aForceStartOfChunk,
+-                            nsTArray<gfxPoint>& aDeltas);
++  bool ResolvePositionsForNode(nsIContent* aContent, uint32_t& aIndex,
++                               bool aInTextPath, bool& aForceStartOfChunk,
++                               nsTArray<gfxPoint>& aDeltas);
+ 
+   /**
+    * Initializes mPositions with character position information based on
+@@ -521,9 +524,13 @@ private:
+    * was not given for that character.  Also fills aDeltas with values based on
+    * dx/dy attributes.
+    *
++   * @param aDeltas (in/out) Receives the resolved dx/dy values for each
++   *   character.
+    * @param aRunPerGlyph Whether mPositions should record that a new run begins
+    *   at each glyph.
+-   * @return True if we recorded any positions.
++   * @return false if we did not record any positions (due to having no
++   *   displayed characters) or if we discover that mPositions did not have
++   *   enough elements; true otherwise.
+    */
+   bool ResolvePositions(nsTArray<gfxPoint>& aDeltas, bool aRunPerGlyph);
+ 
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2710-pt2.patch b/gnu/packages/patches/icecat-CVE-2015-2710-pt2.patch
new file mode 100644
index 0000000000..26a10ca2e4
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2710-pt2.patch
@@ -0,0 +1,64 @@
+From f7c0070831e72735c43beb426ac0c2ce33403f4f Mon Sep 17 00:00:00 2001
+From: Cameron McCormack <cam@mcc.id.au>
+Date: Mon, 6 Apr 2015 09:12:06 -0400
+Subject: [PATCH] Bug 1149542 - Part 2: Track undisplayed characters before
+ empty text frames properly. r=dholbert, a=sledru
+
+---
+ layout/svg/SVGTextFrame.cpp | 29 ++++++++++++++++-------------
+ 1 file changed, 16 insertions(+), 13 deletions(-)
+
+diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp
+index 45327881..9d331b8 100644
+--- a/layout/svg/SVGTextFrame.cpp
++++ b/layout/svg/SVGTextFrame.cpp
+@@ -290,22 +290,25 @@ GetNonEmptyTextFrameAndNode(nsIFrame* aFrame,
+                             nsTextNode*& aTextNode)
+ {
+   nsTextFrame* text = do_QueryFrame(aFrame);
+-  if (!text) {
+-    return false;
+-  }
++  bool isNonEmptyTextFrame = text && text->GetContentLength() != 0;
+ 
+-  nsIContent* content = text->GetContent();
+-  NS_ASSERTION(content && content->IsNodeOfType(nsINode::eTEXT),
+-               "unexpected content type for nsTextFrame");
++  if (isNonEmptyTextFrame) {
++    nsIContent* content = text->GetContent();
++    NS_ASSERTION(content && content->IsNodeOfType(nsINode::eTEXT),
++                 "unexpected content type for nsTextFrame");
+ 
+-  nsTextNode* node = static_cast<nsTextNode*>(content);
+-  if (node->TextLength() == 0) {
+-    return false;
++    nsTextNode* node = static_cast<nsTextNode*>(content);
++    MOZ_ASSERT(node->TextLength() != 0,
++               "frame's GetContentLength() should be 0 if the text node "
++               "has no content");
++
++    aTextFrame = text;
++    aTextNode = node;
+   }
+ 
+-  aTextFrame = text;
+-  aTextNode = node;
+-  return true;
++  MOZ_ASSERT(IsNonEmptyTextFrame(aFrame) == isNonEmptyTextFrame,
++             "our logic should agree with IsNonEmptyTextFrame");
++  return isNonEmptyTextFrame;
+ }
+ 
+ /**
+@@ -1298,7 +1301,7 @@ GetUndisplayedCharactersBeforeFrame(nsTextFrame* aFrame)
+ /**
+  * Traverses the nsTextFrames for an SVGTextFrame and records a
+  * TextNodeCorrespondenceProperty on each for the number of undisplayed DOM
+- * characters between each frame.  This is done by iterating simultaenously
++ * characters between each frame.  This is done by iterating simultaneously
+  * over the nsTextNodes and nsTextFrames and noting when nsTextNodes (or
+  * parts of them) are skipped when finding the next nsTextFrame.
+  */
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2710-pt3.patch b/gnu/packages/patches/icecat-CVE-2015-2710-pt3.patch
new file mode 100644
index 0000000000..6759506213
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2710-pt3.patch
@@ -0,0 +1,50 @@
+From 2cda46e6158a459b56b392c8e389b055fdf740ca Mon Sep 17 00:00:00 2001
+From: Ryan VanderMeulen <ryanvm@gmail.com>
+Date: Mon, 6 Apr 2015 22:59:41 -0400
+Subject: [PATCH] Bug 1149542 - Replace MOZ_ASSERT_UNREACHABLE with MOZ_ASSERT.
+ r=dholbert, a=bustage
+
+---
+ layout/svg/SVGTextFrame.cpp | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp
+index 9d331b8..e7b7275 100644
+--- a/layout/svg/SVGTextFrame.cpp
++++ b/layout/svg/SVGTextFrame.cpp
+@@ -4333,8 +4333,8 @@ SVGTextFrame::ResolvePositionsForNode(nsIContent* aContent,
+     if (length) {
+       uint32_t end = aIndex + length;
+       if (MOZ_UNLIKELY(end > mPositions.Length())) {
+-        MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
+-                               "found by iterating content");
++        MOZ_ASSERT(false, "length of mPositions does not match characters "
++                          "found by iterating content");
+         return false;
+       }
+       if (aForceStartOfChunk) {
+@@ -4367,8 +4367,8 @@ SVGTextFrame::ResolvePositionsForNode(nsIContent* aContent,
+     // only if they actually have some text content.
+     if (HasTextContent(aContent)) {
+       if (MOZ_UNLIKELY(aIndex >= mPositions.Length())) {
+-        MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
+-                               "found by iterating content");
++        MOZ_ASSERT(false, "length of mPositions does not match characters "
++                          "found by iterating content");
+         return false;
+       }
+       mPositions[aIndex].mPosition = gfxPoint();
+@@ -4394,8 +4394,8 @@ SVGTextFrame::ResolvePositionsForNode(nsIContent* aContent,
+     uint32_t count = GetTextContentLength(aContent);
+ 
+     if (MOZ_UNLIKELY(aIndex + count > mPositions.Length())) {
+-      MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
+-                             "found by iterating content");
++      MOZ_ASSERT(false, "length of mPositions does not match characters "
++                        "found by iterating content");
+       return false;
+     }
+ 
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2713-pt1.patch b/gnu/packages/patches/icecat-CVE-2015-2713-pt1.patch
new file mode 100644
index 0000000000..9e52759ae8
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2713-pt1.patch
@@ -0,0 +1,102 @@
+From 2b1c90da3e849e1c9d7457658290aa8eb01d0fa9 Mon Sep 17 00:00:00 2001
+From: Mats Palmgren <mats@mozilla.com>
+Date: Thu, 16 Apr 2015 09:04:19 +0000
+Subject: [PATCH] Bug 1153478 - Part 1: Add nsInlineFrame::StealFrame and make
+ it deal with being called on the wrong parent for aChild (due to lazy
+ reparenting). r=roc, a=sledru
+
+---
+ layout/generic/nsContainerFrame.cpp |  7 +++----
+ layout/generic/nsInlineFrame.cpp    | 39 +++++++++++++++++++++++++++++++++++++
+ layout/generic/nsInlineFrame.h      |  4 +++-
+ 3 files changed, 45 insertions(+), 5 deletions(-)
+
+diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp
+index 3ffcba7..34878af 100644
+--- a/layout/generic/nsContainerFrame.cpp
++++ b/layout/generic/nsContainerFrame.cpp
+@@ -172,13 +172,12 @@ nsContainerFrame::RemoveFrame(ChildListID aListID,
+   nsIPresShell* shell = PresContext()->PresShell();
+   nsContainerFrame* lastParent = nullptr;
+   while (aOldFrame) {
+-    //XXXfr probably should use StealFrame here. I'm not sure if we need to
+-    //      check the overflow lists atm, but we'll need a prescontext lookup
+-    //      for overflow containers once we can split abspos elements with
+-    //      inline containing blocks.
+     nsIFrame* oldFrameNextContinuation = aOldFrame->GetNextContinuation();
+     nsContainerFrame* parent =
+       static_cast<nsContainerFrame*>(aOldFrame->GetParent());
++    // Please note that 'parent' may not actually be where 'aOldFrame' lives.
++    // We really MUST use StealFrame() and nothing else here.
++    // @see nsInlineFrame::StealFrame for details.
+     parent->StealFrame(aOldFrame, true);
+     aOldFrame->Destroy();
+     aOldFrame = oldFrameNextContinuation;
+diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp
+index 526041e..a392a15 100644
+--- a/layout/generic/nsInlineFrame.cpp
++++ b/layout/generic/nsInlineFrame.cpp
+@@ -172,6 +172,45 @@ nsInlineFrame::PeekOffsetCharacter(bool aForward, int32_t* aOffset,
+   return CONTINUE;
+ }
+ 
++nsresult
++nsInlineFrame::StealFrame(nsIFrame* aChild,
++                          bool      aForceNormal)
++{
++  if (aChild->HasAnyStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER) &&
++      !aForceNormal) {
++    return nsContainerFrame::StealFrame(aChild, aForceNormal);
++  }
++
++  nsInlineFrame* parent = this;
++  bool removed = false;
++  do {
++    removed = parent->mFrames.StartRemoveFrame(aChild);
++    if (removed) {
++      break;
++    }
++
++    // We didn't find the child in our principal child list.
++    // Maybe it's on the overflow list?
++    nsFrameList* frameList = parent->GetOverflowFrames();
++    if (frameList) {
++      removed = frameList->ContinueRemoveFrame(aChild);
++      if (frameList->IsEmpty()) {
++        parent->DestroyOverflowList();
++      }
++      if (removed) {
++        break;
++      }
++    }
++
++    // Due to our "lazy reparenting" optimization 'aChild' might not actually
++    // be on any of our child lists, but instead in one of our next-in-flows.
++    parent = static_cast<nsInlineFrame*>(parent->GetNextInFlow());
++  } while (parent);
++
++  MOZ_ASSERT(removed, "nsInlineFrame::StealFrame: can't find aChild");
++  return removed ? NS_OK : NS_ERROR_UNEXPECTED;
++}
++
+ void
+ nsInlineFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
+                                 const nsRect&           aDirtyRect,
+diff --git a/layout/generic/nsInlineFrame.h b/layout/generic/nsInlineFrame.h
+index 1a9899e..3e49241 100644
+--- a/layout/generic/nsInlineFrame.h
++++ b/layout/generic/nsInlineFrame.h
+@@ -61,7 +61,9 @@ public:
+ 
+   virtual FrameSearchResult PeekOffsetCharacter(bool aForward, int32_t* aOffset,
+                                      bool aRespectClusters = true) MOZ_OVERRIDE;
+-  
++
++  virtual nsresult StealFrame(nsIFrame* aChild, bool aForceNormal) MOZ_OVERRIDE;
++
+   // nsIHTMLReflow overrides
+   virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
+                                  InlineMinWidthData *aData) MOZ_OVERRIDE;
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2713-pt2.patch b/gnu/packages/patches/icecat-CVE-2015-2713-pt2.patch
new file mode 100644
index 0000000000..b1f2adde47
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2713-pt2.patch
@@ -0,0 +1,47 @@
+From d84ed2990dd2304fef752213f1908280ff24d77c Mon Sep 17 00:00:00 2001
+From: Mats Palmgren <mats@mozilla.com>
+Date: Thu, 16 Apr 2015 09:04:19 +0000
+Subject: [PATCH] Bug 1153478 - Part 2: Remove useless assertions. r=roc,
+ a=sledru
+
+---
+ layout/generic/nsContainerFrame.cpp | 1 -
+ layout/generic/nsInlineFrame.cpp    | 3 ---
+ 2 files changed, 4 deletions(-)
+
+diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp
+index 34878af..b95bddd 100644
+--- a/layout/generic/nsContainerFrame.cpp
++++ b/layout/generic/nsContainerFrame.cpp
+@@ -1516,7 +1516,6 @@ nsContainerFrame::DrainSelfOverflowList()
+ {
+   AutoFrameListPtr overflowFrames(PresContext(), StealOverflowFrames());
+   if (overflowFrames) {
+-    NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
+     mFrames.AppendFrames(nullptr, *overflowFrames);
+     return true;
+   }
+diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp
+index a392a15..e0922bb 100644
+--- a/layout/generic/nsInlineFrame.cpp
++++ b/layout/generic/nsInlineFrame.cpp
+@@ -449,7 +449,6 @@ nsInlineFrame::DrainSelfOverflowListInternal(DrainFlags aFlags,
+ {
+   AutoFrameListPtr overflowFrames(PresContext(), StealOverflowFrames());
+   if (overflowFrames) {
+-    NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
+     // The frames on our own overflowlist may have been pushed by a
+     // previous lazilySetParentPointer Reflow so we need to ensure the
+     // correct parent pointer.  This is sometimes skipped by Reflow.
+@@ -1157,8 +1156,6 @@ nsFirstLineFrame::DrainSelfOverflowList()
+ {
+   AutoFrameListPtr overflowFrames(PresContext(), StealOverflowFrames());
+   if (overflowFrames) {
+-    NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
+-
+     bool result = !overflowFrames->IsEmpty();
+     const nsFrameList::Slice& newFrames =
+       mFrames.AppendFrames(nullptr, *overflowFrames);
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2015-2716.patch b/gnu/packages/patches/icecat-CVE-2015-2716.patch
new file mode 100644
index 0000000000..ce036a0921
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2015-2716.patch
@@ -0,0 +1,62 @@
+From 9dcb4563847cb6e2a8112dca03d2684907f96313 Mon Sep 17 00:00:00 2001
+From: Eric Rahm <erahm@mozilla.com>
+Date: Fri, 10 Apr 2015 15:50:23 -0700
+Subject: [PATCH] Bug 1140537 - Sanity check size calculations. r=peterv,
+ a=abillings
+
+---
+ parser/expat/lib/xmlparse.c | 23 +++++++++++++++++++++--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c
+index 70acf1a..436b735 100644
+--- a/parser/expat/lib/xmlparse.c
++++ b/parser/expat/lib/xmlparse.c
+@@ -1651,6 +1651,12 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
+ void * XMLCALL
+ XML_GetBuffer(XML_Parser parser, int len)
+ {
++/* BEGIN MOZILLA CHANGE (sanity check len) */
++  if (len < 0) {
++    errorCode = XML_ERROR_NO_MEMORY;
++    return NULL;
++  }
++/* END MOZILLA CHANGE */
+   switch (ps_parsing) {
+   case XML_SUSPENDED:
+     errorCode = XML_ERROR_SUSPENDED;
+@@ -1662,8 +1668,13 @@ XML_GetBuffer(XML_Parser parser, int len)
+   }
+ 
+   if (len > bufferLim - bufferEnd) {
+-    /* FIXME avoid integer overflow */
+     int neededSize = len + (int)(bufferEnd - bufferPtr);
++/* BEGIN MOZILLA CHANGE (sanity check neededSize) */
++    if (neededSize < 0) {
++      errorCode = XML_ERROR_NO_MEMORY;
++      return NULL;
++    }
++/* END MOZILLA CHANGE */
+ #ifdef XML_CONTEXT_BYTES
+     int keep = (int)(bufferPtr - buffer);
+ 
+@@ -1692,7 +1703,15 @@ XML_GetBuffer(XML_Parser parser, int len)
+         bufferSize = INIT_BUFFER_SIZE;
+       do {
+         bufferSize *= 2;
+-      } while (bufferSize < neededSize);
++/* BEGIN MOZILLA CHANGE (prevent infinite loop on overflow) */
++      } while (bufferSize < neededSize && bufferSize > 0);
++/* END MOZILLA CHANGE */
++/* BEGIN MOZILLA CHANGE (sanity check bufferSize) */
++      if (bufferSize <= 0) {
++        errorCode = XML_ERROR_NO_MEMORY;
++        return NULL;
++      }
++/* END MOZILLA CHANGE */
+       newBuf = (char *)MALLOC(bufferSize);
+       if (newBuf == 0) {
+         errorCode = XML_ERROR_NO_MEMORY;
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/librep-rules.mk.patch b/gnu/packages/patches/librep-rules.mk.patch
deleted file mode 100644
index 4ea2a3ae1b..0000000000
--- a/gnu/packages/patches/librep-rules.mk.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-rules.mk.in: Don't set prefix, datadir, libdir, datarootdir and repdir.
-rules.mk.in: Use pkg-config to get the absolute path for repcommonexedir.
-
-Merged into upstream: <https://github.com/SawfishWM/librep/commit/a1f2db721aa5055e90f6a76fde625946340ed8cf>.
-
---- librep_0.92.4.orig/rules.mk.in	2015-01-31 23:21:59.614751496 +0800
-+++ librep_0.92.4/rules.mk.in	2015-02-02 18:56:55.097171657 +0800
-@@ -1,18 +1,10 @@
- # rules.mk
- 
--prefix=@prefix@
--datadir=@datadir@
--libdir=@libdir@
-+repcommonexecdir?=$(shell pkg-config --variable=repcommonexecdir librep)
-+rpath_repcommonexecdir:=$(repcommonexecdir)
- 
--# shut up configure
--datarootdir=@datarootdir@
--
--repdir=@repdir@
--repcommonexecdir=@repcommonexecdir@
--rpath_repcommonexecdir=@repcommonexecdir@
--
--rep_LIBTOOL=$(repcommonexecdir)/libtool --tag CC
--rep_INSTALL_ALIASES=$(repcommonexecdir)/install-aliases
-+rep_LIBTOOL:=$(repcommonexecdir)/libtool --tag CC
-+rep_INSTALL_ALIASES:=$(repcommonexecdir)/install-aliases
- 
- # use this like:
- # foo.la : foo.lo bar.lo
diff --git a/gnu/packages/patches/libtool-skip-tests.patch b/gnu/packages/patches/libtool-skip-tests2.patch
index 9191d40487..c9d61e3b41 100644
--- a/gnu/packages/patches/libtool-skip-tests.patch
+++ b/gnu/packages/patches/libtool-skip-tests2.patch
@@ -1,8 +1,4 @@
-Because our GCC 'lib' spec automatically adds '-rpath' for each '-L'
-and a couple more '-rpath, there are two test failures:
-one in demo.test, and one in destdir.at.  Disable these.
-
-Also skip the nopic test on ARM and MIPS systems.
+Skip the nopic test on ARM and MIPS systems.
 
 --- libtool-2.4.6/tests/demo.at.orig	2015-01-16 13:52:04.000000000 -0500
 +++ libtool-2.4.6/tests/demo.at	2015-02-16 10:48:51.435851966 -0500
@@ -35,21 +31,3 @@ Also skip the nopic test on ARM and MIPS systems.
    # These hosts cannot use non-PIC shared libs
    exit 77 ;;
  *-solaris*|*-sunos*)
-@@ -9298,7 +9298,7 @@
- #AT_START_34
- at_fn_group_banner 34 'demo.at:548' \
-   "hardcoding library path" "                        " 4
--at_xfail=no
-+at_xfail=yes
-       test no = "$ACLOCAL" && at_xfail=yes
-       test no = "$AUTOHEADER" && at_xfail=yes
-       test no = "$AUTOMAKE" && at_xfail=yes
-@@ -27243,7 +27243,7 @@
- #AT_START_98
- at_fn_group_banner 98 'destdir.at:75' \
-   "DESTDIR with in-package deplibs" "                " 8
--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/gnu/packages/patches/lirc-localstatedir.patch b/gnu/packages/patches/lirc-localstatedir.patch
new file mode 100644
index 0000000000..43a41a743f
--- /dev/null
+++ b/gnu/packages/patches/lirc-localstatedir.patch
@@ -0,0 +1,13 @@
+Do not try to create $localstatedir as we cannot do this when it is /var.
+
+--- lirc-0.9.2a/daemons/Makefile.in
++++ lirc-0.9.2a/daemons/Makefile.in
+@@ -790,9 +790,6 @@
+ 	uninstall-local uninstall-sbinPROGRAMS
+ 
+ 
+-install-exec-local:
+-	test -d  $(DESTDIR)$(varrundir)/$(PACKAGE) \
+-		 || mkdir -p $(DESTDIR)$(varrundir)/$(PACKAGE)
+ uninstall-local:
+ 	-$(RM) $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd
diff --git a/gnu/packages/patches/mplayer2-theora-fix.patch b/gnu/packages/patches/mplayer2-theora-fix.patch
new file mode 100644
index 0000000000..982db5f57c
--- /dev/null
+++ b/gnu/packages/patches/mplayer2-theora-fix.patch
@@ -0,0 +1,286 @@
+Fix libtheora linking issue with modern theora versions.
+
+Adapted from:
+http://git.buildroot.net/buildroot/commit/?id=46b71cb0be27c0e6b7c93afb49fc80779bf310e3
+
+--- a/libmpcodecs/vd_theora.c
++++ b/libmpcodecs/vd_theora.c
+@@ -39,22 +39,23 @@
+ 
+ LIBVD_EXTERN(theora)
+ 
+-#include <theora/theora.h>
++#include <theora/theoradec.h>
+ 
+ #define THEORA_NUM_HEADER_PACKETS 3
+ 
+ typedef struct theora_struct_st {
+-    theora_state st;
+-    theora_comment cc;
+-    theora_info inf;
++    th_setup_info *tsi;
++    th_dec_ctx    *tctx;
++    th_comment     tc;
++    th_info        ti;
+ } theora_struct_t;
+ 
+ /** Convert Theora pixelformat to the corresponding IMGFMT_ */
+-static uint32_t theora_pixelformat2imgfmt(theora_pixelformat fmt){
++static uint32_t theora_pixelformat2imgfmt(th_pixel_fmt fmt){
+     switch(fmt) {
+-       case OC_PF_420: return IMGFMT_YV12;
+-       case OC_PF_422: return IMGFMT_422P;
+-       case OC_PF_444: return IMGFMT_444P;
++       case TH_PF_420: return IMGFMT_YV12;
++       case TH_PF_422: return IMGFMT_422P;
++       case TH_PF_444: return IMGFMT_444P;
+     }
+     return 0;
+ }
+@@ -64,7 +65,7 @@
+     theora_struct_t *context = sh->context;
+     switch(cmd) {
+     case VDCTRL_QUERY_FORMAT:
+-        if (*(int*)arg == theora_pixelformat2imgfmt(context->inf.pixelformat))
++        if (*(int*)arg == theora_pixelformat2imgfmt(context->ti.pixel_fmt))
+ 	    return CONTROL_TRUE;
+ 	return CONTROL_FALSE;
+     }
+@@ -88,8 +89,9 @@
+     if (!context)
+         goto err_out;
+ 
+-    theora_info_init(&context->inf);
+-    theora_comment_init(&context->cc);
++    th_info_init(&context->ti);
++    th_comment_init(&context->tc);
++    context->tsi = NULL;
+ 
+     /* Read all header packets, pass them to theora_decode_header. */
+     for (i = 0; i < THEORA_NUM_HEADER_PACKETS; i++)
+@@ -109,7 +111,7 @@
+             op.b_o_s = 1;
+         }
+ 
+-        if ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) )
++        if ( (errorCode = th_decode_headerin (&context->ti, &context->tc, &context->tsi, &op)) < 0)
+         {
+             mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Broken Theora header; errorCode=%i!\n", errorCode);
+             goto err_out;
+@@ -117,23 +119,25 @@
+     }
+ 
+     /* now init codec */
+-    errorCode = theora_decode_init (&context->st, &context->inf);
+-    if (errorCode)
++    context->tctx = th_decode_alloc (&context->ti, context->tsi);
++    if (!context->tctx)
+     {
+-        mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed: %i \n", errorCode);
++        mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed\n");
+         goto err_out;
+     }
++    /* free memory used for decoder setup information */
++    th_setup_free(context->tsi);
+ 
+-    if(sh->aspect==0.0 && context->inf.aspect_denominator!=0)
++    if(sh->aspect==0.0 && context->ti.aspect_denominator!=0)
+     {
+-       sh->aspect = ((double)context->inf.aspect_numerator * context->inf.width)/
+-          ((double)context->inf.aspect_denominator * context->inf.height);
++       sh->aspect = ((double)context->ti.aspect_numerator * context->ti.frame_width)/
++          ((double)context->ti.aspect_denominator * context->ti.frame_height);
+     }
+ 
+     mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n");
+-    mp_msg(MSGT_DECVIDEO,MSGL_INFO,"Frame: %dx%d, Picture %dx%d, Offset [%d,%d]\n", context->inf.width, context->inf.height, context->inf.frame_width, context->inf.frame_height, context->inf.offset_x, context->inf.offset_y);
++    mp_msg(MSGT_DECVIDEO,MSGL_INFO,"Frame: %dx%d, Picture %dx%d, Offset [%d,%d]\n", context->ti.frame_width, context->ti.frame_height, context->ti.pic_width, context->ti.pic_height, context->ti.pic_x, context->ti.pic_y);
+ 
+-    return mpcodecs_config_vo (sh,context->inf.width,context->inf.height,theora_pixelformat2imgfmt(context->inf.pixelformat));
++    return mpcodecs_config_vo (sh,context->ti.frame_width,context->ti.frame_height,theora_pixelformat2imgfmt(context->ti.pixel_fmt));
+ 
+ err_out:
+     free(context);
+@@ -150,9 +154,9 @@
+ 
+    if (context)
+    {
+-      theora_info_clear(&context->inf);
+-      theora_comment_clear(&context->cc);
+-      theora_clear (&context->st);
++      th_info_clear(&context->ti);
++      th_comment_clear(&context->tc);
++      th_decode_free (context->tctx);
+       free (context);
+    }
+ }
+@@ -165,7 +169,7 @@
+    theora_struct_t *context = sh->context;
+    int errorCode = 0;
+    ogg_packet op;
+-   yuv_buffer yuv;
++   th_ycbcr_buffer ycbcrbuf;
+    mp_image_t* mpi;
+ 
+    // no delayed frames
+@@ -177,31 +181,31 @@
+    op.packet = data;
+    op.granulepos = -1;
+ 
+-   errorCode = theora_decode_packetin (&context->st, &op);
+-   if (errorCode)
++   errorCode = th_decode_packetin (context->tctx, &op, NULL);
++   if (errorCode < 0)
+    {
+       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode packetin failed: %i \n",
+ 	     errorCode);
+       return NULL;
+    }
+ 
+-   errorCode = theora_decode_YUVout (&context->st, &yuv);
+-   if (errorCode)
++   errorCode = th_decode_ycbcr_out (context->tctx, ycbcrbuf);
++   if (errorCode < 0)
+    {
+       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode YUVout failed: %i \n",
+ 	     errorCode);
+       return NULL;
+    }
+ 
+-    mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, yuv.y_width, yuv.y_height);
++    mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, ycbcrbuf[0].width, ycbcrbuf[0].height);
+     if(!mpi) return NULL;
+ 
+-    mpi->planes[0]=yuv.y;
+-    mpi->stride[0]=yuv.y_stride;
+-    mpi->planes[1]=yuv.u;
+-    mpi->stride[1]=yuv.uv_stride;
+-    mpi->planes[2]=yuv.v;
+-    mpi->stride[2]=yuv.uv_stride;
++    mpi->planes[0]=ycbcrbuf[0].data;
++    mpi->stride[0]=ycbcrbuf[0].stride;
++    mpi->planes[1]=ycbcrbuf[1].data;
++    mpi->stride[1]=ycbcrbuf[1].stride;
++    mpi->planes[2]=ycbcrbuf[2].data;
++    mpi->stride[2]=ycbcrbuf[2].stride;
+ 
+     return mpi;
+ }
+--- a/libmpdemux/demux_ogg.c
++++ b/libmpdemux/demux_ogg.c
+@@ -49,21 +49,21 @@
+ #endif
+ 
+ #ifdef CONFIG_OGGTHEORA
+-#include <theora/theora.h>
+-int _ilog (unsigned int); /* defined in many places in theora/lib/ */
++#include <theora/theoradec.h>
+ #endif
+ 
+ #define BLOCK_SIZE 4096
+ 
+ /* Theora decoder context : we won't be able to interpret granule positions
+- * without using theora_granule_time with the theora_state of the stream.
++ * without using th_granule_time with the th_dec_ctx of the stream.
+  * This is duplicated in `vd_theora.c'; put this in a common header?
+  */
+ #ifdef CONFIG_OGGTHEORA
+ typedef struct theora_struct_st {
+-    theora_state   st;
+-    theora_comment cc;
+-    theora_info    inf;
++    th_setup_info *tsi;
++    th_dec_ctx    *tctx;
++    th_comment     tc;
++    th_info        ti;
+ } theora_struct_t;
+ #endif
+ 
+@@ -116,7 +116,7 @@
+     float   samplerate; /// granulpos 2 time
+     int64_t lastpos;
+     int32_t lastsize;
+-    int     keyframe_frequency_force;
++    int     keyframe_granule_shift;
+ 
+     // Logical stream state
+     ogg_stream_state stream;
+@@ -299,11 +299,10 @@
+            have theora_state st, until all header packets were passed to the
+            decoder. */
+         if (!pack->bytes || !(*data&0x80)) {
+-            int keyframe_granule_shift = _ilog(os->keyframe_frequency_force - 1);
+-            int64_t iframemask = (1 << keyframe_granule_shift) - 1;
++            int64_t iframemask = (1 << os->keyframe_granule_shift) - 1;
+ 
+             if (pack->granulepos >= 0) {
+-                os->lastpos  = pack->granulepos >> keyframe_granule_shift;
++                os->lastpos  = pack->granulepos >> os->keyframe_granule_shift;
+                 os->lastpos += pack->granulepos & iframemask;
+                 *flags = (pack->granulepos & iframemask) == 0;
+             } else {
+@@ -892,14 +891,15 @@
+ #ifdef CONFIG_OGGTHEORA
+         } else if (pack.bytes >= 7 && !strncmp (&pack.packet[1], "theora", 6)) {
+             int errorCode = 0;
+-            theora_info inf;
+-            theora_comment cc;
++            th_info ti;
++            th_comment tc;
++            th_setup_info *tsi = NULL;
+ 
+-            theora_info_init (&inf);
+-            theora_comment_init (&cc);
++            th_info_init (&ti);
++            th_comment_init (&tc);
+ 
+-            errorCode = theora_decode_header (&inf, &cc, &pack);
+-            if (errorCode) {
++            errorCode = th_decode_headerin(&ti, &tc, &tsi, &pack);
++            if (errorCode < 0) {
+                 mp_msg(MSGT_DEMUX, MSGL_ERR,
+                        "Theora header parsing failed: %i \n", errorCode);
+             } else {
+@@ -908,30 +908,32 @@
+                 sh_v->bih = calloc(1, sizeof(*sh_v->bih));
+                 sh_v->bih->biSize        = sizeof(*sh_v->bih);
+                 sh_v->bih->biCompression = sh_v->format = FOURCC_THEORA;
+-                sh_v->fps = ((double)inf.fps_numerator) / (double)inf.fps_denominator;
+-                sh_v->frametime = ((double)inf.fps_denominator) / (double)inf.fps_numerator;
+-                sh_v->disp_w = sh_v->bih->biWidth  = inf.frame_width;
+-                sh_v->disp_h = sh_v->bih->biHeight = inf.frame_height;
++                sh_v->fps = ((double)ti.fps_numerator) / (double)ti.fps_denominator;
++                sh_v->frametime = ((double)ti.fps_denominator) / (double)ti.fps_numerator;
++                sh_v->i_bps  = ti.target_bitrate / 8;
++                sh_v->disp_w = sh_v->bih->biWidth  = ti.frame_width;
++                sh_v->disp_h = sh_v->bih->biHeight = ti.frame_height;
+                 sh_v->bih->biBitCount  = 24;
+                 sh_v->bih->biPlanes    = 3;
+                 sh_v->bih->biSizeImage = ((sh_v->bih->biBitCount / 8) * sh_v->bih->biWidth * sh_v->bih->biHeight);
+                 ogg_d->subs[ogg_d->num_sub].samplerate               = sh_v->fps;
+                 ogg_d->subs[ogg_d->num_sub].theora                   = 1;
+-                ogg_d->subs[ogg_d->num_sub].keyframe_frequency_force = inf.keyframe_frequency_force;
++                ogg_d->subs[ogg_d->num_sub].keyframe_granule_shift   = ti.keyframe_granule_shift;
+                 ogg_d->subs[ogg_d->num_sub].id                       = n_video;
+                 n_video++;
+                 mp_msg(MSGT_DEMUX, MSGL_INFO,
+                        "[Ogg] stream %d: video (Theora v%d.%d.%d), -vid %d\n",
+                        ogg_d->num_sub,
+-                       (int)inf.version_major,
+-                       (int)inf.version_minor,
+-                       (int)inf.version_subminor,
++                       (int)ti.version_major,
++                       (int)ti.version_minor,
++                       (int)ti.version_subminor,
+                        n_video - 1);
+                 if (mp_msg_test(MSGT_HEADER, MSGL_V))
+                     print_video_header(sh_v->bih, MSGL_V);
+             }
+-            theora_comment_clear(&cc);
+-            theora_info_clear(&inf);
++            th_comment_clear(&tc);
++            th_info_clear(&ti);
++            th_setup_free(tsi);
+ #endif /* CONFIG_OGGTHEORA */
+         } else if (pack.bytes >= 4 && !strncmp (&pack.packet[0], "fLaC", 4)) {
+             sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
diff --git a/gnu/packages/patches/openssl-runpath.patch b/gnu/packages/patches/openssl-runpath.patch
new file mode 100644
index 0000000000..fa7c0b9962
--- /dev/null
+++ b/gnu/packages/patches/openssl-runpath.patch
@@ -0,0 +1,15 @@
+This patch makes the build system pass -Wl,-rpath=$out/lib even for
+libraries (it already does so for executables, thanks to 'DO_GNU_APP'
+in 'Makefile.shared'.)
+
+--- openssl-1.0.2a/Makefile.shared	2015-04-05 01:07:35.357602454 +0200
++++ openssl-1.0.2a/Makefile.shared	2015-04-05 01:09:50.474513303 +0200
+@@ -106,7 +106,7 @@ LINK_SO=	\
+     LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
+     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
+     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
+-    $${SHAREDCMD} $${SHAREDFLAGS} \
++    $${SHAREDCMD} $${SHAREDFLAGS} -Wl,-rpath,$(LIBRPATH) \
+ 	-o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
+ 	$$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
+   ) && $(SYMLINK_SO)
diff --git a/gnu/packages/patches/perl-gd-options-passthrough-and-fontconfig.patch b/gnu/packages/patches/perl-gd-options-passthrough-and-fontconfig.patch
new file mode 100644
index 0000000000..b2ff43c0d3
--- /dev/null
+++ b/gnu/packages/patches/perl-gd-options-passthrough-and-fontconfig.patch
@@ -0,0 +1,53 @@
+This patch (adapted from nixpkgs for Build.PL) configures Getopt::Long to pass
+options so they will be available at the second GetOptions call.
+
+Also an option to specify the search path for libfontconfig is added.
+
+--- GD-2.56/Build.PL	2014-10-27 20:34:54.000000000 -0500
++++ GD-2.56/Build.PL	2015-02-22 10:08:12.569973657 -0600
+@@ -2,14 +2,14 @@
+ 
+ use strict;
+ use Module::Build;
+-use Getopt::Long;
++use Getopt::Long qw(:config pass_through);
+ use Config;
+ 
+ # =====> PATHS: CHECK AND ADJUST <=====
+ my (@INC,@LIBPATH,@LIBS);
+ my $AUTOCONFIG = 0;      # global set by try_to_autoconfigure() below
+ 
+-my ($options,$lib_gd_path,$lib_ft_path,$lib_png_path,$lib_jpeg_path,$lib_xpm_path,$lib_zlib_path);
++my ($options,$lib_gd_path,$lib_ft_path,$lib_png_path,$lib_jpeg_path,$lib_xpm_path,$lib_zlib_path,$lib_fontconfig_path);
+ 
+ unless (try_to_autoconfigure(\$options,\$lib_gd_path,\@INC,\@LIBPATH,\@LIBS)) {
+     die <<END;
+@@ -38,6 +38,7 @@
+ 			"lib_jpeg_path=s" => \$lib_jpeg_path,
+ 			"lib_xpm_path=s"  => \$lib_xpm_path,
+ 			"lib_zlib_path=s" => \$lib_zlib_path,
++			"lib_fontconfig_path=s" => \$lib_fontconfig_path,
+ 		       );
+ unless ($result) {
+   die <<END;
+@@ -53,6 +54,7 @@
+      -lib_jpeg_path path            path to libjpeg
+      -lib_xpm_path  path            path to libxpm
+      -lib_zlib_path path            path to libpng
++     -lib_fontconfig_path path      path to fontconfig
+      -ignore_missing_gd             Ignore missing or old libgd installations and try to compile anyway
+ 
+ If no options are passed on the command line.  The program will
+@@ -100,6 +102,12 @@
+     @INC     = ("-I$lib_zlib_path/include", @INC);
+     @LIBPATH = ("-L$lib_zlib_path/lib", @LIBPATH); 
+ }
++if( defined($lib_fontconfig_path) ) 
++{
++    print "Fontconfig library used from:     $lib_fontconfig_path\n";
++    @INC     = ("-I$lib_fontconfig_path/include", @INC);
++    @LIBPATH = ("-L$lib_fontconfig_path/lib", @LIBPATH); 
++}
+ #############################################################################################
+ 
+ if ($^O eq 'VMS'){
diff --git a/gnu/packages/patches/perl-module-pluggable-search.patch b/gnu/packages/patches/perl-module-pluggable-search.patch
new file mode 100644
index 0000000000..bb2a57f7e5
--- /dev/null
+++ b/gnu/packages/patches/perl-module-pluggable-search.patch
@@ -0,0 +1,25 @@
+Fix core Perl module Module::Pluggable such that it can find plugins that live
+in symlinked directories.
+
+Patch borrowed/adapted from Nixpkgs.
+
+--- perl-5.16.1/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm	2015-04-08 23:28:48.120164135 -0500
++++ perl-5.16.1/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm	2015-04-08 23:30:27.032166704 -0500
+@@ -164,7 +164,7 @@
+         my $sp = catdir($dir, (split /::/, $searchpath));
+ 
+         # if it doesn't exist or it's not a dir then skip it
+-        next unless ( -e $sp && -d _ ); # Use the cached stat the second time
++        next unless ( -e $sp );
+ 
+         my @files = $self->find_files($sp);
+ 
+@@ -279,7 +279,7 @@
+                              (my $path = $File::Find::name) =~ s#^\\./##;
+                              push @files, $path;
+                            }
+-                      }, $search_path );
++                      }, "$search_path/." );
+     }
+     #chdir $cwd;
+     return @files;
diff --git a/gnu/packages/patches/perl-net-amazon-s3-moose-warning.patch b/gnu/packages/patches/perl-net-amazon-s3-moose-warning.patch
new file mode 100644
index 0000000000..c6408d5251
--- /dev/null
+++ b/gnu/packages/patches/perl-net-amazon-s3-moose-warning.patch
@@ -0,0 +1,17 @@
+Patch borrowed from nixpkgs.  Works around warning message produced by the
+current version of Moose:
+
+"Passing a list of values to enum is deprecated. Enum values should be wrapped
+in an arrayref."
+
+--- Net-Amazon-S3-0.60/lib/Net/Amazon/S3/Client/Object.pm	2015-04-15 16:18:47.226410022 -0500
++++ Net-Amazon-S3-0.60/lib/Net/Amazon/S3/Client/Object.pm	2015-04-15 16:19:25.410408425 -0500
+@@ -19,7 +19,7 @@
+     [ qw(private public-read public-read-write authenticated-read) ];
+ 
+ enum 'StorageClass' =>
+-    qw(standard reduced_redundancy);
++    [ qw(standard reduced_redundancy) ];
+ 
+ has 'client' =>
+     ( is => 'ro', isa => 'Net::Amazon::S3::Client', required => 1 );
diff --git a/gnu/packages/patches/portaudio-audacity-compat.patch b/gnu/packages/patches/portaudio-audacity-compat.patch
new file mode 100644
index 0000000000..9f239ada35
--- /dev/null
+++ b/gnu/packages/patches/portaudio-audacity-compat.patch
@@ -0,0 +1,324 @@
+Description: Add features needed to make portmixer work with audacity.
+Author: Audacity Team
+Last-Update: 2011-12-07
+
+See <http://music.columbia.edu/pipermail/portaudio/2015-March/016611.html>.
+
+--- a/include/pa_win_ds.h
++++ b/include/pa_win_ds.h
+@@ -89,6 +89,21 @@
+ 

+ }PaWinDirectSoundStreamInfo;

+ 

++/** Retrieve the GUID of the input device.

++

++ @param stream The stream to query.

++

++ @return A pointer to the GUID, or NULL if none.

++*/

++LPGUID PaWinDS_GetStreamInputGUID( PaStream* s );

++

++/** Retrieve the GUID of the output device.

++

++ @param stream The stream to query.

++

++ @return A pointer to the GUID, or NULL if none.

++*/

++LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s );

+ 

+ 

+ #ifdef __cplusplus

+--- a/include/portaudio.h
++++ b/include/portaudio.h
+@@ -1146,6 +1146,15 @@
+ signed long Pa_GetStreamWriteAvailable( PaStream* stream );
+ 
+ 
++/** Retrieve the host type handling an open stream.
++
++ @return Returns a non-negative value representing the host API type
++ handling an open stream or, a PaErrorCode (which are always negative)
++ if PortAudio is not initialized or an error is encountered.
++*/
++PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream );
++
++
+ /* Miscellaneous utilities */
+ 
+ 
+--- /dev/null
++++ b/include/pa_unix_oss.h
+@@ -0,0 +1,104 @@
++#ifndef PA_UNIX_OSS_H
++#define PA_UNIX_OSS_H
++
++/*
++ * $Id: portaudio.patch,v 1.10 2009-06-30 04:52:59 llucius Exp $
++ * PortAudio Portable Real-Time Audio Library
++ * OSS-specific extensions
++ *
++ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files
++ * (the "Software"), to deal in the Software without restriction,
++ * including without limitation the rights to use, copy, modify, merge,
++ * publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so,
++ * subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * Any person wishing to distribute modifications to the Software is
++ * requested to send the modifications to the original developer so that
++ * they can be incorporated into the canonical version.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ *
++ */
++
++/** @file
++ * OSS-specific PortAudio API extension header file.
++ */
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++const char *PaOSS_GetStreamInputDevice( PaStream *s );
++
++const char *PaOSS_GetStreamOutputDevice( PaStream *s );
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
++#ifndef PA_UNIX_OSS_H
++#define PA_UNIX_OSS_H
++
++/*
++ * $Id: portaudio.patch,v 1.10 2009-06-30 04:52:59 llucius Exp $
++ * PortAudio Portable Real-Time Audio Library
++ * OSS-specific extensions
++ *
++ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files
++ * (the "Software"), to deal in the Software without restriction,
++ * including without limitation the rights to use, copy, modify, merge,
++ * publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so,
++ * subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * Any person wishing to distribute modifications to the Software is
++ * requested to send the modifications to the original developer so that
++ * they can be incorporated into the canonical version.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
++ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ *
++ */
++
++/** @file
++ * OSS-specific PortAudio API extension header file.
++ */
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++const char *PaOSS_GetStreamInputDevice( PaStream *s );
++
++const char *PaOSS_GetStreamOutputDevice( PaStream *s );
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+--- a/src/common/pa_front.c
++++ b/src/common/pa_front.c
+@@ -1216,8 +1216,10 @@
+                                   hostApiInputParametersPtr, hostApiOutputParametersPtr,
+                                   sampleRate, framesPerBuffer, streamFlags, streamCallback, userData );
+ 
+-    if( result == paNoError )
++    if( result == paNoError ) {
+         AddOpenStream( *stream );
++        PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type;
++    }
+ 
+ 
+     PA_LOGAPI(("Pa_OpenStream returned:\n" ));
+@@ -1729,6 +1731,32 @@
+     return result;
+ }
+ 
++PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream )
++{
++    PaError error = PaUtil_ValidateStreamPointer( stream );
++    PaHostApiTypeId result;
++
++#ifdef PA_LOG_API_CALLS
++    PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" );
++    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
++#endif
++
++    if( error == paNoError )
++    {
++        result = PA_STREAM_REP(stream)->hostApiType;
++    }
++    else
++    {
++        result = (PaHostApiTypeId) error;
++    }
++
++#ifdef PA_LOG_API_CALLS
++    PaUtil_DebugPrint("Pa_GetStreamHostApiType returned:\n" );
++    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
++#endif
++
++    return result;
++}
+ 
+ PaError Pa_GetSampleSize( PaSampleFormat format )
+ {
+--- a/src/common/pa_stream.c
++++ b/src/common/pa_stream.c
+@@ -93,6 +93,8 @@
+     streamRepresentation->streamInfo.inputLatency = 0.;
+     streamRepresentation->streamInfo.outputLatency = 0.;
+     streamRepresentation->streamInfo.sampleRate = 0.;
++
++    streamRepresentation->hostApiType = 0;
+ }
+ 
+ 
+--- a/src/common/pa_stream.h
++++ b/src/common/pa_stream.h
+@@ -152,6 +152,7 @@
+     PaStreamFinishedCallback *streamFinishedCallback;
+     void *userData;
+     PaStreamInfo streamInfo;
++    PaHostApiTypeId hostApiType;
+ } PaUtilStreamRepresentation;
+ 
+ 
+--- a/src/hostapi/coreaudio/pa_mac_core_blocking.c
++++ b/src/hostapi/coreaudio/pa_mac_core_blocking.c
+@@ -66,6 +66,9 @@
+ #ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS

+ # define OSAtomicOr32( a, b ) ( (*(b)) |= (a) )

+ # define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) )

++#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3

++# define OSAtomicOr32( a, b ) BitOrAtomic( a, (UInt32 *) b )

++# define OSAtomicAnd32( a, b ) BitAndAtomic( a, (UInt32 *) b )

+ #else

+ # include <libkern/OSAtomic.h>

+ #endif

+--- a/src/hostapi/alsa/pa_linux_alsa.c
++++ b/src/hostapi/alsa/pa_linux_alsa.c
+@@ -611,6 +611,7 @@
+     StreamDirection streamDir;
+ 
+     snd_pcm_channel_area_t *channelAreas;  /* Needed for channel adaption */
++    int card;
+ } PaAlsaStreamComponent;
+ 
+ /* Implementation specific stream structure */
+@@ -1806,6 +1807,7 @@
+ {
+     PaError result = paNoError;
+     PaSampleFormat userSampleFormat = params->sampleFormat, hostSampleFormat = paNoError;
++    snd_pcm_info_t* pcmInfo;
+     assert( params->channelCount > 0 );
+ 
+     /* Make sure things have an initial value */
+@@ -1826,6 +1828,9 @@
+     self->device = params->device;
+ 
+     PA_ENSURE( AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm ) );
++
++    snd_pcm_info_alloca( &pcmInfo );
++    self->card = snd_pcm_info_get_card( pcmInfo );
+     self->nfds = alsa_snd_pcm_poll_descriptors_count( self->pcm );
+ 
+     PA_ENSURE( hostSampleFormat = PaUtil_SelectClosestAvailableFormat( GetAvailableFormats( self->pcm ), userSampleFormat ) );
+@@ -4519,9 +4524,7 @@
+     /* XXX: More descriptive error? */
+     PA_UNLESS( stream->capture.pcm, paDeviceUnavailable );
+ 
+-    alsa_snd_pcm_info_alloca( &pcmInfo );
+-    PA_ENSURE( alsa_snd_pcm_info( stream->capture.pcm, pcmInfo ) );
+-    *card = alsa_snd_pcm_info_get_card( pcmInfo );
++    *card = stream->capture.card;
+ 
+ error:
+     return result;
+@@ -4537,9 +4540,7 @@
+     /* XXX: More descriptive error? */
+     PA_UNLESS( stream->playback.pcm, paDeviceUnavailable );
+ 
+-    alsa_snd_pcm_info_alloca( &pcmInfo );
+-    PA_ENSURE( alsa_snd_pcm_info( stream->playback.pcm, pcmInfo ) );
+-    *card = alsa_snd_pcm_info_get_card( pcmInfo );
++    *card = stream->playback.card;
+ 
+ error:
+     return result;
+--- a/src/hostapi/oss/pa_unix_oss.c
++++ b/src/hostapi/oss/pa_unix_oss.c
+@@ -2028,3 +2028,26 @@
+ #endif
+ }
+ 
++const char *PaOSS_GetStreamInputDevice( PaStream* s )
++{
++    PaOssStream *stream = (PaOssStream*)s;
++
++    if( stream->capture )
++    {
++      return stream->capture->devName;
++    }
++
++   return NULL;
++}
++
++const char *PaOSS_GetStreamOutputDevice( PaStream* s )
++{
++    PaOssStream *stream = (PaOssStream*)s;
++
++    if( stream->playback )
++    {
++      return stream->playback->devName;
++    }
++
++   return NULL;
++}
+--- a/configure.in
++++ b/configure.in
+@@ -365,6 +365,7 @@
+                    DLL_LIBS="$DLL_LIBS -lossaudio"
+                    LIBS="$LIBS -lossaudio"
+            fi
++           INCLUDES="$INCLUDES pa_unix_oss.h"
+            AC_DEFINE(PA_USE_OSS,1)
+         fi
+ 
diff --git a/gnu/packages/patches/pulseaudio-longer-test-timeout.patch b/gnu/packages/patches/pulseaudio-longer-test-timeout.patch
new file mode 100644
index 0000000000..fa81f749d2
--- /dev/null
+++ b/gnu/packages/patches/pulseaudio-longer-test-timeout.patch
@@ -0,0 +1,13 @@
+Increase the timeout on 'cpu-mix-test' to accommodate slower machines.
+
+--- pulseaudio-6.0/src/tests/cpu-mix-test.c.ORIG	2015-02-12 09:10:35.000000000 -0500
++++ pulseaudio-6.0/src/tests/cpu-mix-test.c	2015-03-31 13:45:05.316878322 -0400
+@@ -212,7 +212,7 @@
+ #if defined (__arm__) && defined (__linux__) && defined (HAVE_NEON)
+     tcase_add_test(tc, mix_neon_test);
+ #endif
+-    tcase_set_timeout(tc, 120);
++    tcase_set_timeout(tc, 240);
+     suite_add_tcase(s, tc);
+ 
+     sr = srunner_create(s);
diff --git a/gnu/packages/patches/pycairo-wscript.patch b/gnu/packages/patches/pycairo-wscript.patch
new file mode 100644
index 0000000000..c49f0afcb3
--- /dev/null
+++ b/gnu/packages/patches/pycairo-wscript.patch
@@ -0,0 +1,31 @@
+Update the wscript to work with waf-1.8.8.  Based on:
+http://cgit.freedesktop.org/pycairo/commit/?id=c57cd129407c904f8c2f752a59d0183df7b01a5e
+
+
+--- pycairo-1.10.0.orig/wscript	2011-04-18 15:42:29.000000000 +0800
++++ pycairo-1.10.0/wscript	2015-04-20 13:01:45.383756898 +0800
+@@ -13,18 +13,18 @@
+ 
+ def options(ctx):
+   print('  %s/options()' %d)
+-  ctx.tool_options('gnu_dirs')
+-  ctx.tool_options('compiler_cc')
+-  ctx.tool_options('python') # options for disabling pyc or pyo compilation
++  ctx.load('gnu_dirs')
++  ctx.load('compiler_c')
++  ctx.load('python') # options for disabling pyc or pyo compilation
+ 
+ 
+ def configure(ctx):
+   print('  %s/configure()' %d)
+ 
+   env = ctx.env
+-  ctx.check_tool('gnu_dirs')
+-  ctx.check_tool('compiler_cc')
+-  ctx.check_tool('python')
++  ctx.load('gnu_dirs')
++  ctx.load('compiler_c')
++  ctx.load('python')
+   ctx.check_python_version((3,1,0))
+   ctx.check_python_headers()
+   ctx.check_cfg(package='cairo', atleast_version=cairo_version_required,
diff --git a/gnu/packages/patches/python-fix-tests.patch b/gnu/packages/patches/python-fix-tests.patch
index 70e4aa05d5..82c19980f9 100644
--- a/gnu/packages/patches/python-fix-tests.patch
+++ b/gnu/packages/patches/python-fix-tests.patch
@@ -64,8 +64,8 @@ http://bugs.python.org/issue20868 .
      @unittest.skipUnless(support.is_resource_enabled('network'),
                           'network is not enabled')
      def test_idna(self):
---- Lib/test/test_multiprocessing.py	2014-04-06 23:12:27.575235000 +0200
-+++ Lib/test/test_multiprocessing.py	2014-04-06 23:13:04.827235000 +0200
+--- Lib/test/_test_multiprocessing.py	2014-04-06 23:12:27.575235000 +0200
++++ Lib/test/_test_multiprocessing.py	2014-04-06 23:13:04.827235000 +0200
 @@ -1016,6 +1016,7 @@
          if pid is not None:
              os.kill(pid, signal.SIGINT)
@@ -112,3 +112,52 @@ http://bugs.python.org/issue20868 .
      def test_issue_8959_a(self):
          from ctypes.util import find_library
          libc_path = find_library("c")
+--- Tools/scripts/run_tests.py.orig	2015-04-06 03:52:17.484000000 +0200
++++ Tools/scripts/run_tests.py	2015-04-06 03:52:25.880000000 +0200
+@@ -47,7 +47,7 @@
+     if threading and not any(is_multiprocess_flag(arg) for arg in regrtest_args):
+         args.extend(['-j', '0'])  # Use all CPU cores
+     if not any(is_resource_use_flag(arg) for arg in regrtest_args):
+-        args.extend(['-u', 'all,-largefile,-audio,-gui'])
++        args.extend(['-u', 'all,-largefile,-audio,-gui,-network'])
+     args.extend(regrtest_args)
+     print(' '.join(args))
+     os.execv(sys.executable, args)
+--- Lib/distutils/tests/test_archive_util.py.orig	2015-04-06 04:08:49.288000000 +0200
++++ Lib/distutils/tests/test_archive_util.py	2015-04-06 04:09:34.396000000 +0200
+@@ -282,6 +282,7 @@
+         finally:
+             del ARCHIVE_FORMATS['xxx']
+
++    @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
+     def test_make_archive_owner_group(self):
+         # testing make_archive with owner and group, with various combinations
+         # this works even if there's not gid/uid support
+@@ -310,6 +311,7 @@
+
+     @unittest.skipUnless(ZLIB_SUPPORT, "Requires zlib")
+     @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
++    @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
+     def test_tarfile_root_owner(self):
+         tmpdir, tmpdir2, base_name =  self._create_files()
+         old_dir = os.getcwd()
+--- Lib/distutils/tests/test_sdist.py.orig	2015-04-06 04:10:05.264000000 +0200
++++ Lib/distutils/tests/test_sdist.py	2015-04-06 04:10:21.448000000 +0200
+@@ -435,6 +435,7 @@
+                      "The tar command is not found")
+     @unittest.skipIf(find_executable('gzip') is None,
+                      "The gzip command is not found")
++    @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
+     def test_make_distribution_owner_group(self):
+         # now building a sdist
+         dist, cmd = self.get_cmd()
+--- Lib/test/test_resource.py.orig	2015-04-06 21:30:24.708000000 +0200
++++ Lib/test/test_resource.py	2015-04-06 23:07:27.220000000 +0200
+@@ -146,6 +146,7 @@
+
+     @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit')
+     @support.requires_linux_version(2, 6, 36)
++    @unittest.skipIf(True, "Bug: the PermissionError is not raised")
+     def test_prlimit(self):
+         self.assertRaises(TypeError, resource.prlimit)
+         if os.geteuid() != 0:
diff --git a/gnu/packages/patches/python-sqlite-3.8.4-test-fix.patch b/gnu/packages/patches/python-sqlite-3.8.4-test-fix.patch
deleted file mode 100644
index 2f8b159870..0000000000
--- a/gnu/packages/patches/python-sqlite-3.8.4-test-fix.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-From resolution of upstream python issue #20901: http://bugs.python.org/issue20901
-
-diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
---- Lib/sqlite3/test/hooks.py
-+++ Lib/sqlite3/test/hooks.py
-@@ -162,7 +162,7 @@ class ProgressTests(unittest.TestCase):
-             create table bar (a, b)
-             """)
-         second_count = len(progress_calls)
--        self.assertGreater(first_count, second_count)
-+        self.assertGreaterEqual(first_count, second_count)
- 
-     def CheckCancelOperation(self):
-         """
-
diff --git a/gnu/packages/patches/qemu-CVE-2015-3456.patch b/gnu/packages/patches/qemu-CVE-2015-3456.patch
new file mode 100644
index 0000000000..9514f7c3e5
--- /dev/null
+++ b/gnu/packages/patches/qemu-CVE-2015-3456.patch
@@ -0,0 +1,85 @@
+From e907746266721f305d67bc0718795fedee2e824c Mon Sep 17 00:00:00 2001
+From: Petr Matousek <pmatouse@redhat.com>
+Date: Wed, 6 May 2015 09:48:59 +0200
+Subject: [PATCH] fdc: force the fifo access to be in bounds of the allocated
+ buffer
+
+During processing of certain commands such as FD_CMD_READ_ID and
+FD_CMD_DRIVE_SPECIFICATION_COMMAND the fifo memory access could
+get out of bounds leading to memory corruption with values coming
+from the guest.
+
+Fix this by making sure that the index is always bounded by the
+allocated memory.
+
+This is CVE-2015-3456.
+
+Signed-off-by: Petr Matousek <pmatouse@redhat.com>
+Reviewed-by: John Snow <jsnow@redhat.com>
+Signed-off-by: John Snow <jsnow@redhat.com>
+---
+ hw/block/fdc.c | 17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/hw/block/fdc.c b/hw/block/fdc.c
+index f72a392..d8a8edd 100644
+--- a/hw/block/fdc.c
++++ b/hw/block/fdc.c
+@@ -1497,7 +1497,7 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
+ {
+     FDrive *cur_drv;
+     uint32_t retval = 0;
+-    int pos;
++    uint32_t pos;
+ 
+     cur_drv = get_cur_drv(fdctrl);
+     fdctrl->dsr &= ~FD_DSR_PWRDOWN;
+@@ -1506,8 +1506,8 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
+         return 0;
+     }
+     pos = fdctrl->data_pos;
++    pos %= FD_SECTOR_LEN;
+     if (fdctrl->msr & FD_MSR_NONDMA) {
+-        pos %= FD_SECTOR_LEN;
+         if (pos == 0) {
+             if (fdctrl->data_pos != 0)
+                 if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) {
+@@ -1852,10 +1852,13 @@ static void fdctrl_handle_option(FDCtrl *fdctrl, int direction)
+ static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direction)
+ {
+     FDrive *cur_drv = get_cur_drv(fdctrl);
++    uint32_t pos;
+ 
+-    if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) {
++    pos = fdctrl->data_pos - 1;
++    pos %= FD_SECTOR_LEN;
++    if (fdctrl->fifo[pos] & 0x80) {
+         /* Command parameters done */
+-        if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x40) {
++        if (fdctrl->fifo[pos] & 0x40) {
+             fdctrl->fifo[0] = fdctrl->fifo[1];
+             fdctrl->fifo[2] = 0;
+             fdctrl->fifo[3] = 0;
+@@ -1955,7 +1958,7 @@ static uint8_t command_to_handler[256];
+ static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
+ {
+     FDrive *cur_drv;
+-    int pos;
++    uint32_t pos;
+ 
+     /* Reset mode */
+     if (!(fdctrl->dor & FD_DOR_nRESET)) {
+@@ -2004,7 +2007,9 @@ static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
+     }
+ 
+     FLOPPY_DPRINTF("%s: %02x\n", __func__, value);
+-    fdctrl->fifo[fdctrl->data_pos++] = value;
++    pos = fdctrl->data_pos++;
++    pos %= FD_SECTOR_LEN;
++    fdctrl->fifo[pos] = value;
+     if (fdctrl->data_pos == fdctrl->data_len) {
+         /* We now have all parameters
+          * and will be able to treat the command
+-- 
+2.2.1
+
diff --git a/gnu/packages/patches/qt4-ldflags.patch b/gnu/packages/patches/qt4-ldflags.patch
new file mode 100644
index 0000000000..0d6398018a
--- /dev/null
+++ b/gnu/packages/patches/qt4-ldflags.patch
@@ -0,0 +1,18 @@
+Explicitly link against libicui18n so that libQtCore.so always finds it.
+
+--- qt-everywhere-opensource-src-4.8.6/src/corelib/corelib.pro	2015-04-15 12:01:41.661862663 +0200
++++ qt-everywhere-opensource-src-4.8.6/src/corelib/corelib.pro	2015-04-15 12:03:57.954586336 +0200
+@@ -19,6 +19,13 @@ include(codecs/codecs.pri)
+ include(statemachine/statemachine.pri)
+ include(xml/xml.pri)
+ 
++# Explicitly link with icui18n, which is dlopened by libQtCore.so.
++# We cannot do this by setting LDFLAGS because that then overrides
++# other LDFLAGS: <https://bugreports.qt.io/browse/QTBUG-5471>.
++# XXX: According to the Nixpkgs recipe, this may be necessary for
++# further libraries (cups, gtk-x11-2.0, libgdk-x11-2.0).
++LIBS_PRIVATE += -licui18n
++
+ !qpa:mac|darwin:LIBS_PRIVATE += -framework ApplicationServices
+ qpa:mac {
+     !ios {
diff --git a/gnu/packages/patches/qt5-conflicting-typedefs.patch b/gnu/packages/patches/qt5-conflicting-typedefs.patch
new file mode 100644
index 0000000000..751452c2db
--- /dev/null
+++ b/gnu/packages/patches/qt5-conflicting-typedefs.patch
@@ -0,0 +1,70 @@
+See <https://bugreports.qt.io/browse/QTBUG-45205>.
+
+diff --git a/qtwebengine/src/core/chromium_gpu_helper.cpp b/qtwebengine/src/core/chromium_gpu_helper.cpp
+index c7c97e6..ef574ec 100644
+--- a/qtwebengine/src/core/chromium_gpu_helper.cpp
++++ b/qtwebengine/src/core/chromium_gpu_helper.cpp
+@@ -40,13 +40,15 @@
+ 
+ #include "chromium_gpu_helper.h"
+ 
+-#include "content/common/gpu/gpu_channel_manager.h"
+-#include "content/common/gpu/sync_point_manager.h"
+-#include "content/gpu/gpu_child_thread.h"
++// Including gpu/command_buffer headers before content/gpu headers makes sure that
++// guards are defined to prevent duplicate definition errors with forward declared
++// GL typedefs cascading through content header includes.
+ #include "gpu/command_buffer/service/mailbox_manager.h"
+ #include "gpu/command_buffer/service/texture_manager.h"
+ 
+-#include <QtGlobal> // We need this for the Q_OS_QNX define.
++#include "content/common/gpu/gpu_channel_manager.h"
++#include "content/common/gpu/sync_point_manager.h"
++#include "content/gpu/gpu_child_thread.h"
+ 
+ #ifdef Q_OS_QNX
+ #include "content/common/gpu/stream_texture_qnx.h"
+diff --git a/qtwebengine/src/core/gl_surface_qt.cpp b/qtwebengine/src/core/gl_surface_qt.cpp
+index 4fe2f21..5a27aa9 100644
+--- a/qtwebengine/src/core/gl_surface_qt.cpp
++++ b/qtwebengine/src/core/gl_surface_qt.cpp
+@@ -49,8 +49,6 @@
+ #include "base/logging.h"
+ #include "base/memory/scoped_ptr.h"
+ #include "content/common/gpu/image_transport_surface.h"
+-#include "content/common/gpu/gpu_channel_manager.h"
+-#include "content/common/gpu/gpu_command_buffer_stub.h"
+ #include "ui/gl/egl_util.h"
+ #include "ui/gl/gl_context.h"
+ #include "ui/gl/gl_implementation.h"
+@@ -544,7 +542,9 @@ GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window)
+ }  // namespace gfx
+ 
+ namespace content {
+-scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(GpuChannelManager* manager, GpuCommandBufferStub* stub, const gfx::GLSurfaceHandle& handle)
++class GpuCommandBufferStub;
++class GpuChannelManager;
++scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(GpuChannelManager*, GpuCommandBufferStub*, const gfx::GLSurfaceHandle&)
+ {
+     QT_NOT_USED
+     return scoped_refptr<gfx::GLSurface>();
+diff --git a/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h b/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h
+index 04a3dc3..506cf00 100644
+--- a/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h
++++ b/qtwebengine/src/3rdparty/chromium/gpu/command_buffer/common/gles2_cmd_format.h
+@@ -20,6 +20,7 @@
+ #include "gpu/command_buffer/common/cmd_buffer_common.h"
+ #include "gpu/command_buffer/common/gles2_cmd_ids.h"
+ 
++#ifndef GL_VERSION_1_5
+ // GL types are forward declared to avoid including the GL headers. The problem
+ // is determining which GL headers to include from code that is common to the
+ // client and service sides (GLES2 or one of several GL implementations).
+@@ -47,6 +48,7 @@ typedef signed long long int GLsizeiptr;
+ typedef khronos_intptr_t GLintptr;
+ typedef khronos_ssize_t  GLsizeiptr;
+ #endif
++#endif
+ 
+ namespace gpu {
+ namespace gles2 {
diff --git a/gnu/packages/patches/qt5-runpath.patch b/gnu/packages/patches/qt5-runpath.patch
new file mode 100644
index 0000000000..a6cbb26ff9
--- /dev/null
+++ b/gnu/packages/patches/qt5-runpath.patch
@@ -0,0 +1,25 @@
+Allow the use of DT_RUNPATH.  This fixes a bug whereby libQt5WebEngineCore.so
+ends up having an empty RUNPATH.
+
+--- qt-everywhere-opensource-src-5.4.1/qtwebengine/src/3rdparty/chromium/build/common.gypi	2015-04-14 10:21:09.330925545 +0200
++++ qt-everywhere-opensource-src-5.4.1/qtwebengine/src/3rdparty/chromium/build/common.gypi	2015-04-14 10:21:38.735106097 +0200
+@@ -4142,19 +4142,6 @@
+               '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
+             ],
+           }],
+-          # Some binutils 2.23 releases may or may not have new dtags enabled,
+-          # but they are all compatible with --disable-new-dtags,
+-          # because the new dynamic tags are not created by default.
+-          ['binutils_version>=223', {
+-            # Newer binutils don't set DT_RPATH unless you disable "new" dtags
+-            # and the new DT_RUNPATH doesn't work without --no-as-needed flag.
+-            # FIXME(mithro): Figure out the --as-needed/--no-as-needed flags
+-            # inside this file to allow usage of --no-as-needed and removal of
+-            # this flag.
+-            'ldflags': [
+-              '-Wl,--disable-new-dtags',
+-            ],
+-          }]
+         ],
+       },
+     }],
diff --git a/gnu/packages/patches/r-fix-15899.patch b/gnu/packages/patches/r-fix-15899.patch
new file mode 100644
index 0000000000..40593d34e6
--- /dev/null
+++ b/gnu/packages/patches/r-fix-15899.patch
@@ -0,0 +1,17 @@
+Without the "extern" keyword external applications linking against R (such as
+Shogun, for example) might not be linkable.
+
+See https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15899 for details
+about this bug.
+
+--- a/src/include/Rinterface.h	(revision 66251)
++++ b/src/include/Rinterface.h	(working copy)
+@@ -84,7 +84,7 @@
+ void fpu_setup(Rboolean);
+ 
+ /* in unix/system.c */
+-int R_running_as_main_program; 
++extern int R_running_as_main_program; 
+ 
+ #ifdef CSTACK_DEFNS
+ /* duplicating Defn.h */
diff --git a/gnu/packages/patches/rsem-makefile.patch b/gnu/packages/patches/rsem-makefile.patch
new file mode 100644
index 0000000000..5481dc685f
--- /dev/null
+++ b/gnu/packages/patches/rsem-makefile.patch
@@ -0,0 +1,682 @@
+This patch simplifies the Makefile, making it much easier to build rsem
+without the bundled version of samtools.  It has already been submitted
+upstream: https://github.com/bli25wisc/RSEM/pull/11
+
+From 161894e91a16c7e15af57e4fcfe8cb613711c7fa Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 14:51:07 +0200
+Subject: [PATCH 1/7] remove all headers from Makefile
+
+---
+ Makefile | 95 +++++++++++-----------------------------------------------------
+ 1 file changed, 16 insertions(+), 79 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 54e2603..3a55ed8 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,133 +10,70 @@ all : $(PROGRAMS)
+ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+ 
+-Transcript.h : utils.h
+-
+-Transcripts.h : utils.h my_assert.h Transcript.h
+-
+-rsem-extract-reference-transcripts : utils.h my_assert.h GTFItem.h Transcript.h Transcripts.h extractRef.cpp
++rsem-extract-reference-transcripts : extractRef.cpp
+ 	$(CC) -Wall -O3 extractRef.cpp -o rsem-extract-reference-transcripts
+ 
+-rsem-synthesis-reference-transcripts : utils.h my_assert.h Transcript.h Transcripts.h synthesisRef.cpp
++rsem-synthesis-reference-transcripts : synthesisRef.cpp
+ 	$(CC) -Wall -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
+ 
+-BowtieRefSeqPolicy.h : RefSeqPolicy.h
+-
+-RefSeq.h : utils.h
+-
+-Refs.h : utils.h RefSeq.h RefSeqPolicy.h PolyARules.h
+-
+-
+ rsem-preref : preRef.o
+ 	$(CC) preRef.o -o rsem-preref
+ 
+-preRef.o : utils.h RefSeq.h Refs.h PolyARules.h RefSeqPolicy.h AlignerRefSeqPolicy.h preRef.cpp
++preRef.o : preRef.cpp
+ 	$(CC) $(COFLAGS) preRef.cpp
+ 
+-
+-SingleRead.h : Read.h
+-
+-SingleReadQ.h : Read.h
+-
+-PairedEndRead.h : Read.h SingleRead.h
+-
+-PairedEndReadQ.h : Read.h SingleReadQ.h
+-
+-
+-PairedEndHit.h : SingleHit.h
+-
+-HitContainer.h : GroupInfo.h
+-
+-
+-SamParser.h : sam/sam.h sam/bam.h utils.h my_assert.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h Transcripts.h
+-
+-
+ rsem-parse-alignments : parseIt.o sam/libbam.a
+ 	$(CC) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread 
+ 
+-parseIt.o : utils.h GroupInfo.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h HitContainer.h SamParser.h Transcripts.h sam/sam.h sam/bam.h parseIt.cpp
++parseIt.o : parseIt.cpp
+ 	$(CC) -Wall -O2 -c -I. parseIt.cpp
+ 
+-
+-rsem-build-read-index : utils.h buildReadIndex.cpp
++rsem-build-read-index : buildReadIndex.cpp
+ 	$(CC) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+-
+-simul.h : boost/random.hpp
+-
+-ReadReader.h : SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h ReadIndex.h
+-
+-SingleModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h Profile.h NoiseProfile.h ModelParams.h RefSeq.h Refs.h SingleRead.h SingleHit.h ReadReader.h simul.h
+-
+-SingleQModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h Refs.h SingleReadQ.h SingleHit.h ReadReader.h simul.h
+-
+-PairedEndModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h Profile.h NoiseProfile.h ModelParams.h RefSeq.h Refs.h SingleRead.h PairedEndRead.h PairedEndHit.h ReadReader.h simul.h 
+-
+-PairedEndQModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h Refs.h SingleReadQ.h PairedEndReadQ.h PairedEndHit.h ReadReader.h simul.h
+-
+-HitWrapper.h : HitContainer.h
+-
+-sam_rsem_aux.h : sam/bam.h
+-
+-sam_rsem_cvt.h : sam/bam.h Transcript.h Transcripts.h
+-
+-BamWriter.h : sam/sam.h sam/bam.h sam_rsem_aux.h sam_rsem_cvt.h SingleHit.h PairedEndHit.h HitWrapper.h Transcript.h Transcripts.h
+-
+-sampling.h : boost/random.hpp
+-
+-WriteResults.h : utils.h my_assert.h GroupInfo.h Transcript.h Transcripts.h RefSeq.h Refs.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h
+-
+ rsem-run-em : EM.o sam/libbam.a
+ 	$(CC) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
+ 
+-EM.o : utils.h my_assert.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h Refs.h GroupInfo.h HitContainer.h ReadIndex.h ReadReader.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h RefSeqPolicy.h PolyARules.h Profile.h NoiseProfile.h Transcript.h Transcripts.h HitWrapper.h BamWriter.h sam/bam.h sam/sam.h simul.h sam_rsem_aux.h sampling.h boost/random.hpp WriteResults.h EM.cpp
++EM.o : EM.cpp
+ 	$(CC) $(COFLAGS) EM.cpp
+ 
+-bc_aux.h : sam/bam.h
+-
+-BamConverter.h : utils.h my_assert.h sam/sam.h sam/bam.h sam_rsem_aux.h sam_rsem_cvt.h bc_aux.h Transcript.h Transcripts.h
+-
+-rsem-tbam2gbam : utils.h Transcripts.h Transcript.h bc_aux.h BamConverter.h sam/sam.h sam/bam.h sam/libbam.a sam_rsem_aux.h sam_rsem_cvt.h tbam2gbam.cpp sam/libbam.a
++rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-bam2wig : utils.h my_assert.h wiggle.h wiggle.o sam/libbam.a bam2wig.cpp
++rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+ 	$(CC) -O3 -Wall bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-bam2readdepth : utils.h my_assert.h wiggle.h wiggle.o sam/libbam.a bam2readdepth.cpp
++rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+ 	$(CC) -O3 -Wall bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+-wiggle.o: sam/bam.h sam/sam.h wiggle.cpp wiggle.h
++wiggle.o: wiggle.cpp
+ 	$(CC) $(COFLAGS) wiggle.cpp
+ 
+ rsem-simulate-reads : simulation.o
+ 	$(CC) -o rsem-simulate-reads simulation.o
+ 
+-simulation.o : utils.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h Refs.h RefSeq.h GroupInfo.h Transcript.h Transcripts.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h Profile.h NoiseProfile.h simul.h boost/random.hpp WriteResults.h simulation.cpp
++simulation.o : simulation.cpp
+ 	$(CC) $(COFLAGS) simulation.cpp
+ 
+ rsem-run-gibbs : Gibbs.o
+ 	$(CC) -o rsem-run-gibbs Gibbs.o -lpthread
+ 
+-#some header files are omitted
+-Gibbs.o : utils.h my_assert.h boost/random.hpp sampling.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h RefSeq.h RefSeqPolicy.h PolyARules.h Refs.h GroupInfo.h WriteResults.h Gibbs.cpp 
++Gibbs.o : Gibbs.cpp
+ 	$(CC) $(COFLAGS) Gibbs.cpp
+ 
+-Buffer.h : my_assert.h
+-
+ rsem-calculate-credibility-intervals : calcCI.o
+ 	$(CC) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+-#some header files are omitted
+-calcCI.o : utils.h my_assert.h boost/random.hpp sampling.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h RefSeq.h RefSeqPolicy.h PolyARules.h Refs.h GroupInfo.h WriteResults.h Buffer.h calcCI.cpp
++calcCI.o : calcCI.cpp
+ 	$(CC) $(COFLAGS) calcCI.cpp
+ 
+-rsem-get-unique : sam/bam.h sam/sam.h getUnique.cpp sam/libbam.a
++rsem-get-unique : getUnique.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall getUnique.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-sam-validator : sam/bam.h sam/sam.h my_assert.h samValidator.cpp sam/libbam.a
++rsem-sam-validator : samValidator.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall samValidator.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-scan-for-paired-end-reads : sam/bam.h sam/sam.h my_assert.h scanForPairedEndReads.cpp sam/libbam.a
++rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ ebseq :
+
+From ec136638a727632e20abfaeb65c22c46d15ca8c4 Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:06:41 +0200
+Subject: [PATCH 2/7] include current dir, ./sam and ./boost by default
+
+---
+ Makefile | 48 ++++++++++++++++++++++++------------------------
+ 1 file changed, 24 insertions(+), 24 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 3a55ed8..1dd97ca 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ CC = g++
+-CFLAGS = -Wall -c -I.
+-COFLAGS = -Wall -O3 -ffast-math -c -I.
++CFLAGS = -Wall -I. -I./sam -I./boost
++COFLAGS = -O3 -ffast-math -c
+ PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
+ 
+ .PHONY : all ebseq clean
+@@ -11,70 +11,70 @@ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+ 
+ rsem-extract-reference-transcripts : extractRef.cpp
+-	$(CC) -Wall -O3 extractRef.cpp -o rsem-extract-reference-transcripts
++	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
+ 
+ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+-	$(CC) -Wall -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
++	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
+ 
+ rsem-preref : preRef.o
+-	$(CC) preRef.o -o rsem-preref
++	$(CC) $(CFLAGS) preRef.o -o rsem-preref
+ 
+ preRef.o : preRef.cpp
+-	$(CC) $(COFLAGS) preRef.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
+ 
+ rsem-parse-alignments : parseIt.o sam/libbam.a
+-	$(CC) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread 
++	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
+ 
+ parseIt.o : parseIt.cpp
+-	$(CC) -Wall -O2 -c -I. parseIt.cpp
++	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+-	$(CC) -O3 buildReadIndex.cpp -o rsem-build-read-index
++	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+ rsem-run-em : EM.o sam/libbam.a
+-	$(CC) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
++	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
+ 
+ EM.o : EM.cpp
+-	$(CC) $(COFLAGS) EM.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
+ 
+ rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+-	$(CC) -O3 -Wall tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+-	$(CC) -O3 -Wall bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+-	$(CC) -O3 -Wall bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+ wiggle.o: wiggle.cpp
+-	$(CC) $(COFLAGS) wiggle.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
+ 
+ rsem-simulate-reads : simulation.o
+-	$(CC) -o rsem-simulate-reads simulation.o
++	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
+ 
+ simulation.o : simulation.cpp
+-	$(CC) $(COFLAGS) simulation.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
+ 
+ rsem-run-gibbs : Gibbs.o
+-	$(CC) -o rsem-run-gibbs Gibbs.o -lpthread
++	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
+ 
+ Gibbs.o : Gibbs.cpp
+-	$(CC) $(COFLAGS) Gibbs.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
+ 
+ rsem-calculate-credibility-intervals : calcCI.o
+-	$(CC) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
++	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+ calcCI.o : calcCI.cpp
+-	$(CC) $(COFLAGS) calcCI.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
+ 
+ rsem-get-unique : getUnique.cpp sam/libbam.a
+-	$(CC) -O3 -Wall getUnique.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-sam-validator : samValidator.cpp sam/libbam.a
+-	$(CC) -O3 -Wall samValidator.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 samValidator.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+-	$(CC) -O3 -Wall scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ ebseq :
+ 	cd EBSeq ; ${MAKE} all
+
+From d366614ea50f79fdd93e3c76383ccb6fcdeaa8e0 Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:10:49 +0200
+Subject: [PATCH 3/7] separate object rules from rules for executables
+
+---
+ Makefile | 50 ++++++++++++++++++++++++++------------------------
+ 1 file changed, 26 insertions(+), 24 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1dd97ca..ae4de3b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,6 +10,32 @@ all : $(PROGRAMS)
+ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+ 
++ebseq :
++	cd EBSeq ; ${MAKE} all
++
++
++calcCI.o : calcCI.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
++
++EM.o : EM.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
++
++Gibbs.o : Gibbs.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
++
++preRef.o : preRef.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
++
++parseIt.o : parseIt.cpp
++	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
++
++simulation.o : simulation.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
++
++wiggle.o: wiggle.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
++
++
+ rsem-extract-reference-transcripts : extractRef.cpp
+ 	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
+ 
+@@ -19,24 +45,15 @@ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+ rsem-preref : preRef.o
+ 	$(CC) $(CFLAGS) preRef.o -o rsem-preref
+ 
+-preRef.o : preRef.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
+-
+ rsem-parse-alignments : parseIt.o sam/libbam.a
+ 	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
+ 
+-parseIt.o : parseIt.cpp
+-	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
+-
+ rsem-build-read-index : buildReadIndex.cpp
+ 	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+ rsem-run-em : EM.o sam/libbam.a
+ 	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
+ 
+-EM.o : EM.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
+-
+ rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+ 	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+@@ -46,27 +63,15 @@ rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+ rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+ 	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+-wiggle.o: wiggle.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
+-
+ rsem-simulate-reads : simulation.o
+ 	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
+ 
+-simulation.o : simulation.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
+-
+ rsem-run-gibbs : Gibbs.o
+ 	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
+ 
+-Gibbs.o : Gibbs.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
+-
+ rsem-calculate-credibility-intervals : calcCI.o
+ 	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+-calcCI.o : calcCI.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
+-
+ rsem-get-unique : getUnique.cpp sam/libbam.a
+ 	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+@@ -76,9 +81,6 @@ rsem-sam-validator : samValidator.cpp sam/libbam.a
+ rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+ 	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-ebseq :
+-	cd EBSeq ; ${MAKE} all
+-
+ clean :
+ 	rm -f *.o *~ $(PROGRAMS)
+ 	cd sam ; ${MAKE} clean
+
+From 6ba1c33cccdf7c8e7df7a3189e7db204be3b1e8d Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:28:30 +0200
+Subject: [PATCH 4/7] add ./sam to library directories, link with -lbam
+
+---
+ Makefile | 36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ae4de3b..a87cc4d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,11 +1,11 @@
+ CC = g++
+-CFLAGS = -Wall -I. -I./sam -I./boost
++CFLAGS = -Wall -I. -I./sam -I./boost -L./sam
+ COFLAGS = -O3 -ffast-math -c
+ PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
+ 
+ .PHONY : all ebseq clean
+ 
+-all : $(PROGRAMS)
++all : sam/libbam.a $(PROGRAMS)
+ 
+ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+@@ -45,23 +45,23 @@ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+ rsem-preref : preRef.o
+ 	$(CC) $(CFLAGS) preRef.o -o rsem-preref
+ 
+-rsem-parse-alignments : parseIt.o sam/libbam.a
+-	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
++rsem-parse-alignments : parseIt.o
++	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o -lbam -lz -lpthread
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+ 	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+-rsem-run-em : EM.o sam/libbam.a
+-	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
++rsem-run-em : EM.o
++	$(CC) $(CFLAGS) -o rsem-run-em EM.o -lbam -lz -lpthread
+ 
+-rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-tbam2gbam : tbam2gbam.cpp
++	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
+ 
+-rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+-	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++rsem-bam2wig : wiggle.o bam2wig.cpp
++	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o -lbam -lz -lpthread -o $@
+ 
+-rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+-	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
++	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
+ 
+ rsem-simulate-reads : simulation.o
+ 	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
+@@ -72,14 +72,14 @@ rsem-run-gibbs : Gibbs.o
+ rsem-calculate-credibility-intervals : calcCI.o
+ 	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+-rsem-get-unique : getUnique.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-get-unique : getUnique.cpp
++	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
+ 
+-rsem-sam-validator : samValidator.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 samValidator.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-sam-validator : samValidator.cpp
++	$(CC) $(CFLAGS) -O3 samValidator.cpp -lbam -lz -lpthread -o $@
+ 
+-rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp
++	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp -lbam -lz -lpthread -o $@
+ 
+ clean :
+ 	rm -f *.o *~ $(PROGRAMS)
+
+From 5402b88c269df79ee245c1c59e15f3c8282a0220 Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:33:02 +0200
+Subject: [PATCH 5/7] do not repeat target name, use $@ instead
+
+---
+ Makefile | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index a87cc4d..7ec90a3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -37,22 +37,22 @@ wiggle.o: wiggle.cpp
+ 
+ 
+ rsem-extract-reference-transcripts : extractRef.cpp
+-	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
++	$(CC) $(CFLAGS) -O3 extractRef.cpp -o $@
+ 
+ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+-	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
++	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o $@
+ 
+ rsem-preref : preRef.o
+-	$(CC) $(CFLAGS) preRef.o -o rsem-preref
++	$(CC) $(CFLAGS) preRef.o -o $@
+ 
+ rsem-parse-alignments : parseIt.o
+-	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ parseIt.o -lbam -lz -lpthread
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+-	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
++	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o $@
+ 
+ rsem-run-em : EM.o
+-	$(CC) $(CFLAGS) -o rsem-run-em EM.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ EM.o -lbam -lz -lpthread
+ 
+ rsem-tbam2gbam : tbam2gbam.cpp
+ 	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
+@@ -64,13 +64,13 @@ rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
+ 	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
+ 
+ rsem-simulate-reads : simulation.o
+-	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
++	$(CC) $(CFLAGS) -o $@ simulation.o
+ 
+ rsem-run-gibbs : Gibbs.o
+-	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
++	$(CC) $(CFLAGS) -o $@ Gibbs.o -lpthread
+ 
+ rsem-calculate-credibility-intervals : calcCI.o
+-	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
++	$(CC) $(CFLAGS) -o $@ calcCI.o -lpthread
+ 
+ rsem-get-unique : getUnique.cpp
+ 	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
+
+From f60784bc7aa303cc825bd87dd3f5d7d26c51bded Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:44:53 +0200
+Subject: [PATCH 6/7] use automatic variables to refer to prerequisites
+
+---
+ Makefile | 44 ++++++++++++++++++++++----------------------
+ 1 file changed, 22 insertions(+), 22 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 7ec90a3..6540d81 100644
+--- a/Makefile
++++ b/Makefile
+@@ -15,71 +15,71 @@ ebseq :
+ 
+ 
+ calcCI.o : calcCI.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ EM.o : EM.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ Gibbs.o : Gibbs.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ preRef.o : preRef.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ parseIt.o : parseIt.cpp
+-	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
++	$(CC) $(CFLAGS) -O2 -c $<
+ 
+ simulation.o : simulation.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ wiggle.o: wiggle.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ 
+ rsem-extract-reference-transcripts : extractRef.cpp
+-	$(CC) $(CFLAGS) -O3 extractRef.cpp -o $@
++	$(CC) $(CFLAGS) -O3 $< -o $@
+ 
+ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+-	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o $@
++	$(CC) $(CFLAGS) -O3 $< -o $@
+ 
+ rsem-preref : preRef.o
+-	$(CC) $(CFLAGS) preRef.o -o $@
++	$(CC) $(CFLAGS) $< -o $@
+ 
+ rsem-parse-alignments : parseIt.o
+-	$(CC) $(CFLAGS) -o $@ parseIt.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lbam -lz -lpthread
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+-	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o $@
++	$(CC) $(CFLAGS) -O3 $< -o $@
+ 
+ rsem-run-em : EM.o
+-	$(CC) $(CFLAGS) -o $@ EM.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lbam -lz -lpthread
+ 
+ rsem-tbam2gbam : tbam2gbam.cpp
+-	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ rsem-bam2wig : wiggle.o bam2wig.cpp
+-	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $^ -lbam -lz -lpthread -o $@
+ 
+ rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
+-	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $^ -lbam -lz -lpthread -o $@
+ 
+ rsem-simulate-reads : simulation.o
+-	$(CC) $(CFLAGS) -o $@ simulation.o
++	$(CC) $(CFLAGS) -o $@ $<
+ 
+ rsem-run-gibbs : Gibbs.o
+-	$(CC) $(CFLAGS) -o $@ Gibbs.o -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lpthread
+ 
+ rsem-calculate-credibility-intervals : calcCI.o
+-	$(CC) $(CFLAGS) -o $@ calcCI.o -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lpthread
+ 
+ rsem-get-unique : getUnique.cpp
+-	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ rsem-sam-validator : samValidator.cpp
+-	$(CC) $(CFLAGS) -O3 samValidator.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp
+-	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ clean :
+ 	rm -f *.o *~ $(PROGRAMS)
+
+From 0cf9721077f67fb4ca15fdc59cbfbf24a944debd Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:49:19 +0200
+Subject: [PATCH 7/7] split long line
+
+---
+ Makefile | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 6540d81..0ab04a5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,22 @@
+ CC = g++
+ CFLAGS = -Wall -I. -I./sam -I./boost -L./sam
+ COFLAGS = -O3 -ffast-math -c
+-PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
++PROGRAMS = \
++  rsem-extract-reference-transcripts \
++  rsem-synthesis-reference-transcripts \
++  rsem-preref \
++  rsem-parse-alignments \
++  rsem-build-read-index \
++  rsem-run-em \
++  rsem-tbam2gbam \
++  rsem-run-gibbs \
++  rsem-calculate-credibility-intervals \
++  rsem-simulate-reads \
++  rsem-bam2wig \
++  rsem-get-unique \
++  rsem-bam2readdepth \
++  rsem-sam-validator \
++  rsem-scan-for-paired-end-reads
+ 
+ .PHONY : all ebseq clean
+ 
diff --git a/gnu/packages/patches/serf-comment-style-fix.patch b/gnu/packages/patches/serf-comment-style-fix.patch
new file mode 100644
index 0000000000..5d336fb3c8
--- /dev/null
+++ b/gnu/packages/patches/serf-comment-style-fix.patch
@@ -0,0 +1,23 @@
+r2443 | andreas.stieger@gmx.de | 2014-10-21 17:42:56 -0400 (Tue, 21 Oct 2014) | 7 lines
+
+Follow-up to r2419: Correct comment style
+
+* test/test_buckets.c
+  (deflate_compress): Correct comment style not supported by strict
+  compilers, fails on /branches/1.3.x
+
+Index: test/test_buckets.c
+===================================================================
+--- test/test_buckets.c	(revision 2442)
++++ test/test_buckets.c	(revision 2443)
+@@ -1323,9 +1323,9 @@
+ 
+     /* The largest buffer we should need is 0.1% larger than the
+        uncompressed data, + 12 bytes. This info comes from zlib.h.
++       buf_size = orig_len + (orig_len / 1000) + 12;
+        Note: This isn't sufficient when using Z_NO_FLUSH and extremely compressed
+        data. Use a buffer bigger than what we need. */
+-//    buf_size = orig_len + (orig_len / 1000) + 12;
+     buf_size = 100000;
+ 
+     write_buf = apr_palloc(pool, buf_size);
diff --git a/gnu/packages/patches/serf-deflate-buckets-test-fix.patch b/gnu/packages/patches/serf-deflate-buckets-test-fix.patch
new file mode 100644
index 0000000000..be8be1b1e8
--- /dev/null
+++ b/gnu/packages/patches/serf-deflate-buckets-test-fix.patch
@@ -0,0 +1,69 @@
+r2445 | chemodax | 2014-10-23 12:15:22 -0400 (Thu, 23 Oct 2014) | 6 lines
+
+Reduce memory usage by deflate buckets test.
+
+* test/test_buckets.c
+  (deflate_buckets): Add POOL argument and use it instead of tb->pool.
+  (test_deflate_buckets): Use iterpool for deflate_buckets() call.
+
+Index: test/test_buckets.c
+===================================================================
+--- test/test_buckets.c	(revision 2444)
++++ test/test_buckets.c	(revision 2445)
+@@ -1400,12 +1400,12 @@
+                           expected_len);
+ }
+ 
+-static void deflate_buckets(CuTest *tc, int nr_of_loops)
++static void deflate_buckets(CuTest *tc, int nr_of_loops, apr_pool_t *pool)
+ {
+     const char *msg = "12345678901234567890123456789012345678901234567890";
+ 
+     test_baton_t *tb = tc->testBaton;
+-    serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(tb->pool, NULL,
++    serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(pool, NULL,
+                                                               NULL);
+     z_stream zdestr;
+     int i;
+@@ -1424,8 +1424,8 @@
+     {
+         serf_config_t *config;
+ 
+-        serf_context_t *ctx = serf_context_create(tb->pool);
+-        /* status = */ serf__config_store_get_config(ctx, NULL, &config, tb->pool);
++        serf_context_t *ctx = serf_context_create(pool);
++        /* status = */ serf__config_store_get_config(ctx, NULL, &config, pool);
+ 
+         serf_bucket_set_config(defbkt, config);
+     }
+@@ -1447,11 +1447,11 @@
+         if (i == nr_of_loops - 1) {
+             CuAssertIntEquals(tc, APR_SUCCESS,
+                               deflate_compress(&data, &len, &zdestr, msg,
+-                                               strlen(msg), 1, tb->pool));
++                                               strlen(msg), 1, pool));
+         } else {
+             CuAssertIntEquals(tc, APR_SUCCESS,
+                               deflate_compress(&data, &len, &zdestr, msg,
+-                                               strlen(msg), 0, tb->pool));
++                                               strlen(msg), 0, pool));
+         }
+ 
+         if (len == 0)
+@@ -1469,10 +1469,15 @@
+ static void test_deflate_buckets(CuTest *tc)
+ {
+     int i;
++    apr_pool_t *iterpool;
++    test_baton_t *tb = tc->testBaton;
+ 
++    apr_pool_create(&iterpool, tb->pool);
+     for (i = 1; i < 1000; i++) {
+-        deflate_buckets(tc, i);
++        apr_pool_clear(iterpool);
++        deflate_buckets(tc, i, iterpool);
+     }
++    apr_pool_destroy(iterpool);
+ }
+ 
+ static apr_status_t discard_data(serf_bucket_t *bkt,
diff --git a/gnu/packages/patches/source-highlight-regexrange-test.patch b/gnu/packages/patches/source-highlight-regexrange-test.patch
deleted file mode 100644
index 298c831b35..0000000000
--- a/gnu/packages/patches/source-highlight-regexrange-test.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Disable a single check.  The failure is discussed at:
-
-  https://savannah.gnu.org/bugs/index.php?41786
-
---- a/lib/tests/test_regexranges_main.cpp	2012-04-14 08:58:25.000000000 -0500
-+++ b/lib/tests/test_regexranges_main.cpp	2014-03-05 23:49:23.520402043 -0600
-@@ -52,7 +52,7 @@
-     check_range_regex("simple regex");
-     check_range_regex("[[:alpha:]]+");
-     // test with a wrong regular expression
--    check_range_regex("{notclosed", false);
-+    // check_range_regex("{notclosed", false);
- 
-     // reset regular expressions
-     ranges.clear();
diff --git a/gnu/packages/patches/subversion-sqlite-3.8.9-fix.patch b/gnu/packages/patches/subversion-sqlite-3.8.9-fix.patch
new file mode 100644
index 0000000000..92d8a85c8f
--- /dev/null
+++ b/gnu/packages/patches/subversion-sqlite-3.8.9-fix.patch
@@ -0,0 +1,59 @@
+This upstream patch (r1672295) is needed to fix a test failure when built
+against sqlite 3.8.9.  See:
+
+  https://mail-archives.apache.org/mod_mbox/subversion-dev/201504.mbox/%3C5526D197.6020808@gmx.de%3E
+
+
+r1672295 | rhuijben | 2015-04-09 07:31:12 -0400 (Thu, 09 Apr 2015) | 15 lines
+
+Optimize STMT_SELECT_EXTERNALS_DEFINED when using Sqlite 3.8.9, by
+adding two more rows to the sqlite_stat1 table.
+
+This fixes a test failure in wc-queries-test.c, but actual users most
+likely don't notice a difference as a tablescan on an EXTERNALS tables
+index is not that expensive, given that most working copies don't have
+many externals.
+
+* subversion/libsvn_wc/wc-metadata.sql
+  (STMT_INSTALL_SCHEMA_STATISTICS): Add two rows.
+
+* subversion/tests/libsvn_wc/wc-queries-test.c
+  (test_schema_statistics): Add a dummy externals row to allow
+    verifying schema.
+
+Index: subversion/tests/libsvn_wc/wc-queries-test.c
+===================================================================
+--- subversion/tests/libsvn_wc/wc-queries-test.c	(revision 1672294)
++++ subversion/tests/libsvn_wc/wc-queries-test.c	(revision 1672295)
+@@ -927,6 +927,15 @@
+                    "VALUES (1, '', '')",
+                    NULL, NULL, NULL));
+ 
++  SQLITE_ERR(
++      sqlite3_exec(sdb,
++                   "INSERT INTO EXTERNALS (wc_id, local_relpath,"
++                   "                       parent_relpath, repos_id,"
++                   "                       presence, kind, def_local_relpath,"
++                   "                       def_repos_relpath) "
++                   "VALUES (1, 'subdir', '', 1, 'normal', 'dir', '', '')",
++                   NULL, NULL, NULL));
++
+   /* These are currently not necessary for query optimization, but it's better
+      to tell Sqlite how we intend to use this table anyway */
+   SQLITE_ERR(
+Index: subversion/libsvn_wc/wc-metadata.sql
+===================================================================
+--- subversion/libsvn_wc/wc-metadata.sql	(revision 1672294)
++++ subversion/libsvn_wc/wc-metadata.sql	(revision 1672295)
+@@ -619,6 +619,11 @@
+ INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES
+     ('WC_LOCK', 'sqlite_autoindex_WC_LOCK_1',           '100 100 1');
+ 
++INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES
++    ('EXTERNALS','sqlite_autoindex_EXTERNALS_1',        '100 100 1');
++INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES
++    ('EXTERNALS','I_EXTERNALS_DEFINED',                 '100 100 3 1');
++
+ /* sqlite_autoindex_WORK_QUEUE_1 doesn't exist because WORK_QUEUE is
+    a INTEGER PRIMARY KEY AUTOINCREMENT table */
+ 
diff --git a/gnu/packages/patches/tvtime-gcc41.patch b/gnu/packages/patches/tvtime-gcc41.patch
new file mode 100644
index 0000000000..d6e42721b8
--- /dev/null
+++ b/gnu/packages/patches/tvtime-gcc41.patch
@@ -0,0 +1,58 @@
+Source: https://projects.archlinux.org/svntogit/community.git/tree/trunk/tvtime-1.0.2-gcc41.patch?h=packages/tvtime
+
+--- tvtime-1.0.1/plugins/greedyh.asm	2005-08-14 18:16:43.000000000 +0200
++++ tvtime-1.0.1-gcc41/plugins/greedyh.asm	2005-11-28 17:53:09.210774544 +0100
+@@ -18,7 +18,7 @@
+ 
+ #include "x86-64_macros.inc"
+ 
+-void DScalerFilterGreedyH::FUNCT_NAME(TDeinterlaceInfo* pInfo)
++void FUNCT_NAME(TDeinterlaceInfo* pInfo)
+ {
+     int64_t i;
+     bool InfoIsOdd = (pInfo->PictureHistory[0]->Flags & PICTURE_INTERLACED_ODD) ? 1 : 0;
+diff -Naur tvtime-1.0.1/plugins/tomsmocomp/TomsMoCompAll2.inc tvtime-1.0.1-gcc41/plugins/tomsmocomp/TomsMoCompAll2.inc
+--- tvtime-1.0.1/plugins/tomsmocomp/TomsMoCompAll2.inc	2004-10-20 17:31:05.000000000 +0200
++++ tvtime-1.0.1-gcc41/plugins/tomsmocomp/TomsMoCompAll2.inc	2005-11-28 17:53:33.251119856 +0100
+@@ -5,9 +5,9 @@
+ #endif
+ 
+ #ifdef USE_STRANGE_BOB
+-#define SEARCH_EFFORT_FUNC(n) DScalerFilterTomsMoComp::SEFUNC(n##_SB)
++#define SEARCH_EFFORT_FUNC(n) SEFUNC(n##_SB)
+ #else
+-#define SEARCH_EFFORT_FUNC(n) DScalerFilterTomsMoComp::SEFUNC(n)
++#define SEARCH_EFFORT_FUNC(n) SEFUNC(n)
+ #endif
+ 
+ int SEARCH_EFFORT_FUNC(0)		// we don't try at all ;-)
+diff -Naur tvtime-1.0.1/plugins/tomsmocomp.cpp tvtime-1.0.1-gcc41/plugins/tomsmocomp.cpp
+--- tvtime-1.0.1/plugins/tomsmocomp.cpp	2004-10-20 19:38:04.000000000 +0200
++++ tvtime-1.0.1-gcc41/plugins/tomsmocomp.cpp	2005-11-28 17:52:53.862107896 +0100
+@@ -31,7 +31,7 @@
+ 
+ #define IS_MMX
+ #define SSE_TYPE MMX
+-#define FUNCT_NAME DScalerFilterTomsMoComp::filterDScaler_MMX
++#define FUNCT_NAME filterDScaler_MMX
+ #include "tomsmocomp/TomsMoCompAll.inc"
+ #undef  IS_MMX
+ #undef  SSE_TYPE
+@@ -39,7 +39,7 @@
+ 
+ #define IS_3DNOW
+ #define SSE_TYPE 3DNOW
+-#define FUNCT_NAME DScalerFilterTomsMoComp::filterDScaler_3DNOW
++#define FUNCT_NAME filterDScaler_3DNOW
+ #include "tomsmocomp/TomsMoCompAll.inc"
+ #undef  IS_3DNOW
+ #undef  SSE_TYPE
+@@ -47,7 +47,7 @@
+ 
+ #define IS_SSE
+ #define SSE_TYPE SSE
+-#define FUNCT_NAME DScalerFilterTomsMoComp::filterDScaler_SSE
++#define FUNCT_NAME filterDScaler_SSE
+ #include "tomsmocomp/TomsMoCompAll.inc"
+ #undef  IS_SSE
+ #undef  SSE_TYPE
diff --git a/gnu/packages/patches/tvtime-pngoutput.patch b/gnu/packages/patches/tvtime-pngoutput.patch
new file mode 100644
index 0000000000..0d14f77ca1
--- /dev/null
+++ b/gnu/packages/patches/tvtime-pngoutput.patch
@@ -0,0 +1,15 @@
+Source: https://sources.debian.net/src/tvtime/1.0.2-14/debian/patches/libpng.diff
+
+From: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+Date: Mon, 14 May 2012 19:01:31 +0900
+Prepares the package for libpng 1.5.  Closes: #650582.
+
+--- tvtime-1.0.2.orig/src/pngoutput.c
++++ tvtime-1.0.2/src/pngoutput.c
+@@ -18,5 +18,6 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <zlib.h>
+ #include <png.h>
+ #include "pngoutput.h" 
diff --git a/gnu/packages/patches/tvtime-videodev2.patch b/gnu/packages/patches/tvtime-videodev2.patch
new file mode 100644
index 0000000000..74131f25d0
--- /dev/null
+++ b/gnu/packages/patches/tvtime-videodev2.patch
@@ -0,0 +1,15 @@
+Fix compilation error: non-existing header file.
+
+This is an excerpt from the debian patch:
+http://http.debian.net/debian/pool/main/t/tvtime/tvtime_1.0.2-14.diff.gz
+
+--- tvtime-1.0.2.orig/src/videodev2.h
++++ tvtime-1.0.2/src/videodev2.h
+@@ -16,7 +16,6 @@
+ #ifdef __KERNEL__
+ #include <linux/time.h> /* need struct timeval */
+ #endif
+-#include <linux/compiler.h> /* need __user */
+ 
+ /* for kernel versions 2.4.26 and below: */
+ #ifndef __user
diff --git a/gnu/packages/patches/tvtime-xmltv.patch b/gnu/packages/patches/tvtime-xmltv.patch
new file mode 100644
index 0000000000..2f4afc6e5a
--- /dev/null
+++ b/gnu/packages/patches/tvtime-xmltv.patch
@@ -0,0 +1,28 @@
+Fix compilation error: conflicting types for 'locale_t'.
+
+This is an excerpt from the debian patch ... 
+http://http.debian.net/debian/pool/main/t/tvtime/tvtime_1.0.2-14.diff.gz
+
+--- tvtime-1.0.2.orig/src/xmltv.c
++++ tvtime-1.0.2/src/xmltv.c
+@@ -118,9 +118,9 @@
+ typedef struct {
+     const char *code;
+     const char *name;
+-} locale_t;
++} tvtime_locale_t;
+ 
+-static locale_t locale_table[] = {
++static tvtime_locale_t locale_table[] = {
+     {"AA", "Afar"},           {"AB", "Abkhazian"},      {"AF", "Afrikaans"},
+     {"AM", "Amharic"},        {"AR", "Arabic"},         {"AS", "Assamese"},
+     {"AY", "Aymara"},         {"AZ", "Azerbaijani"},    {"BA", "Bashkir"},
+@@ -168,7 +168,7 @@
+     {"XH", "Xhosa"},          {"YO", "Yoruba"},         {"ZH", "Chinese"},
+     {"ZU", "Zulu"} };
+ 
+-const int num_locales = sizeof( locale_table ) / sizeof( locale_t );
++const int num_locales = sizeof( locale_table ) / sizeof( tvtime_locale_t );
+ 
+ /**
+  * Timezone parsing code based loosely on the algorithm in
diff --git a/gnu/packages/patches/udev-gir-libtool.patch b/gnu/packages/patches/udev-gir-libtool.patch
deleted file mode 100644
index 7504f87eb8..0000000000
--- a/gnu/packages/patches/udev-gir-libtool.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Without this patch, 'ld' as invoked by 'g-ir-scanner' fails to find -lgudev-1.0
-This is because libtool puts it in $(top_builddir)/.libs.
-
-This patch forces 'g-ir-scanner' to use libtool, which enables it to find
-libgudev-1.0.la.
-
---- udev-182/Makefile.in	2014-06-22 14:55:07.000000000 +0200
-+++ udev-182/Makefile.in	2014-06-22 14:55:15.000000000 +0200
-@@ -3622,7 +3622,7 @@ test-sys-distclean:
- @ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--namespace GUdev \
- @ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--nsversion=1.0 \
- @ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--include=GObject-2.0 \
--@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--library=gudev-1.0 \
-+@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--library=gudev-1.0 --libtool=$(top_builddir)/libtool \
- @ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--library-path=$(top_builddir)/src \
- @ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--library-path=$(top_builddir)/src/gudev \
- @ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@		--output $@ \
diff --git a/gnu/packages/patches/upower-builddir.patch b/gnu/packages/patches/upower-builddir.patch
new file mode 100644
index 0000000000..13cef5876a
--- /dev/null
+++ b/gnu/packages/patches/upower-builddir.patch
@@ -0,0 +1,44 @@
+Remove explicit set of UPOWER_CONF_FILE_NAME in up-self-test.c;
+instead the harness should set it.  In Guix we set it explicitly; the
+right thing is to use AM_TEST_ENVIRONMENT and regenerate the
+makefiles, but we can't regenerate because current autotools carp on
+some things, so we patch the Makefile.in instead.
+
+Also fix to not try to create /var/lib/upower if /var isn't writable.
+
+Patch by Andy Wingo <wingo@igalia.com>
+
+--- upower-0.99.2.orig/src/Makefile.in	2014-12-18 10:32:01.000000000 +0100
++++ upower-0.99.2/src/Makefile.in	2015-04-04 19:49:28.020843678 +0200
+@@ -780,6 +780,7 @@
+ 
+ @UP_BUILD_TESTS_TRUE@up_self_test_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS_C)
+ @UP_BUILD_TESTS_TRUE@TESTS_ENVIRONMENT = $(DBUS_LAUNCH)
++@UP_BUILD_TESTS_TRUE@AM_TESTS_ENVIRONMENT = UPOWER_CONF_FILE_NAME=$(top_srcdir)/etc/UPower.conf
+ dbusservicedir = $(datadir)/dbus-1/system-services
+ dbusservice_in_files = org.freedesktop.UPower.service.in
+ dbusservice_DATA = $(dbusservice_in_files:.service.in=.service)
+@@ -1789,7 +1790,7 @@
+ @HAVE_SYSTEMDSYSTEMUNITDIR_TRUE@	@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+ 
+ install-data-hook:
+-	if test -w $(DESTDIR)$(prefix)/; then \
++	if test -w $(DESTDIR)$(localstatedir)/; then \
+ 		mkdir -p $(DESTDIR)$(historydir); \
+ 	fi
+ 
+--- upower-0.99.2.orig/src/up-self-test.c	2014-07-17 09:46:15.000000000 +0200
++++ upower-0.99.2/src/up-self-test.c	2015-04-04 18:43:04.952741927 +0200
+@@ -295,12 +295,6 @@
+ #endif
+ 	g_test_init (&argc, &argv, NULL);
+ 
+-	/* make check, vs. make distcheck */
+-	if (g_file_test ("../etc/UPower.conf", G_FILE_TEST_EXISTS))
+-		g_setenv ("UPOWER_CONF_FILE_NAME", "../etc/UPower.conf", TRUE);
+-	else
+-		g_setenv ("UPOWER_CONF_FILE_NAME", "../../etc/UPower.conf", TRUE);
+-
+ 	/* tests go here */
+ 	g_test_add_func ("/power/backend", up_test_backend_func);
+ 	g_test_add_func ("/power/device", up_test_device_func);
diff --git a/gnu/packages/patches/webkitgtk-2.4.8-gmutexlocker.patch b/gnu/packages/patches/webkitgtk-2.4.8-gmutexlocker.patch
new file mode 100644
index 0000000000..79e12c302f
--- /dev/null
+++ b/gnu/packages/patches/webkitgtk-2.4.8-gmutexlocker.patch
@@ -0,0 +1,289 @@
+Webkit's own WebCore::GMutexLocker conflicts with the GMutexLocker in
+glib-2.44.0.
+
+Patch taken from <http://pkgs.fedoraproject.org/cgit/webkitgtk3.git/
+plain/webkitgtk-2.4.8-gmutexlocker.patch
+?id=7433f334cc84866af5ef0b2c25ead931e6e603ea>.
+
+
+diff -up webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp.gmutexlocker webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
+--- webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp.gmutexlocker	2015-02-18 15:40:21.851816374 +0100
++++ webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2015-02-18 15:45:58.560092191 +0100
+@@ -316,7 +316,7 @@ void MediaPlayerPrivateGStreamerBase::mu
+ #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)
+ PassRefPtr<BitmapTexture> MediaPlayerPrivateGStreamerBase::updateTexture(TextureMapper* textureMapper)
+ {
+-    GMutexLocker lock(m_bufferMutex);
++    WebCore::GMutexLocker lock(m_bufferMutex);
+     if (!m_buffer)
+         return nullptr;
+ 
+@@ -366,7 +366,7 @@ void MediaPlayerPrivateGStreamerBase::tr
+     g_return_if_fail(GST_IS_BUFFER(buffer));
+ 
+     {
+-        GMutexLocker lock(m_bufferMutex);
++        WebCore::GMutexLocker lock(m_bufferMutex);
+         gst_buffer_replace(&m_buffer, buffer);
+     }
+ 
+@@ -398,7 +398,7 @@ void MediaPlayerPrivateGStreamerBase::pa
+     if (!m_player->visible())
+         return;
+ 
+-    GMutexLocker lock(m_bufferMutex);
++    WebCore::GMutexLocker lock(m_bufferMutex);
+     if (!m_buffer)
+         return;
+ 
+diff -up webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp.gmutexlocker webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+diff -up webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp.gmutexlocker webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp
+--- webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp.gmutexlocker	2015-02-18 15:16:11.995228731 +0100
++++ webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp	2015-02-18 15:45:42.686843477 +0100
+@@ -118,7 +118,7 @@ static gboolean webkitVideoSinkTimeoutCa
+     WebKitVideoSink* sink = reinterpret_cast<WebKitVideoSink*>(data);
+     WebKitVideoSinkPrivate* priv = sink->priv;
+ 
+-    GMutexLocker lock(priv->bufferMutex);
++    WebCore::GMutexLocker lock(priv->bufferMutex);
+     GstBuffer* buffer = priv->buffer;
+     priv->buffer = 0;
+     priv->timeoutId = 0;
+@@ -140,7 +140,7 @@ static GstFlowReturn webkitVideoSinkRend
+     WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(baseSink);
+     WebKitVideoSinkPrivate* priv = sink->priv;
+ 
+-    GMutexLocker lock(priv->bufferMutex);
++    WebCore::GMutexLocker lock(priv->bufferMutex);
+ 
+     if (priv->unlocked)
+         return GST_FLOW_OK;
+@@ -279,7 +279,7 @@ static void webkitVideoSinkGetProperty(G
+ 
+ static void unlockBufferMutex(WebKitVideoSinkPrivate* priv)
+ {
+-    GMutexLocker lock(priv->bufferMutex);
++    WebCore::GMutexLocker lock(priv->bufferMutex);
+ 
+     if (priv->buffer) {
+         gst_buffer_unref(priv->buffer);
+@@ -305,7 +305,7 @@ static gboolean webkitVideoSinkUnlockSto
+     WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv;
+ 
+     {
+-        GMutexLocker lock(priv->bufferMutex);
++        WebCore::GMutexLocker lock(priv->bufferMutex);
+         priv->unlocked = false;
+     }
+ 
+@@ -330,7 +330,7 @@ static gboolean webkitVideoSinkStart(Gst
+ {
+     WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv;
+ 
+-    GMutexLocker lock(priv->bufferMutex);
++    WebCore::GMutexLocker lock(priv->bufferMutex);
+     priv->unlocked = false;
+     return TRUE;
+ }
+diff -up webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp.gmutexlocker webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
+--- webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp.gmutexlocker	2015-02-18 15:16:40.954678407 +0100
++++ webkitgtk-2.4.8/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2015-02-18 15:45:19.567481225 +0100
+@@ -346,7 +346,7 @@ static void webKitWebSrcSetProperty(GObj
+ 
+     switch (propID) {
+     case PROP_IRADIO_MODE: {
+-        GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++        WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+         priv->iradioMode = g_value_get_boolean(value);
+         break;
+     }
+@@ -364,7 +364,7 @@ static void webKitWebSrcGetProperty(GObj
+     WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
+     WebKitWebSrcPrivate* priv = src->priv;
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     switch (propID) {
+     case PROP_IRADIO_MODE:
+         g_value_set_boolean(value, priv->iradioMode);
+@@ -417,7 +417,7 @@ static gboolean webKitWebSrcStop(WebKitW
+ 
+     ASSERT(isMainThread());
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+ 
+     bool seeking = priv->seekID;
+ 
+@@ -476,7 +476,7 @@ static gboolean webKitWebSrcStart(WebKit
+ 
+     ASSERT(isMainThread());
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+ 
+     priv->startID = 0;
+     priv->corsAccessCheck = CORSNoCheck;
+@@ -573,7 +573,7 @@ static GstStateChangeReturn webKitWebSrc
+         return ret;
+     }
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     switch (transition) {
+     case GST_STATE_CHANGE_READY_TO_PAUSED:
+         GST_DEBUG_OBJECT(src, "READY->PAUSED");
+@@ -604,7 +604,7 @@ static gboolean webKitWebSrcQueryWithPar
+         gst_query_parse_duration(query, &format, NULL);
+ 
+         GST_DEBUG_OBJECT(src, "duration query in format %s", gst_format_get_name(format));
+-        GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++        WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+         if (format == GST_FORMAT_BYTES && src->priv->size > 0) {
+             gst_query_set_duration(query, format, src->priv->size);
+             result = TRUE;
+@@ -612,7 +612,7 @@ static gboolean webKitWebSrcQueryWithPar
+         break;
+     }
+     case GST_QUERY_URI: {
+-        GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++        WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+         gst_query_set_uri(query, src->priv->uri);
+         result = TRUE;
+         break;
+@@ -653,7 +653,7 @@ static gchar* webKitWebSrcGetUri(GstURIH
+     WebKitWebSrc* src = WEBKIT_WEB_SRC(handler);
+     gchar* ret;
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     ret = g_strdup(src->priv->uri);
+     return ret;
+ }
+@@ -668,7 +668,7 @@ static gboolean webKitWebSrcSetUri(GstUR
+         return FALSE;
+     }
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+ 
+     g_free(priv->uri);
+     priv->uri = 0;
+@@ -704,7 +704,7 @@ static gboolean webKitWebSrcNeedDataMain
+ 
+     ASSERT(isMainThread());
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     // already stopped
+     if (!priv->needDataID)
+         return FALSE;
+@@ -725,7 +725,7 @@ static void webKitWebSrcNeedDataCb(GstAp
+ 
+     GST_DEBUG_OBJECT(src, "Need more data: %u", length);
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     if (priv->needDataID || !priv->paused) {
+         return;
+     }
+@@ -739,7 +739,7 @@ static gboolean webKitWebSrcEnoughDataMa
+ 
+     ASSERT(isMainThread());
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     // already stopped
+     if (!priv->enoughDataID)
+         return FALSE;
+@@ -760,7 +760,7 @@ static void webKitWebSrcEnoughDataCb(Gst
+ 
+     GST_DEBUG_OBJECT(src, "Have enough data");
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     if (priv->enoughDataID || priv->paused) {
+         return;
+     }
+@@ -774,7 +774,7 @@ static gboolean webKitWebSrcSeekMainCb(W
+ 
+     ASSERT(isMainThread());
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     // already stopped
+     if (!priv->seekID)
+         return FALSE;
+@@ -792,7 +792,7 @@ static gboolean webKitWebSrcSeekDataCb(G
+     WebKitWebSrcPrivate* priv = src->priv;
+ 
+     GST_DEBUG_OBJECT(src, "Seeking to offset: %" G_GUINT64_FORMAT, offset);
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     if (offset == priv->offset && priv->requestedOffset == priv->offset)
+         return TRUE;
+ 
+@@ -811,7 +811,7 @@ static gboolean webKitWebSrcSeekDataCb(G
+ void webKitWebSrcSetMediaPlayer(WebKitWebSrc* src, WebCore::MediaPlayer* player)
+ {
+     ASSERT(player);
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     src->priv->player = player;
+ }
+ 
+@@ -841,7 +841,7 @@ char* StreamingClient::createReadBuffer(
+ 
+     mapGstBuffer(buffer);
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     priv->buffer = adoptGRef(buffer);
+     locker.unlock();
+ 
+@@ -867,7 +867,7 @@ void StreamingClient::handleResponseRece
+         return;
+     }
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+ 
+     priv->corsAccessCheck = corsAccessCheck;
+ 
+@@ -966,7 +966,7 @@ void StreamingClient::handleDataReceived
+     WebKitWebSrc* src = WEBKIT_WEB_SRC(m_src);
+     WebKitWebSrcPrivate* priv = src->priv;
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+ 
+     GST_LOG_OBJECT(src, "Have %lld bytes of data", priv->buffer ? static_cast<long long>(gst_buffer_get_size(priv->buffer.get())) : length);
+ 
+@@ -1035,7 +1035,7 @@ void StreamingClient::handleNotifyFinish
+ 
+     GST_DEBUG_OBJECT(src, "Have EOS");
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     if (!priv->seekID) {
+         locker.unlock();
+         gst_app_src_end_of_stream(priv->appsrc);
+@@ -1194,7 +1194,7 @@ void ResourceHandleStreamingClient::wasB
+ 
+     GST_ERROR_OBJECT(src, "Request was blocked");
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     uri.reset(g_strdup(src->priv->uri));
+     locker.unlock();
+ 
+@@ -1208,7 +1208,7 @@ void ResourceHandleStreamingClient::cann
+ 
+     GST_ERROR_OBJECT(src, "Cannot show URL");
+ 
+-    GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
++    WebCore::GMutexLocker locker(GST_OBJECT_GET_LOCK(src));
+     uri.reset(g_strdup(src->priv->uri));
+     locker.unlock();
+ 
+diff -up webkitgtk-2.4.8/Source/WTF/wtf/gobject/GMutexLocker.h.gmutexlocker webkitgtk-2.4.8/Source/WTF/wtf/gobject/GMutexLocker.h
diff --git a/gnu/packages/patches/wicd-template-instantiation.patch b/gnu/packages/patches/wicd-template-instantiation.patch
new file mode 100644
index 0000000000..16d8fa6e1d
--- /dev/null
+++ b/gnu/packages/patches/wicd-template-instantiation.patch
@@ -0,0 +1,29 @@
+Wicd 1.7.3 fails to instantiate template lines that have several
+variable references.  For instance, the line:
+
+  wep_key$_KEY_INDEX=$_KEY
+
+which is found in in the 'wep-hex' template, expands to these two
+lines:
+
+  wep_key0=$_KEY
+  wep_key0=123456789ab
+
+This patch fixes that by only emitting the fully substituted line.
+
+Patch by Ludovic Courtès <ludo@gnu.org>.
+
+--- a/wicd/misc.py	2012-11-17 00:07:08 +0000
++++ b/wicd/misc.py	2015-05-09 11:22:37 +0000
+@@ -321,11 +321,11 @@ def ParseEncryption(network):
+                                 rep_val = '0'
+                         if rep_val:
+                             line = line.replace("$_%s" % cur_val, str(rep_val))
+-                            config_file = ''.join([config_file, line])
+                         else:
+                             print "Ignoring template line: '%s'" % line
+                     else:
+                         print "Weird parsing error occurred"
++                config_file = ''.join([config_file, line])
+             else:  # Just a regular entry.
+                 config_file = ''.join([config_file, line])
diff --git a/gnu/packages/patches/wpa-supplicant-2015-2-fix.patch b/gnu/packages/patches/wpa-supplicant-2015-2-fix.patch
new file mode 100644
index 0000000000..cd097006d2
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-2015-2-fix.patch
@@ -0,0 +1,51 @@
+Patch copied from http://w1.fi/security/2015-2/
+
+From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Tue, 28 Apr 2015 17:08:33 +0300
+Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
+
+strtoul() return value may end up overflowing the int h->chunk_size and
+resulting in a negative value to be stored as the chunk_size. This could
+result in the following memcpy operation using a very large length
+argument which would result in a buffer overflow and segmentation fault.
+
+This could have been used to cause a denial service by any device that
+has been authorized for network access (either wireless or wired). This
+would affect both the WPS UPnP functionality in a WPS AP (hostapd with
+upnp_iface parameter set in the configuration) and WPS ER
+(wpa_supplicant with WPS_ER_START control interface command used).
+
+Validate the parsed chunk length value to avoid this. In addition to
+rejecting negative values, we can also reject chunk size that would be
+larger than the maximum configured body length.
+
+Thanks to Kostya Kortchinsky of Google security team for discovering and
+reporting this issue.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/wps/httpread.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/wps/httpread.c b/src/wps/httpread.c
+index 2f08f37..d2855e3 100644
+--- a/src/wps/httpread.c
++++ b/src/wps/httpread.c
+@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
+ 					if (!isxdigit(*cbp))
+ 						goto bad;
+ 					h->chunk_size = strtoul(cbp, NULL, 16);
++					if (h->chunk_size < 0 ||
++					    h->chunk_size > h->max_bytes) {
++						wpa_printf(MSG_DEBUG,
++							   "httpread: Invalid chunk size %d",
++							   h->chunk_size);
++						goto bad;
++					}
+ 					/* throw away chunk header
+ 					 * so we have only real data
+ 					 */
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/wpa-supplicant-2015-3-fix.patch b/gnu/packages/patches/wpa-supplicant-2015-3-fix.patch
new file mode 100644
index 0000000000..de042f0c49
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-2015-3-fix.patch
@@ -0,0 +1,43 @@
+Patch copied from http://w1.fi/security/2015-3/
+
+From ef566a4d4f74022e1fdb0a2addfe81e6de9f4aae Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Wed, 29 Apr 2015 02:21:53 +0300
+Subject: [PATCH] AP WMM: Fix integer underflow in WMM Action frame parser
+
+The length of the WMM Action frame was not properly validated and the
+length of the information elements (int left) could end up being
+negative. This would result in reading significantly past the stack
+buffer while parsing the IEs in ieee802_11_parse_elems() and while doing
+so, resulting in segmentation fault.
+
+This can result in an invalid frame being used for a denial of service
+attack (hostapd process killed) against an AP with a driver that uses
+hostapd for management frame processing (e.g., all mac80211-based
+drivers).
+
+Thanks to Kostya Kortchinsky of Google security team for discovering and
+reporting this issue.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/ap/wmm.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/ap/wmm.c b/src/ap/wmm.c
+index 6d4177c..314e244 100644
+--- a/src/ap/wmm.c
++++ b/src/ap/wmm.c
+@@ -274,6 +274,9 @@ void hostapd_wmm_action(struct hostapd_data *hapd,
+ 		return;
+ 	}
+ 
++	if (left < 0)
++		return; /* not a valid WMM Action frame */
++
+ 	/* extract the tspec info element */
+ 	if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
+ 		hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt1.patch b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt1.patch
new file mode 100644
index 0000000000..7ebf5f4cc1
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt1.patch
@@ -0,0 +1,75 @@
+Patch copied from http://w1.fi/security/2015-4/
+
+From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Fri, 1 May 2015 16:37:45 +0300
+Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit
+ and Confirm
+
+The length of the received Commit and Confirm message payloads was not
+checked before reading them. This could result in a buffer read
+overflow when processing an invalid message.
+
+Fix this by verifying that the payload is of expected length before
+processing it. In addition, enforce correct state transition sequence to
+make sure there is no unexpected behavior if receiving a Commit/Confirm
+message before the previous exchanges have been completed.
+
+Thanks to Kostya Kortchinsky of Google security team for discovering and
+reporting this issue.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index f2b0926..a629437 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ 	BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
+ 	u16 offset;
+ 	u8 *ptr, *scalar = NULL, *element = NULL;
++	size_t prime_len, order_len;
++
++	if (data->state != PWD_Commit_Req) {
++		ret->ignore = TRUE;
++		goto fin;
++	}
++
++	prime_len = BN_num_bytes(data->grp->prime);
++	order_len = BN_num_bytes(data->grp->order);
++
++	if (payload_len != 2 * prime_len + order_len) {
++		wpa_printf(MSG_INFO,
++			   "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
++			   (unsigned int) payload_len,
++			   (unsigned int) (2 * prime_len + order_len));
++		goto fin;
++	}
+ 
+ 	if (((data->private_value = BN_new()) == NULL) ||
+ 	    ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
+@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ 	u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
+ 	int offset;
+ 
++	if (data->state != PWD_Confirm_Req) {
++		ret->ignore = TRUE;
++		goto fin;
++	}
++
++	if (payload_len != SHA256_MAC_LEN) {
++		wpa_printf(MSG_INFO,
++			   "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
++			   (unsigned int) payload_len, SHA256_MAC_LEN);
++		goto fin;
++	}
++
+ 	/*
+ 	 * first build up the ciphersuite which is group | random_function |
+ 	 *	prf
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt2.patch b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt2.patch
new file mode 100644
index 0000000000..c11e4175d9
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt2.patch
@@ -0,0 +1,68 @@
+Patch copied from http://w1.fi/security/2015-4/
+
+From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Fri, 1 May 2015 16:40:44 +0300
+Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit
+ and Confirm
+
+The length of the received Commit and Confirm message payloads was not
+checked before reading them. This could result in a buffer read
+overflow when processing an invalid message.
+
+Fix this by verifying that the payload is of expected length before
+processing it. In addition, enforce correct state transition sequence to
+make sure there is no unexpected behavior if receiving a Commit/Confirm
+message before the previous exchanges have been completed.
+
+Thanks to Kostya Kortchinsky of Google security team for discovering and
+reporting this issue.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index 66bd5d2..3189105 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ 	BIGNUM *x = NULL, *y = NULL, *cofactor = NULL;
+ 	EC_POINT *K = NULL, *point = NULL;
+ 	int res = 0;
++	size_t prime_len, order_len;
+ 
+ 	wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response");
+ 
++	prime_len = BN_num_bytes(data->grp->prime);
++	order_len = BN_num_bytes(data->grp->order);
++
++	if (payload_len != 2 * prime_len + order_len) {
++		wpa_printf(MSG_INFO,
++			   "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
++			   (unsigned int) payload_len,
++			   (unsigned int) (2 * prime_len + order_len));
++		goto fin;
++	}
++
+ 	if (((data->peer_scalar = BN_new()) == NULL) ||
+ 	    ((data->k = BN_new()) == NULL) ||
+ 	    ((cofactor = BN_new()) == NULL) ||
+@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ 	u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
+ 	int offset;
+ 
++	if (payload_len != SHA256_MAC_LEN) {
++		wpa_printf(MSG_INFO,
++			   "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
++			   (unsigned int) payload_len, SHA256_MAC_LEN);
++		goto fin;
++	}
++
+ 	/* build up the ciphersuite: group | random_function | prf */
+ 	grp = htons(data->group_num);
+ 	ptr = (u8 *) &cs;
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt3.patch b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt3.patch
new file mode 100644
index 0000000000..963dac9270
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt3.patch
@@ -0,0 +1,54 @@
+Patch copied from http://w1.fi/security/2015-4/
+
+From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 2 May 2015 19:23:04 +0300
+Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment
+ reassembly
+
+The remaining number of bytes in the message could be smaller than the
+Total-Length field size, so the length needs to be explicitly checked
+prior to reading the field and decrementing the len variable. This could
+have resulted in the remaining length becoming negative and interpreted
+as a huge positive integer.
+
+In addition, check that there is no already started fragment in progress
+before allocating a new buffer for reassembling fragments. This avoid a
+potential memory leak when processing invalid message.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_peer/eap_pwd.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index a629437..1d2079b 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
+ 	 * if it's the first fragment there'll be a length field
+ 	 */
+ 	if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
++		if (len < 2) {
++			wpa_printf(MSG_DEBUG,
++				   "EAP-pwd: Frame too short to contain Total-Length field");
++			ret->ignore = TRUE;
++			return NULL;
++		}
+ 		tot_len = WPA_GET_BE16(pos);
+ 		wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose "
+ 			   "total length = %d", tot_len);
+ 		if (tot_len > 15000)
+ 			return NULL;
++		if (data->inbuf) {
++			wpa_printf(MSG_DEBUG,
++				   "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
++			ret->ignore = TRUE;
++			return NULL;
++		}
+ 		data->inbuf = wpabuf_alloc(tot_len);
+ 		if (data->inbuf == NULL) {
+ 			wpa_printf(MSG_INFO, "Out of memory to buffer "
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt4.patch b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt4.patch
new file mode 100644
index 0000000000..3d945382bc
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt4.patch
@@ -0,0 +1,52 @@
+Patch copied from http://w1.fi/security/2015-4/
+
+From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 2 May 2015 19:26:06 +0300
+Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment
+ reassembly
+
+The remaining number of bytes in the message could be smaller than the
+Total-Length field size, so the length needs to be explicitly checked
+prior to reading the field and decrementing the len variable. This could
+have resulted in the remaining length becoming negative and interpreted
+as a huge positive integer.
+
+In addition, check that there is no already started fragment in progress
+before allocating a new buffer for reassembling fragments. This avoid a
+potential memory leak when processing invalid message.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_server/eap_server_pwd.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index 3189105..2bfc3c2 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
+ 	 * the first fragment has a total length
+ 	 */
+ 	if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
++		if (len < 2) {
++			wpa_printf(MSG_DEBUG,
++				   "EAP-pwd: Frame too short to contain Total-Length field");
++			return;
++		}
+ 		tot_len = WPA_GET_BE16(pos);
+ 		wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total "
+ 			   "length = %d", tot_len);
+ 		if (tot_len > 15000)
+ 			return;
++		if (data->inbuf) {
++			wpa_printf(MSG_DEBUG,
++				   "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
++			return;
++		}
+ 		data->inbuf = wpabuf_alloc(tot_len);
+ 		if (data->inbuf == NULL) {
+ 			wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to "
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt5.patch b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt5.patch
new file mode 100644
index 0000000000..30f71974ad
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-2015-4-fix-pt5.patch
@@ -0,0 +1,34 @@
+Patch copied from http://w1.fi/security/2015-4/
+
+From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 2 May 2015 19:26:28 +0300
+Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior
+
+The L (Length) and M (More) flags needs to be cleared before deciding
+whether the locally generated response requires fragmentation. This
+fixes an issue where these flags from the server could have been invalid
+for the following message. In some cases, this could have resulted in
+triggering the wpabuf security check that would terminate the process
+due to invalid buffer allocation.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_peer/eap_pwd.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index 1d2079b..e58b13a 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
+ 	/*
+ 	 * we have output! Do we need to fragment it?
+ 	 */
++	lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch);
+ 	len = wpabuf_len(data->outbuf);
+ 	if ((len + EAP_PWD_HDR_SIZE) > data->mtu) {
+ 		resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu,
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/wpa-supplicant-CVE-2015-1863.patch b/gnu/packages/patches/wpa-supplicant-CVE-2015-1863.patch
new file mode 100644
index 0000000000..de1964ca76
--- /dev/null
+++ b/gnu/packages/patches/wpa-supplicant-CVE-2015-1863.patch
@@ -0,0 +1,42 @@
+From 9ed4eee345f85e3025c33c6e20aa25696e341ccd Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@qca.qualcomm.com>
+Date: Tue, 7 Apr 2015 11:32:11 +0300
+Subject: [PATCH] P2P: Validate SSID element length before copying it
+ (CVE-2015-1863)
+
+This fixes a possible memcpy overflow for P2P dev->oper_ssid in
+p2p_add_device(). The length provided by the peer device (0..255 bytes)
+was used without proper bounds checking and that could have resulted in
+arbitrary data of up to 223 bytes being written beyond the end of the
+dev->oper_ssid[] array (of which about 150 bytes would be beyond the
+heap allocation) when processing a corrupted management frame for P2P
+peer discovery purposes.
+
+This could result in corrupted state in heap, unexpected program
+behavior due to corrupted P2P peer device information, denial of service
+due to process crash, exposure of memory contents during GO Negotiation,
+and potentially arbitrary code execution.
+
+Thanks to Google security team for reporting this issue and smart
+hardware research group of Alibaba security team for discovering it.
+
+Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
+---
+ src/p2p/p2p.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
+index f584fae..a45fe73 100644
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -778,6 +778,7 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
+ 	if (os_memcmp(addr, p2p_dev_addr, ETH_ALEN) != 0)
+ 		os_memcpy(dev->interface_addr, addr, ETH_ALEN);
+ 	if (msg.ssid &&
++	    msg.ssid[1] <= sizeof(dev->oper_ssid) &&
+ 	    (msg.ssid[1] != P2P_WILDCARD_SSID_LEN ||
+ 	     os_memcmp(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)
+ 	     != 0)) {
+-- 
+1.9.1
+
diff --git a/gnu/packages/patches/xf86-video-sis-fix-exa-crash.patch b/gnu/packages/patches/xf86-video-sis-fix-exa-crash.patch
new file mode 100644
index 0000000000..f5cd0b9a9e
--- /dev/null
+++ b/gnu/packages/patches/xf86-video-sis-fix-exa-crash.patch
@@ -0,0 +1,45 @@
+Fix X server crash when sis driver is used with EXA acceleration.
+
+Source: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/xserver-xorg-video-sis/trusty/revision/24/debian/patches/fix-exa-crash.diff
+
+The patch was originally proposed by nihui:
+https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-sis/+bug/1066464/comments/13
+
+--- a/src/sis310_accel.c
++++ b/src/sis310_accel.c
+@@ -1874,7 +1874,7 @@
+ {
+ 	ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
+ 	SISPtr pSiS = SISPTR(pScrn);
+-	unsigned char *dst = pDst->devPrivate.ptr;
++	unsigned char *dst = ((unsigned char *) pSiS->FbBase) + exaGetPixmapOffset(pDst);
+ 	int dst_pitch = exaGetPixmapPitch(pDst);
+ 
+ 	(pSiS->SyncAccel)(pScrn);
+@@ -1882,7 +1882,7 @@
+ 	if(pDst->drawable.bitsPerPixel < 8)
+ 	   return FALSE;
+ 
+-	dst += (x * pDst->drawable.bitsPerPixel / 8) + (y * src_pitch);
++	dst += (x * pDst->drawable.bitsPerPixel / 8) + (y * dst_pitch);
+ 	while(h--) {
+ 	   SiSMemCopyToVideoRam(pSiS, dst, (unsigned char *)src,
+ 				(w * pDst->drawable.bitsPerPixel / 8));
+@@ -1953,7 +1953,7 @@
+ {
+ 	ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
+ 	SISPtr pSiS = SISPTR(pScrn);
+-	unsigned char *src = pSrc->devPrivate.ptr;
++	unsigned char *src = ((unsigned char *) pSiS->FbBase) + exaGetPixmapOffset(pSrc);
+ 	int src_pitch = exaGetPixmapPitch(pSrc);
+ 	int size = src_pitch < dst_pitch ? src_pitch : dst_pitch;
+ 
+@@ -1964,7 +1964,7 @@
+ 
+ 	src += (x * pSrc->drawable.bitsPerPixel / 8) + (y * src_pitch);
+ 	while(h--) {
+-	   SiSMemCopyFromVideoRam(pSiS, (unsigned char *)dst, src, size);
++	   SiSMemCopyFromVideoRam(pSiS, (unsigned char *)dst, src, (w * pSrc->drawable.bitsPerPixel / 8));
+ 	   src += src_pitch;
+ 	   dst += dst_pitch;
+ 	}