summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2020-09-05 21:56:34 +0300
committerEfraim Flashner <efraim@flashner.co.il>2020-09-05 22:30:04 +0300
commitde3c03a47160dec355d9b19ad5ca210d90c15fd7 (patch)
tree4ca6dc05b5fc9530d812bbb269f1c61ab9efccf3 /gnu/packages/patches
parentab6fe9d362046231ad6f46eccfd1ea2c9c80b401 (diff)
parentb8477cab7bccc4191ed3dfa3f149aec7917834d8 (diff)
Merge remote-tracking branch 'origin/master' into staging
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/blender-2.79-gcc8.patch36
-rw-r--r--gnu/packages/patches/blender-2.79-gcc9.patch53
-rw-r--r--gnu/packages/patches/blender-2.79-oiio2.patch284
-rw-r--r--gnu/packages/patches/blender-2.79-python-3.8-fix.patch204
-rw-r--r--gnu/packages/patches/bpftrace-disable-bfd-disasm.patch15
-rw-r--r--gnu/packages/patches/clang-runtime-3.5-libsanitizer-mode-field.patch29
-rw-r--r--gnu/packages/patches/dbxfs-remove-sentry-sdk.patch64
-rw-r--r--gnu/packages/patches/dee-vapi.patch15
-rw-r--r--gnu/packages/patches/emacs-exec-path.patch22
-rw-r--r--gnu/packages/patches/emacs-ignore-empty-xim-styles.patch24
-rw-r--r--gnu/packages/patches/emacs-source-date-epoch.patch6
-rw-r--r--gnu/packages/patches/emacs27-exec-path.patch18
-rw-r--r--gnu/packages/patches/fpc-reproducibility.patch28
-rw-r--r--gnu/packages/patches/freedink-engine-fix-sdl-hints.patch33
-rw-r--r--gnu/packages/patches/glibc-CVE-2015-5180.patch311
-rw-r--r--gnu/packages/patches/glibc-CVE-2015-7547.patch590
-rw-r--r--gnu/packages/patches/glibc-CVE-2016-3075.patch43
-rw-r--r--gnu/packages/patches/glibc-CVE-2016-3706.patch188
-rw-r--r--gnu/packages/patches/glibc-CVE-2016-4429.patch58
-rw-r--r--gnu/packages/patches/glibc-CVE-2017-1000366-pt1.patch36
-rw-r--r--gnu/packages/patches/glibc-CVE-2017-1000366-pt2.patch124
-rw-r--r--gnu/packages/patches/glibc-CVE-2017-1000366-pt3.patch206
-rw-r--r--gnu/packages/patches/glibc-o-largefile.patch25
-rw-r--r--gnu/packages/patches/glibc-vectorized-strcspn-guards.patch23
-rw-r--r--gnu/packages/patches/gpodder-disable-updater.patch18
-rw-r--r--gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch34
-rw-r--r--gnu/packages/patches/icecat-makeicecat.patch4
-rw-r--r--gnu/packages/patches/json-c-0.12-CVE-2020-12762.patch175
-rw-r--r--gnu/packages/patches/json-c-0.13-CVE-2020-12762.patch230
-rw-r--r--gnu/packages/patches/json-c-CVE-2020-12762.patch193
-rw-r--r--gnu/packages/patches/ldns-drill-examples.patch85
-rw-r--r--gnu/packages/patches/lib2geom-enable-assertions.patch36
-rw-r--r--gnu/packages/patches/lib2geom-fix-tests.patch40
-rw-r--r--gnu/packages/patches/libextractor-exiv2.patch124
-rw-r--r--gnu/packages/patches/liblouisutdml-fix-tests.patch33
-rw-r--r--gnu/packages/patches/libmhash-hmac-fix-uaf.patch22
-rw-r--r--gnu/packages/patches/libofa-curl.diff15
-rw-r--r--gnu/packages/patches/libofa-ftbfs-1.diff45
-rw-r--r--gnu/packages/patches/libofa-ftbfs-2.diff27
-rw-r--r--gnu/packages/patches/libquicktime-ffmpeg.patch1309
-rw-r--r--gnu/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch73
-rw-r--r--gnu/packages/patches/ola-readdir-r.patch62
-rw-r--r--gnu/packages/patches/opencv-fix-build-of-grfmt_jpeg2000.cpp.patch39
-rw-r--r--gnu/packages/patches/opensles-add-license-file.patch45
-rw-r--r--gnu/packages/patches/pjproject-correct-the-cflags-field.patch121
-rw-r--r--gnu/packages/patches/pjproject-fix-pkg-config-ldflags.patch79
-rw-r--r--gnu/packages/patches/plotutils-spline-test.patch34
-rw-r--r--gnu/packages/patches/python-alembic-exceptions-cause.patch69
-rw-r--r--gnu/packages/patches/python-jedi-sort-project-test.patch18
-rw-r--r--gnu/packages/patches/python-onnx-use-system-googletest.patch54
-rw-r--r--gnu/packages/patches/python-slugify-depend-on-unidecode.patch22
-rw-r--r--gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch59
-rw-r--r--gnu/packages/patches/remake-impure-dirs.patch30
-rw-r--r--gnu/packages/patches/rnp-add-version.cmake.patch169
-rw-r--r--gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch26
-rw-r--r--gnu/packages/patches/rnp-unbundle-googletest.patch43
-rw-r--r--gnu/packages/patches/seed-webkit.patch49
-rw-r--r--gnu/packages/patches/sooperlooper-build-with-wx-30.patch179
-rw-r--r--gnu/packages/patches/sphinxbase-fix-doxygen.patch24
-rw-r--r--gnu/packages/patches/sssd-system-directories.patch56
-rw-r--r--gnu/packages/patches/transcode-ffmpeg.patch1408
-rw-r--r--gnu/packages/patches/ttfautohint-source-date-epoch.patch70
-rw-r--r--gnu/packages/patches/unknown-horizons-python-3.8-distro.patch52
-rw-r--r--gnu/packages/patches/vcflib-use-shared-libraries.patch135
-rw-r--r--gnu/packages/patches/webkitgtk-bind-all-fonts.patch26
-rw-r--r--gnu/packages/patches/wgetpaste-update-bpaste.patch27
-rw-r--r--gnu/packages/patches/xf86-video-geode-glibc-2.20.patch15
-rw-r--r--gnu/packages/patches/xf86-video-sis-xorg-compat.patch18
-rw-r--r--gnu/packages/patches/xmonad-dynamic-linking.patch16
69 files changed, 5581 insertions, 2262 deletions
diff --git a/gnu/packages/patches/blender-2.79-gcc8.patch b/gnu/packages/patches/blender-2.79-gcc8.patch
new file mode 100644
index 0000000000..6a9186323b
--- /dev/null
+++ b/gnu/packages/patches/blender-2.79-gcc8.patch
@@ -0,0 +1,36 @@
+diff --git a/intern/itasc/kdl/tree.hpp b/intern/itasc/kdl/tree.hpp
+index c8a253fc901..bd35f82d185 100644
+--- a/intern/itasc/kdl/tree.hpp
++++ b/intern/itasc/kdl/tree.hpp
+@@ -34,7 +34,7 @@ namespace KDL
+ //Forward declaration
+ class TreeElement;
+ // Eigen allocator is needed for alignment of Eigen data types
+- typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
++ typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<const std::string, TreeElement> > > SegmentMap;
+
+ class TreeElement
+ {
+diff --git a/intern/cycles/util/util_sseb.h b/intern/cycles/util/util_sseb.h
+index 6e669701f3b..977976c3fc0 100644
+--- a/intern/cycles/util/util_sseb.h
++++ b/intern/cycles/util/util_sseb.h
+@@ -22,6 +22,9 @@ CCL_NAMESPACE_BEGIN
+
+ #ifdef __KERNEL_SSE2__
+
++struct ssei;
++struct ssef;
++
+ /*! 4-wide SSE bool type. */
+ struct sseb
+ {
+@@ -116,7 +119,7 @@ __forceinline const sseb unpacklo( const sseb& a, const sseb& b ) { return _mm_u
+ __forceinline const sseb unpackhi( const sseb& a, const sseb& b ) { return _mm_unpackhi_ps(a, b); }
+
+ template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const sseb shuffle( const sseb& a ) {
+- return _mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0));
++ return _mm_castsi128_ps(_mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0)));
+ }
+
+ template<> __forceinline const sseb shuffle<0, 1, 0, 1>( const sseb& a ) {
diff --git a/gnu/packages/patches/blender-2.79-gcc9.patch b/gnu/packages/patches/blender-2.79-gcc9.patch
new file mode 100644
index 0000000000..d538a02620
--- /dev/null
+++ b/gnu/packages/patches/blender-2.79-gcc9.patch
@@ -0,0 +1,53 @@
+commit e6d803fd4a383cecf8c643095f093a31c944b785
+Author: Robert-André Mauchin <zebob.m@gmail.com>
+Date: Wed Apr 3 01:36:52 2019 +0200
+
+ Fix for GCC9 new OpenMP data sharing
+
+ GCC 9 started implementing the OpenMP 4.0 and later behavior. When not using
+ default clause or when using default(shared), this makes no difference, but
+ if using default(none), previously the choice was not specify the const
+ qualified variables on the construct at all, or specify in firstprivate
+ clause. In GCC 9 as well as for OpenMP 4.0 compliance, those variables need
+ to be specified on constructs in which they are used, either in shared or
+ in firstprivate clause. Specifying them in firstprivate clause is one way to
+ achieve compatibility with both older GCC versions and GCC 9,
+ another option is to drop the default(none) clause.
+
+ This patch thus drops the default(none) clause.
+
+ See https://gcc.gnu.org/gcc-9/porting_to.html#ompdatasharing
+
+ Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
+
+diff --git a/intern/elbeem/intern/solver_main.cpp b/intern/elbeem/intern/solver_main.cpp
+index 68f7c04cd54..514087b6130 100644
+--- a/intern/elbeem/intern/solver_main.cpp
++++ b/intern/elbeem/intern/solver_main.cpp
+@@ -381,7 +381,7 @@ LbmFsgrSolver::mainLoop(const int lev)
+ GRID_REGION_INIT();
+ #if PARALLEL==1
+ const int gDebugLevel = ::gDebugLevel;
+-#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
++#pragma omp parallel num_threads(mNumOMPThreads) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
+@@ -1126,7 +1126,7 @@ LbmFsgrSolver::preinitGrids()
+ GRID_REGION_INIT();
+ #if PARALLEL==1
+ const int gDebugLevel = ::gDebugLevel;
+-#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
++#pragma omp parallel num_threads(mNumOMPThreads) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
+@@ -1164,7 +1164,7 @@ LbmFsgrSolver::standingFluidPreinit()
+ GRID_REGION_INIT();
+ #if PARALLEL==1
+ const int gDebugLevel = ::gDebugLevel;
+-#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
++#pragma omp parallel num_threads(mNumOMPThreads) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
diff --git a/gnu/packages/patches/blender-2.79-oiio2.patch b/gnu/packages/patches/blender-2.79-oiio2.patch
new file mode 100644
index 0000000000..1c3606a940
--- /dev/null
+++ b/gnu/packages/patches/blender-2.79-oiio2.patch
@@ -0,0 +1,284 @@
+From: Sergey Sharybin <sergey@blender.org>
+Date: Fri, 28 Dec 2018 11:25:35 +0100
+Subject: adapt_build_against_OIIO2
+
+---
+ intern/cycles/blender/blender_python.cpp | 2 +-
+ intern/cycles/graph/node_xml.cpp | 2 +-
+ intern/cycles/render/buffers.cpp | 4 ++--
+ intern/cycles/render/image.cpp | 15 ++++--------
+ intern/cycles/render/image.h | 3 ++-
+ intern/cycles/util/util_unique_ptr.h | 28 ++++++++++++++++++++++
+ .../blender/imbuf/intern/oiio/openimageio_api.cpp | 19 +++++++--------
+ 7 files changed, 48 insertions(+), 25 deletions(-)
+ create mode 100644 intern/cycles/util/util_unique_ptr.h
+
+diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
+index 54973fd..bee6dd1 100644
+--- a/intern/cycles/blender/blender_python.cpp
++++ b/intern/cycles/blender/blender_python.cpp
+@@ -493,7 +493,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
+ socket_type = "NodeSocketString";
+ data_type = BL::NodeSocket::type_STRING;
+ if(param->validdefault)
+- default_string = param->sdefault[0];
++ default_string = param->sdefault[0].string();
+ }
+ else
+ continue;
+diff --git a/intern/cycles/graph/node_xml.cpp b/intern/cycles/graph/node_xml.cpp
+index d26b3b2..2a24104 100644
+--- a/intern/cycles/graph/node_xml.cpp
++++ b/intern/cycles/graph/node_xml.cpp
+@@ -250,7 +250,7 @@ void xml_read_node(XMLReader& reader, Node *node, xml_node xml_node)
+ }
+ }
+
+- if(node->name)
++ if(!node->name.empty())
+ reader.node_map[node->name] = node;
+ }
+
+diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
+index cf402c3..f84a37a 100644
+--- a/intern/cycles/render/buffers.cpp
++++ b/intern/cycles/render/buffers.cpp
+@@ -27,6 +27,7 @@
+ #include "util/util_opengl.h"
+ #include "util/util_time.h"
+ #include "util/util_types.h"
++#include "util/util_unique_ptr.h"
+
+ CCL_NAMESPACE_BEGIN
+
+@@ -453,7 +454,7 @@ void DisplayBuffer::write(Device *device, const string& filename)
+ device->pixels_copy_from(rgba, 0, w, h);
+
+ /* write image */
+- ImageOutput *out = ImageOutput::create(filename);
++ unique_ptr<ImageOutput> out = unique_ptr<ImageOutput>(ImageOutput::create(filename));
+ ImageSpec spec(w, h, 4, TypeDesc::UINT8);
+ int scanlinesize = w*4*sizeof(uchar);
+
+@@ -468,7 +469,6 @@ void DisplayBuffer::write(Device *device, const string& filename)
+
+ out->close();
+
+- delete out;
+ }
+
+ device_memory& DisplayBuffer::rgba_data()
+diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
+index 595eb46..a143b02 100644
+--- a/intern/cycles/render/image.cpp
++++ b/intern/cycles/render/image.cpp
+@@ -23,6 +23,7 @@
+ #include "util/util_path.h"
+ #include "util/util_progress.h"
+ #include "util/util_texture.h"
++#include "util/util_unique_ptr.h"
+
+ #ifdef WITH_OSL
+ #include <OSL/oslexec.h>
+@@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_metadata(const string& filename,
+ return IMAGE_DATA_TYPE_BYTE4;
+ }
+
+- ImageInput *in = ImageInput::create(filename);
++ unique_ptr<ImageInput> in(ImageInput::create(filename));
+
+ if(in) {
+ ImageSpec spec;
+@@ -194,7 +195,6 @@ ImageDataType ImageManager::get_image_metadata(const string& filename,
+ in->close();
+ }
+
+- delete in;
+ }
+
+ if(is_half) {
+@@ -449,7 +449,7 @@ void ImageManager::tag_reload_image(const string& filename,
+ }
+
+ bool ImageManager::file_load_image_generic(Image *img,
+- ImageInput **in,
++ unique_ptr<ImageInput> *in,
+ int &width,
+ int &height,
+ int &depth,
+@@ -465,7 +465,7 @@ bool ImageManager::file_load_image_generic(Image *img,
+ }
+
+ /* load image from file through OIIO */
+- *in = ImageInput::create(img->filename);
++ *in = unique_ptr<ImageInput>(ImageInput::create(img->filename));
+
+ if(!*in)
+ return false;
+@@ -477,8 +477,6 @@ bool ImageManager::file_load_image_generic(Image *img,
+ config.attribute("oiio:UnassociatedAlpha", 1);
+
+ if(!(*in)->open(img->filename, spec, config)) {
+- delete *in;
+- *in = NULL;
+ return false;
+ }
+
+@@ -500,8 +498,6 @@ bool ImageManager::file_load_image_generic(Image *img,
+ if(!(components >= 1 && components <= 4)) {
+ if(*in) {
+ (*in)->close();
+- delete *in;
+- *in = NULL;
+ }
+
+ return false;
+@@ -519,7 +515,7 @@ bool ImageManager::file_load_image(Image *img,
+ device_vector<DeviceType>& tex_img)
+ {
+ const StorageType alpha_one = (FileFormat == TypeDesc::UINT8)? 255 : 1;
+- ImageInput *in = NULL;
++ unique_ptr<ImageInput> in = NULL;
+ int width, height, depth, components;
+ if(!file_load_image_generic(img, &in, width, height, depth, components)) {
+ return false;
+@@ -575,7 +571,6 @@ bool ImageManager::file_load_image(Image *img,
+ }
+ cmyk = strcmp(in->format_name(), "jpeg") == 0 && components == 4;
+ in->close();
+- delete in;
+ }
+ else {
+ if(FileFormat == TypeDesc::FLOAT) {
+diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
+index db7e28a..f4a14f4 100644
+--- a/intern/cycles/render/image.h
++++ b/intern/cycles/render/image.h
+@@ -23,6 +23,7 @@
+ #include "util/util_image.h"
+ #include "util/util_string.h"
+ #include "util/util_thread.h"
++#include "util/util_unique_ptr.h"
+ #include "util/util_vector.h"
+
+ CCL_NAMESPACE_BEGIN
+@@ -133,7 +134,7 @@ private:
+ bool pack_images;
+
+ bool file_load_image_generic(Image *img,
+- ImageInput **in,
++ unique_ptr<ImageInput> *in,
+ int &width,
+ int &height,
+ int &depth,
+diff --git a/intern/cycles/util/util_unique_ptr.h b/intern/cycles/util/util_unique_ptr.h
+new file mode 100644
+index 0000000..1ceae73
+--- /dev/null
++++ b/intern/cycles/util/util_unique_ptr.h
+@@ -0,0 +1,28 @@
++/*
++ * Copyright 2011-2013 Blender Foundation
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef __UTIL_UNIQUE_PTR_H__
++#define __UTIL_UNIQUE_PTR_H__
++
++#include <memory>
++
++CCL_NAMESPACE_BEGIN
++
++using std::unique_ptr;
++
++CCL_NAMESPACE_END
++
++#endif /* __UTIL_UNIQUE_PTR_H__ */
+diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+index b123d50..7f2fac9 100644
+--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
++++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+@@ -35,6 +35,11 @@
+ #include "utfconv.h"
+ #endif
+
++// NOTE: Keep first, BLI_path_util conflicts with OIIO's format.
++#include <memory>
++#include <openimageio_api.h>
++#include <OpenImageIO/imageio.h>
++
+ extern "C"
+ {
+ #include "MEM_guardedalloc.h"
+@@ -48,12 +53,10 @@ extern "C"
+ #include "IMB_colormanagement_intern.h"
+ }
+
+-#include <openimageio_api.h>
+-#include <OpenImageIO/imageio.h>
+-
+ OIIO_NAMESPACE_USING
+
+ using std::string;
++using std::unique_ptr;
+
+ typedef unsigned char uchar;
+
+@@ -197,7 +200,6 @@ int imb_save_photoshop(struct ImBuf *ibuf, const char * /*name*/, int flags)
+
+ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspace[IM_MAX_SPACE])
+ {
+- ImageInput *in = NULL;
+ struct ImBuf *ibuf = NULL;
+ int width, height, components;
+ bool is_float, is_alpha;
+@@ -210,7 +212,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
+
+ colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
+
+- in = ImageInput::create(filename);
++ unique_ptr<ImageInput> in(ImageInput::create(filename));
+ if (!in) {
+ std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl
+ << OIIO_NAMESPACE::geterror() << std::endl;
+@@ -223,7 +225,6 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
+ if (!in->open(filename, spec, config)) {
+ std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl
+ << in->geterror() << std::endl;
+- delete in;
+ return NULL;
+ }
+
+@@ -249,19 +250,17 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
+ if (!(components >= 1 && components <= 4)) {
+ if (in) {
+ in->close();
+- delete in;
+ }
+ return NULL;
+ }
+
+ if (is_float)
+- ibuf = imb_oiio_load_image_float(in, width, height, components, flags, is_alpha);
++ ibuf = imb_oiio_load_image_float(in.get(), width, height, components, flags, is_alpha);
+ else
+- ibuf = imb_oiio_load_image(in, width, height, components, flags, is_alpha);
++ ibuf = imb_oiio_load_image(in.get(), width, height, components, flags, is_alpha);
+
+ if (in) {
+ in->close();
+- delete in;
+ }
+
+ if (!ibuf)
diff --git a/gnu/packages/patches/blender-2.79-python-3.8-fix.patch b/gnu/packages/patches/blender-2.79-python-3.8-fix.patch
new file mode 100644
index 0000000000..18d25449ee
--- /dev/null
+++ b/gnu/packages/patches/blender-2.79-python-3.8-fix.patch
@@ -0,0 +1,204 @@
+From 4b663ecf264020b1d7003a137ce84b06d7ec4ce6 Mon Sep 17 00:00:00 2001
+From: bartus <szczepaniak.bartek+github@gmail.com>
+Date: Sat, 16 Nov 2019 20:29:30 +0100
+Subject: [PATCH] Add python 3.8 support.
+
+---
+ source/blender/python/generic/py_capi_utils.c | 27 +++++++++++++++----
+ 1 file changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
+index 545e0506f84..a7eab70600b 100644
+--- a/source/blender/python/generic/py_capi_utils.c
++++ b/source/blender/python/generic/py_capi_utils.c
+@@ -696,9 +696,16 @@ PyObject *PyC_UnicodeFromByte(const char *str)
+ ****************************************************************************/
+ PyObject *PyC_DefaultNameSpace(const char *filename)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ PyObject *builtins = PyEval_GetBuiltins();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
++ PyObject *modules = interp->modules;
++ PyObject *builtins = interp->builtins;
++ #endif
+ PyObject *mod_main = PyModule_New("__main__");
+- PyDict_SetItemString(interp->modules, "__main__", mod_main);
++ PyDict_SetItemString(modules, "__main__", mod_main);
+ Py_DECREF(mod_main); /* sys.modules owns now */
+ PyModule_AddStringConstant(mod_main, "__name__", "__main__");
+ if (filename) {
+@@ -706,8 +713,8 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
+ * note: this wont map to a real file when executing text-blocks and buttons. */
+ PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename));
+ }
+- PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
+- Py_INCREF(interp->builtins); /* AddObject steals a reference */
++ PyModule_AddObject(mod_main, "__builtins__", builtins);
++ Py_INCREF(builtins); /* AddObject steals a reference */
+ return PyModule_GetDict(mod_main);
+ }
+
+@@ -734,15 +741,25 @@ bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[])
+ /* restore MUST be called after this */
+ void PyC_MainModule_Backup(PyObject **main_mod)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+- *main_mod = PyDict_GetItemString(interp->modules, "__main__");
++ PyObject *modules = interp->modules;
++ #endif
++ *main_mod = PyDict_GetItemString(modules, "__main__");
+ Py_XINCREF(*main_mod); /* don't free */
+ }
+
+ void PyC_MainModule_Restore(PyObject *main_mod)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+- PyDict_SetItemString(interp->modules, "__main__", main_mod);
++ PyObject *modules = interp->modules;
++ #endif
++ PyDict_SetItemString(modules, "__main__", main_mod);
+ Py_XDECREF(main_mod);
+ }
+
+--
+2.24.0
+
+From 44f719b63238503ef8f933f55383c6d4798995cc Mon Sep 17 00:00:00 2001
+From: Campbell Barton <ideasman42@gmail.com>
+Date: Thu, 13 Sep 2018 17:06:07 +1000
+Subject: [PATCH] Cleanup: use PyImport_GetModuleDict
+
+Replace direct access using PyThreadState_GET
+---
+ source/blender/python/bmesh/bmesh_py_api.c | 2 +-
+ source/blender/python/generic/idprop_py_api.c | 2 +-
+ source/blender/python/intern/bpy_interface.c | 2 +-
+ source/blender/python/intern/gpu.c | 4 ++--
+ source/blender/python/mathutils/mathutils.c | 2 +-
+ source/blender/python/mathutils/mathutils_noise.c | 5 +++--
+ source/gameengine/Ketsji/KX_PythonInit.cpp | 2 +-
+ 7 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
+index d5973baeadb..d7324eabb6c 100644
+--- a/source/blender/python/bmesh/bmesh_py_api.c
++++ b/source/blender/python/bmesh/bmesh_py_api.c
+@@ -196,7 +196,7 @@ PyObject *BPyInit_bmesh(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ BPy_BM_init_types();
+ BPy_BM_init_types_select();
+diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
+index 4d4d5232800..8bed0f28cba 100644
+--- a/source/blender/python/generic/idprop_py_api.c
++++ b/source/blender/python/generic/idprop_py_api.c
+@@ -1795,7 +1795,7 @@ PyObject *BPyInit_idprop(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ mod = PyModule_Create(&IDProp_module_def);
+
+diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
+index 7ca087e4993..123c938b921 100644
+--- a/source/blender/python/intern/bpy_interface.c
++++ b/source/blender/python/intern/bpy_interface.c
+@@ -537,7 +537,7 @@ static bool python_script_exec(
+
+ if (py_dict) {
+ #ifdef PYMODULE_CLEAR_WORKAROUND
+- PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
++ PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyImport_GetModuleDict(), "__main__");
+ PyObject *dict_back = mmod->md_dict;
+ /* freeing the module will clear the namespace,
+ * gives problems running classes defined in this namespace being used later. */
+diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
+index 43796dc9474..d902b6838f4 100644
+--- a/source/blender/python/intern/gpu.c
++++ b/source/blender/python/intern/gpu.c
+@@ -326,7 +326,7 @@ PyObject *GPU_initPython(void)
+ {
+ PyObject *module;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ module = PyInit_gpu();
+
+@@ -337,6 +337,6 @@ PyObject *GPU_initPython(void)
+ PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
+ Py_INCREF(submodule);
+
+- PyDict_SetItem(PyImport_GetModuleDict(), PyModule_GetNameObject(module), module);
++ PyDict_SetItem(sys_modules, PyModule_GetNameObject(module), module);
+ return module;
+ }
+diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
+index a3a4e7f313b..f021d456b3a 100644
+--- a/source/blender/python/mathutils/mathutils.c
++++ b/source/blender/python/mathutils/mathutils.c
+@@ -615,7 +615,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ if (PyType_Ready(&vector_Type) < 0)
+ return NULL;
+diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
+index 839d1ffc588..834322c0aed 100644
+--- a/source/blender/python/mathutils/mathutils_noise.c
++++ b/source/blender/python/mathutils/mathutils_noise.c
+@@ -845,6 +845,7 @@ static struct PyModuleDef M_Noise_module_def = {
+ /*----------------------------MODULE INIT-------------------------*/
+ PyMODINIT_FUNC PyInit_mathutils_noise(void)
+ {
++ PyObject *sys_modules = PyImport_GetModuleDict();
+ PyObject *submodule = PyModule_Create(&M_Noise_module_def);
+ PyObject *item_types, *item_metrics;
+
+@@ -852,11 +853,11 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void)
+ setRndSeed(0);
+
+ PyModule_AddObject(submodule, "types", (item_types = PyInit_mathutils_noise_types()));
+- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.types", item_types);
++ PyDict_SetItemString(sys_modules, "noise.types", item_types);
+ Py_INCREF(item_types);
+
+ PyModule_AddObject(submodule, "distance_metrics", (item_metrics = PyInit_mathutils_noise_metrics()));
+- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.distance_metrics", item_metrics);
++ PyDict_SetItemString(sys_modules, "noise.distance_metrics", item_metrics);
+ Py_INCREF(item_metrics);
+
+ return submodule;
+diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
+index 251273cf7a8..9611a4ea49b 100644
+--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
++++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
+@@ -2234,7 +2234,7 @@ PyMODINIT_FUNC initBGE(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+ const char *mod_full;
+
+ mod = PyModule_Create(&BGE_module_def);
+--
+2.25.0
+
diff --git a/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch b/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch
new file mode 100644
index 0000000000..8565d8d851
--- /dev/null
+++ b/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch
@@ -0,0 +1,15 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e89a6a9..a594786 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -126,10 +126,6 @@ find_package(LibBpf)
+ find_package(LibBfd)
+ find_package(LibOpcodes)
+
+-if(${LIBBFD_FOUND} AND ${LIBOPCODES_FOUND})
+- set(HAVE_BFD_DISASM TRUE)
+-endif()
+-
+ include(CheckIncludeFile)
+ check_include_file("sys/sdt.h" HAVE_SYSTEMTAP_SYS_SDT_H)
+
diff --git a/gnu/packages/patches/clang-runtime-3.5-libsanitizer-mode-field.patch b/gnu/packages/patches/clang-runtime-3.5-libsanitizer-mode-field.patch
new file mode 100644
index 0000000000..9e9d57d265
--- /dev/null
+++ b/gnu/packages/patches/clang-runtime-3.5-libsanitizer-mode-field.patch
@@ -0,0 +1,29 @@
+Adjust libsanitizer to ABI change in glibc 2.31.
+
+Adapted to 3.x from this upstream commit:
+https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
+
+--- a/lib/sanitizer_common/saniniitizer_platform_limits_posix.h.orig 2020-08-11 16:01:32.494882282 +0200 #
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h 2020-08-11 16:32:49.711383554 +0200
+@@ -176,8 +176,7 @@
+ unsigned long __unused1;
+ unsigned long __unused2;
+ #else
+- unsigned short mode;
+- unsigned short __pad1;
++ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2020-08-11 16:01:07.926821829 +0200
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2020-08-11 16:01:03.698811421 +0200
+@@ -1056,7 +1056,9 @@
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
++#endif
+
+ CHECK_TYPE_SIZE(shmid_ds);
+ CHECK_SIZE_AND_OFFSET(shmid_ds, shm_perm);
diff --git a/gnu/packages/patches/dbxfs-remove-sentry-sdk.patch b/gnu/packages/patches/dbxfs-remove-sentry-sdk.patch
new file mode 100644
index 0000000000..7079fa8c3c
--- /dev/null
+++ b/gnu/packages/patches/dbxfs-remove-sentry-sdk.patch
@@ -0,0 +1,64 @@
+sentry-sdk provides a link to sentry.io, a service which monitors applications deployed in the wild.
+Defaults to true. Best to just remove the option.
+
+---
+ dbxfs/main.py | 16 ----------------
+ setup.py | 1 -
+ 2 files changed, 17 deletions(-)
+
+diff --git a/dbxfs/main.py b/dbxfs/main.py
+index 5a6cea1..5d00818 100755
+--- a/dbxfs/main.py
++++ b/dbxfs/main.py
+@@ -40,8 +40,6 @@ import userspacefs
+ import keyring
+ from keyring.errors import KeyringError
+
+-import sentry_sdk
+-
+ from block_tracing import block_tracing, BLOCK_TRACING_INHERITS
+
+ from dbxfs.dbxfs import FileSystem as DropboxFileSystem
+@@ -299,12 +297,6 @@ def _main(argv=None):
+ config['keyring_user'] = keyring_user
+ save_config = True
+
+- if not config.get("asked_send_error_reports", False):
+- if yes_no_input("Would you like to help us improve %s by providing anonymous error reports?" % (APP_NAME,), default_yes=True):
+- config['send_error_reports'] = True
+- config['asked_send_error_reports'] = True
+- save_config = True
+-
+ if save_access_token and yes_no_input("Do you want \"%s\" to be the default mount point?" % (mount_point,), default_yes=True):
+ config['mount_point'] = mount_point
+ save_config = True
+@@ -315,14 +307,6 @@ def _main(argv=None):
+
+ log.info("Starting %s...", APP_NAME)
+
+- if config.get('send_error_reports', False):
+- try:
+- sentry_sdk.init("https://b4b13ebd300849bd92260507a594e618@sentry.io/1293235",
+- release='%s@%s' % (APP_NAME, version),
+- with_locals=False)
+- except Exception:
+- log.warning("Failed to initialize sentry", exc_info=True)
+-
+ if cache_folder is None:
+ cache_folder = os.path.join(appdirs.user_cache_dir(APP_NAME), "file_cache")
+ try:
+diff --git a/setup.py b/setup.py
+index 89e25c6..f940d47 100644
+--- a/setup.py
++++ b/setup.py
+@@ -43,7 +43,6 @@ setup(
+ "privy>=6.0,<7",
+ "keyring>=15.1.0",
+ "keyrings.alt>=3.1,<4",
+- "sentry_sdk>=0.3,<1",
+ ],
+ extras_require={
+ 'safefs': ["safefs"],
+--
+2.28.0
+
diff --git a/gnu/packages/patches/dee-vapi.patch b/gnu/packages/patches/dee-vapi.patch
new file mode 100644
index 0000000000..3a9353a521
--- /dev/null
+++ b/gnu/packages/patches/dee-vapi.patch
@@ -0,0 +1,15 @@
+Index: dee-1.2.7+17.10.20170616/vapi/Dee-1.0.metadata
+===================================================================
+--- dee-1.2.7+17.10.20170616.orig/vapi/Dee-1.0.metadata
++++ dee-1.2.7+17.10.20170616/vapi/Dee-1.0.metadata
+@@ -2,7 +2,9 @@ GListResultSet skip
+ GListResultSetClass skip
+
+ FilterModel
+- .filter unowned
++ .filter skip // unsupported type for construct property
++Index
++ .reader skip // unsupported type for construct property
+ Model
+ .append skip=false
+ .build_named_row skip
diff --git a/gnu/packages/patches/emacs-exec-path.patch b/gnu/packages/patches/emacs-exec-path.patch
index 884fa94a64..7303599df1 100644
--- a/gnu/packages/patches/emacs-exec-path.patch
+++ b/gnu/packages/patches/emacs-exec-path.patch
@@ -4,15 +4,13 @@ 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)))
+@@ -481,7 +481,8 @@ lost after dumping")))
+ ((equal dump-mode "dump") "emacs")
+ ((equal dump-mode "bootstrap") "emacs")
+ ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
+- (t (error "unrecognized dump mode %s" dump-mode)))))
++ (t (error "unrecognized dump mode %s" dump-mode))))
++ (exec-path nil))
+ (message "Dumping under the name %s" output)
+ (condition-case ()
+ (delete-file output)
diff --git a/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch b/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch
new file mode 100644
index 0000000000..398e65bdc8
--- /dev/null
+++ b/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch
@@ -0,0 +1,24 @@
+Fix contributed upstream here:
+https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42694.
+
+Index: emacs-26.3/src/xfns.c
+===================================================================
+--- emacs-26.3.orig/src/xfns.c
++++ emacs-26.3/src/xfns.c
+@@ -2628,6 +2628,8 @@ xic_free_xfontset (struct frame *f)
+ static XIMStyle
+ best_xim_style (XIMStyles *xim)
+ {
++ if (xim == NULL) goto out;
++
+ int i, j;
+ int nr_supported = ARRAYELTS (supported_xim_styles);
+
+@@ -2636,6 +2638,7 @@ best_xim_style (XIMStyles *xim)
+ if (supported_xim_styles[i] == xim->supported_styles[j])
+ return supported_xim_styles[i];
+
++ out:
+ /* Return the default style. */
+ return XIMPreeditNothing | XIMStatusNothing;
+ }
diff --git a/gnu/packages/patches/emacs-source-date-epoch.patch b/gnu/packages/patches/emacs-source-date-epoch.patch
index 41c03ef514..77ea7ac15c 100644
--- a/gnu/packages/patches/emacs-source-date-epoch.patch
+++ b/gnu/packages/patches/emacs-source-date-epoch.patch
@@ -3,9 +3,9 @@ Honor SOURCE_DATE_EPOCH variable to avoid non-determinism in generated
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
-@@ -378,8 +378,12 @@
- "Insert the section-header line,
- which lists the file name and which functions are in it, etc."
+@@ -419,8 +419,12 @@
+ ;; nil t))
+ ;; (match-end 2))))
(insert generate-autoload-section-header)
- (prin1 `(autoloads ,autoloads ,load-name ,file ,time)
- outbuf)
diff --git a/gnu/packages/patches/emacs27-exec-path.patch b/gnu/packages/patches/emacs27-exec-path.patch
deleted file mode 100644
index 418aa633a1..0000000000
--- a/gnu/packages/patches/emacs27-exec-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-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.
-
-(like emacs-exec-path.patch, but for Emacs 27)
-
---- a/lisp/loadup.el
-+++ b/lisp/loadup.el
-@@ -479,7 +479,8 @@ lost after dumping")))
- ((equal dump-mode "dump") "emacs")
- ((equal dump-mode "bootstrap") "emacs")
- ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
-- (t (error "unrecognized dump mode %s" dump-mode)))))
-+ (t (error "unrecognized dump mode %s" dump-mode))))
-+ (exec-path nil))
- (message "Dumping under the name %s" output)
- (condition-case ()
- (delete-file output)
diff --git a/gnu/packages/patches/fpc-reproducibility.patch b/gnu/packages/patches/fpc-reproducibility.patch
new file mode 100644
index 0000000000..619f42b3b5
--- /dev/null
+++ b/gnu/packages/patches/fpc-reproducibility.patch
@@ -0,0 +1,28 @@
+Remove/patch metadata timestamps for reproducibility.
+
+diff -ur fpcbuild-3.0.0.old/fpcsrc/packages/fpmkunit/src/fpmkunit.pp fpcbuild-3.0.0/fpcsrc/packages/fpmkunit/src/fpmkunit.pp
+--- fpcbuild-3.0.0.old/fpcsrc/packages/fpmkunit/src/fpmkunit.pp 2015-11-04 16:17:00.000000000 -0500
++++ fpcbuild-3.0.0/fpcsrc/packages/fpmkunit/src/fpmkunit.pp 2017-01-26 16:25:29.327339282 -0500
+@@ -3779,7 +3779,7 @@
+ Values[KeyName]:=Name;
+ Values[KeyVersion]:=Version;
+ // TODO Generate checksum based on PPUs
+- InstalledChecksum:=DateTimeToFileDate(Now);
++ InstalledChecksum:=0;
+ Values[KeyChecksum]:=IntToStr(InstalledChecksum);
+ Values[KeyCPU]:=CPUToString(ACPU);
+ Values[KeyOS]:=OSToString(AOS);
+diff -ur fpcbuild-3.0.0.old/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp fpcbuild-3.0.0/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp
+--- fpcbuild-3.0.0.old/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp 2013-06-01 18:27:16.000000000 -0400
++++ fpcbuild-3.0.0/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp 2017-01-26 16:24:22.949044903 -0500
+@@ -234,8 +234,8 @@
+ TemplateParser.Values['FPCTARGETOS'] := BuildOSTarget;
+ TemplateParser.Values['FPCBIN'] := 'fpc';
+ TemplateParser.Values['PWD'] := GetCurrentDir;
+- TemplateParser.Values['BUILDDATE'] := DateToStr(Date);
+- TemplateParser.Values['BUILDTIME'] := TimeToStr(Time);
++ TemplateParser.Values['BUILDDATE'] := '';
++ TemplateParser.Values['BUILDTIME'] := '';
+
+ TemplateParser.Values['LOCALREPOSITORY'] := GetDefaultLocalRepository;
+ TemplateParser.Values['LOCALBASEPATH'] := GetDefaultLocalBasepath;
diff --git a/gnu/packages/patches/freedink-engine-fix-sdl-hints.patch b/gnu/packages/patches/freedink-engine-fix-sdl-hints.patch
new file mode 100644
index 0000000000..ce37ab4870
--- /dev/null
+++ b/gnu/packages/patches/freedink-engine-fix-sdl-hints.patch
@@ -0,0 +1,33 @@
+From 85f8dda6de28ef86e58f26c8aa863a26524f6ce0 Mon Sep 17 00:00:00 2001
+From: Jesse Gibbons <jgibbons2357+freedink@gmail.com>
+Date: Sun, 9 Feb 2020 21:46:26 -0700
+Subject: [PATCH] Fix mouse/touch event hints for SDL 2.0.10.
+
+This fixes the bug reported at
+<https://lists.gnu.org/archive/html/bug-freedink/2019-08/msg00000.html>.
+
+It should remain backwards compatible with releases of SDL prior to 2.0.10.
+---
+ src/input.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/input.cpp b/src/input.cpp
+index b5ae21e..153d349 100644
+--- a/src/input.cpp
++++ b/src/input.cpp
+@@ -91,7 +91,12 @@ void input_init(void)
+
+ // TODO: don't attempt to simulate mouse events from touch events -
+ // fake mouse events often are de-centered
++#ifdef SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH
+ SDL_SetHint(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, "0");
++#elif defined SDL_HINT_MOUSE_TOUCH_EVENTS && defined SDL_HINT_TOUCH_MOUSE_EVENTS
++ SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
++ SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
++#endif
+
+ /* Touch devices */
+ {
+--
+2.25.0
+
diff --git a/gnu/packages/patches/glibc-CVE-2015-5180.patch b/gnu/packages/patches/glibc-CVE-2015-5180.patch
deleted file mode 100644
index 92e3740fc1..0000000000
--- a/gnu/packages/patches/glibc-CVE-2015-5180.patch
+++ /dev/null
@@ -1,311 +0,0 @@
-From b3b37f1a5559a7620e31c8053ed1b44f798f2b6d Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Sat, 31 Dec 2016 20:22:09 +0100
-Subject: [PATCH] CVE-2015-5180: resolv: Fix crash with internal QTYPE [BZ
- #18784]
-
-Also rename T_UNSPEC because an upcoming public header file
-update will use that name.
-
-(cherry picked from commit fc82b0a2dfe7dbd35671c10510a8da1043d746a5)
----
- ChangeLog | 14 ++++
- NEWS | 6 ++
- include/arpa/nameser_compat.h | 6 +-
- resolv/Makefile | 5 ++
- resolv/nss_dns/dns-host.c | 2 +-
- resolv/res_mkquery.c | 4 +
- resolv/res_query.c | 6 +-
- resolv/tst-resolv-qtypes.c | 185 ++++++++++++++++++++++++++++++++++++++++++
- 8 files changed, 221 insertions(+), 7 deletions(-)
- create mode 100644 resolv/tst-resolv-qtypes.c
-
-diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h
-index 2e735ed..7c0deed 100644
---- a/include/arpa/nameser_compat.h
-+++ b/include/arpa/nameser_compat.h
-@@ -1,8 +1,8 @@
- #ifndef _ARPA_NAMESER_COMPAT_
- #include <resolv/arpa/nameser_compat.h>
-
--/* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e.,
-- T_A and T_AAAA). */
--#define T_UNSPEC 62321
-+/* The number is outside the 16-bit RR type range and is used
-+ internally by the implementation. */
-+#define T_QUERY_A_AND_AAAA 439963904
-
- #endif
-diff --git a/resolv/Makefile b/resolv/Makefile
-index 8be41d3..a4c86b9 100644
---- a/resolv/Makefile
-+++ b/resolv/Makefile
-@@ -40,6 +40,9 @@ ifeq ($(have-thread-library),yes)
- extra-libs += libanl
- routines += gai_sigqueue
- tests += tst-res_hconf_reorder
-+
-+# This test sends millions of packets and is rather slow.
-+xtests += tst-resolv-qtypes
- endif
- extra-libs-others = $(extra-libs)
- libresolv-routines := gethnamaddr res_comp res_debug \
-@@ -117,3 +120,5 @@ tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace
- $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
- $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@; \
- $(evaluate-test)
-+
-+$(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
-diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
-index 5f9e357..d16fa4b 100644
---- a/resolv/nss_dns/dns-host.c
-+++ b/resolv/nss_dns/dns-host.c
-@@ -323,7 +323,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
-
- int olderr = errno;
- enum nss_status status;
-- int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC,
-+ int n = __libc_res_nsearch (&_res, name, C_IN, T_QUERY_A_AND_AAAA,
- host_buffer.buf->buf, 2048, &host_buffer.ptr,
- &ans2p, &nans2p, &resplen2, &ans2p_malloced);
- if (n >= 0)
-diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
-index 12f9730..d80b531 100644
---- a/resolv/res_mkquery.c
-+++ b/resolv/res_mkquery.c
-@@ -103,6 +103,10 @@ res_nmkquery(res_state statp,
- int n;
- u_char *dnptrs[20], **dpp, **lastdnptr;
-
-+ if (class < 0 || class > 65535
-+ || type < 0 || type > 65535)
-+ return -1;
-+
- #ifdef DEBUG
- if (statp->options & RES_DEBUG)
- printf(";; res_nmkquery(%s, %s, %s, %s)\n",
-diff --git a/resolv/res_query.c b/resolv/res_query.c
-index 944d1a9..07dc6f6 100644
---- a/resolv/res_query.c
-+++ b/resolv/res_query.c
-@@ -122,7 +122,7 @@ __libc_res_nquery(res_state statp,
- int n, use_malloc = 0;
- u_int oflags = statp->_flags;
-
-- size_t bufsize = (type == T_UNSPEC ? 2 : 1) * QUERYSIZE;
-+ size_t bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * QUERYSIZE;
- u_char *buf = alloca (bufsize);
- u_char *query1 = buf;
- int nquery1 = -1;
-@@ -137,7 +137,7 @@ __libc_res_nquery(res_state statp,
- printf(";; res_query(%s, %d, %d)\n", name, class, type);
- #endif
-
-- if (type == T_UNSPEC)
-+ if (type == T_QUERY_A_AND_AAAA)
- {
- n = res_nmkquery(statp, QUERY, name, class, T_A, NULL, 0, NULL,
- query1, bufsize);
-@@ -190,7 +190,7 @@ __libc_res_nquery(res_state statp,
- if (__builtin_expect (n <= 0, 0) && !use_malloc) {
- /* Retry just in case res_nmkquery failed because of too
- short buffer. Shouldn't happen. */
-- bufsize = (type == T_UNSPEC ? 2 : 1) * MAXPACKET;
-+ bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * MAXPACKET;
- buf = malloc (bufsize);
- if (buf != NULL) {
- query1 = buf;
-diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c
-new file mode 100644
-index 0000000..b3e60c6
---- /dev/null
-+++ b/resolv/tst-resolv-qtypes.c
-@@ -0,0 +1,185 @@
-+/* Exercise low-level query functions with different QTYPEs.
-+ Copyright (C) 2016 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <resolv.h>
-+#include <string.h>
-+#include <support/check.h>
-+#include <support/check_nss.h>
-+#include <support/resolv_test.h>
-+#include <support/support.h>
-+#include <support/test-driver.h>
-+#include <support/xmemstream.h>
-+
-+/* If ture, the response function will send the actual response packet
-+ over TCP instead of UDP. */
-+static volatile bool force_tcp;
-+
-+/* Send back a fake resource record matching the QTYPE. */
-+static void
-+response (const struct resolv_response_context *ctx,
-+ struct resolv_response_builder *b,
-+ const char *qname, uint16_t qclass, uint16_t qtype)
-+{
-+ if (force_tcp && ctx->tcp)
-+ {
-+ resolv_response_init (b, (struct resolv_response_flags) { .tc = 1 });
-+ resolv_response_add_question (b, qname, qclass, qtype);
-+ return;
-+ }
-+
-+ resolv_response_init (b, (struct resolv_response_flags) { });
-+ resolv_response_add_question (b, qname, qclass, qtype);
-+ resolv_response_section (b, ns_s_an);
-+ resolv_response_open_record (b, qname, qclass, qtype, 0);
-+ resolv_response_add_data (b, &qtype, sizeof (qtype));
-+ resolv_response_close_record (b);
-+}
-+
-+static const const char *domain = "www.example.com";
-+
-+static int
-+wrap_res_query (int type, unsigned char *answer, int answer_length)
-+{
-+ return res_query (domain, C_IN, type, answer, answer_length);
-+}
-+
-+static int
-+wrap_res_search (int type, unsigned char *answer, int answer_length)
-+{
-+ return res_query (domain, C_IN, type, answer, answer_length);
-+}
-+
-+static int
-+wrap_res_querydomain (int type, unsigned char *answer, int answer_length)
-+{
-+ return res_querydomain ("www", "example.com", C_IN, type,
-+ answer, answer_length);
-+}
-+
-+static int
-+wrap_res_send (int type, unsigned char *answer, int answer_length)
-+{
-+ unsigned char buf[512];
-+ int ret = res_mkquery (QUERY, domain, C_IN, type,
-+ (const unsigned char *) "", 0, NULL,
-+ buf, sizeof (buf));
-+ if (type < 0 || type >= 65536)
-+ {
-+ /* res_mkquery fails for out-of-range record types. */
-+ TEST_VERIFY_EXIT (ret == -1);
-+ return -1;
-+ }
-+ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */
-+ return res_send (buf, ret, answer, answer_length);
-+}
-+
-+static int
-+wrap_res_nquery (int type, unsigned char *answer, int answer_length)
-+{
-+ return res_nquery (&_res, domain, C_IN, type, answer, answer_length);
-+}
-+
-+static int
-+wrap_res_nsearch (int type, unsigned char *answer, int answer_length)
-+{
-+ return res_nquery (&_res, domain, C_IN, type, answer, answer_length);
-+}
-+
-+static int
-+wrap_res_nquerydomain (int type, unsigned char *answer, int answer_length)
-+{
-+ return res_nquerydomain (&_res, "www", "example.com", C_IN, type,
-+ answer, answer_length);
-+}
-+
-+static int
-+wrap_res_nsend (int type, unsigned char *answer, int answer_length)
-+{
-+ unsigned char buf[512];
-+ int ret = res_nmkquery (&_res, QUERY, domain, C_IN, type,
-+ (const unsigned char *) "", 0, NULL,
-+ buf, sizeof (buf));
-+ if (type < 0 || type >= 65536)
-+ {
-+ /* res_mkquery fails for out-of-range record types. */
-+ TEST_VERIFY_EXIT (ret == -1);
-+ return -1;
-+ }
-+ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */
-+ return res_nsend (&_res, buf, ret, answer, answer_length);
-+}
-+
-+static void
-+test_function (const char *fname,
-+ int (*func) (int type,
-+ unsigned char *answer, int answer_length))
-+{
-+ unsigned char buf[512];
-+ for (int tcp = 0; tcp < 2; ++tcp)
-+ {
-+ force_tcp = tcp;
-+ for (unsigned int type = 1; type <= 65535; ++type)
-+ {
-+ if (test_verbose)
-+ printf ("info: sending QTYPE %d with %s (tcp=%d)\n",
-+ type, fname, tcp);
-+ int ret = func (type, buf, sizeof (buf));
-+ if (ret != 47)
-+ FAIL_EXIT1 ("%s tcp=%d qtype=%d return value %d",
-+ fname,tcp, type, ret);
-+ /* One question, one answer record. */
-+ TEST_VERIFY (memcmp (buf + 4, "\0\1\0\1\0\0\0\0", 8) == 0);
-+ /* Question section. */
-+ static const char qname[] = "\3www\7example\3com";
-+ size_t qname_length = sizeof (qname);
-+ TEST_VERIFY (memcmp (buf + 12, qname, qname_length) == 0);
-+ /* RDATA part of answer. */
-+ uint16_t type16 = type;
-+ TEST_VERIFY (memcmp (buf + ret - 2, &type16, sizeof (type16)) == 0);
-+ }
-+ }
-+
-+ TEST_VERIFY (func (-1, buf, sizeof (buf) == -1));
-+ TEST_VERIFY (func (65536, buf, sizeof (buf) == -1));
-+}
-+
-+static int
-+do_test (void)
-+{
-+ struct resolv_redirect_config config =
-+ {
-+ .response_callback = response,
-+ };
-+ struct resolv_test *obj = resolv_test_start (config);
-+
-+ test_function ("res_query", &wrap_res_query);
-+ test_function ("res_search", &wrap_res_search);
-+ test_function ("res_querydomain", &wrap_res_querydomain);
-+ test_function ("res_send", &wrap_res_send);
-+
-+ test_function ("res_nquery", &wrap_res_nquery);
-+ test_function ("res_nsearch", &wrap_res_nsearch);
-+ test_function ("res_nquerydomain", &wrap_res_nquerydomain);
-+ test_function ("res_nsend", &wrap_res_nsend);
-+
-+ resolv_test_end (obj);
-+ return 0;
-+}
-+
-+#define TIMEOUT 300
-+#include <support/test-driver.c>
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-CVE-2015-7547.patch b/gnu/packages/patches/glibc-CVE-2015-7547.patch
deleted file mode 100644
index 12abeb76d4..0000000000
--- a/gnu/packages/patches/glibc-CVE-2015-7547.patch
+++ /dev/null
@@ -1,590 +0,0 @@
-From b995d95a5943785be3ab862b2d3276f3b4a22481 Mon Sep 17 00:00:00 2001
-From: Carlos O'Donell <carlos@systemhalted.org>
-Date: Tue, 16 Feb 2016 21:26:37 -0500
-Subject: [PATCH] CVE-2015-7547: getaddrinfo() stack-based buffer overflow (Bug
- 18665).
-
-* A stack-based buffer overflow was found in libresolv when invoked from
- libnss_dns, allowing specially crafted DNS responses to seize control
- of execution flow in the DNS client. The buffer overflow occurs in
- the functions send_dg (send datagram) and send_vc (send TCP) for the
- NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
- family. The use of AF_UNSPEC triggers the low-level resolver code to
- send out two parallel queries for A and AAAA. A mismanagement of the
- buffers used for those queries could result in the response of a query
- writing beyond the alloca allocated buffer created by
- _nss_dns_gethostbyname4_r. Buffer management is simplified to remove
- the overflow. Thanks to the Google Security Team and Red Hat for
- reporting the security impact of this issue, and Robert Holiday of
- Ciena for reporting the related bug 18665. (CVE-2015-7547)
-
-See also:
-https://sourceware.org/ml/libc-alpha/2016-02/msg00416.html
-https://sourceware.org/ml/libc-alpha/2016-02/msg00418.html
-
-(cherry picked from commit e9db92d3acfe1822d56d11abcea5bfc4c41cf6ca)
----
- ChangeLog | 15 +++
- NEWS | 14 +++
- resolv/nss_dns/dns-host.c | 111 ++++++++++++++++++-
- resolv/res_query.c | 3 +
- resolv/res_send.c | 264 ++++++++++++++++++++++++++++++++++------------
- 5 files changed, 338 insertions(+), 69 deletions(-)
-
-diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
-index 357ac04..a0fe9a8 100644
---- a/resolv/nss_dns/dns-host.c
-+++ b/resolv/nss_dns/dns-host.c
-@@ -1031,7 +1031,10 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
- int h_namelen = 0;
-
- if (ancount == 0)
-- return NSS_STATUS_NOTFOUND;
-+ {
-+ *h_errnop = HOST_NOT_FOUND;
-+ return NSS_STATUS_NOTFOUND;
-+ }
-
- while (ancount-- > 0 && cp < end_of_message && had_error == 0)
- {
-@@ -1208,7 +1211,14 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
- /* Special case here: if the resolver sent a result but it only
- contains a CNAME while we are looking for a T_A or T_AAAA record,
- we fail with NOTFOUND instead of TRYAGAIN. */
-- return canon == NULL ? NSS_STATUS_TRYAGAIN : NSS_STATUS_NOTFOUND;
-+ if (canon != NULL)
-+ {
-+ *h_errnop = HOST_NOT_FOUND;
-+ return NSS_STATUS_NOTFOUND;
-+ }
-+
-+ *h_errnop = NETDB_INTERNAL;
-+ return NSS_STATUS_TRYAGAIN;
- }
-
-
-@@ -1222,11 +1232,101 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
-
- enum nss_status status = NSS_STATUS_NOTFOUND;
-
-+ /* Combining the NSS status of two distinct queries requires some
-+ compromise and attention to symmetry (A or AAAA queries can be
-+ returned in any order). What follows is a breakdown of how this
-+ code is expected to work and why. We discuss only SUCCESS,
-+ TRYAGAIN, NOTFOUND and UNAVAIL, since they are the only returns
-+ that apply (though RETURN and MERGE exist). We make a distinction
-+ between TRYAGAIN (recoverable) and TRYAGAIN' (not-recoverable).
-+ A recoverable TRYAGAIN is almost always due to buffer size issues
-+ and returns ERANGE in errno and the caller is expected to retry
-+ with a larger buffer.
-+
-+ Lastly, you may be tempted to make significant changes to the
-+ conditions in this code to bring about symmetry between responses.
-+ Please don't change anything without due consideration for
-+ expected application behaviour. Some of the synthesized responses
-+ aren't very well thought out and sometimes appear to imply that
-+ IPv4 responses are always answer 1, and IPv6 responses are always
-+ answer 2, but that's not true (see the implementation of send_dg
-+ and send_vc to see response can arrive in any order, particularly
-+ for UDP). However, we expect it holds roughly enough of the time
-+ that this code works, but certainly needs to be fixed to make this
-+ a more robust implementation.
-+
-+ ----------------------------------------------
-+ | Answer 1 Status / | Synthesized | Reason |
-+ | Answer 2 Status | Status | |
-+ |--------------------------------------------|
-+ | SUCCESS/SUCCESS | SUCCESS | [1] |
-+ | SUCCESS/TRYAGAIN | TRYAGAIN | [5] |
-+ | SUCCESS/TRYAGAIN' | SUCCESS | [1] |
-+ | SUCCESS/NOTFOUND | SUCCESS | [1] |
-+ | SUCCESS/UNAVAIL | SUCCESS | [1] |
-+ | TRYAGAIN/SUCCESS | TRYAGAIN | [2] |
-+ | TRYAGAIN/TRYAGAIN | TRYAGAIN | [2] |
-+ | TRYAGAIN/TRYAGAIN' | TRYAGAIN | [2] |
-+ | TRYAGAIN/NOTFOUND | TRYAGAIN | [2] |
-+ | TRYAGAIN/UNAVAIL | TRYAGAIN | [2] |
-+ | TRYAGAIN'/SUCCESS | SUCCESS | [3] |
-+ | TRYAGAIN'/TRYAGAIN | TRYAGAIN | [3] |
-+ | TRYAGAIN'/TRYAGAIN' | TRYAGAIN' | [3] |
-+ | TRYAGAIN'/NOTFOUND | TRYAGAIN' | [3] |
-+ | TRYAGAIN'/UNAVAIL | UNAVAIL | [3] |
-+ | NOTFOUND/SUCCESS | SUCCESS | [3] |
-+ | NOTFOUND/TRYAGAIN | TRYAGAIN | [3] |
-+ | NOTFOUND/TRYAGAIN' | TRYAGAIN' | [3] |
-+ | NOTFOUND/NOTFOUND | NOTFOUND | [3] |
-+ | NOTFOUND/UNAVAIL | UNAVAIL | [3] |
-+ | UNAVAIL/SUCCESS | UNAVAIL | [4] |
-+ | UNAVAIL/TRYAGAIN | UNAVAIL | [4] |
-+ | UNAVAIL/TRYAGAIN' | UNAVAIL | [4] |
-+ | UNAVAIL/NOTFOUND | UNAVAIL | [4] |
-+ | UNAVAIL/UNAVAIL | UNAVAIL | [4] |
-+ ----------------------------------------------
-+
-+ [1] If the first response is a success we return success.
-+ This ignores the state of the second answer and in fact
-+ incorrectly sets errno and h_errno to that of the second
-+ answer. However because the response is a success we ignore
-+ *errnop and *h_errnop (though that means you touched errno on
-+ success). We are being conservative here and returning the
-+ likely IPv4 response in the first answer as a success.
-+
-+ [2] If the first response is a recoverable TRYAGAIN we return
-+ that instead of looking at the second response. The
-+ expectation here is that we have failed to get an IPv4 response
-+ and should retry both queries.
-+
-+ [3] If the first response was not a SUCCESS and the second
-+ response is not NOTFOUND (had a SUCCESS, need to TRYAGAIN,
-+ or failed entirely e.g. TRYAGAIN' and UNAVAIL) then use the
-+ result from the second response, otherwise the first responses
-+ status is used. Again we have some odd side-effects when the
-+ second response is NOTFOUND because we overwrite *errnop and
-+ *h_errnop that means that a first answer of NOTFOUND might see
-+ its *errnop and *h_errnop values altered. Whether it matters
-+ in practice that a first response NOTFOUND has the wrong
-+ *errnop and *h_errnop is undecided.
-+
-+ [4] If the first response is UNAVAIL we return that instead of
-+ looking at the second response. The expectation here is that
-+ it will have failed similarly e.g. configuration failure.
-+
-+ [5] Testing this code is complicated by the fact that truncated
-+ second response buffers might be returned as SUCCESS if the
-+ first answer is a SUCCESS. To fix this we add symmetry to
-+ TRYAGAIN with the second response. If the second response
-+ is a recoverable error we now return TRYAGIN even if the first
-+ response was SUCCESS. */
-+
- if (anslen1 > 0)
- status = gaih_getanswer_slice(answer1, anslen1, qname,
- &pat, &buffer, &buflen,
- errnop, h_errnop, ttlp,
- &first);
-+
- if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
- || (status == NSS_STATUS_TRYAGAIN
- /* We want to look at the second answer in case of an
-@@ -1242,8 +1342,15 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
- &pat, &buffer, &buflen,
- errnop, h_errnop, ttlp,
- &first);
-+ /* Use the second response status in some cases. */
- if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND)
- status = status2;
-+ /* Do not return a truncated second response (unless it was
-+ unavoidable e.g. unrecoverable TRYAGAIN). */
-+ if (status == NSS_STATUS_SUCCESS
-+ && (status2 == NSS_STATUS_TRYAGAIN
-+ && *errnop == ERANGE && *h_errnop != NO_RECOVERY))
-+ status = NSS_STATUS_TRYAGAIN;
- }
-
- return status;
-diff --git a/resolv/res_query.c b/resolv/res_query.c
-index 4a9b3b3..95470a9 100644
---- a/resolv/res_query.c
-+++ b/resolv/res_query.c
-@@ -396,6 +396,7 @@ __libc_res_nsearch(res_state statp,
- {
- free (*answerp2);
- *answerp2 = NULL;
-+ *nanswerp2 = 0;
- *answerp2_malloced = 0;
- }
- }
-@@ -447,6 +448,7 @@ __libc_res_nsearch(res_state statp,
- {
- free (*answerp2);
- *answerp2 = NULL;
-+ *nanswerp2 = 0;
- *answerp2_malloced = 0;
- }
-
-@@ -521,6 +523,7 @@ __libc_res_nsearch(res_state statp,
- {
- free (*answerp2);
- *answerp2 = NULL;
-+ *nanswerp2 = 0;
- *answerp2_malloced = 0;
- }
- if (saved_herrno != -1)
-diff --git a/resolv/res_send.c b/resolv/res_send.c
-index 5e53cc2..6511bb1 100644
---- a/resolv/res_send.c
-+++ b/resolv/res_send.c
-@@ -1,3 +1,20 @@
-+/* Copyright (C) 2016 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
- /*
- * Copyright (c) 1985, 1989, 1993
- * The Regents of the University of California. All rights reserved.
-@@ -363,6 +380,8 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
- #ifdef USE_HOOKS
- if (__glibc_unlikely (statp->qhook || statp->rhook)) {
- if (anssiz < MAXPACKET && ansp) {
-+ /* Always allocate MAXPACKET, callers expect
-+ this specific size. */
- u_char *buf = malloc (MAXPACKET);
- if (buf == NULL)
- return (-1);
-@@ -638,6 +657,77 @@ get_nsaddr (res_state statp, int n)
- return (struct sockaddr *) (void *) &statp->nsaddr_list[n];
- }
-
-+/* The send_vc function is responsible for sending a DNS query over TCP
-+ to the nameserver numbered NS from the res_state STATP i.e.
-+ EXT(statp).nssocks[ns]. The function supports sending both IPv4 and
-+ IPv6 queries at the same serially on the same socket.
-+
-+ Please note that for TCP there is no way to disable sending both
-+ queries, unlike UDP, which honours RES_SNGLKUP and RES_SNGLKUPREOP
-+ and sends the queries serially and waits for the result after each
-+ sent query. This implemetnation should be corrected to honour these
-+ options.
-+
-+ Please also note that for TCP we send both queries over the same
-+ socket one after another. This technically violates best practice
-+ since the server is allowed to read the first query, respond, and
-+ then close the socket (to service another client). If the server
-+ does this, then the remaining second query in the socket data buffer
-+ will cause the server to send the client an RST which will arrive
-+ asynchronously and the client's OS will likely tear down the socket
-+ receive buffer resulting in a potentially short read and lost
-+ response data. This will force the client to retry the query again,
-+ and this process may repeat until all servers and connection resets
-+ are exhausted and then the query will fail. It's not known if this
-+ happens with any frequency in real DNS server implementations. This
-+ implementation should be corrected to use two sockets by default for
-+ parallel queries.
-+
-+ The query stored in BUF of BUFLEN length is sent first followed by
-+ the query stored in BUF2 of BUFLEN2 length. Queries are sent
-+ serially on the same socket.
-+
-+ Answers to the query are stored firstly in *ANSP up to a max of
-+ *ANSSIZP bytes. If more than *ANSSIZP bytes are needed and ANSCP
-+ is non-NULL (to indicate that modifying the answer buffer is allowed)
-+ then malloc is used to allocate a new response buffer and ANSCP and
-+ ANSP will both point to the new buffer. If more than *ANSSIZP bytes
-+ are needed but ANSCP is NULL, then as much of the response as
-+ possible is read into the buffer, but the results will be truncated.
-+ When truncation happens because of a small answer buffer the DNS
-+ packets header field TC will bet set to 1, indicating a truncated
-+ message and the rest of the socket data will be read and discarded.
-+
-+ Answers to the query are stored secondly in *ANSP2 up to a max of
-+ *ANSSIZP2 bytes, with the actual response length stored in
-+ *RESPLEN2. If more than *ANSSIZP bytes are needed and ANSP2
-+ is non-NULL (required for a second query) then malloc is used to
-+ allocate a new response buffer, *ANSSIZP2 is set to the new buffer
-+ size and *ANSP2_MALLOCED is set to 1.
-+
-+ The ANSP2_MALLOCED argument will eventually be removed as the
-+ change in buffer pointer can be used to detect the buffer has
-+ changed and that the caller should use free on the new buffer.
-+
-+ Note that the answers may arrive in any order from the server and
-+ therefore the first and second answer buffers may not correspond to
-+ the first and second queries.
-+
-+ It is not supported to call this function with a non-NULL ANSP2
-+ but a NULL ANSCP. Put another way, you can call send_vc with a
-+ single unmodifiable buffer or two modifiable buffers, but no other
-+ combination is supported.
-+
-+ It is the caller's responsibility to free the malloc allocated
-+ buffers by detecting that the pointers have changed from their
-+ original values i.e. *ANSCP or *ANSP2 has changed.
-+
-+ If errors are encountered then *TERRNO is set to an appropriate
-+ errno value and a zero result is returned for a recoverable error,
-+ and a less-than zero result is returned for a non-recoverable error.
-+
-+ If no errors are encountered then *TERRNO is left unmodified and
-+ a the length of the first response in bytes is returned. */
- static int
- send_vc(res_state statp,
- const u_char *buf, int buflen, const u_char *buf2, int buflen2,
-@@ -647,11 +737,7 @@ send_vc(res_state statp,
- {
- const HEADER *hp = (HEADER *) buf;
- const HEADER *hp2 = (HEADER *) buf2;
-- u_char *ans = *ansp;
-- int orig_anssizp = *anssizp;
-- // XXX REMOVE
-- // int anssiz = *anssizp;
-- HEADER *anhp = (HEADER *) ans;
-+ HEADER *anhp = (HEADER *) *ansp;
- struct sockaddr *nsap = get_nsaddr (statp, ns);
- int truncating, connreset, n;
- /* On some architectures compiler might emit a warning indicating
-@@ -743,6 +829,8 @@ send_vc(res_state statp,
- * Receive length & response
- */
- int recvresp1 = 0;
-+ /* Skip the second response if there is no second query.
-+ To do that we mark the second response as received. */
- int recvresp2 = buf2 == NULL;
- uint16_t rlen16;
- read_len:
-@@ -779,40 +867,14 @@ send_vc(res_state statp,
- u_char **thisansp;
- int *thisresplenp;
- if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
-+ /* We have not received any responses
-+ yet or we only have one response to
-+ receive. */
- thisanssizp = anssizp;
- thisansp = anscp ?: ansp;
- assert (anscp != NULL || ansp2 == NULL);
- thisresplenp = &resplen;
- } else {
-- if (*anssizp != MAXPACKET) {
-- /* No buffer allocated for the first
-- reply. We can try to use the rest
-- of the user-provided buffer. */
--#if __GNUC_PREREQ (4, 7)
-- DIAG_PUSH_NEEDS_COMMENT;
-- DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
--#endif
--#if _STRING_ARCH_unaligned
-- *anssizp2 = orig_anssizp - resplen;
-- *ansp2 = *ansp + resplen;
--#else
-- int aligned_resplen
-- = ((resplen + __alignof__ (HEADER) - 1)
-- & ~(__alignof__ (HEADER) - 1));
-- *anssizp2 = orig_anssizp - aligned_resplen;
-- *ansp2 = *ansp + aligned_resplen;
--#endif
--#if __GNUC_PREREQ (4, 7)
-- DIAG_POP_NEEDS_COMMENT;
--#endif
-- } else {
-- /* The first reply did not fit into the
-- user-provided buffer. Maybe the second
-- answer will. */
-- *anssizp2 = orig_anssizp;
-- *ansp2 = *ansp;
-- }
--
- thisanssizp = anssizp2;
- thisansp = ansp2;
- thisresplenp = resplen2;
-@@ -820,10 +882,14 @@ send_vc(res_state statp,
- anhp = (HEADER *) *thisansp;
-
- *thisresplenp = rlen;
-- if (rlen > *thisanssizp) {
-- /* Yes, we test ANSCP here. If we have two buffers
-- both will be allocatable. */
-- if (__glibc_likely (anscp != NULL)) {
-+ /* Is the answer buffer too small? */
-+ if (*thisanssizp < rlen) {
-+ /* If the current buffer is not the the static
-+ user-supplied buffer then we can reallocate
-+ it. */
-+ if (thisansp != NULL && thisansp != ansp) {
-+ /* Always allocate MAXPACKET, callers expect
-+ this specific size. */
- u_char *newp = malloc (MAXPACKET);
- if (newp == NULL) {
- *terrno = ENOMEM;
-@@ -835,6 +901,9 @@ send_vc(res_state statp,
- if (thisansp == ansp2)
- *ansp2_malloced = 1;
- anhp = (HEADER *) newp;
-+ /* A uint16_t can't be larger than MAXPACKET
-+ thus it's safe to allocate MAXPACKET but
-+ read RLEN bytes instead. */
- len = rlen;
- } else {
- Dprint(statp->options & RES_DEBUG,
-@@ -997,6 +1066,66 @@ reopen (res_state statp, int *terrno, int ns)
- return 1;
- }
-
-+/* The send_dg function is responsible for sending a DNS query over UDP
-+ to the nameserver numbered NS from the res_state STATP i.e.
-+ EXT(statp).nssocks[ns]. The function supports IPv4 and IPv6 queries
-+ along with the ability to send the query in parallel for both stacks
-+ (default) or serially (RES_SINGLKUP). It also supports serial lookup
-+ with a close and reopen of the socket used to talk to the server
-+ (RES_SNGLKUPREOP) to work around broken name servers.
-+
-+ The query stored in BUF of BUFLEN length is sent first followed by
-+ the query stored in BUF2 of BUFLEN2 length. Queries are sent
-+ in parallel (default) or serially (RES_SINGLKUP or RES_SNGLKUPREOP).
-+
-+ Answers to the query are stored firstly in *ANSP up to a max of
-+ *ANSSIZP bytes. If more than *ANSSIZP bytes are needed and ANSCP
-+ is non-NULL (to indicate that modifying the answer buffer is allowed)
-+ then malloc is used to allocate a new response buffer and ANSCP and
-+ ANSP will both point to the new buffer. If more than *ANSSIZP bytes
-+ are needed but ANSCP is NULL, then as much of the response as
-+ possible is read into the buffer, but the results will be truncated.
-+ When truncation happens because of a small answer buffer the DNS
-+ packets header field TC will bet set to 1, indicating a truncated
-+ message, while the rest of the UDP packet is discarded.
-+
-+ Answers to the query are stored secondly in *ANSP2 up to a max of
-+ *ANSSIZP2 bytes, with the actual response length stored in
-+ *RESPLEN2. If more than *ANSSIZP bytes are needed and ANSP2
-+ is non-NULL (required for a second query) then malloc is used to
-+ allocate a new response buffer, *ANSSIZP2 is set to the new buffer
-+ size and *ANSP2_MALLOCED is set to 1.
-+
-+ The ANSP2_MALLOCED argument will eventually be removed as the
-+ change in buffer pointer can be used to detect the buffer has
-+ changed and that the caller should use free on the new buffer.
-+
-+ Note that the answers may arrive in any order from the server and
-+ therefore the first and second answer buffers may not correspond to
-+ the first and second queries.
-+
-+ It is not supported to call this function with a non-NULL ANSP2
-+ but a NULL ANSCP. Put another way, you can call send_vc with a
-+ single unmodifiable buffer or two modifiable buffers, but no other
-+ combination is supported.
-+
-+ It is the caller's responsibility to free the malloc allocated
-+ buffers by detecting that the pointers have changed from their
-+ original values i.e. *ANSCP or *ANSP2 has changed.
-+
-+ If an answer is truncated because of UDP datagram DNS limits then
-+ *V_CIRCUIT is set to 1 and the return value non-zero to indicate to
-+ the caller to retry with TCP. The value *GOTSOMEWHERE is set to 1
-+ if any progress was made reading a response from the nameserver and
-+ is used by the caller to distinguish between ECONNREFUSED and
-+ ETIMEDOUT (the latter if *GOTSOMEWHERE is 1).
-+
-+ If errors are encountered then *TERRNO is set to an appropriate
-+ errno value and a zero result is returned for a recoverable error,
-+ and a less-than zero result is returned for a non-recoverable error.
-+
-+ If no errors are encountered then *TERRNO is left unmodified and
-+ a the length of the first response in bytes is returned. */
- static int
- send_dg(res_state statp,
- const u_char *buf, int buflen, const u_char *buf2, int buflen2,
-@@ -1006,8 +1135,6 @@ send_dg(res_state statp,
- {
- const HEADER *hp = (HEADER *) buf;
- const HEADER *hp2 = (HEADER *) buf2;
-- u_char *ans = *ansp;
-- int orig_anssizp = *anssizp;
- struct timespec now, timeout, finish;
- struct pollfd pfd[1];
- int ptimeout;
-@@ -1040,6 +1167,8 @@ send_dg(res_state statp,
- int need_recompute = 0;
- int nwritten = 0;
- int recvresp1 = 0;
-+ /* Skip the second response if there is no second query.
-+ To do that we mark the second response as received. */
- int recvresp2 = buf2 == NULL;
- pfd[0].fd = EXT(statp).nssocks[ns];
- pfd[0].events = POLLOUT;
-@@ -1203,55 +1332,56 @@ send_dg(res_state statp,
- int *thisresplenp;
-
- if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
-+ /* We have not received any responses
-+ yet or we only have one response to
-+ receive. */
- thisanssizp = anssizp;
- thisansp = anscp ?: ansp;
- assert (anscp != NULL || ansp2 == NULL);
- thisresplenp = &resplen;
- } else {
-- if (*anssizp != MAXPACKET) {
-- /* No buffer allocated for the first
-- reply. We can try to use the rest
-- of the user-provided buffer. */
--#if _STRING_ARCH_unaligned
-- *anssizp2 = orig_anssizp - resplen;
-- *ansp2 = *ansp + resplen;
--#else
-- int aligned_resplen
-- = ((resplen + __alignof__ (HEADER) - 1)
-- & ~(__alignof__ (HEADER) - 1));
-- *anssizp2 = orig_anssizp - aligned_resplen;
-- *ansp2 = *ansp + aligned_resplen;
--#endif
-- } else {
-- /* The first reply did not fit into the
-- user-provided buffer. Maybe the second
-- answer will. */
-- *anssizp2 = orig_anssizp;
-- *ansp2 = *ansp;
-- }
--
- thisanssizp = anssizp2;
- thisansp = ansp2;
- thisresplenp = resplen2;
- }
-
- if (*thisanssizp < MAXPACKET
-- /* Yes, we test ANSCP here. If we have two buffers
-- both will be allocatable. */
-- && anscp
-+ /* If the current buffer is not the the static
-+ user-supplied buffer then we can reallocate
-+ it. */
-+ && (thisansp != NULL && thisansp != ansp)
- #ifdef FIONREAD
-+ /* Is the size too small? */
- && (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0
- || *thisanssizp < *thisresplenp)
- #endif
- ) {
-+ /* Always allocate MAXPACKET, callers expect
-+ this specific size. */
- u_char *newp = malloc (MAXPACKET);
- if (newp != NULL) {
-- *anssizp = MAXPACKET;
-- *thisansp = ans = newp;
-+ *thisanssizp = MAXPACKET;
-+ *thisansp = newp;
- if (thisansp == ansp2)
- *ansp2_malloced = 1;
- }
- }
-+ /* We could end up with truncation if anscp was NULL
-+ (not allowed to change caller's buffer) and the
-+ response buffer size is too small. This isn't a
-+ reliable way to detect truncation because the ioctl
-+ may be an inaccurate report of the UDP message size.
-+ Therefore we use this only to issue debug output.
-+ To do truncation accurately with UDP we need
-+ MSG_TRUNC which is only available on Linux. We
-+ can abstract out the Linux-specific feature in the
-+ future to detect truncation. */
-+ if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
-+ Dprint(statp->options & RES_DEBUG,
-+ (stdout, ";; response may be truncated (UDP)\n")
-+ );
-+ }
-+
- HEADER *anhp = (HEADER *) *thisansp;
- socklen_t fromlen = sizeof(struct sockaddr_in6);
- assert (sizeof(from) <= fromlen);
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-CVE-2016-3075.patch b/gnu/packages/patches/glibc-CVE-2016-3075.patch
deleted file mode 100644
index d16722806e..0000000000
--- a/gnu/packages/patches/glibc-CVE-2016-3075.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 146b58d11fddbef15b888906e3be4f33900c416f Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Tue, 29 Mar 2016 12:57:56 +0200
-Subject: [PATCH] CVE-2016-3075: Stack overflow in _nss_dns_getnetbyname_r [BZ
- #19879]
-
-The defensive copy is not needed because the name may not alias the
-output buffer.
-
-(cherry picked from commit 317b199b4aff8cfa27f2302ab404d2bb5032b9a4)
-(cherry picked from commit 883dceebc8f11921a9890211a4e202e5be17562f)
----
- ChangeLog | 7 +++++++
- NEWS | 10 ++++++++--
- resolv/nss_dns/dns-network.c | 5 +----
- 3 files changed, 16 insertions(+), 6 deletions(-)
-
-diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
-index 2eb2f67..8f301a7 100644
---- a/resolv/nss_dns/dns-network.c
-+++ b/resolv/nss_dns/dns-network.c
-@@ -118,17 +118,14 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
- } net_buffer;
- querybuf *orig_net_buffer;
- int anslen;
-- char *qbuf;
- enum nss_status status;
-
- if (__res_maybe_init (&_res, 0) == -1)
- return NSS_STATUS_UNAVAIL;
-
-- qbuf = strdupa (name);
--
- net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
-
-- anslen = __libc_res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
-+ anslen = __libc_res_nsearch (&_res, name, C_IN, T_PTR, net_buffer.buf->buf,
- 1024, &net_buffer.ptr, NULL, NULL, NULL, NULL);
- if (anslen < 0)
- {
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-CVE-2016-3706.patch b/gnu/packages/patches/glibc-CVE-2016-3706.patch
deleted file mode 100644
index 617242df24..0000000000
--- a/gnu/packages/patches/glibc-CVE-2016-3706.patch
+++ /dev/null
@@ -1,188 +0,0 @@
-From 1a8a7c12950a0026a3c406a7cb1608f96aa1460e Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 29 Apr 2016 10:35:34 +0200
-Subject: [PATCH] CVE-2016-3706: getaddrinfo: stack overflow in hostent
- conversion [BZ #20010]
-
-When converting a struct hostent response to struct gaih_addrtuple, the
-gethosts macro (which is called from gaih_inet) used alloca, without
-malloc fallback for large responses. This commit changes this code to
-use calloc unconditionally.
-
-This commit also consolidated a second hostent-to-gaih_addrtuple
-conversion loop (in gaih_inet) to use the new conversion function.
-
-(cherry picked from commit 4ab2ab03d4351914ee53248dc5aef4a8c88ff8b9)
----
- ChangeLog | 10 ++++
- sysdeps/posix/getaddrinfo.c | 130 +++++++++++++++++++++++---------------------
- 2 files changed, 79 insertions(+), 61 deletions(-)
-
-diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
-index 1ef3f20..fed2d3b 100644
---- a/sysdeps/posix/getaddrinfo.c
-+++ b/sysdeps/posix/getaddrinfo.c
-@@ -168,9 +168,58 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
- return 0;
- }
-
-+/* Convert struct hostent to a list of struct gaih_addrtuple objects.
-+ h_name is not copied, and the struct hostent object must not be
-+ deallocated prematurely. *RESULT must be NULL or a pointer to an
-+ object allocated using malloc, which is freed. */
-+static bool
-+convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
-+ int family,
-+ struct hostent *h,
-+ struct gaih_addrtuple **result)
-+{
-+ free (*result);
-+ *result = NULL;
-+
-+ /* Count the number of addresses in h->h_addr_list. */
-+ size_t count = 0;
-+ for (char **p = h->h_addr_list; *p != NULL; ++p)
-+ ++count;
-+
-+ /* Report no data if no addresses are available, or if the incoming
-+ address size is larger than what we can store. */
-+ if (count == 0 || h->h_length > sizeof (((struct gaih_addrtuple) {}).addr))
-+ return true;
-+
-+ struct gaih_addrtuple *array = calloc (count, sizeof (*array));
-+ if (array == NULL)
-+ return false;
-+
-+ for (size_t i = 0; i < count; ++i)
-+ {
-+ if (family == AF_INET && req->ai_family == AF_INET6)
-+ {
-+ /* Perform address mapping. */
-+ array[i].family = AF_INET6;
-+ memcpy(array[i].addr + 3, h->h_addr_list[i], sizeof (uint32_t));
-+ array[i].addr[2] = htonl (0xffff);
-+ }
-+ else
-+ {
-+ array[i].family = family;
-+ memcpy (array[i].addr, h->h_addr_list[i], h->h_length);
-+ }
-+ array[i].next = array + i + 1;
-+ }
-+ array[0].name = h->h_name;
-+ array[count - 1].next = NULL;
-+
-+ *result = array;
-+ return true;
-+}
-+
- #define gethosts(_family, _type) \
- { \
-- int i; \
- int herrno; \
- struct hostent th; \
- struct hostent *h; \
-@@ -219,36 +268,23 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
- } \
- else if (h != NULL) \
- { \
-- for (i = 0; h->h_addr_list[i]; i++) \
-+ /* Make sure that addrmem can be freed. */ \
-+ if (!malloc_addrmem) \
-+ addrmem = NULL; \
-+ if (!convert_hostent_to_gaih_addrtuple (req, _family,h, &addrmem)) \
- { \
-- if (*pat == NULL) \
-- { \
-- *pat = __alloca (sizeof (struct gaih_addrtuple)); \
-- (*pat)->scopeid = 0; \
-- } \
-- uint32_t *addr = (*pat)->addr; \
-- (*pat)->next = NULL; \
-- (*pat)->name = i == 0 ? strdupa (h->h_name) : NULL; \
-- if (_family == AF_INET && req->ai_family == AF_INET6) \
-- { \
-- (*pat)->family = AF_INET6; \
-- addr[3] = *(uint32_t *) h->h_addr_list[i]; \
-- addr[2] = htonl (0xffff); \
-- addr[1] = 0; \
-- addr[0] = 0; \
-- } \
-- else \
-- { \
-- (*pat)->family = _family; \
-- memcpy (addr, h->h_addr_list[i], sizeof(_type)); \
-- } \
-- pat = &((*pat)->next); \
-+ _res.options |= old_res_options & RES_USE_INET6; \
-+ result = -EAI_SYSTEM; \
-+ goto free_and_return; \
- } \
-+ *pat = addrmem; \
-+ /* The conversion uses malloc unconditionally. */ \
-+ malloc_addrmem = true; \
- \
- if (localcanon != NULL && canon == NULL) \
- canon = strdupa (localcanon); \
- \
-- if (_family == AF_INET6 && i > 0) \
-+ if (_family == AF_INET6 && *pat != NULL) \
- got_ipv6 = true; \
- } \
- }
-@@ -612,44 +648,16 @@ gaih_inet (const char *name, const struct gaih_service *service,
- {
- if (h != NULL)
- {
-- int i;
-- /* We found data, count the number of addresses. */
-- for (i = 0; h->h_addr_list[i]; ++i)
-- ;
-- if (i > 0 && *pat != NULL)
-- --i;
--
-- if (__libc_use_alloca (alloca_used
-- + i * sizeof (struct gaih_addrtuple)))
-- addrmem = alloca_account (i * sizeof (struct gaih_addrtuple),
-- alloca_used);
-- else
-- {
-- addrmem = malloc (i
-- * sizeof (struct gaih_addrtuple));
-- if (addrmem == NULL)
-- {
-- result = -EAI_MEMORY;
-- goto free_and_return;
-- }
-- malloc_addrmem = true;
-- }
--
-- /* Now convert it into the list. */
-- struct gaih_addrtuple *addrfree = addrmem;
-- for (i = 0; h->h_addr_list[i]; ++i)
-+ /* We found data, convert it. */
-+ if (!convert_hostent_to_gaih_addrtuple
-+ (req, AF_INET, h, &addrmem))
- {
-- if (*pat == NULL)
-- {
-- *pat = addrfree++;
-- (*pat)->scopeid = 0;
-- }
-- (*pat)->next = NULL;
-- (*pat)->family = AF_INET;
-- memcpy ((*pat)->addr, h->h_addr_list[i],
-- h->h_length);
-- pat = &((*pat)->next);
-+ result = -EAI_MEMORY;
-+ goto free_and_return;
- }
-+ *pat = addrmem;
-+ /* The conversion uses malloc unconditionally. */
-+ malloc_addrmem = true;
- }
- }
- else
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-CVE-2016-4429.patch b/gnu/packages/patches/glibc-CVE-2016-4429.patch
deleted file mode 100644
index 5eebd10543..0000000000
--- a/gnu/packages/patches/glibc-CVE-2016-4429.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From bdce95930e1d9a7d013d1ba78740243491262879 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 23 May 2016 20:18:34 +0200
-Subject: [PATCH] CVE-2016-4429: sunrpc: Do not use alloca in clntudp_call [BZ
- #20112]
-
-The call is technically in a loop, and under certain circumstances
-(which are quite difficult to reproduce in a test case), alloca
-can be invoked repeatedly during a single call to clntudp_call.
-As a result, the available stack space can be exhausted (even
-though individual alloca sizes are bounded implicitly by what
-can fit into a UDP packet, as a side effect of the earlier
-successful send operation).
-
-(cherry picked from commit bc779a1a5b3035133024b21e2f339fe4219fb11c)
----
- ChangeLog | 7 +++++++
- NEWS | 4 ++++
- sunrpc/clnt_udp.c | 10 +++++++++-
- 3 files changed, 20 insertions(+), 1 deletion(-)
-
-diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
-index a6cf5f1..4d9acb1 100644
---- a/sunrpc/clnt_udp.c
-+++ b/sunrpc/clnt_udp.c
-@@ -388,9 +388,15 @@ send_again:
- struct sock_extended_err *e;
- struct sockaddr_in err_addr;
- struct iovec iov;
-- char *cbuf = (char *) alloca (outlen + 256);
-+ char *cbuf = malloc (outlen + 256);
- int ret;
-
-+ if (cbuf == NULL)
-+ {
-+ cu->cu_error.re_errno = errno;
-+ return (cu->cu_error.re_status = RPC_CANTRECV);
-+ }
-+
- iov.iov_base = cbuf + 256;
- iov.iov_len = outlen;
- msg.msg_name = (void *) &err_addr;
-@@ -415,10 +421,12 @@ send_again:
- cmsg = CMSG_NXTHDR (&msg, cmsg))
- if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR)
- {
-+ free (cbuf);
- e = (struct sock_extended_err *) CMSG_DATA(cmsg);
- cu->cu_error.re_errno = e->ee_errno;
- return (cu->cu_error.re_status = RPC_CANTRECV);
- }
-+ free (cbuf);
- }
- #endif
- do
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-CVE-2017-1000366-pt1.patch b/gnu/packages/patches/glibc-CVE-2017-1000366-pt1.patch
deleted file mode 100644
index 71e80968be..0000000000
--- a/gnu/packages/patches/glibc-CVE-2017-1000366-pt1.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From f6110a8fee2ca36f8e2d2abecf3cba9fa7b8ea7d Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 19 Jun 2017 17:09:55 +0200
-Subject: [PATCH] CVE-2017-1000366: Ignore LD_LIBRARY_PATH for AT_SECURE=1
- programs [BZ #21624]
-
-LD_LIBRARY_PATH can only be used to reorder system search paths, which
-is not useful functionality.
-
-This makes an exploitable unbounded alloca in _dl_init_paths unreachable
-for AT_SECURE=1 programs.
-
-patch from:
-https://sourceware.org/git/?p=glibc.git;a=commit;h=f6110a8fee2ca36f8e2d2abecf3cba9fa7b8ea7d
----
- ChangeLog | 7 +++++++
- elf/rtld.c | 3 ++-
- 2 files changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 2446a87..2269dbe 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -2422,7 +2422,8 @@ process_envvars (enum mode *modep)
-
- case 12:
- /* The library search path. */
-- if (memcmp (envline, "LIBRARY_PATH", 12) == 0)
-+ if (!__libc_enable_secure
-+ && memcmp (envline, "LIBRARY_PATH", 12) == 0)
- {
- library_path = &envline[13];
- break;
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-CVE-2017-1000366-pt2.patch b/gnu/packages/patches/glibc-CVE-2017-1000366-pt2.patch
deleted file mode 100644
index 4b859c4bfd..0000000000
--- a/gnu/packages/patches/glibc-CVE-2017-1000366-pt2.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From 6d0ba622891bed9d8394eef1935add53003b12e8 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 19 Jun 2017 22:31:04 +0200
-Subject: [PATCH] ld.so: Reject overly long LD_PRELOAD path elements
-
-patch from:
-https://sourceware.org/git/?p=glibc.git;a=patch;h=6d0ba622891bed9d8394eef1935add53003b12e8
-
----
- ChangeLog | 7 ++++++
- elf/rtld.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++------------
- 2 files changed, 73 insertions(+), 16 deletions(-)
-
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 2269dbe..86ae20c 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -99,6 +99,35 @@ uintptr_t __pointer_chk_guard_local
- strong_alias (__pointer_chk_guard_local, __pointer_chk_guard)
- #endif
-
-+/* Length limits for names and paths, to protect the dynamic linker,
-+ particularly when __libc_enable_secure is active. */
-+#ifdef NAME_MAX
-+# define SECURE_NAME_LIMIT NAME_MAX
-+#else
-+# define SECURE_NAME_LIMIT 255
-+#endif
-+#ifdef PATH_MAX
-+# define SECURE_PATH_LIMIT PATH_MAX
-+#else
-+# define SECURE_PATH_LIMIT 1024
-+#endif
-+
-+/* Check that AT_SECURE=0, or that the passed name does not contain
-+ directories and is not overly long. Reject empty names
-+ unconditionally. */
-+static bool
-+dso_name_valid_for_suid (const char *p)
-+{
-+ if (__glibc_unlikely (__libc_enable_secure))
-+ {
-+ /* Ignore pathnames with directories for AT_SECURE=1
-+ programs, and also skip overlong names. */
-+ size_t len = strlen (p);
-+ if (len >= SECURE_NAME_LIMIT || memchr (p, '/', len) != NULL)
-+ return false;
-+ }
-+ return *p != '\0';
-+}
-
- /* List of auditing DSOs. */
- static struct audit_list
-@@ -718,6 +747,42 @@ static const char *preloadlist attribute_relro;
- /* Nonzero if information about versions has to be printed. */
- static int version_info attribute_relro;
-
-+/* The LD_PRELOAD environment variable gives list of libraries
-+ separated by white space or colons that are loaded before the
-+ executable's dependencies and prepended to the global scope list.
-+ (If the binary is running setuid all elements containing a '/' are
-+ ignored since it is insecure.) Return the number of preloads
-+ performed. */
-+unsigned int
-+handle_ld_preload (const char *preloadlist, struct link_map *main_map)
-+{
-+ unsigned int npreloads = 0;
-+ const char *p = preloadlist;
-+ char fname[SECURE_PATH_LIMIT];
-+
-+ while (*p != '\0')
-+ {
-+ /* Split preload list at space/colon. */
-+ size_t len = strcspn (p, " :");
-+ if (len > 0 && len < sizeof (fname))
-+ {
-+ memcpy (fname, p, len);
-+ fname[len] = '\0';
-+ }
-+ else
-+ fname[0] = '\0';
-+
-+ /* Skip over the substring and the following delimiter. */
-+ p += len;
-+ if (*p != '\0')
-+ ++p;
-+
-+ if (dso_name_valid_for_suid (fname))
-+ npreloads += do_preload (fname, main_map, "LD_PRELOAD");
-+ }
-+ return npreloads;
-+}
-+
- static void
- dl_main (const ElfW(Phdr) *phdr,
- ElfW(Word) phnum,
-@@ -1464,23 +1529,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
-
- if (__glibc_unlikely (preloadlist != NULL))
- {
-- /* The LD_PRELOAD environment variable gives list of libraries
-- separated by white space or colons that are loaded before the
-- executable's dependencies and prepended to the global scope
-- list. If the binary is running setuid all elements
-- containing a '/' are ignored since it is insecure. */
-- char *list = strdupa (preloadlist);
-- char *p;
--
- HP_TIMING_NOW (start);
--
-- /* Prevent optimizing strsep. Speed is not important here. */
-- while ((p = (strsep) (&list, " :")) != NULL)
-- if (p[0] != '\0'
-- && (__builtin_expect (! __libc_enable_secure, 1)
-- || strchr (p, '/') == NULL))
-- npreloads += do_preload (p, main_map, "LD_PRELOAD");
--
-+ npreloads += handle_ld_preload (preloadlist, main_map);
- HP_TIMING_NOW (stop);
- HP_TIMING_DIFF (diff, start, stop);
- HP_TIMING_ACCUM_NT (load_time, diff);
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-CVE-2017-1000366-pt3.patch b/gnu/packages/patches/glibc-CVE-2017-1000366-pt3.patch
deleted file mode 100644
index 3d8f6d2bf8..0000000000
--- a/gnu/packages/patches/glibc-CVE-2017-1000366-pt3.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-From 81b82fb966ffbd94353f793ad17116c6088dedd9 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 19 Jun 2017 22:32:12 +0200
-Subject: [PATCH] ld.so: Reject overly long LD_AUDIT path elements
-
-Also only process the last LD_AUDIT entry.
-
-patch from:
-https://sourceware.org/git/?p=glibc.git;a=commit;h=81b82fb966ffbd94353f793ad17116c6088dedd9
-
----
- ChangeLog | 11 +++++++
- elf/rtld.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------
- 2 files changed, 106 insertions(+), 15 deletions(-)
-
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 86ae20c..65647fb 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -129,13 +129,91 @@ dso_name_valid_for_suid (const char *p)
- return *p != '\0';
- }
-
--/* List of auditing DSOs. */
-+/* LD_AUDIT variable contents. Must be processed before the
-+ audit_list below. */
-+const char *audit_list_string;
-+
-+/* Cyclic list of auditing DSOs. audit_list->next is the first
-+ element. */
- static struct audit_list
- {
- const char *name;
- struct audit_list *next;
- } *audit_list;
-
-+/* Iterator for audit_list_string followed by audit_list. */
-+struct audit_list_iter
-+{
-+ /* Tail of audit_list_string still needing processing, or NULL. */
-+ const char *audit_list_tail;
-+
-+ /* The list element returned in the previous iteration. NULL before
-+ the first element. */
-+ struct audit_list *previous;
-+
-+ /* Scratch buffer for returning a name which is part of
-+ audit_list_string. */
-+ char fname[SECURE_NAME_LIMIT];
-+};
-+
-+/* Initialize an audit list iterator. */
-+static void
-+audit_list_iter_init (struct audit_list_iter *iter)
-+{
-+ iter->audit_list_tail = audit_list_string;
-+ iter->previous = NULL;
-+}
-+
-+/* Iterate through both audit_list_string and audit_list. */
-+static const char *
-+audit_list_iter_next (struct audit_list_iter *iter)
-+{
-+ if (iter->audit_list_tail != NULL)
-+ {
-+ /* First iterate over audit_list_string. */
-+ while (*iter->audit_list_tail != '\0')
-+ {
-+ /* Split audit list at colon. */
-+ size_t len = strcspn (iter->audit_list_tail, ":");
-+ if (len > 0 && len < sizeof (iter->fname))
-+ {
-+ memcpy (iter->fname, iter->audit_list_tail, len);
-+ iter->fname[len] = '\0';
-+ }
-+ else
-+ /* Do not return this name to the caller. */
-+ iter->fname[0] = '\0';
-+
-+ /* Skip over the substring and the following delimiter. */
-+ iter->audit_list_tail += len;
-+ if (*iter->audit_list_tail == ':')
-+ ++iter->audit_list_tail;
-+
-+ /* If the name is valid, return it. */
-+ if (dso_name_valid_for_suid (iter->fname))
-+ return iter->fname;
-+ /* Otherwise, wrap around and try the next name. */
-+ }
-+ /* Fall through to the procesing of audit_list. */
-+ }
-+
-+ if (iter->previous == NULL)
-+ {
-+ if (audit_list == NULL)
-+ /* No pre-parsed audit list. */
-+ return NULL;
-+ /* Start of audit list. The first list element is at
-+ audit_list->next (cyclic list). */
-+ iter->previous = audit_list->next;
-+ return iter->previous->name;
-+ }
-+ if (iter->previous == audit_list)
-+ /* Cyclic list wrap-around. */
-+ return NULL;
-+ iter->previous = iter->previous->next;
-+ return iter->previous->name;
-+}
-+
- #ifndef HAVE_INLINED_SYSCALLS
- /* Set nonzero during loading and initialization of executable and
- libraries, cleared before the executable's entry point runs. This
-@@ -1305,11 +1383,13 @@ of this helper program; chances are you did not intend to run this program.\n\
- GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
-
- /* If we have auditing DSOs to load, do it now. */
-- if (__glibc_unlikely (audit_list != NULL))
-+ bool need_security_init = true;
-+ if (__glibc_unlikely (audit_list != NULL)
-+ || __glibc_unlikely (audit_list_string != NULL))
- {
-- /* Iterate over all entries in the list. The order is important. */
- struct audit_ifaces *last_audit = NULL;
-- struct audit_list *al = audit_list->next;
-+ struct audit_list_iter al_iter;
-+ audit_list_iter_init (&al_iter);
-
- /* Since we start using the auditing DSOs right away we need to
- initialize the data structures now. */
-@@ -1320,9 +1400,14 @@ of this helper program; chances are you did not intend to run this program.\n\
- use different values (especially the pointer guard) and will
- fail later on. */
- security_init ();
-+ need_security_init = false;
-
-- do
-+ while (true)
- {
-+ const char *name = audit_list_iter_next (&al_iter);
-+ if (name == NULL)
-+ break;
-+
- int tls_idx = GL(dl_tls_max_dtv_idx);
-
- /* Now it is time to determine the layout of the static TLS
-@@ -1331,7 +1416,7 @@ of this helper program; chances are you did not intend to run this program.\n\
- no DF_STATIC_TLS bit is set. The reason is that we know
- glibc will use the static model. */
- struct dlmopen_args dlmargs;
-- dlmargs.fname = al->name;
-+ dlmargs.fname = name;
- dlmargs.map = NULL;
-
- const char *objname;
-@@ -1344,7 +1429,7 @@ of this helper program; chances are you did not intend to run this program.\n\
- not_loaded:
- _dl_error_printf ("\
- ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
-- al->name, err_str);
-+ name, err_str);
- if (malloced)
- free ((char *) err_str);
- }
-@@ -1448,10 +1533,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
- goto not_loaded;
- }
- }
--
-- al = al->next;
- }
-- while (al != audit_list->next);
-
- /* If we have any auditing modules, announce that we already
- have two objects loaded. */
-@@ -1715,7 +1797,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
- if (tcbp == NULL)
- tcbp = init_tls ();
-
-- if (__glibc_likely (audit_list == NULL))
-+ if (__glibc_likely (need_security_init))
- /* Initialize security features. But only if we have not done it
- earlier. */
- security_init ();
-@@ -2346,9 +2428,7 @@ process_dl_audit (char *str)
- char *p;
-
- while ((p = (strsep) (&str, ":")) != NULL)
-- if (p[0] != '\0'
-- && (__builtin_expect (! __libc_enable_secure, 1)
-- || strchr (p, '/') == NULL))
-+ if (dso_name_valid_for_suid (p))
- {
- /* This is using the local malloc, not the system malloc. The
- memory can never be freed. */
-@@ -2412,7 +2492,7 @@ process_envvars (enum mode *modep)
- break;
- }
- if (memcmp (envline, "AUDIT", 5) == 0)
-- process_dl_audit (&envline[6]);
-+ audit_list_string = &envline[6];
- break;
-
- case 7:
---
-2.9.3
-
diff --git a/gnu/packages/patches/glibc-o-largefile.patch b/gnu/packages/patches/glibc-o-largefile.patch
deleted file mode 100644
index 2b0ae8c8bb..0000000000
--- a/gnu/packages/patches/glibc-o-largefile.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-This fixes <https://sourceware.org/bugzilla/show_bug.cgi?id=18781>
-whereby, on 32-bit platforms, libc 2.22 would fail to pass O_LARGEFILE
-to 'openat'. This was caught by 'tests/sparse03.at' in the tar
-test suite.
-
-commit eb32b0d40308166c4d8f6330cc2958cb1e545075
-Author: Andreas Schwab <schwab@suse.de>
-Date: Mon Aug 10 14:12:47 2015 +0200
-
- Readd O_LARGEFILE flag for openat64 (bug 18781)
-
---- a/sysdeps/unix/sysv/linux/openat.c
-+++ b/sysdeps/unix/sysv/linux/openat.c
-@@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
- va_end (arg);
- }
-
-+ /* We have to add the O_LARGEFILE flag for openat64. */
-+#ifdef MORE_OFLAGS
-+ oflag |= MORE_OFLAGS;
-+#endif
-+
- return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
- }
- libc_hidden_def (__OPENAT)
diff --git a/gnu/packages/patches/glibc-vectorized-strcspn-guards.patch b/gnu/packages/patches/glibc-vectorized-strcspn-guards.patch
deleted file mode 100644
index 3d6c7749d4..0000000000
--- a/gnu/packages/patches/glibc-vectorized-strcspn-guards.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Copied from Debian.
-
-2017-06-14 Florian Weimer <fweimer@redhat.com>
-
- * sysdeps/i386/i686/multiarch/strcspn-c.c: Add IS_IN (libc) guard.
- * sysdeps/i386/i686/multiarch/varshift.c: Likewise.
-
---- a/sysdeps/i386/i686/multiarch/strcspn-c.c
-+++ b/sysdeps/i386/i686/multiarch/strcspn-c.c
-@@ -1,2 +1,4 @@
--#define __strcspn_sse2 __strcspn_ia32
--#include <sysdeps/x86_64/multiarch/strcspn-c.c>
-+#if IS_IN (libc)
-+# define __strcspn_sse2 __strcspn_ia32
-+# include <sysdeps/x86_64/multiarch/strcspn-c.c>
-+#endif
---- a/sysdeps/i386/i686/multiarch/varshift.c
-+++ b/sysdeps/i386/i686/multiarch/varshift.c
-@@ -1 +1,3 @@
--#include <sysdeps/x86_64/multiarch/varshift.c>
-+#if IS_IN (libc)
-+# include <sysdeps/x86_64/multiarch/varshift.c>
-+#endif
diff --git a/gnu/packages/patches/gpodder-disable-updater.patch b/gnu/packages/patches/gpodder-disable-updater.patch
new file mode 100644
index 0000000000..1aa0afe4f1
--- /dev/null
+++ b/gnu/packages/patches/gpodder-disable-updater.patch
@@ -0,0 +1,18 @@
+Description: Modify the default value for check_on_startup to false.
+ This prevents an privacy/information disclosure unless the user
+ explicitly opts-in for the update check.
+Forwarded: not-needed
+Origin: vendor
+Author: tony mancill <tmancill@debian.org>
+
+--- a/src/gpodder/config.py
++++ b/src/gpodder/config.py
+@@ -93,7 +93,7 @@
+
+ # Software updates from gpodder.org
+ 'software_update': {
+- 'check_on_startup': True, # check for updates on start
++ 'check_on_startup': False, # check for updates on start
+ 'last_check': 0, # unix timestamp of last update check
+ 'interval': 5, # interval (in days) to check for updates
+ },
diff --git a/gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch b/gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch
new file mode 100644
index 0000000000..250eef2c8b
--- /dev/null
+++ b/gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch
@@ -0,0 +1,34 @@
+Source: https://gitlab.gnome.org/GNOME/gvfs/-/commit/13551f3f40d41f1357126ac5a26d0fa012cd8123
+
+Note: This change should be incorporated into stable version 1.46.x of gvfs.
+
+From 13551f3f40d41f1357126ac5a26d0fa012cd8123 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Tue, 16 Jun 2020 13:28:35 +0200
+Subject: [PATCH] afc: Add support for libplist-2.2
+
+Which changed name from libplist to libplist-2.0 to embed its API
+version number in the library name.
+---
+ meson.build | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 1750f65ca..187bfd55f 100644
+--- a/meson.build
++++ b/meson.build
+@@ -357,7 +357,10 @@ config_h.set('HAVE_LOGIND', enable_logind)
+ enable_afc = get_option('afc')
+ if enable_afc
+ libimobiledevice_dep = dependency('libimobiledevice-1.0', version: '>= 1.2')
+- libplist_dep = dependency('libplist', version: '>= 0.15')
++ libplist_dep = dependency('libplist-2.0', required: false)
++ if not libplist_dep.found()
++ libplist_dep = dependency('libplist', version: '>= 0.15')
++ endif
+ endif
+
+ # *** Check if we should build with GOA volume monitor ***
+--
+GitLab
+
diff --git a/gnu/packages/patches/icecat-makeicecat.patch b/gnu/packages/patches/icecat-makeicecat.patch
index cff0b7ad45..265725ce36 100644
--- a/gnu/packages/patches/icecat-makeicecat.patch
+++ b/gnu/packages/patches/icecat-makeicecat.patch
@@ -25,7 +25,7 @@ index 8be2362..48716f2 100755
-wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc
-gpg --recv-keys --keyserver keyserver.ubuntu.com 14F26682D0916CDD81E37B6D61B7B526D98F0353
-gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc
--echo -n 2ec8c2627e46e80fc208584966a2ded7a0a9ff76b55ffccec0623b89b98ded2b firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c -
+-echo -n ae692bf2a15908cacbb9d4c7ccf78525a87410ff3f13befedc1926f849bc27cc firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c -
-
-echo Extracting Firefox tarball
-tar -xf firefox-${FFVERSION}esr.source.tar.xz
@@ -37,7 +37,7 @@ index 8be2362..48716f2 100755
+# wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc
+# gpg --recv-keys --keyserver keyserver.ubuntu.com 14F26682D0916CDD81E37B6D61B7B526D98F0353
+# gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc
-+# echo -n 2ec8c2627e46e80fc208584966a2ded7a0a9ff76b55ffccec0623b89b98ded2b firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c -
++# echo -n ae692bf2a15908cacbb9d4c7ccf78525a87410ff3f13befedc1926f849bc27cc firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c -
+#
+# echo Extracting Firefox tarball
+# tar -xf firefox-${FFVERSION}esr.source.tar.xz
diff --git a/gnu/packages/patches/json-c-0.12-CVE-2020-12762.patch b/gnu/packages/patches/json-c-0.12-CVE-2020-12762.patch
new file mode 100644
index 0000000000..4c06d124ee
--- /dev/null
+++ b/gnu/packages/patches/json-c-0.12-CVE-2020-12762.patch
@@ -0,0 +1,175 @@
+https://github.com/json-c/json-c/pull/611
+https://github.com/json-c/json-c/commit/74accb17cde1b88794b2b764cabaaf1f0858656c.patch
+
+From 74accb17cde1b88794b2b764cabaaf1f0858656c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
+Date: Fri, 15 May 2020 20:38:40 +0200
+Subject: [PATCH] Fix CVE-2020-12762.
+
+This commit is a squashed and slightly modified backport
+of the following commits on the master branch:
+
+ * 77d935b
+ * d07b910
+ * 519dfe1
+ * a59d5ac
+---
+ linkhash.c | 12 +++++++++++-
+ printbuf.c | 18 +++++++++++++++++-
+ tests/test4.c | 31 ++++++++++++++++++++++++++++++-
+ tests/test4.expected | 1 +
+ 4 files changed, 59 insertions(+), 3 deletions(-)
+
+diff --git a/linkhash.c b/linkhash.c
+index 8791a421e7..6543e171f9 100644
+--- a/linkhash.c
++++ b/linkhash.c
+@@ -10,6 +10,7 @@
+ *
+ */
+
++#include <assert.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+@@ -431,6 +432,8 @@ struct lh_table* lh_table_new(int size, const char *name,
+ int i;
+ struct lh_table *t;
+
++ /* Allocate space for elements to avoid divisions by zero. */
++ assert(size > 0);
+ t = (struct lh_table*)calloc(1, sizeof(struct lh_table));
+ if(!t) lh_abort("lh_table_new: calloc failed\n");
+ t->count = 0;
+@@ -495,7 +498,14 @@ int lh_table_insert(struct lh_table *t, void *k, const void *v)
+ unsigned long h, n;
+
+ t->inserts++;
+- if(t->count >= t->size * LH_LOAD_FACTOR) lh_table_resize(t, t->size * 2);
++ if (t->count >= t->size * LH_LOAD_FACTOR) {
++ /* Avoid signed integer overflow with large tables. */
++ int new_size = (t->size > INT_MAX / 2) ? INT_MAX : (t->size * 2);
++ if (t->size == INT_MAX)
++ return -1;
++
++ lh_table_resize(t, new_size);
++ }
+
+ h = t->hash_fn(k);
+ n = h % t->size;
+diff --git a/printbuf.c b/printbuf.c
+index 9d56522000..31dd86f87d 100644
+--- a/printbuf.c
++++ b/printbuf.c
+@@ -15,6 +15,7 @@
+
+ #include "config.h"
+
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -63,7 +64,16 @@ static int printbuf_extend(struct printbuf *p, int min_size)
+ if (p->size >= min_size)
+ return 0;
+
+- new_size = json_max(p->size * 2, min_size + 8);
++ /* Prevent signed integer overflows with large buffers. */
++ if (min_size > INT_MAX - 8)
++ return -1;
++ if (p->size > INT_MAX / 2)
++ new_size = min_size + 8;
++ else {
++ new_size = p->size * 2;
++ if (new_size < min_size + 8)
++ new_size = min_size + 8;
++ }
+ #ifdef PRINTBUF_DEBUG
+ MC_DEBUG("printbuf_memappend: realloc "
+ "bpos=%d min_size=%d old_size=%d new_size=%d\n",
+@@ -78,6 +88,9 @@ static int printbuf_extend(struct printbuf *p, int min_size)
+
+ int printbuf_memappend(struct printbuf *p, const char *buf, int size)
+ {
++ /* Prevent signed integer overflows with large buffers. */
++ if (size > INT_MAX - p->bpos - 1)
++ return -1;
+ if (p->size <= p->bpos + size + 1) {
+ if (printbuf_extend(p, p->bpos + size + 1) < 0)
+ return -1;
+@@ -94,6 +107,9 @@ int printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len)
+
+ if (offset == -1)
+ offset = pb->bpos;
++ /* Prevent signed integer overflows with large buffers. */
++ if (len > INT_MAX - offset)
++ return -1;
+ size_needed = offset + len;
+ if (pb->size < size_needed)
+ {
+diff --git a/tests/test4.c b/tests/test4.c
+index 23e97dac1b..8b05848a13 100644
+--- a/tests/test4.c
++++ b/tests/test4.c
+@@ -2,9 +2,11 @@
+ * gcc -o utf8 utf8.c -I/home/y/include -L./.libs -ljson
+ */
+
++#include "config.h"
++#include <assert.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+-#include "config.h"
+
+ #include "json_inttypes.h"
+ #include "json_object.h"
+@@ -24,6 +26,30 @@ void print_hex( const char* s)
+ printf("\n");
+ }
+
++static void test_lot_of_adds(void);
++static void test_lot_of_adds()
++{
++ int ii;
++ char key[50];
++ json_object *jobj = json_object_new_object();
++ assert(jobj != NULL);
++ for (ii = 0; ii < 500; ii++)
++ {
++ snprintf(key, sizeof(key), "k%d", ii);
++ json_object *iobj = json_object_new_int(ii);
++ assert(iobj != NULL);
++ json_object_object_add(jobj, key, iobj);
++ if (json_object_object_get_ex(jobj, key, &iobj) == FALSE)
++ {
++ fprintf(stderr, "FAILED to add object #%d\n", ii);
++ abort();
++ }
++ }
++ printf("%s\n", json_object_to_json_string(jobj));
++ assert(json_object_object_length(jobj) == 500);
++ json_object_put(jobj);
++}
++
+ int main()
+ {
+ const char *input = "\"\\ud840\\udd26,\\ud840\\udd27,\\ud800\\udd26,\\ud800\\udd27\"";
+@@ -49,5 +75,8 @@ int main()
+ retval = 1;
+ }
+ json_object_put(parse_result);
++
++ test_lot_of_adds();
++
+ return retval;
+ }
+diff --git a/tests/test4.expected b/tests/test4.expected
+index 68d4336d90..cb2744012b 100644
+--- a/tests/test4.expected
++++ b/tests/test4.expected
+@@ -1,3 +1,4 @@
+ input: "\ud840\udd26,\ud840\udd27,\ud800\udd26,\ud800\udd27"
+ JSON parse result is correct: 𠄦,𠄧,𐄦,𐄧
+ PASS
++{ "k0": 0, "k1": 1, "k2": 2, "k3": 3, "k4": 4, "k5": 5, "k6": 6, "k7": 7, "k8": 8, "k9": 9, "k10": 10, "k11": 11, "k12": 12, "k13": 13, "k14": 14, "k15": 15, "k16": 16, "k17": 17, "k18": 18, "k19": 19, "k20": 20, "k21": 21, "k22": 22, "k23": 23, "k24": 24, "k25": 25, "k26": 26, "k27": 27, "k28": 28, "k29": 29, "k30": 30, "k31": 31, "k32": 32, "k33": 33, "k34": 34, "k35": 35, "k36": 36, "k37": 37, "k38": 38, "k39": 39, "k40": 40, "k41": 41, "k42": 42, "k43": 43, "k44": 44, "k45": 45, "k46": 46, "k47": 47, "k48": 48, "k49": 49, "k50": 50, "k51": 51, "k52": 52, "k53": 53, "k54": 54, "k55": 55, "k56": 56, "k57": 57, "k58": 58, "k59": 59, "k60": 60, "k61": 61, "k62": 62, "k63": 63, "k64": 64, "k65": 65, "k66": 66, "k67": 67, "k68": 68, "k69": 69, "k70": 70, "k71": 71, "k72": 72, "k73": 73, "k74": 74, "k75": 75, "k76": 76, "k77": 77, "k78": 78, "k79": 79, "k80": 80, "k81": 81, "k82": 82, "k83": 83, "k84": 84, "k85": 85, "k86": 86, "k87": 87, "k88": 88, "k89": 89, "k90": 90, "k91": 91, "k92": 92, "k93": 93, "k94": 94, "k95": 95, "k96": 96, "k97": 97, "k98": 98, "k99": 99, "k100": 100, "k101": 101, "k102": 102, "k103": 103, "k104": 104, "k105": 105, "k106": 106, "k107": 107, "k108": 108, "k109": 109, "k110": 110, "k111": 111, "k112": 112, "k113": 113, "k114": 114, "k115": 115, "k116": 116, "k117": 117, "k118": 118, "k119": 119, "k120": 120, "k121": 121, "k122": 122, "k123": 123, "k124": 124, "k125": 125, "k126": 126, "k127": 127, "k128": 128, "k129": 129, "k130": 130, "k131": 131, "k132": 132, "k133": 133, "k134": 134, "k135": 135, "k136": 136, "k137": 137, "k138": 138, "k139": 139, "k140": 140, "k141": 141, "k142": 142, "k143": 143, "k144": 144, "k145": 145, "k146": 146, "k147": 147, "k148": 148, "k149": 149, "k150": 150, "k151": 151, "k152": 152, "k153": 153, "k154": 154, "k155": 155, "k156": 156, "k157": 157, "k158": 158, "k159": 159, "k160": 160, "k161": 161, "k162": 162, "k163": 163, "k164": 164, "k165": 165, "k166": 166, "k167": 167, "k168": 168, "k169": 169, "k170": 170, "k171": 171, "k172": 172, "k173": 173, "k174": 174, "k175": 175, "k176": 176, "k177": 177, "k178": 178, "k179": 179, "k180": 180, "k181": 181, "k182": 182, "k183": 183, "k184": 184, "k185": 185, "k186": 186, "k187": 187, "k188": 188, "k189": 189, "k190": 190, "k191": 191, "k192": 192, "k193": 193, "k194": 194, "k195": 195, "k196": 196, "k197": 197, "k198": 198, "k199": 199, "k200": 200, "k201": 201, "k202": 202, "k203": 203, "k204": 204, "k205": 205, "k206": 206, "k207": 207, "k208": 208, "k209": 209, "k210": 210, "k211": 211, "k212": 212, "k213": 213, "k214": 214, "k215": 215, "k216": 216, "k217": 217, "k218": 218, "k219": 219, "k220": 220, "k221": 221, "k222": 222, "k223": 223, "k224": 224, "k225": 225, "k226": 226, "k227": 227, "k228": 228, "k229": 229, "k230": 230, "k231": 231, "k232": 232, "k233": 233, "k234": 234, "k235": 235, "k236": 236, "k237": 237, "k238": 238, "k239": 239, "k240": 240, "k241": 241, "k242": 242, "k243": 243, "k244": 244, "k245": 245, "k246": 246, "k247": 247, "k248": 248, "k249": 249, "k250": 250, "k251": 251, "k252": 252, "k253": 253, "k254": 254, "k255": 255, "k256": 256, "k257": 257, "k258": 258, "k259": 259, "k260": 260, "k261": 261, "k262": 262, "k263": 263, "k264": 264, "k265": 265, "k266": 266, "k267": 267, "k268": 268, "k269": 269, "k270": 270, "k271": 271, "k272": 272, "k273": 273, "k274": 274, "k275": 275, "k276": 276, "k277": 277, "k278": 278, "k279": 279, "k280": 280, "k281": 281, "k282": 282, "k283": 283, "k284": 284, "k285": 285, "k286": 286, "k287": 287, "k288": 288, "k289": 289, "k290": 290, "k291": 291, "k292": 292, "k293": 293, "k294": 294, "k295": 295, "k296": 296, "k297": 297, "k298": 298, "k299": 299, "k300": 300, "k301": 301, "k302": 302, "k303": 303, "k304": 304, "k305": 305, "k306": 306, "k307": 307, "k308": 308, "k309": 309, "k310": 310, "k311": 311, "k312": 312, "k313": 313, "k314": 314, "k315": 315, "k316": 316, "k317": 317, "k318": 318, "k319": 319, "k320": 320, "k321": 321, "k322": 322, "k323": 323, "k324": 324, "k325": 325, "k326": 326, "k327": 327, "k328": 328, "k329": 329, "k330": 330, "k331": 331, "k332": 332, "k333": 333, "k334": 334, "k335": 335, "k336": 336, "k337": 337, "k338": 338, "k339": 339, "k340": 340, "k341": 341, "k342": 342, "k343": 343, "k344": 344, "k345": 345, "k346": 346, "k347": 347, "k348": 348, "k349": 349, "k350": 350, "k351": 351, "k352": 352, "k353": 353, "k354": 354, "k355": 355, "k356": 356, "k357": 357, "k358": 358, "k359": 359, "k360": 360, "k361": 361, "k362": 362, "k363": 363, "k364": 364, "k365": 365, "k366": 366, "k367": 367, "k368": 368, "k369": 369, "k370": 370, "k371": 371, "k372": 372, "k373": 373, "k374": 374, "k375": 375, "k376": 376, "k377": 377, "k378": 378, "k379": 379, "k380": 380, "k381": 381, "k382": 382, "k383": 383, "k384": 384, "k385": 385, "k386": 386, "k387": 387, "k388": 388, "k389": 389, "k390": 390, "k391": 391, "k392": 392, "k393": 393, "k394": 394, "k395": 395, "k396": 396, "k397": 397, "k398": 398, "k399": 399, "k400": 400, "k401": 401, "k402": 402, "k403": 403, "k404": 404, "k405": 405, "k406": 406, "k407": 407, "k408": 408, "k409": 409, "k410": 410, "k411": 411, "k412": 412, "k413": 413, "k414": 414, "k415": 415, "k416": 416, "k417": 417, "k418": 418, "k419": 419, "k420": 420, "k421": 421, "k422": 422, "k423": 423, "k424": 424, "k425": 425, "k426": 426, "k427": 427, "k428": 428, "k429": 429, "k430": 430, "k431": 431, "k432": 432, "k433": 433, "k434": 434, "k435": 435, "k436": 436, "k437": 437, "k438": 438, "k439": 439, "k440": 440, "k441": 441, "k442": 442, "k443": 443, "k444": 444, "k445": 445, "k446": 446, "k447": 447, "k448": 448, "k449": 449, "k450": 450, "k451": 451, "k452": 452, "k453": 453, "k454": 454, "k455": 455, "k456": 456, "k457": 457, "k458": 458, "k459": 459, "k460": 460, "k461": 461, "k462": 462, "k463": 463, "k464": 464, "k465": 465, "k466": 466, "k467": 467, "k468": 468, "k469": 469, "k470": 470, "k471": 471, "k472": 472, "k473": 473, "k474": 474, "k475": 475, "k476": 476, "k477": 477, "k478": 478, "k479": 479, "k480": 480, "k481": 481, "k482": 482, "k483": 483, "k484": 484, "k485": 485, "k486": 486, "k487": 487, "k488": 488, "k489": 489, "k490": 490, "k491": 491, "k492": 492, "k493": 493, "k494": 494, "k495": 495, "k496": 496, "k497": 497, "k498": 498, "k499": 499 }
diff --git a/gnu/packages/patches/json-c-0.13-CVE-2020-12762.patch b/gnu/packages/patches/json-c-0.13-CVE-2020-12762.patch
new file mode 100644
index 0000000000..7a6743bcc0
--- /dev/null
+++ b/gnu/packages/patches/json-c-0.13-CVE-2020-12762.patch
@@ -0,0 +1,230 @@
+https://github.com/json-c/json-c/pull/607
+https://github.com/json-c/json-c/commit/865b5a65199973bb63dff8e47a2f57e04fec9736.patch
+
+From 865b5a65199973bb63dff8e47a2f57e04fec9736 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
+Date: Thu, 14 May 2020 12:32:30 +0200
+Subject: [PATCH] Fix CVE-2020-12762.
+
+This commit is a squashed backport of the following commits
+on the master branch:
+
+ * 099016b7e8d70a6d5dd814e788bba08d33d48426
+ * 77d935b7ae7871a1940cd827e850e6063044ec45
+ * d07b91014986900a3a75f306d302e13e005e9d67
+ * 519dfe1591d85432986f9762d41d1a883198c157
+ * a59d5acfab4485d5133114df61785b1fc633e0c6
+---
+ arraylist.c | 3 +++
+ linkhash.c | 21 ++++++++++++++-------
+ printbuf.c | 38 ++++++++++++++++++++++++++------------
+ tests/test4.c | 30 +++++++++++++++++++++++++++++-
+ tests/test4.expected | 1 +
+ 5 files changed, 73 insertions(+), 20 deletions(-)
+
+diff --git a/arraylist.c b/arraylist.c
+index ddeb8d4eb4..e737052e32 100644
+--- a/arraylist.c
++++ b/arraylist.c
+@@ -135,6 +135,9 @@ array_list_del_idx( struct array_list *arr, size_t idx, size_t count )
+ {
+ size_t i, stop;
+
++ /* Avoid overflow in calculation with large indices. */
++ if (idx > SIZE_T_MAX - count)
++ return -1;
+ stop = idx + count;
+ if ( idx >= arr->length || stop > arr->length ) return -1;
+ for ( i = idx; i < stop; ++i ) {
+diff --git a/linkhash.c b/linkhash.c
+index 5497061a8a..6435a154ac 100644
+--- a/linkhash.c
++++ b/linkhash.c
+@@ -12,12 +12,13 @@
+
+ #include "config.h"
+
+-#include <stdio.h>
+-#include <string.h>
+-#include <stdlib.h>
++#include <assert.h>
++#include <limits.h>
+ #include <stdarg.h>
+ #include <stddef.h>
+-#include <limits.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
+
+ #ifdef HAVE_ENDIAN_H
+ # include <endian.h> /* attempt to define endianness */
+@@ -28,8 +29,8 @@
+ # include <windows.h> /* Get InterlockedCompareExchange */
+ #endif
+
+-#include "random_seed.h"
+ #include "linkhash.h"
++#include "random_seed.h"
+
+ /* hash functions */
+ static unsigned long lh_char_hash(const void *k);
+@@ -498,7 +499,9 @@ struct lh_table* lh_table_new(int size,
+ int i;
+ struct lh_table *t;
+
+- t = (struct lh_table*)calloc(1, sizeof(struct lh_table));
++ /* Allocate space for elements to avoid divisions by zero. */
++ assert(size > 0);
++ t = (struct lh_table *)calloc(1, sizeof(struct lh_table));
+ if (!t)
+ return NULL;
+
+@@ -577,8 +580,12 @@ int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, con
+ unsigned long n;
+
+ if (t->count >= t->size * LH_LOAD_FACTOR)
+- if (lh_table_resize(t, t->size * 2) != 0)
++ {
++ /* Avoid signed integer overflow with large tables. */
++ int new_size = (t->size > INT_MAX / 2) ? INT_MAX : (t->size * 2);
++ if (t->size == INT_MAX || lh_table_resize(t, new_size) != 0)
+ return -1;
++ }
+
+ n = h % t->size;
+
+diff --git a/printbuf.c b/printbuf.c
+index 6c77b5defd..6fc56de455 100644
+--- a/printbuf.c
++++ b/printbuf.c
+@@ -15,6 +15,7 @@
+
+ #include "config.h"
+
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -64,10 +65,16 @@ static int printbuf_extend(struct printbuf *p, int min_size)
+
+ if (p->size >= min_size)
+ return 0;
+-
+- new_size = p->size * 2;
+- if (new_size < min_size + 8)
+- new_size = min_size + 8;
++ /* Prevent signed integer overflows with large buffers. */
++ if (min_size > INT_MAX - 8)
++ return -1;
++ if (p->size > INT_MAX / 2)
++ new_size = min_size + 8;
++ else {
++ new_size = p->size * 2;
++ if (new_size < min_size + 8)
++ new_size = min_size + 8;
++ }
+ #ifdef PRINTBUF_DEBUG
+ MC_DEBUG("printbuf_memappend: realloc "
+ "bpos=%d min_size=%d old_size=%d new_size=%d\n",
+@@ -82,14 +89,18 @@ static int printbuf_extend(struct printbuf *p, int min_size)
+
+ int printbuf_memappend(struct printbuf *p, const char *buf, int size)
+ {
+- if (p->size <= p->bpos + size + 1) {
+- if (printbuf_extend(p, p->bpos + size + 1) < 0)
+- return -1;
+- }
+- memcpy(p->buf + p->bpos, buf, size);
+- p->bpos += size;
+- p->buf[p->bpos]= '\0';
+- return size;
++ /* Prevent signed integer overflows with large buffers. */
++ if (size > INT_MAX - p->bpos - 1)
++ return -1;
++ if (p->size <= p->bpos + size + 1)
++ {
++ if (printbuf_extend(p, p->bpos + size + 1) < 0)
++ return -1;
++ }
++ memcpy(p->buf + p->bpos, buf, size);
++ p->bpos += size;
++ p->buf[p->bpos] = '\0';
++ return size;
+ }
+
+ int printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len)
+@@ -98,6 +109,9 @@ int printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len)
+
+ if (offset == -1)
+ offset = pb->bpos;
++ /* Prevent signed integer overflows with large buffers. */
++ if (len > INT_MAX - offset)
++ return -1;
+ size_needed = offset + len;
+ if (pb->size < size_needed)
+ {
+diff --git a/tests/test4.c b/tests/test4.c
+index fc8b79dbf4..82d3f494de 100644
+--- a/tests/test4.c
++++ b/tests/test4.c
+@@ -2,9 +2,11 @@
+ * gcc -o utf8 utf8.c -I/home/y/include -L./.libs -ljson
+ */
+
++#include "config.h"
++#include <assert.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+-#include "config.h"
+
+ #include "json_inttypes.h"
+ #include "json_object.h"
+@@ -24,6 +26,29 @@ void print_hex(const char* s)
+ putchar('\n');
+ }
+
++static void test_lot_of_adds(void);
++static void test_lot_of_adds()
++{
++ int ii;
++ char key[50];
++ json_object *jobj = json_object_new_object();
++ assert(jobj != NULL);
++ for (ii = 0; ii < 500; ii++)
++ {
++ snprintf(key, sizeof(key), "k%d", ii);
++ json_object *iobj = json_object_new_int(ii);
++ assert(iobj != NULL);
++ if (json_object_object_add(jobj, key, iobj))
++ {
++ fprintf(stderr, "FAILED to add object #%d\n", ii);
++ abort();
++ }
++ }
++ printf("%s\n", json_object_to_json_string(jobj));
++ assert(json_object_object_length(jobj) == 500);
++ json_object_put(jobj);
++}
++
+ int main(void)
+ {
+ const char *input = "\"\\ud840\\udd26,\\ud840\\udd27,\\ud800\\udd26,\\ud800\\udd27\"";
+@@ -49,5 +74,8 @@ int main(void)
+ retval = 1;
+ }
+ json_object_put(parse_result);
++
++ test_lot_of_adds();
++
+ return retval;
+ }
+diff --git a/tests/test4.expected b/tests/test4.expected
+index 68d4336d90..cb2744012b 100644
+--- a/tests/test4.expected
++++ b/tests/test4.expected
+@@ -1,3 +1,4 @@
+ input: "\ud840\udd26,\ud840\udd27,\ud800\udd26,\ud800\udd27"
+ JSON parse result is correct: 𠄦,𠄧,𐄦,𐄧
+ PASS
++{ "k0": 0, "k1": 1, "k2": 2, "k3": 3, "k4": 4, "k5": 5, "k6": 6, "k7": 7, "k8": 8, "k9": 9, "k10": 10, "k11": 11, "k12": 12, "k13": 13, "k14": 14, "k15": 15, "k16": 16, "k17": 17, "k18": 18, "k19": 19, "k20": 20, "k21": 21, "k22": 22, "k23": 23, "k24": 24, "k25": 25, "k26": 26, "k27": 27, "k28": 28, "k29": 29, "k30": 30, "k31": 31, "k32": 32, "k33": 33, "k34": 34, "k35": 35, "k36": 36, "k37": 37, "k38": 38, "k39": 39, "k40": 40, "k41": 41, "k42": 42, "k43": 43, "k44": 44, "k45": 45, "k46": 46, "k47": 47, "k48": 48, "k49": 49, "k50": 50, "k51": 51, "k52": 52, "k53": 53, "k54": 54, "k55": 55, "k56": 56, "k57": 57, "k58": 58, "k59": 59, "k60": 60, "k61": 61, "k62": 62, "k63": 63, "k64": 64, "k65": 65, "k66": 66, "k67": 67, "k68": 68, "k69": 69, "k70": 70, "k71": 71, "k72": 72, "k73": 73, "k74": 74, "k75": 75, "k76": 76, "k77": 77, "k78": 78, "k79": 79, "k80": 80, "k81": 81, "k82": 82, "k83": 83, "k84": 84, "k85": 85, "k86": 86, "k87": 87, "k88": 88, "k89": 89, "k90": 90, "k91": 91, "k92": 92, "k93": 93, "k94": 94, "k95": 95, "k96": 96, "k97": 97, "k98": 98, "k99": 99, "k100": 100, "k101": 101, "k102": 102, "k103": 103, "k104": 104, "k105": 105, "k106": 106, "k107": 107, "k108": 108, "k109": 109, "k110": 110, "k111": 111, "k112": 112, "k113": 113, "k114": 114, "k115": 115, "k116": 116, "k117": 117, "k118": 118, "k119": 119, "k120": 120, "k121": 121, "k122": 122, "k123": 123, "k124": 124, "k125": 125, "k126": 126, "k127": 127, "k128": 128, "k129": 129, "k130": 130, "k131": 131, "k132": 132, "k133": 133, "k134": 134, "k135": 135, "k136": 136, "k137": 137, "k138": 138, "k139": 139, "k140": 140, "k141": 141, "k142": 142, "k143": 143, "k144": 144, "k145": 145, "k146": 146, "k147": 147, "k148": 148, "k149": 149, "k150": 150, "k151": 151, "k152": 152, "k153": 153, "k154": 154, "k155": 155, "k156": 156, "k157": 157, "k158": 158, "k159": 159, "k160": 160, "k161": 161, "k162": 162, "k163": 163, "k164": 164, "k165": 165, "k166": 166, "k167": 167, "k168": 168, "k169": 169, "k170": 170, "k171": 171, "k172": 172, "k173": 173, "k174": 174, "k175": 175, "k176": 176, "k177": 177, "k178": 178, "k179": 179, "k180": 180, "k181": 181, "k182": 182, "k183": 183, "k184": 184, "k185": 185, "k186": 186, "k187": 187, "k188": 188, "k189": 189, "k190": 190, "k191": 191, "k192": 192, "k193": 193, "k194": 194, "k195": 195, "k196": 196, "k197": 197, "k198": 198, "k199": 199, "k200": 200, "k201": 201, "k202": 202, "k203": 203, "k204": 204, "k205": 205, "k206": 206, "k207": 207, "k208": 208, "k209": 209, "k210": 210, "k211": 211, "k212": 212, "k213": 213, "k214": 214, "k215": 215, "k216": 216, "k217": 217, "k218": 218, "k219": 219, "k220": 220, "k221": 221, "k222": 222, "k223": 223, "k224": 224, "k225": 225, "k226": 226, "k227": 227, "k228": 228, "k229": 229, "k230": 230, "k231": 231, "k232": 232, "k233": 233, "k234": 234, "k235": 235, "k236": 236, "k237": 237, "k238": 238, "k239": 239, "k240": 240, "k241": 241, "k242": 242, "k243": 243, "k244": 244, "k245": 245, "k246": 246, "k247": 247, "k248": 248, "k249": 249, "k250": 250, "k251": 251, "k252": 252, "k253": 253, "k254": 254, "k255": 255, "k256": 256, "k257": 257, "k258": 258, "k259": 259, "k260": 260, "k261": 261, "k262": 262, "k263": 263, "k264": 264, "k265": 265, "k266": 266, "k267": 267, "k268": 268, "k269": 269, "k270": 270, "k271": 271, "k272": 272, "k273": 273, "k274": 274, "k275": 275, "k276": 276, "k277": 277, "k278": 278, "k279": 279, "k280": 280, "k281": 281, "k282": 282, "k283": 283, "k284": 284, "k285": 285, "k286": 286, "k287": 287, "k288": 288, "k289": 289, "k290": 290, "k291": 291, "k292": 292, "k293": 293, "k294": 294, "k295": 295, "k296": 296, "k297": 297, "k298": 298, "k299": 299, "k300": 300, "k301": 301, "k302": 302, "k303": 303, "k304": 304, "k305": 305, "k306": 306, "k307": 307, "k308": 308, "k309": 309, "k310": 310, "k311": 311, "k312": 312, "k313": 313, "k314": 314, "k315": 315, "k316": 316, "k317": 317, "k318": 318, "k319": 319, "k320": 320, "k321": 321, "k322": 322, "k323": 323, "k324": 324, "k325": 325, "k326": 326, "k327": 327, "k328": 328, "k329": 329, "k330": 330, "k331": 331, "k332": 332, "k333": 333, "k334": 334, "k335": 335, "k336": 336, "k337": 337, "k338": 338, "k339": 339, "k340": 340, "k341": 341, "k342": 342, "k343": 343, "k344": 344, "k345": 345, "k346": 346, "k347": 347, "k348": 348, "k349": 349, "k350": 350, "k351": 351, "k352": 352, "k353": 353, "k354": 354, "k355": 355, "k356": 356, "k357": 357, "k358": 358, "k359": 359, "k360": 360, "k361": 361, "k362": 362, "k363": 363, "k364": 364, "k365": 365, "k366": 366, "k367": 367, "k368": 368, "k369": 369, "k370": 370, "k371": 371, "k372": 372, "k373": 373, "k374": 374, "k375": 375, "k376": 376, "k377": 377, "k378": 378, "k379": 379, "k380": 380, "k381": 381, "k382": 382, "k383": 383, "k384": 384, "k385": 385, "k386": 386, "k387": 387, "k388": 388, "k389": 389, "k390": 390, "k391": 391, "k392": 392, "k393": 393, "k394": 394, "k395": 395, "k396": 396, "k397": 397, "k398": 398, "k399": 399, "k400": 400, "k401": 401, "k402": 402, "k403": 403, "k404": 404, "k405": 405, "k406": 406, "k407": 407, "k408": 408, "k409": 409, "k410": 410, "k411": 411, "k412": 412, "k413": 413, "k414": 414, "k415": 415, "k416": 416, "k417": 417, "k418": 418, "k419": 419, "k420": 420, "k421": 421, "k422": 422, "k423": 423, "k424": 424, "k425": 425, "k426": 426, "k427": 427, "k428": 428, "k429": 429, "k430": 430, "k431": 431, "k432": 432, "k433": 433, "k434": 434, "k435": 435, "k436": 436, "k437": 437, "k438": 438, "k439": 439, "k440": 440, "k441": 441, "k442": 442, "k443": 443, "k444": 444, "k445": 445, "k446": 446, "k447": 447, "k448": 448, "k449": 449, "k450": 450, "k451": 451, "k452": 452, "k453": 453, "k454": 454, "k455": 455, "k456": 456, "k457": 457, "k458": 458, "k459": 459, "k460": 460, "k461": 461, "k462": 462, "k463": 463, "k464": 464, "k465": 465, "k466": 466, "k467": 467, "k468": 468, "k469": 469, "k470": 470, "k471": 471, "k472": 472, "k473": 473, "k474": 474, "k475": 475, "k476": 476, "k477": 477, "k478": 478, "k479": 479, "k480": 480, "k481": 481, "k482": 482, "k483": 483, "k484": 484, "k485": 485, "k486": 486, "k487": 487, "k488": 488, "k489": 489, "k490": 490, "k491": 491, "k492": 492, "k493": 493, "k494": 494, "k495": 495, "k496": 496, "k497": 497, "k498": 498, "k499": 499 }
diff --git a/gnu/packages/patches/json-c-CVE-2020-12762.patch b/gnu/packages/patches/json-c-CVE-2020-12762.patch
new file mode 100644
index 0000000000..80daa475e9
--- /dev/null
+++ b/gnu/packages/patches/json-c-CVE-2020-12762.patch
@@ -0,0 +1,193 @@
+https://github.com/json-c/json-c/pull/608
+https://github.com/json-c/json-c/commit/5d6fa331418d49f1bd488553fd1cfa9ab023fabb.patch
+
+From 5d6fa331418d49f1bd488553fd1cfa9ab023fabb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
+Date: Thu, 14 May 2020 12:32:30 +0200
+Subject: [PATCH] Fix CVE-2020-12762.
+
+This commit is a squashed backport of the following commits
+on the master branch:
+
+ * 099016b7e8d70a6d5dd814e788bba08d33d48426
+ * 77d935b7ae7871a1940cd827e850e6063044ec45
+ * d07b91014986900a3a75f306d302e13e005e9d67
+ * 519dfe1591d85432986f9762d41d1a883198c157
+ * a59d5acfab4485d5133114df61785b1fc633e0c6
+ * 26f080997d41cfdb17beab65e90c82217d0ac43b
+---
+ arraylist.c | 3 +++
+ linkhash.c | 9 ++++++++-
+ printbuf.c | 18 ++++++++++++++++--
+ tests/test4.c | 29 +++++++++++++++++++++++++++++
+ tests/test4.expected | 1 +
+ 5 files changed, 57 insertions(+), 3 deletions(-)
+
+diff --git a/arraylist.c b/arraylist.c
+index 12ad8af6d3..e5524aca75 100644
+--- a/arraylist.c
++++ b/arraylist.c
+@@ -136,6 +136,9 @@ int array_list_del_idx(struct array_list *arr, size_t idx, size_t count)
+ {
+ size_t i, stop;
+
++ /* Avoid overflow in calculation with large indices. */
++ if (idx > SIZE_T_MAX - count)
++ return -1;
+ stop = idx + count;
+ if (idx >= arr->length || stop > arr->length)
+ return -1;
+diff --git a/linkhash.c b/linkhash.c
+index 7ea58c0abf..b021ef10b0 100644
+--- a/linkhash.c
++++ b/linkhash.c
+@@ -12,6 +12,7 @@
+
+ #include "config.h"
+
++#include <assert.h>
+ #include <limits.h>
+ #include <stdarg.h>
+ #include <stddef.h>
+@@ -499,6 +500,8 @@ struct lh_table *lh_table_new(int size, lh_entry_free_fn *free_fn, lh_hash_fn *h
+ int i;
+ struct lh_table *t;
+
++ /* Allocate space for elements to avoid divisions by zero. */
++ assert(size > 0);
+ t = (struct lh_table *)calloc(1, sizeof(struct lh_table));
+ if (!t)
+ return NULL;
+@@ -578,8 +581,12 @@ int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, con
+ unsigned long n;
+
+ if (t->count >= t->size * LH_LOAD_FACTOR)
+- if (lh_table_resize(t, t->size * 2) != 0)
++ {
++ /* Avoid signed integer overflow with large tables. */
++ int new_size = (t->size > INT_MAX / 2) ? INT_MAX : (t->size * 2);
++ if (t->size == INT_MAX || lh_table_resize(t, new_size) != 0)
+ return -1;
++ }
+
+ n = h % t->size;
+
+diff --git a/printbuf.c b/printbuf.c
+index 976c12dde5..f9b15b1191 100644
+--- a/printbuf.c
++++ b/printbuf.c
+@@ -15,6 +15,7 @@
+
+ #include "config.h"
+
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -66,9 +67,16 @@ static int printbuf_extend(struct printbuf *p, int min_size)
+ if (p->size >= min_size)
+ return 0;
+
+- new_size = p->size * 2;
+- if (new_size < min_size + 8)
++ /* Prevent signed integer overflows with large buffers. */
++ if (min_size > INT_MAX - 8)
++ return -1;
++ if (p->size > INT_MAX / 2)
+ new_size = min_size + 8;
++ else {
++ new_size = p->size * 2;
++ if (new_size < min_size + 8)
++ new_size = min_size + 8;
++ }
+ #ifdef PRINTBUF_DEBUG
+ MC_DEBUG("printbuf_memappend: realloc "
+ "bpos=%d min_size=%d old_size=%d new_size=%d\n",
+@@ -83,6 +91,9 @@ static int printbuf_extend(struct printbuf *p, int min_size)
+
+ int printbuf_memappend(struct printbuf *p, const char *buf, int size)
+ {
++ /* Prevent signed integer overflows with large buffers. */
++ if (size > INT_MAX - p->bpos - 1)
++ return -1;
+ if (p->size <= p->bpos + size + 1)
+ {
+ if (printbuf_extend(p, p->bpos + size + 1) < 0)
+@@ -100,6 +111,9 @@ int printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len)
+
+ if (offset == -1)
+ offset = pb->bpos;
++ /* Prevent signed integer overflows with large buffers. */
++ if (len > INT_MAX - offset)
++ return -1;
+ size_needed = offset + len;
+ if (pb->size < size_needed)
+ {
+diff --git a/tests/test4.c b/tests/test4.c
+index bd964ec789..288cec1792 100644
+--- a/tests/test4.c
++++ b/tests/test4.c
+@@ -3,12 +3,15 @@
+ */
+
+ #include "config.h"
++#include <assert.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+
+ #include "json_inttypes.h"
+ #include "json_object.h"
+ #include "json_tokener.h"
++#include "snprintf_compat.h"
+
+ void print_hex(const char *s)
+ {
+@@ -24,6 +27,29 @@ void print_hex(const char *s)
+ putchar('\n');
+ }
+
++static void test_lot_of_adds(void);
++static void test_lot_of_adds()
++{
++ int ii;
++ char key[50];
++ json_object *jobj = json_object_new_object();
++ assert(jobj != NULL);
++ for (ii = 0; ii < 500; ii++)
++ {
++ snprintf(key, sizeof(key), "k%d", ii);
++ json_object *iobj = json_object_new_int(ii);
++ assert(iobj != NULL);
++ if (json_object_object_add(jobj, key, iobj))
++ {
++ fprintf(stderr, "FAILED to add object #%d\n", ii);
++ abort();
++ }
++ }
++ printf("%s\n", json_object_to_json_string(jobj));
++ assert(json_object_object_length(jobj) == 500);
++ json_object_put(jobj);
++}
++
+ int main(void)
+ {
+ const char *input = "\"\\ud840\\udd26,\\ud840\\udd27,\\ud800\\udd26,\\ud800\\udd27\"";
+@@ -52,5 +78,8 @@ int main(void)
+ retval = 1;
+ }
+ json_object_put(parse_result);
++
++ test_lot_of_adds();
++
+ return retval;
+ }
+diff --git a/tests/test4.expected b/tests/test4.expected
+index 68d4336d90..cb2744012b 100644
+--- a/tests/test4.expected
++++ b/tests/test4.expected
+@@ -1,3 +1,4 @@
+ input: "\ud840\udd26,\ud840\udd27,\ud800\udd26,\ud800\udd27"
+ JSON parse result is correct: 𠄦,𠄧,𐄦,𐄧
+ PASS
++{ "k0": 0, "k1": 1, "k2": 2, "k3": 3, "k4": 4, "k5": 5, "k6": 6, "k7": 7, "k8": 8, "k9": 9, "k10": 10, "k11": 11, "k12": 12, "k13": 13, "k14": 14, "k15": 15, "k16": 16, "k17": 17, "k18": 18, "k19": 19, "k20": 20, "k21": 21, "k22": 22, "k23": 23, "k24": 24, "k25": 25, "k26": 26, "k27": 27, "k28": 28, "k29": 29, "k30": 30, "k31": 31, "k32": 32, "k33": 33, "k34": 34, "k35": 35, "k36": 36, "k37": 37, "k38": 38, "k39": 39, "k40": 40, "k41": 41, "k42": 42, "k43": 43, "k44": 44, "k45": 45, "k46": 46, "k47": 47, "k48": 48, "k49": 49, "k50": 50, "k51": 51, "k52": 52, "k53": 53, "k54": 54, "k55": 55, "k56": 56, "k57": 57, "k58": 58, "k59": 59, "k60": 60, "k61": 61, "k62": 62, "k63": 63, "k64": 64, "k65": 65, "k66": 66, "k67": 67, "k68": 68, "k69": 69, "k70": 70, "k71": 71, "k72": 72, "k73": 73, "k74": 74, "k75": 75, "k76": 76, "k77": 77, "k78": 78, "k79": 79, "k80": 80, "k81": 81, "k82": 82, "k83": 83, "k84": 84, "k85": 85, "k86": 86, "k87": 87, "k88": 88, "k89": 89, "k90": 90, "k91": 91, "k92": 92, "k93": 93, "k94": 94, "k95": 95, "k96": 96, "k97": 97, "k98": 98, "k99": 99, "k100": 100, "k101": 101, "k102": 102, "k103": 103, "k104": 104, "k105": 105, "k106": 106, "k107": 107, "k108": 108, "k109": 109, "k110": 110, "k111": 111, "k112": 112, "k113": 113, "k114": 114, "k115": 115, "k116": 116, "k117": 117, "k118": 118, "k119": 119, "k120": 120, "k121": 121, "k122": 122, "k123": 123, "k124": 124, "k125": 125, "k126": 126, "k127": 127, "k128": 128, "k129": 129, "k130": 130, "k131": 131, "k132": 132, "k133": 133, "k134": 134, "k135": 135, "k136": 136, "k137": 137, "k138": 138, "k139": 139, "k140": 140, "k141": 141, "k142": 142, "k143": 143, "k144": 144, "k145": 145, "k146": 146, "k147": 147, "k148": 148, "k149": 149, "k150": 150, "k151": 151, "k152": 152, "k153": 153, "k154": 154, "k155": 155, "k156": 156, "k157": 157, "k158": 158, "k159": 159, "k160": 160, "k161": 161, "k162": 162, "k163": 163, "k164": 164, "k165": 165, "k166": 166, "k167": 167, "k168": 168, "k169": 169, "k170": 170, "k171": 171, "k172": 172, "k173": 173, "k174": 174, "k175": 175, "k176": 176, "k177": 177, "k178": 178, "k179": 179, "k180": 180, "k181": 181, "k182": 182, "k183": 183, "k184": 184, "k185": 185, "k186": 186, "k187": 187, "k188": 188, "k189": 189, "k190": 190, "k191": 191, "k192": 192, "k193": 193, "k194": 194, "k195": 195, "k196": 196, "k197": 197, "k198": 198, "k199": 199, "k200": 200, "k201": 201, "k202": 202, "k203": 203, "k204": 204, "k205": 205, "k206": 206, "k207": 207, "k208": 208, "k209": 209, "k210": 210, "k211": 211, "k212": 212, "k213": 213, "k214": 214, "k215": 215, "k216": 216, "k217": 217, "k218": 218, "k219": 219, "k220": 220, "k221": 221, "k222": 222, "k223": 223, "k224": 224, "k225": 225, "k226": 226, "k227": 227, "k228": 228, "k229": 229, "k230": 230, "k231": 231, "k232": 232, "k233": 233, "k234": 234, "k235": 235, "k236": 236, "k237": 237, "k238": 238, "k239": 239, "k240": 240, "k241": 241, "k242": 242, "k243": 243, "k244": 244, "k245": 245, "k246": 246, "k247": 247, "k248": 248, "k249": 249, "k250": 250, "k251": 251, "k252": 252, "k253": 253, "k254": 254, "k255": 255, "k256": 256, "k257": 257, "k258": 258, "k259": 259, "k260": 260, "k261": 261, "k262": 262, "k263": 263, "k264": 264, "k265": 265, "k266": 266, "k267": 267, "k268": 268, "k269": 269, "k270": 270, "k271": 271, "k272": 272, "k273": 273, "k274": 274, "k275": 275, "k276": 276, "k277": 277, "k278": 278, "k279": 279, "k280": 280, "k281": 281, "k282": 282, "k283": 283, "k284": 284, "k285": 285, "k286": 286, "k287": 287, "k288": 288, "k289": 289, "k290": 290, "k291": 291, "k292": 292, "k293": 293, "k294": 294, "k295": 295, "k296": 296, "k297": 297, "k298": 298, "k299": 299, "k300": 300, "k301": 301, "k302": 302, "k303": 303, "k304": 304, "k305": 305, "k306": 306, "k307": 307, "k308": 308, "k309": 309, "k310": 310, "k311": 311, "k312": 312, "k313": 313, "k314": 314, "k315": 315, "k316": 316, "k317": 317, "k318": 318, "k319": 319, "k320": 320, "k321": 321, "k322": 322, "k323": 323, "k324": 324, "k325": 325, "k326": 326, "k327": 327, "k328": 328, "k329": 329, "k330": 330, "k331": 331, "k332": 332, "k333": 333, "k334": 334, "k335": 335, "k336": 336, "k337": 337, "k338": 338, "k339": 339, "k340": 340, "k341": 341, "k342": 342, "k343": 343, "k344": 344, "k345": 345, "k346": 346, "k347": 347, "k348": 348, "k349": 349, "k350": 350, "k351": 351, "k352": 352, "k353": 353, "k354": 354, "k355": 355, "k356": 356, "k357": 357, "k358": 358, "k359": 359, "k360": 360, "k361": 361, "k362": 362, "k363": 363, "k364": 364, "k365": 365, "k366": 366, "k367": 367, "k368": 368, "k369": 369, "k370": 370, "k371": 371, "k372": 372, "k373": 373, "k374": 374, "k375": 375, "k376": 376, "k377": 377, "k378": 378, "k379": 379, "k380": 380, "k381": 381, "k382": 382, "k383": 383, "k384": 384, "k385": 385, "k386": 386, "k387": 387, "k388": 388, "k389": 389, "k390": 390, "k391": 391, "k392": 392, "k393": 393, "k394": 394, "k395": 395, "k396": 396, "k397": 397, "k398": 398, "k399": 399, "k400": 400, "k401": 401, "k402": 402, "k403": 403, "k404": 404, "k405": 405, "k406": 406, "k407": 407, "k408": 408, "k409": 409, "k410": 410, "k411": 411, "k412": 412, "k413": 413, "k414": 414, "k415": 415, "k416": 416, "k417": 417, "k418": 418, "k419": 419, "k420": 420, "k421": 421, "k422": 422, "k423": 423, "k424": 424, "k425": 425, "k426": 426, "k427": 427, "k428": 428, "k429": 429, "k430": 430, "k431": 431, "k432": 432, "k433": 433, "k434": 434, "k435": 435, "k436": 436, "k437": 437, "k438": 438, "k439": 439, "k440": 440, "k441": 441, "k442": 442, "k443": 443, "k444": 444, "k445": 445, "k446": 446, "k447": 447, "k448": 448, "k449": 449, "k450": 450, "k451": 451, "k452": 452, "k453": 453, "k454": 454, "k455": 455, "k456": 456, "k457": 457, "k458": 458, "k459": 459, "k460": 460, "k461": 461, "k462": 462, "k463": 463, "k464": 464, "k465": 465, "k466": 466, "k467": 467, "k468": 468, "k469": 469, "k470": 470, "k471": 471, "k472": 472, "k473": 473, "k474": 474, "k475": 475, "k476": 476, "k477": 477, "k478": 478, "k479": 479, "k480": 480, "k481": 481, "k482": 482, "k483": 483, "k484": 484, "k485": 485, "k486": 486, "k487": 487, "k488": 488, "k489": 489, "k490": 490, "k491": 491, "k492": 492, "k493": 493, "k494": 494, "k495": 495, "k496": 496, "k497": 497, "k498": 498, "k499": 499 }
diff --git a/gnu/packages/patches/ldns-drill-examples.patch b/gnu/packages/patches/ldns-drill-examples.patch
new file mode 100644
index 0000000000..f85e14cebe
--- /dev/null
+++ b/gnu/packages/patches/ldns-drill-examples.patch
@@ -0,0 +1,85 @@
+From 68916cd7ffb49ece9126d13ef984595595a156c4 Mon Sep 17 00:00:00 2001
+From: Raghav Gururajan <raghavgururajan@disroot.org>
+Date: Wed, 29 Jul 2020 12:32:48 -0400
+Subject: [PATCH] [PATCH]: Split installation of drill and examples.
+
+---
+ Makefile.in | 38 +++++++++++++++++++++-----------------
+ 1 file changed, 21 insertions(+), 17 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 442067de..9d2d5f4d 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -14,6 +14,10 @@ libdir = @libdir@
+ includedir = @includedir@
+ sysconfdir = @sysconfdir@
+ doxygen = @doxygen@
++drillbindir = @drillbindir@
++drillmandir = @drillmandir@
++examplesbindir = @examplesbindir@
++examplesmandir = @examplesmandir@
+ pywrapdir = $(srcdir)/contrib/python
+ pyldnsxwrapdir = $(srcdir)/contrib/ldnsx
+ p5_dns_ldns_dir = $(srcdir)/contrib/DNS-LDNS
+@@ -154,16 +158,16 @@ drill/drill.1: $(srcdir)/drill/drill.1.in
+ $(edit) $(srcdir)/drill/drill.1.in > drill/drill.1
+
+ install-drill: drill/drill drill/drill.1
+- $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
+- $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
+- $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
+- $(LIBTOOL) --mode=install cp drill/drill $(DESTDIR)$(bindir)
+- $(INSTALL) -m 644 drill/drill.1 $(DESTDIR)$(mandir)/man1/drill.1
++ $(INSTALL) -m 755 -d $(drillbindir)
++ $(INSTALL) -m 755 -d $(drillmandir)
++ $(INSTALL) -m 755 -d $(drillmandir)/man1
++ $(LIBTOOL) --mode=install cp drill/drill $(drillbindir)
++ $(INSTALL) -m 644 drill/drill.1 $(drillmandir)/man1/drill.1
+
+ uninstall-drill:
+- rm -f $(DESTDIR)$(bindir)/drill $(DESTDIR)$(mandir)/man1/drill.1
+- test ! -d $(DESTDIR)$(mandir) || rmdir -p $(DESTDIR)$(mandir)/man1 || :;
+- test ! -d $(DESTDIR)$(bindir) || rmdir -p $(DESTDIR)$(bindir) || : ;
++ rm -f $(drillbindir)/drill $(drillmandir)/man1/drill.1
++ test ! -d $(drillmandir) || rmdir -p $(drillmandir)/man1 || :;
++ test ! -d $(drillbindir) || rmdir -p $(drillbindir) || : ;
+
+ clean-drill:
+ $(LIBTOOL) --mode clean rm -f $(DRILL_LOBJS) drill/drill drill/drill.1
+@@ -202,23 +206,23 @@ examples/ldns-verify-zone.1: $(srcdir)/examples/ldns-verify-zone.1.in
+ $(edit) $(srcdir)/examples/ldns-verify-zone.1.in > examples/ldns-verify-zone.1
+
+ install-examples: $(EXAMPLE_PROGS) $(TESTNS) $(LDNS_DPA) $(LDNS_DANE) $(EX_SSL_PROGS) examples/ldns-dane.1 examples/ldns-verify-zone.1
+- $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
+- $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
+- $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
++ $(INSTALL) -m 755 -d $(examplesbindir)
++ $(INSTALL) -m 755 -d $(examplesmandir)
++ $(INSTALL) -m 755 -d $(examplesmandir)/man1
+ for p in $(EXAMPLE_PROGS) $(TESTNS) $(LDNS_DPA) $(LDNS_DANE) $(EX_SSL_PROGS) ; do \
+- $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(bindir) ; \
++ $(LIBTOOL) --mode=install cp $$p $(examplesbindir) ; \
+ if test -f $$p.1 ; \
+- then $(INSTALL) -m 644 $$p.1 $(DESTDIR)$(mandir)/man1 ; \
+- else $(INSTALL) -m 644 $(srcdir)/$$p.1 $(DESTDIR)$(mandir)/man1 ; \
++ then $(INSTALL) -m 644 $$p.1 $(examplesmandir)/man1 ; \
++ else $(INSTALL) -m 644 $(srcdir)/$$p.1 $(examplesmandir)/man1 ; \
+ fi ; \
+ done
+
+ uninstall-examples:
+ for p in $(EX_PROGS_BASENM) ; do \
+- rm -f $(DESTDIR)$(bindir)/$$p $(DESTDIR)$(mandir)/man1/$$p.1 ;\
++ rm -f $(examplesbindir)/$$p $(examplesmandir)/man1/$$p.1 ;\
+ done
+- test ! -d $(DESTDIR)$(mandir) || rmdir -p $(DESTDIR)$(mandir)/man1 || :;
+- test ! -d $(DESTDIR)$(bindir) || rmdir -p $(DESTDIR)$(bindir) || : ;
++ test ! -d $(examplesmandir) || rmdir -p $(examplesmandir)/man1 || :;
++ test ! -d $(examplesbindir) || rmdir -p $(examplesbindir) || : ;
+
+ clean-examples:
+ $(LIBTOOL) --mode clean rm -f $(EXAMPLE_PROGS)
+--
+2.27.0
+
diff --git a/gnu/packages/patches/lib2geom-enable-assertions.patch b/gnu/packages/patches/lib2geom-enable-assertions.patch
deleted file mode 100644
index 8feb44acbf..0000000000
--- a/gnu/packages/patches/lib2geom-enable-assertions.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 4aa78f52232682b353eb15c219171e466987bac7 Mon Sep 17 00:00:00 2001
-From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-Date: Thu, 16 Jan 2020 00:19:29 -0500
-Subject: [PATCH] build: Enable assertions for the RelWithDebugInfo build type.
-
-This fixes issue #5 (see:
-https://gitlab.com/inkscape/lib2geom/issues/5).
-
-* CMakeLists.txt: Remove the "-DNDEBUG" CXX flag from the default
-configuration for the RelWithDebugInfo build type.
----
- CMakeLists.txt | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index bfeb8f03..a663a1b0 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -19,6 +19,14 @@ enable_testing()
-
- include(CheckCXXSourceCompiles)
-
-+# Enable assertions for the RelWithDebugInfo build type. This is
-+# useful as some tests make use of it (see:
-+# https://gitlab.com/inkscape/lib2geom/issues/5).
-+if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
-+ string(REPLACE "-DNDEBUG" ""
-+ CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
-+endif()
-+
- # Find dependencies
- find_package(Boost 1.40 REQUIRED)
- find_package(DoubleConversion REQUIRED)
---
-2.24.1
-
diff --git a/gnu/packages/patches/lib2geom-fix-tests.patch b/gnu/packages/patches/lib2geom-fix-tests.patch
index 9118658e49..47e8f6e2ec 100644
--- a/gnu/packages/patches/lib2geom-fix-tests.patch
+++ b/gnu/packages/patches/lib2geom-fix-tests.patch
@@ -1,10 +1,10 @@
-From 488edbf84e918e0353e7a8f438abbf6eeca3767e Mon Sep 17 00:00:00 2001
+From 3e858cc87f2f8b7dc514a8ad7709c1f47f1f4cde Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 17 Jun 2020 23:20:53 -0400
Subject: [PATCH] tests: Fix tests on non-x86_64 platforms.
On platform other than x86_64 such as aarch64-linux or i686-linux,
-some double comparison would fail.
+some double comparisons would fail.
See <http://issues.guix.gnu.org/41827>.
@@ -14,6 +14,7 @@ EXPECT_near.
(Portion): Replace EXPECT_EQ by EXPECT_near.
* tests/ellipse-test.cpp (BezierIntersection): Lower error tolerance
from 6e-13 to 6e-12.
+(LineIntersection): Replace EXPECT_DOUBLE_EQ by EXPECT_NEAR.
* tests/line-test.cpp (Reflection): Replace EXPECT_FLOAT_EQ BY
EXPECT_near.
(Coefficients): Skip test.
@@ -21,13 +22,13 @@ EXPECT_near.
EXPECT_DOUBLE_EQ.
---
tests/bezier-test.cpp | 31 +++++++++++++++++--------------
- tests/ellipse-test.cpp | 2 +-
+ tests/ellipse-test.cpp | 11 ++++++-----
tests/line-test.cpp | 11 +++++++----
tests/parallelogram-test.cpp | 8 ++++----
- 4 files changed, 29 insertions(+), 23 deletions(-)
+ 4 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/tests/bezier-test.cpp b/tests/bezier-test.cpp
-index 4054a65..46209f4 100644
+index 4054a654..46209f40 100644
--- a/tests/bezier-test.cpp
+++ b/tests/bezier-test.cpp
@@ -152,11 +152,13 @@ TEST_F(BezierTest, Casteljau) {
@@ -104,10 +105,29 @@ index 4054a65..46209f4 100644
}
}
diff --git a/tests/ellipse-test.cpp b/tests/ellipse-test.cpp
-index 561c285..d6e65d8 100644
+index 561c285a..8e4de12c 100644
--- a/tests/ellipse-test.cpp
+++ b/tests/ellipse-test.cpp
-@@ -199,7 +199,7 @@ TEST(EllipseTest, BezierIntersection) {
+@@ -158,13 +158,14 @@ TEST(EllipseTest, LineIntersection) {
+ std::vector<ShapeIntersection> xs = e.intersect(l);
+
+ ASSERT_EQ(xs.size(), 2ul);
+- EXPECT_FLOAT_EQ(xs[0].point()[X], 0);
+- EXPECT_FLOAT_EQ(xs[0].point()[Y], -2);
+- EXPECT_FLOAT_EQ(xs[1].point()[X], 9./5);
+- EXPECT_FLOAT_EQ(xs[1].point()[Y], 8./5);
+
+ // due to numeric imprecision when evaluating Ellipse,
+ // the points may deviate by around 2e-16
++ EXPECT_NEAR(xs[0].point()[X], 0, 1e-15);
++ EXPECT_NEAR(xs[0].point()[Y], -2, 1e-15);
++ EXPECT_NEAR(xs[1].point()[X], 9./5, 1e-15);
++ EXPECT_NEAR(xs[1].point()[Y], 8./5, 1e-15);
++
+ EXPECT_intersections_valid(e, l, xs, 1e-15);
+ }
+
+@@ -199,7 +200,7 @@ TEST(EllipseTest, BezierIntersection) {
std::vector<ShapeIntersection> xs = e.intersect(b);
EXPECT_EQ(xs.size(), 2ul);
@@ -117,7 +137,7 @@ index 561c285..d6e65d8 100644
TEST(EllipseTest, Coefficients) {
diff --git a/tests/line-test.cpp b/tests/line-test.cpp
-index 99546dd..2399130 100644
+index 99546ddc..23991300 100644
--- a/tests/line-test.cpp
+++ b/tests/line-test.cpp
@@ -91,10 +91,12 @@ TEST(LineTest, Reflection) {
@@ -146,7 +166,7 @@ index 99546dd..2399130 100644
lines.push_back(Line(Point(1e9,1e9), Point(1,1)));
//the case below will never work without normalizing the line
diff --git a/tests/parallelogram-test.cpp b/tests/parallelogram-test.cpp
-index 8109ead..70ccea1 100644
+index 8109eadd..70ccea13 100644
--- a/tests/parallelogram-test.cpp
+++ b/tests/parallelogram-test.cpp
@@ -106,13 +106,13 @@ TEST(ParallelogramTest, area)
@@ -168,5 +188,5 @@ index 8109ead..70ccea1 100644
class ParallelogramTest
--
-2.26.2
+2.27.0
diff --git a/gnu/packages/patches/libextractor-exiv2.patch b/gnu/packages/patches/libextractor-exiv2.patch
deleted file mode 100644
index b92fef3ca1..0000000000
--- a/gnu/packages/patches/libextractor-exiv2.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-This patch allows us to build libextractor against exiv2 0.27.x.
-Adapted from this upstream commit:
-
- commit 1ecee9a47717e36cb8a3925d011d1a6de11d631c
- Author: Christian Grothoff <christian@grothoff.org>
- Date: Mon Jul 29 17:58:18 2019 +0200
-
- importing patch from Gentoo/AS to address exiv2 build issue (#5820)
-
-diff --git a/src/plugins/exiv2_extractor.cc b/src/plugins/exiv2_extractor.cc
-index 8741d40..ef402a8 100644
---- a/src/plugins/exiv2_extractor.cc
-+++ b/src/plugins/exiv2_extractor.cc
-@@ -27,10 +27,7 @@
- #include <cassert>
- #include <cstring>
- #include <math.h>
--#include <exiv2/exif.hpp>
--#include <exiv2/error.hpp>
--#include <exiv2/image.hpp>
--#include <exiv2/futils.hpp>
-+#include <exiv2/exiv2.hpp>
-
- /**
- * Enable debugging to get error messages.
-@@ -180,7 +177,7 @@ public:
- *
- * @return -1 on error
- */
--#if EXIV2_VERSION >= EXIV2_MAKE_VERSION(0,26,0)
-+#if EXIV2_TEST_VERSION(0,26,0)
- virtual size_t size (void) const;
- #else
- virtual long int size (void) const;
-@@ -316,7 +313,11 @@ ExtractorIO::getb ()
- const unsigned char *r;
-
- if (1 != ec->read (ec->cls, &data, 1))
-+#if EXIV2_TEST_VERSION(0,27,0)
-+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
-+#else
- throw Exiv2::BasicError<char> (42 /* error code */);
-+#endif
- r = (const unsigned char *) data;
- return *r;
- }
-@@ -371,7 +372,11 @@ ExtractorIO::putb (Exiv2::byte data)
- void
- ExtractorIO::transfer (Exiv2::BasicIo& src)
- {
-+#if EXIV2_TEST_VERSION(0,27,0)
-+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
-+#else
- throw Exiv2::BasicError<char> (42 /* error code */);
-+#endif
- }
-
-
-@@ -416,7 +421,11 @@ ExtractorIO::seek (long offset,
- Exiv2::byte *
- ExtractorIO::mmap (bool isWritable)
- {
-+#if EXIV2_TEST_VERSION(0,27,0)
-+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
-+#else
- throw Exiv2::BasicError<char> (42 /* error code */);
-+#endif
- }
-
-
-@@ -449,7 +458,7 @@ ExtractorIO::tell (void) const
- *
- * @return -1 on error
- */
--#if EXIV2_VERSION >= EXIV2_MAKE_VERSION(0,26,0)
-+#if EXIV2_TEST_VERSION(0,26,0)
- size_t
- #else
- long int
-@@ -504,7 +513,11 @@ ExtractorIO::eof () const
- std::string
- ExtractorIO::path () const
- {
-+#if EXIV2_TEST_VERSION(0,27,0)
-+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
-+#else
- throw Exiv2::BasicError<char> (42 /* error code */);
-+#endif
- }
-
-
-@@ -517,7 +530,11 @@ ExtractorIO::path () const
- std::wstring
- ExtractorIO::wpath () const
- {
-+#if EXIV2_TEST_VERSION(0,27,0)
-+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
-+#else
- throw Exiv2::BasicError<char> (42 /* error code */);
-+#endif
- }
- #endif
-
-@@ -531,7 +548,11 @@ Exiv2::BasicIo::AutoPtr
- ExtractorIO::temporary () const
- {
- fprintf (stderr, "throwing temporary error\n");
-+#if EXIV2_TEST_VERSION(0,27,0)
-+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
-+#else
- throw Exiv2::BasicError<char> (42 /* error code */);
-+#endif
- }
-
-
-@@ -697,7 +718,7 @@ EXTRACTOR_exiv2_extract_method (struct EXTRACTOR_ExtractContext *ec)
- {
- try
- {
--#if EXIV2_MAKE_VERSION(0,23,0) <= EXIV2_VERSION
-+#if !EXIV2_TEST_VERSION(0,24,0)
- Exiv2::LogMsg::setLevel (Exiv2::LogMsg::mute);
- #endif
- std::auto_ptr<Exiv2::BasicIo> eio(new ExtractorIO (ec));
diff --git a/gnu/packages/patches/liblouisutdml-fix-tests.patch b/gnu/packages/patches/liblouisutdml-fix-tests.patch
new file mode 100644
index 0000000000..08d3db2c21
--- /dev/null
+++ b/gnu/packages/patches/liblouisutdml-fix-tests.patch
@@ -0,0 +1,33 @@
+From 52d44cdbc307d4e2ffc3ebe674745eb9d43ec337 Mon Sep 17 00:00:00 2001
+From: Christian Egli <christian.egli@sbs.ch>
+Date: Mon, 10 Aug 2020 16:08:17 +0200
+Subject: [PATCH] Some math over and under tests now actually pass
+
+with the newest liblouis
+---
+ tests/Makefile.am | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 157b005..932a5d0 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -321,10 +321,6 @@ XFAIL_TESTS += \
+ mathml_nemeth/mover_06.test \
+ mathml_nemeth/mover_07.test \
+ mathml_nemeth/mover_08.test \
+- mathml_nemeth/mover_09.test \
+- mathml_nemeth/mover_10.test \
+- mathml_nemeth/mover_11.test \
+- mathml_nemeth/mover_12.test \
+ mathml_nemeth/mover_13.test \
+ mathml_nemeth/mover_14.test \
+ mathml_nemeth/mover_15.test \
+@@ -332,7 +328,6 @@ XFAIL_TESTS += \
+ mathml_nemeth/munder_01.test \
+ mathml_nemeth/munder_02.test \
+ mathml_nemeth/munder_03.test \
+- mathml_nemeth/munder_04.test \
+ mathml_nemeth/munder_05.test \
+ mathml_nemeth/munder_06.test \
+ mathml_nemeth/munder_07.test \
diff --git a/gnu/packages/patches/libmhash-hmac-fix-uaf.patch b/gnu/packages/patches/libmhash-hmac-fix-uaf.patch
new file mode 100644
index 0000000000..76f937f4f6
--- /dev/null
+++ b/gnu/packages/patches/libmhash-hmac-fix-uaf.patch
@@ -0,0 +1,22 @@
+--- mhash-0.9.9.9/src/hmac_test.c 2020-08-20 14:53:06.628995733 -0500
++++ mhash-0.9.9.9/src/hmac_test.c 2020-08-20 14:53:39.424885862 -0500
+@@ -72,8 +72,6 @@
+ return(MUTILS_INVALID_RESULT);
+ }
+
+- mutils_free(tmp);
+-
+ /* Test No 2 */
+
+ mutils_memset(tmp, 0, sizeof(tmp));
+--- mhash-0.9.9.9/src/keygen_test.c 2020-08-20 14:53:12.940974589 -0500
++++ mhash-0.9.9.9/src/keygen_test.c 2020-08-20 14:53:59.736817812 -0500
+@@ -94,8 +94,6 @@
+ return(MUTILS_INVALID_RESULT);
+ }
+
+- mutils_free(tmp);
+-
+ passlen = sizeof(PASSWORD2);
+ password = (mutils_word8 *) mutils_malloc(passlen + 1);
+ mutils_strncpy(password, (mutils_word8 *) PASSWORD2, passlen);
diff --git a/gnu/packages/patches/libofa-curl.diff b/gnu/packages/patches/libofa-curl.diff
new file mode 100644
index 0000000000..6b1e824fad
--- /dev/null
+++ b/gnu/packages/patches/libofa-curl.diff
@@ -0,0 +1,15 @@
+Description: Fix FTBFS due to unexisting and useless include. (Closes: #637896)
+Author: Regis Boudin <regis@debian.org>
+Last-Update: 2011-10-03
+Index: libofa-0.9.3/examples/protocol.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/protocol.cpp
++++ libofa-0.9.3/examples/protocol.cpp
+@@ -13,7 +13,6 @@
+ #include <map>
+ #include <expat.h>
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+
+ using namespace std;
diff --git a/gnu/packages/patches/libofa-ftbfs-1.diff b/gnu/packages/patches/libofa-ftbfs-1.diff
new file mode 100644
index 0000000000..4aa712320c
--- /dev/null
+++ b/gnu/packages/patches/libofa-ftbfs-1.diff
@@ -0,0 +1,45 @@
+Description: fix FTBFS with GCC 4.3. (Closes: #417355)
+Author: Martin Michlmayr <tbm@cyrius.com>
+Last-Update: 2007-04-02
+
+Description: add a missing include. (Closes: #441557)
+Author: Brian M. Carlson <sandals@crustytoothpaste.ath.cx>
+Last-Update: 2007-12-29
+
+Index: libofa-0.9.3/lib/signal_op.cpp
+===================================================================
+--- libofa-0.9.3.orig/lib/signal_op.cpp
++++ libofa-0.9.3/lib/signal_op.cpp
+@@ -12,6 +12,7 @@
+ // DATE CREATED: 1/12/06
+
+
++#include <cstdlib>
+ #include <math.h>
+ #include "signal_op.h"
+ #include "AFLIB/aflibConverter.h"
+Index: libofa-0.9.3/examples/example.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/example.cpp
++++ libofa-0.9.3/examples/example.cpp
+@@ -8,6 +8,8 @@
+ -------------------------------------------------------------------*/
+
+ #include "protocol.h"
++#include <cctype>
++#include <string.h>
+
+ AudioData* loadWaveFile(char *file);
+ AudioData* loadDataUsingLAME(char *file);
+Index: libofa-0.9.3/examples/protocol.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/protocol.cpp
++++ libofa-0.9.3/examples/protocol.cpp
+@@ -8,6 +8,7 @@
+ -------------------------------------------------------------------*/
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <cstring>
+ #include <string>
+ #include <map>
+ #include <expat.h>
diff --git a/gnu/packages/patches/libofa-ftbfs-2.diff b/gnu/packages/patches/libofa-ftbfs-2.diff
new file mode 100644
index 0000000000..ad61573578
--- /dev/null
+++ b/gnu/packages/patches/libofa-ftbfs-2.diff
@@ -0,0 +1,27 @@
+Description: ftbfs with GCC-4.7. (Closes: #667250)
+Author: Matthias Klose <doko@debian.org>
+Last-Update: 2012-04-17
+Index: libofa-0.9.3/examples/uselame.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/uselame.cpp
++++ libofa-0.9.3/examples/uselame.cpp
+@@ -11,6 +11,7 @@
+ #include "windows.h"
+ #else
+ #include <sys/wait.h>
++#include <unistd.h>
+ #endif
+
+ AudioData *loadWaveFile(char *file);
+Index: libofa-0.9.3/examples/wavefile.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/wavefile.cpp
++++ libofa-0.9.3/examples/wavefile.cpp
+@@ -11,6 +11,7 @@
+ #include "io.h"
+ #endif
+ #include <fcntl.h>
++#include <unistd.h>
+
+ static bool readBytes(int fd, unsigned char *buf, int size) {
+ int ct = 0;
diff --git a/gnu/packages/patches/libquicktime-ffmpeg.patch b/gnu/packages/patches/libquicktime-ffmpeg.patch
new file mode 100644
index 0000000000..48c595fba9
--- /dev/null
+++ b/gnu/packages/patches/libquicktime-ffmpeg.patch
@@ -0,0 +1,1309 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2018-05-12
+Initial Package Version: 1.2.4
+Upstream Status: Defunct
+Origin: Gentoo
+Description: Accumulated fixes up to and including building with ffmpeg-4
+
+From gentoo, their libav-9.patch, ffmpeg2.patch, CVE-2016-2399.patch,
+ffmpeg29.patch, ffmpeg4.patch, and seds to files lqt_ffmpeg.c, video.c,
+audio.c in plugins/ffmpeg/ to change CODEC_ID to AV_CODEC_ID.
+
+Build-tested only.
+
+diff -Naur a/plugins/ffmpeg/audio.c b/plugins/ffmpeg/audio.c
+--- a/plugins/ffmpeg/audio.c 2012-03-29 20:44:28.000000000 +0100
++++ b/plugins/ffmpeg/audio.c 2018-05-11 23:15:21.057985300 +0100
+@@ -45,6 +45,11 @@
+ #define ENCODE_AUDIO 1
+ #endif
+
++#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
++/* from libavcodec/avcodec.h dated Dec 23 2012 */
++#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
++#endif
++
+ /* The following code was ported from gmerlin_avdecoder (http://gmerlin.sourceforge.net) */
+
+ /* MPEG Audio header parsing code */
+@@ -540,7 +545,7 @@
+
+ #if DECODE_AUDIO3 || DECODE_AUDIO4
+ codec->pkt.data = codec->chunk_buffer;
+- codec->pkt.size = packet_size + FF_INPUT_BUFFER_PADDING_SIZE;
++ codec->pkt.size = packet_size + AV_INPUT_BUFFER_PADDING_SIZE;
+
+ #if DECODE_AUDIO4
+ frame_bytes = avcodec_decode_audio4(codec->avctx, &f,
+@@ -578,7 +583,7 @@
+ (codec->sample_buffer_end - codec->sample_buffer_start)],
+ &bytes_decoded,
+ codec->chunk_buffer,
+- packet_size + FF_INPUT_BUFFER_PADDING_SIZE);
++ packet_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if(frame_bytes < 0)
+ {
+ lqt_log(file, LQT_LOG_ERROR, LOG_DOMAIN, "avcodec_decode_audio2 error");
+@@ -626,7 +631,7 @@
+ {
+ /* If the codec is mp3, make sure to decode the very last frame */
+
+- if((codec->avctx->codec_id == CODEC_ID_MP3) &&
++ if((codec->avctx->codec_id == AV_CODEC_ID_MP3) &&
+ (codec->bytes_in_chunk_buffer >= 4))
+ {
+ if(!mpa_decode_header(&mph, codec->chunk_buffer, (const mpa_header*)0))
+@@ -640,13 +645,13 @@
+ return 0;
+ }
+
+- if(codec->chunk_buffer_alloc < mph.frame_bytes + FF_INPUT_BUFFER_PADDING_SIZE)
++ if(codec->chunk_buffer_alloc < mph.frame_bytes + AV_INPUT_BUFFER_PADDING_SIZE)
+ {
+- codec->chunk_buffer_alloc = mph.frame_bytes + FF_INPUT_BUFFER_PADDING_SIZE;
++ codec->chunk_buffer_alloc = mph.frame_bytes + AV_INPUT_BUFFER_PADDING_SIZE;
+ codec->chunk_buffer = realloc(codec->chunk_buffer, codec->chunk_buffer_alloc);
+ }
+ memset(codec->chunk_buffer + codec->bytes_in_chunk_buffer, 0,
+- mph.frame_bytes - codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE);
++ mph.frame_bytes - codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE);
+ num_samples = mph.samples_per_frame;
+ codec->bytes_in_chunk_buffer = mph.frame_bytes;
+ }
+@@ -690,12 +695,12 @@
+ {
+
+
+- /* BIG NOTE: We pass extra FF_INPUT_BUFFER_PADDING_SIZE for the buffer size
++ /* BIG NOTE: We pass extra AV_INPUT_BUFFER_PADDING_SIZE for the buffer size
+ because we know, that lqt_read_audio_chunk allocates 16 extra bytes for us */
+
+ /* Some really broken mp3 files have the header bytes split across 2 chunks */
+
+- if(codec->avctx->codec_id == CODEC_ID_MP3)
++ if(codec->avctx->codec_id == AV_CODEC_ID_MP3)
+ {
+ if(codec->bytes_in_chunk_buffer < 4)
+ {
+@@ -756,7 +761,7 @@
+
+ #if DECODE_AUDIO3 || DECODE_AUDIO4
+ codec->pkt.data = &codec->chunk_buffer[bytes_used];
+- codec->pkt.size = codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE;
++ codec->pkt.size = codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE;
+
+ #if DECODE_AUDIO4
+
+@@ -793,7 +798,7 @@
+ (codec->sample_buffer_end - codec->sample_buffer_start)],
+ &bytes_decoded,
+ &codec->chunk_buffer[bytes_used],
+- codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE);
++ codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE);
+ #endif
+ if(frame_bytes < 0)
+ {
+@@ -806,7 +811,7 @@
+
+ if(bytes_decoded < 0)
+ {
+- if(codec->avctx->codec_id == CODEC_ID_MP3)
++ if(codec->avctx->codec_id == AV_CODEC_ID_MP3)
+ {
+ /* For mp3, bytes_decoded < 0 means, that the frame should be muted */
+ memset(&codec->sample_buffer[track_map->channels * (codec->sample_buffer_end -
+@@ -833,7 +838,7 @@
+ }
+ }
+
+- /* This happens because ffmpeg adds FF_INPUT_BUFFER_PADDING_SIZE to the bytes returned */
++ /* This happens because ffmpeg adds AV_INPUT_BUFFER_PADDING_SIZE to the bytes returned */
+
+ if(codec->bytes_in_chunk_buffer < 0)
+ codec->bytes_in_chunk_buffer = 0;
+@@ -866,8 +871,8 @@
+ quicktime_audio_map_t *track_map = &file->atracks[track];
+ quicktime_ffmpeg_audio_codec_t *codec = track_map->codec->priv;
+
+- if((codec->decoder->id == CODEC_ID_MP2) ||
+- (codec->decoder->id == CODEC_ID_MP3))
++ if((codec->decoder->id == AV_CODEC_ID_MP2) ||
++ (codec->decoder->id == AV_CODEC_ID_MP3))
+ {
+ mpa_header h;
+ uint32_t header;
+@@ -909,7 +914,7 @@
+ else
+ track_map->ci.bitrate = h.bitrate;
+ }
+- else if(codec->decoder->id == CODEC_ID_AC3)
++ else if(codec->decoder->id == AV_CODEC_ID_AC3)
+ {
+ a52_header h;
+ uint8_t * ptr;
+@@ -986,7 +991,7 @@
+ #endif
+ /* Some codecs need extra stuff */
+
+- if(codec->decoder->id == CODEC_ID_ALAC)
++ if(codec->decoder->id == AV_CODEC_ID_ALAC)
+ {
+ header = quicktime_wave_get_user_atom(track_map->track, "alac", &header_len);
+ if(header)
+@@ -995,7 +1000,7 @@
+ codec->avctx->extradata_size = header_len;
+ }
+ }
+- if(codec->decoder->id == CODEC_ID_QDM2)
++ if(codec->decoder->id == AV_CODEC_ID_QDM2)
+ {
+ header = quicktime_wave_get_user_atom(track_map->track, "QDCA", &header_len);
+ if(header)
+@@ -1261,7 +1266,7 @@
+ pkt.data = codec->chunk_buffer;
+ pkt.size = codec->chunk_buffer_alloc;
+
+- avcodec_get_frame_defaults(&f);
++ av_frame_unref(&f);
+ f.nb_samples = codec->avctx->frame_size;
+
+ avcodec_fill_audio_frame(&f, channels, codec->avctx->sample_fmt,
+@@ -1495,9 +1500,9 @@
+ codec_base->decode_audio = lqt_ffmpeg_decode_audio;
+ codec_base->set_parameter = set_parameter;
+
+- if((decoder->id == CODEC_ID_MP3) || (decoder->id == CODEC_ID_MP2))
++ if((decoder->id == AV_CODEC_ID_MP3) || (decoder->id == AV_CODEC_ID_MP2))
+ codec_base->read_packet = read_packet_mpa;
+- else if(decoder->id == CODEC_ID_AC3)
++ else if(decoder->id == AV_CODEC_ID_AC3)
+ {
+ codec_base->write_packet = write_packet_ac3;
+ codec_base->read_packet = read_packet_ac3;
+diff -Naur a/plugins/ffmpeg/ffmpeg.h b/plugins/ffmpeg/ffmpeg.h
+--- a/plugins/ffmpeg/ffmpeg.h 2012-02-15 19:48:30.000000000 +0000
++++ b/plugins/ffmpeg/ffmpeg.h 2018-05-11 23:10:24.204992468 +0100
+@@ -27,6 +27,7 @@
+
+ #include <quicktime/qtprivate.h>
+ #include AVCODEC_HEADER
++#include <libavutil/mem.h>
+
+ void quicktime_init_video_codec_ffmpeg(quicktime_codec_t * codec,
+ quicktime_video_map_t *vtrack,
+diff -Naur a/plugins/ffmpeg/lqt_ffmpeg.c b/plugins/ffmpeg/lqt_ffmpeg.c
+--- a/plugins/ffmpeg/lqt_ffmpeg.c 2012-02-15 19:48:30.000000000 +0000
++++ b/plugins/ffmpeg/lqt_ffmpeg.c 2018-05-11 23:15:07.583985628 +0100
+@@ -386,7 +386,7 @@
+ struct CODECIDMAP codecidmap_v[] =
+ {
+ {
+- .id = CODEC_ID_MPEG1VIDEO,
++ .id = AV_CODEC_ID_MPEG1VIDEO,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -397,7 +397,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE }
+ },
+ {
+- .id = CODEC_ID_MPEG4,
++ .id = AV_CODEC_ID_MPEG4,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -415,7 +415,7 @@
+ .compression_id = LQT_COMPRESSION_MPEG4_ASP,
+ },
+ {
+- .id = CODEC_ID_MSMPEG4V1,
++ .id = AV_CODEC_ID_MSMPEG4V1,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -426,7 +426,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_MSMPEG4V2,
++ .id = AV_CODEC_ID_MSMPEG4V2,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -437,7 +437,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_MSMPEG4V3,
++ .id = AV_CODEC_ID_MSMPEG4V3,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -453,7 +453,7 @@
+ .do_encode = 1,
+ },
+ {
+- .id = CODEC_ID_MSMPEG4V3,
++ .id = AV_CODEC_ID_MSMPEG4V3,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -468,7 +468,7 @@
+ },
+ #if 0
+ {
+- .id = CODEC_ID_WMV1,
++ .id = AV_CODEC_ID_WMV1,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -481,7 +481,7 @@
+ },
+ #endif
+ {
+- .id = CODEC_ID_H263,
++ .id = AV_CODEC_ID_H263,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -493,7 +493,7 @@
+ .compatibility_flags = LQT_FILE_QT_OLD | LQT_FILE_QT | LQT_FILE_MP4 | LQT_FILE_3GP,
+ },
+ {
+- .id = CODEC_ID_H263,
++ .id = AV_CODEC_ID_H263,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -508,7 +508,7 @@
+ .do_encode = 1,
+ },
+ {
+- .id = CODEC_ID_H264,
++ .id = AV_CODEC_ID_H264,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -519,7 +519,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_H263P,
++ .id = AV_CODEC_ID_H263P,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -533,7 +533,7 @@
+ .do_encode = 1,
+ },
+ {
+- .id = CODEC_ID_H263I,
++ .id = AV_CODEC_ID_H263I,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -544,7 +544,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_SVQ1,
++ .id = AV_CODEC_ID_SVQ1,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -555,7 +555,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_SVQ3,
++ .id = AV_CODEC_ID_SVQ3,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -566,7 +566,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_MJPEG,
++ .id = AV_CODEC_ID_MJPEG,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -580,7 +580,7 @@
+ .do_encode = 1,
+ },
+ {
+- .id = CODEC_ID_MJPEGB,
++ .id = AV_CODEC_ID_MJPEGB,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -594,7 +594,7 @@
+ },
+ #if LIBAVCODEC_BUILD >= 3346688
+ {
+- .id = CODEC_ID_TARGA,
++ .id = AV_CODEC_ID_TARGA,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -606,7 +606,7 @@
+ #endif
+ #if LIBAVCODEC_BUILD >= 3347456
+ {
+- .id = CODEC_ID_TIFF,
++ .id = AV_CODEC_ID_TIFF,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -617,7 +617,7 @@
+ },
+ #endif
+ {
+- .id = CODEC_ID_8BPS,
++ .id = AV_CODEC_ID_8BPS,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -627,7 +627,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_INDEO3,
++ .id = AV_CODEC_ID_INDEO3,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -638,7 +638,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_RPZA,
++ .id = AV_CODEC_ID_RPZA,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -648,7 +648,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_SMC,
++ .id = AV_CODEC_ID_SMC,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -658,7 +658,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_CINEPAK,
++ .id = AV_CODEC_ID_CINEPAK,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -669,7 +669,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_CYUV,
++ .id = AV_CODEC_ID_CYUV,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -680,7 +680,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_QTRLE,
++ .id = AV_CODEC_ID_QTRLE,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -693,7 +693,7 @@
+ .encoding_colormodels = (int[]){ BC_RGB888, BC_RGBA8888, LQT_COLORMODEL_NONE },
+ },
+ {
+- .id = CODEC_ID_MSRLE,
++ .id = AV_CODEC_ID_MSRLE,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -703,7 +703,7 @@
+ .wav_ids = { LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_DVVIDEO,
++ .id = AV_CODEC_ID_DVVIDEO,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -719,7 +719,7 @@
+ .image_sizes = image_sizes_dv,
+ },
+ {
+- .id = CODEC_ID_DVVIDEO,
++ .id = AV_CODEC_ID_DVVIDEO,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -735,7 +735,7 @@
+ .image_sizes = image_sizes_dv,
+ },
+ {
+- .id = CODEC_ID_DVVIDEO,
++ .id = AV_CODEC_ID_DVVIDEO,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -751,7 +751,7 @@
+ },
+ /* DVCPRO HD (decoding only for now) */
+ {
+- .id = CODEC_ID_DVVIDEO,
++ .id = AV_CODEC_ID_DVVIDEO,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -772,7 +772,7 @@
+ // .do_encode = 1
+ },
+ {
+- .id = CODEC_ID_FFVHUFF,
++ .id = AV_CODEC_ID_FFVHUFF,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -785,7 +785,7 @@
+ .do_encode = 1
+ },
+ {
+- .id = CODEC_ID_FFV1,
++ .id = AV_CODEC_ID_FFV1,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -801,7 +801,7 @@
+ },
+ #if LIBAVCODEC_BUILD >= 3352576
+ {
+- .id = CODEC_ID_DNXHD,
++ .id = AV_CODEC_ID_DNXHD,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -817,7 +817,7 @@
+ },
+ #endif
+ {
+- .id = CODEC_ID_MPEG2VIDEO,
++ .id = AV_CODEC_ID_MPEG2VIDEO,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -839,7 +839,7 @@
+ struct CODECIDMAP codecidmap_a[] =
+ {
+ {
+- .id = CODEC_ID_MP3,
++ .id = AV_CODEC_ID_MP3,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -851,7 +851,7 @@
+ .wav_ids = { 0x50, 0x55, LQT_WAV_ID_NONE },
+ },
+ {
+- .id = CODEC_ID_MP2,
++ .id = AV_CODEC_ID_MP2,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -866,7 +866,7 @@
+ .compression_id = LQT_COMPRESSION_MP2,
+ },
+ {
+- .id = CODEC_ID_AC3,
++ .id = AV_CODEC_ID_AC3,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -881,7 +881,7 @@
+ .compression_id = LQT_COMPRESSION_AC3,
+ },
+ {
+- .id = CODEC_ID_QDM2,
++ .id = AV_CODEC_ID_QDM2,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -896,7 +896,7 @@
+ #if 1
+ /* Doesn't work as long as audio chunks are not split into VBR "Samples" */
+ {
+- .id = CODEC_ID_ALAC,
++ .id = AV_CODEC_ID_ALAC,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -909,7 +909,7 @@
+ #if 1
+ /* Sounds ugly */
+ {
+- .id = CODEC_ID_ADPCM_MS,
++ .id = AV_CODEC_ID_ADPCM_MS,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+@@ -922,7 +922,7 @@
+ #if 1
+ /* Sounds ugly */
+ {
+- .id = CODEC_ID_ADPCM_IMA_WAV,
++ .id = AV_CODEC_ID_ADPCM_IMA_WAV,
+ .index = -1,
+ .encoder = NULL,
+ .decoder = NULL,
+diff -Naur a/plugins/ffmpeg/params.c b/plugins/ffmpeg/params.c
+--- a/plugins/ffmpeg/params.c 2012-03-07 14:10:41.000000000 +0000
++++ b/plugins/ffmpeg/params.c 2018-05-11 23:11:59.803990160 +0100
+@@ -101,6 +101,17 @@
+ } \
+ }
+
++#define PARAM_DICT_INT(name, dict_name) \
++ { \
++ if(!strcasecmp(name, key)) \
++ { \
++ char buf[128]; \
++ snprintf(buf, sizeof(buf), "%d", *(int*)value); \
++ av_dict_set(options, dict_name, buf, 0); \
++ found = 1; \
++ } \
++ }
++
+ #define PARAM_DICT_FLAG(name, dict_name) \
+ { \
+ if(!strcasecmp(name, key)) \
+@@ -113,16 +124,6 @@
+ }
+
+
+-enum_t me_method[] =
+- {
+- { "Zero", ME_ZERO },
+- { "Phods", ME_PHODS },
+- { "Log", ME_LOG },
+- { "X1", ME_X1 },
+- { "Epzs", ME_EPZS },
+- { "Full", ME_FULL }
+- };
+-
+ enum_t prediction_method[] =
+ {
+ { "Left", FF_PRED_LEFT },
+@@ -152,15 +153,6 @@
+ { "Rate distoration", FF_MB_DECISION_RD }
+ };
+
+-enum_t coder_type[] =
+- {
+- { "VLC", FF_CODER_TYPE_VLC },
+- { "Arithmetic", FF_CODER_TYPE_AC },
+- { "Raw", FF_CODER_TYPE_RAW },
+- { "RLE", FF_CODER_TYPE_RLE },
+- { "Deflate", FF_CODER_TYPE_DEFLATE },
+- };
+-
+ #define PARAM_ENUM(name, var, arr) \
+ if(!strcasecmp(key, name)) \
+ { \
+@@ -192,7 +184,7 @@
+ PARAM_INT_SCALE("ff_bit_rate_audio",bit_rate,1000);
+ PARAM_INT_SCALE("ff_bit_rate_video",bit_rate,1000);
+ PARAM_INT_SCALE("ff_bit_rate_tolerance",bit_rate_tolerance,1000);
+- PARAM_ENUM("ff_me_method",me_method,me_method);
++ PARAM_DICT_INT("ff_me_method","motion-est");
+ PARAM_INT("ff_gop_size",gop_size);
+ PARAM_FLOAT("ff_qcompress",qcompress);
+ PARAM_FLOAT("ff_qblur",qblur);
+@@ -202,17 +194,23 @@
+ PARAM_INT("ff_max_b_frames",max_b_frames);
+ PARAM_FLOAT("ff_b_quant_factor",b_quant_factor);
+ PARAM_INT("ff_b_frame_strategy",b_frame_strategy);
++
++#if LIBAVCODEC_VERSION_MAJOR >= 55
++ PARAM_DICT_INT("ff_luma_elim_threshold","luma_elim_threshold");
++ PARAM_DICT_INT("ff_chroma_elim_threshold","chroma_elim_threshold");
++#else
+ PARAM_INT("ff_luma_elim_threshold",luma_elim_threshold);
+ PARAM_INT("ff_chroma_elim_threshold",chroma_elim_threshold);
++#endif
++
+ PARAM_INT("ff_strict_std_compliance",strict_std_compliance);
+ PARAM_QP2LAMBDA("ff_b_quant_offset",b_quant_offset);
+ PARAM_INT("ff_rc_min_rate",rc_min_rate);
+ PARAM_INT("ff_rc_max_rate",rc_max_rate);
+ PARAM_INT_SCALE("ff_rc_buffer_size",rc_buffer_size,1000);
+- PARAM_FLOAT("ff_rc_buffer_aggressivity",rc_buffer_aggressivity);
+ PARAM_FLOAT("ff_i_quant_factor",i_quant_factor);
+ PARAM_QP2LAMBDA("ff_i_quant_offset",i_quant_offset);
+- PARAM_FLOAT("ff_rc_initial_cplx",rc_initial_cplx);
++ PARAM_DICT_INT("ff_rc_initial_cplx","rc_init_cplx");
+ PARAM_FLOAT("ff_lumi_masking",lumi_masking);
+ PARAM_FLOAT("ff_temporal_cplx_masking",temporal_cplx_masking);
+ PARAM_FLOAT("ff_spatial_cplx_masking",spatial_cplx_masking);
+@@ -237,58 +235,68 @@
+ PARAM_INT("ff_me_range",me_range);
+ PARAM_ENUM("ff_mb_decision",mb_decision,mb_decision);
+ PARAM_INT("ff_scenechange_threshold",scenechange_threshold);
+- PARAM_QP2LAMBDA("ff_lmin", lmin);
+- PARAM_QP2LAMBDA("ff_lmax", lmax);
++ PARAM_DICT_INT("ff_lmin", "lmin");
++ PARAM_DICT_INT("ff_lmax", "lmax");
+ PARAM_INT("ff_noise_reduction",noise_reduction);
+ PARAM_INT_SCALE("ff_rc_initial_buffer_occupancy",rc_initial_buffer_occupancy,1000);
++
++#if LIBAVCODEC_VERSION_MAJOR >= 55
++ PARAM_DICT_INT("ff_inter_threshold","inter_threshold");
++ PARAM_DICT_INT("ff_quantizer_noise_shaping","quantizer_noise_shaping");
++#else
+ PARAM_INT("ff_inter_threshold",inter_threshold);
+ PARAM_INT("ff_quantizer_noise_shaping",quantizer_noise_shaping);
++#endif
++
+ PARAM_INT("ff_thread_count",thread_count);
+- PARAM_INT("ff_me_threshold",me_threshold);
+- PARAM_INT("ff_mb_threshold",mb_threshold);
+ PARAM_INT("ff_nsse_weight",nsse_weight);
+- PARAM_FLOAT("ff_border_masking",border_masking);
++ PARAM_DICT_INT("ff_border_masking","border_mask");
+ PARAM_QP2LAMBDA("ff_mb_lmin", mb_lmin);
+ PARAM_QP2LAMBDA("ff_mb_lmax", mb_lmax);
+ PARAM_INT("ff_me_penalty_compensation",me_penalty_compensation);
+ PARAM_INT("ff_bidir_refine",bidir_refine);
+ PARAM_INT("ff_brd_scale",brd_scale);
+- PARAM_INT("ff_scenechange_factor",scenechange_factor);
+- PARAM_FLAG("ff_flag_qscale",CODEC_FLAG_QSCALE);
+- PARAM_FLAG("ff_flag_4mv",CODEC_FLAG_4MV);
+- PARAM_FLAG("ff_flag_qpel",CODEC_FLAG_QPEL);
+- PARAM_FLAG("ff_flag_gmc",CODEC_FLAG_GMC);
+- PARAM_FLAG("ff_flag_mv0",CODEC_FLAG_MV0);
++ PARAM_FLAG("ff_flag_qscale",AV_CODEC_FLAG_QSCALE);
++ PARAM_FLAG("ff_flag_4mv",AV_CODEC_FLAG_4MV);
++ PARAM_FLAG("ff_flag_qpel",AV_CODEC_FLAG_QPEL);
++ PARAM_DICT_FLAG("ff_flag_gmc","gmc");
++ PARAM_DICT_FLAG("ff_flag_mv0","mpv_flags");
+ // PARAM_FLAG("ff_flag_part",CODEC_FLAG_PART); // Unused
+- PARAM_FLAG("ff_flag_gray",CODEC_FLAG_GRAY);
+- PARAM_FLAG("ff_flag_emu_edge",CODEC_FLAG_EMU_EDGE);
+- PARAM_FLAG("ff_flag_normalize_aqp",CODEC_FLAG_NORMALIZE_AQP);
++ PARAM_FLAG("ff_flag_gray",AV_CODEC_FLAG_GRAY);
++ PARAM_DICT_FLAG("ff_flag_normalize_aqp","naq");
+ // PARAM_FLAG("ff_flag_alt_scan",CODEC_FLAG_ALT_SCAN); // Unused
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ PARAM_FLAG("ff_flag_trellis_quant",CODEC_FLAG_TRELLIS_QUANT);
+ #else
+ PARAM_INT("ff_trellis",trellis);
+ #endif
+- PARAM_FLAG("ff_flag_bitexact",CODEC_FLAG_BITEXACT);
+- PARAM_FLAG("ff_flag_ac_pred",CODEC_FLAG_AC_PRED);
++ PARAM_FLAG("ff_flag_bitexact",AV_CODEC_FLAG_BITEXACT);
++ PARAM_FLAG("ff_flag_ac_pred",AV_CODEC_FLAG_AC_PRED);
+ // PARAM_FLAG("ff_flag_h263p_umv",CODEC_FLAG_H263P_UMV); // Unused
+- PARAM_FLAG("ff_flag_cbp_rd",CODEC_FLAG_CBP_RD);
+- PARAM_FLAG("ff_flag_qp_rd",CODEC_FLAG_QP_RD);
++
++#if LIBAVCODEC_VERSION_MAJOR >= 55
++ PARAM_DICT_FLAG("ff_flag_cbp_rd","cbp_rd");
++ PARAM_DICT_FLAG("ff_flag_qp_rd","qp_rd");
++ PARAM_DICT_FLAG("ff_flag2_strict_gop","strict_gop");
++#else
++ PARAM_FLAG("ff_flag_cbp_rd",AV_CODEC_FLAG_CBP_RD);
++ PARAM_FLAG("ff_flag_qp_rd",AV_CODEC_FLAG_QP_RD);
++ PARAM_FLAG2("ff_flag2_strict_gop",AV_CODEC_FLAG2_STRICT_GOP);
++#endif
+
+ #if LIBAVCODEC_VERSION_MAJOR >= 54
+ PARAM_DICT_FLAG("ff_flag_h263p_aiv", "aiv");
+ PARAM_DICT_FLAG("ff_flag_obmc","obmc");
+ PARAM_DICT_FLAG("ff_flag_h263p_slice_struct","structured_slices");
+ #else
+- PARAM_FLAG("ff_flag_h263p_aiv",CODEC_FLAG_H263P_AIV);
+- PARAM_FLAG("ff_flag_obmc",CODEC_FLAG_OBMC);
+- PARAM_FLAG("ff_flag_h263p_slice_struct",CODEC_FLAG_H263P_SLICE_STRUCT);
++ PARAM_FLAG("ff_flag_h263p_aiv",AV_CODEC_FLAG_H263P_AIV);
++ PARAM_FLAG("ff_flag_obmc",AV_CODEC_FLAG_OBMC);
++ PARAM_FLAG("ff_flag_h263p_slice_struct",AV_CODEC_FLAG_H263P_SLICE_STRUCT);
+ #endif
+
+- PARAM_FLAG("ff_flag_loop_filter",CODEC_FLAG_LOOP_FILTER);
+- PARAM_FLAG("ff_flag_closed_gop",CODEC_FLAG_CLOSED_GOP);
+- PARAM_FLAG2("ff_flag2_fast",CODEC_FLAG2_FAST);
+- PARAM_FLAG2("ff_flag2_strict_gop",CODEC_FLAG2_STRICT_GOP);
+- PARAM_ENUM("ff_coder_type",coder_type,coder_type);
++ PARAM_FLAG("ff_flag_loop_filter",AV_CODEC_FLAG_LOOP_FILTER);
++ PARAM_FLAG("ff_flag_closed_gop",AV_CODEC_FLAG_CLOSED_GOP);
++ PARAM_FLAG2("ff_flag2_fast",AV_CODEC_FLAG2_FAST);
++ PARAM_DICT_INT("ff_coder_type","coder");
+
+ }
+diff -Naur a/plugins/ffmpeg/params.h b/plugins/ffmpeg/params.h
+--- a/plugins/ffmpeg/params.h 2011-05-11 16:13:39.000000000 +0100
++++ b/plugins/ffmpeg/params.h 2018-05-11 23:11:59.803990160 +0100
+@@ -149,7 +149,7 @@
+ .type = LQT_PARAMETER_INT, \
+ .val_default = { .val_int = 0 }, \
+ .val_min = { .val_int = 0 }, \
+- .val_max = { .val_int = FF_MAX_B_FRAMES }, \
++ .val_max = { .val_int = 16 }, \
+ .help_string = TRS("Maximum number of B-frames between non B-frames") \
+ }
+
+diff -Naur a/plugins/ffmpeg/video.c b/plugins/ffmpeg/video.c
+--- a/plugins/ffmpeg/video.c 2012-02-25 19:46:56.000000000 +0000
++++ b/plugins/ffmpeg/video.c 2018-05-11 23:15:15.697985432 +0100
+@@ -37,10 +37,10 @@
+ #endif
+
+
+-#ifdef PIX_FMT_YUV422P10
+-#define PIX_FMT_YUV422P10_OR_DUMMY PIX_FMT_YUV422P10
++#ifdef AV_PIX_FMT_YUV422P10
++#define AV_PIX_FMT_YUV422P10_OR_DUMMY AV_PIX_FMT_YUV422P10
+ #else
+-#define PIX_FMT_YUV422P10_OR_DUMMY -1234
++#define AV_PIX_FMT_YUV422P10_OR_DUMMY -1234
+ #endif
+
+ #if LIBAVCODEC_VERSION_INT >= ((54<<16)|(1<<8)|0)
+@@ -90,9 +90,9 @@
+ int imx_bitrate;
+ int imx_strip_vbi;
+
+- /* In some cases FFMpeg would report something like PIX_FMT_YUV422P, while
+- we would like to treat it as PIX_FMT_YUVJ422P. It's only used for decoding */
+- enum PixelFormat reinterpret_pix_fmt;
++ /* In some cases FFMpeg would report something like AV_PIX_FMT_YUV422P, while
++ we would like to treat it as AV_PIX_FMT_YUVJ422P. It's only used for decoding */
++ enum AVPixelFormat reinterpret_pix_fmt;
+
+ int is_imx;
+ int y_offset;
+@@ -137,42 +137,42 @@
+
+ static const struct
+ {
+- enum PixelFormat ffmpeg_id;
++ enum AVPixelFormat ffmpeg_id;
+ int lqt_id;
+ int exact;
+ }
+ colormodels[] =
+ {
+- { PIX_FMT_YUV420P, BC_YUV420P, 1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
++ { AV_PIX_FMT_YUV420P, BC_YUV420P, 1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+- { PIX_FMT_YUV422, BC_YUV422, 1 },
++ { AV_PIX_FMT_YUV422, BC_YUV422, 1 },
+ #else
+- { PIX_FMT_YUYV422, BC_YUV422, 1 },
++ { AV_PIX_FMT_YUYV422, BC_YUV422, 1 },
+ #endif
+- { PIX_FMT_RGB24, BC_RGB888, 1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
+- { PIX_FMT_BGR24, BC_BGR888, 1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
+- { PIX_FMT_YUV422P, BC_YUV422P, 1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
+- { PIX_FMT_YUV444P, BC_YUV444P, 1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
+- { PIX_FMT_YUV411P, BC_YUV411P, 1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
+- { PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
+-#ifdef PIX_FMT_YUV422P10
+- { PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2
+-#endif
+- { PIX_FMT_RGB565, BC_RGB565, 1 }, ///< always stored in cpu endianness
+- { PIX_FMT_YUVJ420P, BC_YUVJ420P, 1 }, ///< Planar YUV 4:2:0 full scale (jpeg)
+- { PIX_FMT_YUVJ422P, BC_YUVJ422P, 1 }, ///< Planar YUV 4:2:2 full scale (jpeg)
+- { PIX_FMT_YUVJ444P, BC_YUVJ444P, 1 }, ///< Planar YUV 4:4:4 full scale (jpeg)
++ { AV_PIX_FMT_RGB24, BC_RGB888, 1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
++ { AV_PIX_FMT_BGR24, BC_BGR888, 1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
++ { AV_PIX_FMT_YUV422P, BC_YUV422P, 1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
++ { AV_PIX_FMT_YUV444P, BC_YUV444P, 1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
++ { AV_PIX_FMT_YUV411P, BC_YUV411P, 1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
++ { AV_PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
++#ifdef AV_PIX_FMT_YUV422P10
++ { AV_PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2
++#endif
++ { AV_PIX_FMT_RGB565, BC_RGB565, 1 }, ///< always stored in cpu endianness
++ { AV_PIX_FMT_YUVJ420P, BC_YUVJ420P, 1 }, ///< Planar YUV 4:2:0 full scale (jpeg)
++ { AV_PIX_FMT_YUVJ422P, BC_YUVJ422P, 1 }, ///< Planar YUV 4:2:2 full scale (jpeg)
++ { AV_PIX_FMT_YUVJ444P, BC_YUVJ444P, 1 }, ///< Planar YUV 4:4:4 full scale (jpeg)
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+- { PIX_FMT_RGBA32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
++ { AV_PIX_FMT_RGBA32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
+ #else
+- { PIX_FMT_RGB32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
++ { AV_PIX_FMT_RGB32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
+ #endif
+- { PIX_FMT_RGB555, BC_RGB888, 0 }, ///< always stored in cpu endianness, most significant bit to 1
+- { PIX_FMT_GRAY8, BC_RGB888, 0 },
+- { PIX_FMT_MONOWHITE, BC_RGB888, 0 }, ///< 0 is white
+- { PIX_FMT_MONOBLACK, BC_RGB888, 0 }, ///< 0 is black
+- { PIX_FMT_PAL8, BC_RGB888, 0 }, ///< 8 bit with RGBA palette
+- { PIX_FMT_YUV410P, BC_YUV420P, 0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
++ { AV_PIX_FMT_RGB555, BC_RGB888, 0 }, ///< always stored in cpu endianness, most significant bit to 1
++ { AV_PIX_FMT_GRAY8, BC_RGB888, 0 },
++ { AV_PIX_FMT_MONOWHITE, BC_RGB888, 0 }, ///< 0 is white
++ { AV_PIX_FMT_MONOBLACK, BC_RGB888, 0 }, ///< 0 is black
++ { AV_PIX_FMT_PAL8, BC_RGB888, 0 }, ///< 8 bit with RGBA palette
++ { AV_PIX_FMT_YUV410P, BC_YUV420P, 0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
+ };
+
+ static const struct
+@@ -343,16 +343,16 @@
+ if (!codec->pix_fmts)
+ return 0;
+
+- for (i = 0; codec->pix_fmts[i] != PIX_FMT_NONE; ++i)
++ for (i = 0; codec->pix_fmts[i] != AV_PIX_FMT_NONE; ++i)
+ {
+- if (codec->pix_fmts[i] == PIX_FMT_YUV422P10_OR_DUMMY)
++ if (codec->pix_fmts[i] == AV_PIX_FMT_YUV422P10_OR_DUMMY)
+ return 1;
+ }
+
+ return 0;
+ }
+
+-static enum PixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id)
++static enum AVPixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id)
+ {
+ int i;
+
+@@ -361,10 +361,10 @@
+ if(colormodels[i].lqt_id == id)
+ return colormodels[i].ffmpeg_id;
+ }
+- return PIX_FMT_NB;
++ return AV_PIX_FMT_NB;
+ }
+
+-static int lqt_ffmpeg_get_lqt_colormodel(enum PixelFormat id, int * exact)
++static int lqt_ffmpeg_get_lqt_colormodel(enum AVPixelFormat id, int * exact)
+ {
+ int i;
+
+@@ -400,26 +400,26 @@
+ codec->reinterpret_pix_fmt = codec->avctx->pix_fmt;
+
+ /* First we try codec-specific colormodel matching. */
+- if(codec->decoder->id == CODEC_ID_DNXHD)
++ if(codec->decoder->id == AV_CODEC_ID_DNXHD)
+ {
+- /* FFMpeg supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10 for DNxHD, which
+- we sometimes interpret as PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10. */
+- if (codec->avctx->pix_fmt == PIX_FMT_YUV422P || codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY)
++ /* FFMpeg supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10 for DNxHD, which
++ we sometimes interpret as AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10. */
++ if (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P || codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY)
+ {
+- int p10 = (codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY);
++ int p10 = (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY);
+ *exact = 1;
+ if (lqt_ffmpeg_get_avid_yuv_range(vtrack->track) == AVID_FULL_YUV_RANGE)
+ {
+ vtrack->stream_cmodel = p10 ? BC_YUVJ422P10 : BC_YUVJ422P;
+- codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUVJ422P;
+- // Note: reinterpret_pix_fmt should really be PIX_FMT_YUVJ422P10, except
++ codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUVJ422P;
++ // Note: reinterpret_pix_fmt should really be AV_PIX_FMT_YUVJ422P10, except
+ // there is no such colormodel in FFMpeg. Fortunately, it's not a problem
+ // in this case, as reinterpret_pix_fmt is only used when *exact == 0.
+ }
+ else
+ {
+ vtrack->stream_cmodel = p10 ? BC_YUV422P10 : BC_YUV422P;
+- codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUV422P;
++ codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUV422P;
+ }
+ return;
+ }
+@@ -438,16 +438,16 @@
+ quicktime_ffmpeg_video_codec_t *codec = vtrack->codec->priv;
+ codec->avctx->pix_fmt = lqt_ffmpeg_get_ffmpeg_colormodel(vtrack->stream_cmodel);
+
+- if (codec->encoder->id == CODEC_ID_DNXHD)
++ if (codec->encoder->id == AV_CODEC_ID_DNXHD)
+ {
+- /* FFMpeg's DNxHD encoder only supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10
+- and doesn't know anything about PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10
++ /* FFMpeg's DNxHD encoder only supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10
++ and doesn't know anything about AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10
+ (in fact, the latter doesn't even exist) */
+- codec->avctx->pix_fmt = PIX_FMT_YUV422P;
++ codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ if (vtrack->stream_cmodel == BC_YUV422P10 || vtrack->stream_cmodel == BC_YUVJ422P10)
+ {
+ if (lqt_tenbit_dnxhd_supported(codec->encoder))
+- codec->avctx->pix_fmt = PIX_FMT_YUV422P10_OR_DUMMY;
++ codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P10_OR_DUMMY;
+ }
+ }
+ }
+@@ -458,7 +458,7 @@
+ /* From avcodec.h: */
+
+ /*
+- * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
++ * AV_PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
+ * color is put together as:
+ * (A << 24) | (R << 16) | (G << 8) | B
+ * This is stored as BGRA on little endian CPU architectures and ARGB on
+@@ -530,7 +530,7 @@
+ */
+
+ static void convert_image_decode(quicktime_ffmpeg_video_codec_t *codec,
+- AVFrame * in_frame, enum PixelFormat in_format,
++ AVFrame * in_frame, enum AVPixelFormat in_format,
+ unsigned char ** out_frame, int out_format,
+ int width, int height, int row_span, int row_span_uv)
+ {
+@@ -547,9 +547,9 @@
+ * RGBA format like in ffmpeg??
+ */
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+- if((in_format == PIX_FMT_RGBA32) && (out_format == BC_RGBA8888))
++ if((in_format == AV_PIX_FMT_RGBA32) && (out_format == BC_RGBA8888))
+ #else
+- if((in_format == PIX_FMT_RGB32) && (out_format == BC_RGBA8888))
++ if((in_format == AV_PIX_FMT_RGB32) && (out_format == BC_RGBA8888))
+ #endif
+ {
+ convert_image_decode_rgba(in_frame, out_frame, width, height, codec->y_offset);
+@@ -728,13 +728,13 @@
+
+ /* Set extradata: It's done differently for each codec */
+
+- if(codec->decoder->id == CODEC_ID_SVQ3)
++ if(codec->decoder->id == AV_CODEC_ID_SVQ3)
+ {
+ extradata = trak->mdia.minf.stbl.stsd.table[0].table_raw + 4;
+ extradata_size = trak->mdia.minf.stbl.stsd.table[0].table_raw_size - 4;
+
+ }
+- else if(codec->decoder->id == CODEC_ID_H264)
++ else if(codec->decoder->id == AV_CODEC_ID_H264)
+ {
+ user_atom = quicktime_stsd_get_user_atom(trak, "avcC", &user_atom_len);
+
+@@ -753,7 +753,7 @@
+ }
+
+ }
+- else if(codec->decoder->id == CODEC_ID_MPEG4)
++ else if(codec->decoder->id == AV_CODEC_ID_MPEG4)
+ {
+ if(trak->mdia.minf.stbl.stsd.table[0].has_esds)
+ {
+@@ -781,7 +781,7 @@
+ if(extradata)
+ {
+ codec->extradata =
+- calloc(1, extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
++ calloc(1, extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(codec->extradata, extradata, extradata_size);
+ codec->avctx->extradata_size = extradata_size;
+ codec->avctx->extradata = codec->extradata;
+@@ -829,7 +829,7 @@
+ if(avcodec_open2(codec->avctx, codec->decoder, NULL) != 0)
+ return -1;
+ #endif
+- codec->frame = avcodec_alloc_frame();
++ codec->frame = av_frame_alloc();
+ vtrack->stream_cmodel = LQT_COLORMODEL_NONE;
+ codec->initialized = 1;
+ }
+@@ -929,10 +929,10 @@
+ #ifdef HAVE_LIBSWSCALE
+
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+- if(!((codec->avctx->pix_fmt == PIX_FMT_RGBA32) &&
++ if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGBA32) &&
+ (vtrack->stream_cmodel == BC_RGBA8888)))
+ #else
+- if(!((codec->avctx->pix_fmt == PIX_FMT_RGB32) &&
++ if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGB32) &&
+ (vtrack->stream_cmodel == BC_RGBA8888)))
+ #endif
+ {
+@@ -947,15 +947,15 @@
+ }
+ #endif
+ }
+- if(codec->decoder->id == CODEC_ID_DVVIDEO)
++ if(codec->decoder->id == AV_CODEC_ID_DVVIDEO)
+ {
+ if(vtrack->stream_cmodel == BC_YUV420P)
+ vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_DVPAL;
+ vtrack->interlace_mode = LQT_INTERLACE_BOTTOM_FIRST;
+ vtrack->ci.id = LQT_COMPRESSION_DV;
+ }
+- else if((codec->decoder->id == CODEC_ID_MPEG4) ||
+- (codec->decoder->id == CODEC_ID_H264))
++ else if((codec->decoder->id == AV_CODEC_ID_MPEG4) ||
++ (codec->decoder->id == AV_CODEC_ID_H264))
+ {
+ if(vtrack->stream_cmodel == BC_YUV420P)
+ vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_MPEG2;
+@@ -1140,8 +1140,8 @@
+ codec->avctx->qmin = 1;
+ codec->avctx->qmax = 3;
+ codec->avctx->rtp_payload_size = 1; // ??
+- codec->avctx->rc_buffer_aggressivity = 0.25;
+- codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_LOW_DELAY;
++ av_dict_set(&codec->options, "rc_buf_aggressivity", "0.25", 0);
++ codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_LOW_DELAY;
+
+ #if (LIBAVCODEC_VERSION_MAJOR < 54)
+ codec->avctx->flags2 |= CODEC_FLAG2_INTRA_VLC|CODEC_FLAG2_NON_LINEAR_QUANT;
+@@ -1299,13 +1299,13 @@
+ {
+ if(vtrack->stream_cmodel == BC_YUV420P)
+ {
+- if(codec->encoder->id == CODEC_ID_MPEG4)
++ if(codec->encoder->id == AV_CODEC_ID_MPEG4)
+ {
+ vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_MPEG2;
+ /* enable interlaced encoding */
+ vtrack->interlace_mode = LQT_INTERLACE_NONE;
+ }
+- else if(codec->encoder->id == CODEC_ID_DVVIDEO)
++ else if(codec->encoder->id == AV_CODEC_ID_DVVIDEO)
+ {
+ vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_DVPAL;
+ }
+@@ -1318,7 +1318,7 @@
+
+ if(!codec->initialized)
+ {
+- codec->frame = avcodec_alloc_frame();
++ codec->frame = av_frame_alloc();
+
+ /* time_base is 1/framerate for constant framerate */
+
+@@ -1328,7 +1328,7 @@
+ // codec->avctx->time_base.den = 1;
+ // codec->avctx->time_base.num = lqt_video_time_scale(file, track);
+
+- if(codec->avctx->flags & CODEC_FLAG_QSCALE)
++ if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE)
+ codec->avctx->global_quality = codec->qscale;
+
+ codec->avctx->width = width;
+@@ -1340,11 +1340,11 @@
+ codec->avctx->sample_aspect_ratio.num = pixel_width;
+ codec->avctx->sample_aspect_ratio.den = pixel_height;
+ /* Use global headers for mp4v */
+- if(codec->encoder->id == CODEC_ID_MPEG4)
++ if(codec->encoder->id == AV_CODEC_ID_MPEG4)
+ {
+ if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML)))
+ {
+- codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
++ codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ codec->write_global_header = 1;
+ }
+
+@@ -1360,16 +1360,16 @@
+ {
+ lqt_log(file, LQT_LOG_INFO, LOG_DOMAIN, "Enabling interlaced encoding");
+ codec->avctx->flags |=
+- (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN);
++ (AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_INTERLACED_ME|AV_CODEC_FLAG_ALT_SCAN);
+ }
+ #endif
+ }
+- else if((codec->encoder->id == CODEC_ID_MSMPEG4V3) && (trak->strl) &&
++ else if((codec->encoder->id == AV_CODEC_ID_MSMPEG4V3) && (trak->strl) &&
+ !strncmp(trak->strl->strf.bh.biCompression, "DIV3", 4))
+ {
+ strncpy(trak->strl->strh.fccHandler, "div3", 4);
+ }
+- else if((codec->encoder->id == CODEC_ID_H263) &&
++ else if((codec->encoder->id == AV_CODEC_ID_H263) &&
+ (file->file_type & (LQT_FILE_MP4|LQT_FILE_3GP)))
+ {
+ uint8_t d263_data[] =
+@@ -1383,34 +1383,34 @@
+ strncpy(trak->mdia.minf.stbl.stsd.table[0].format,
+ "s263", 4);
+ }
+- else if(codec->encoder->id == CODEC_ID_FFVHUFF)
++ else if(codec->encoder->id == AV_CODEC_ID_FFVHUFF)
+ {
+ if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML)))
+ {
+- codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
++ codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ codec->write_global_header = 1;
+ }
+ }
+- else if(codec->encoder->id == CODEC_ID_QTRLE)
++ else if(codec->encoder->id == AV_CODEC_ID_QTRLE)
+ {
+ if(vtrack->stream_cmodel == BC_RGBA8888)
+ {
+ /* Libquicktime doesn't natively support a color model equivalent
+- to PIX_FMT_ARGB, which is required for QTRLE with alpha channel.
++ to AV_PIX_FMT_ARGB, which is required for QTRLE with alpha channel.
+ So, we use BC_RGBA8888 and do ad hoc conversion below. */
+- codec->avctx->pix_fmt = PIX_FMT_ARGB;
++ codec->avctx->pix_fmt = AV_PIX_FMT_ARGB;
+ vtrack->track->mdia.minf.stbl.stsd.table[0].depth = 32;
+ }
+ }
+- else if(codec->encoder->id == CODEC_ID_DVVIDEO)
++ else if(codec->encoder->id == AV_CODEC_ID_DVVIDEO)
+ {
+ set_dv_fourcc(width, height, vtrack->stream_cmodel, trak);
+ }
+- else if(codec->encoder->id == CODEC_ID_DNXHD)
++ else if(codec->encoder->id == AV_CODEC_ID_DNXHD)
+ {
+ if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
+ {
+- codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT;
++ codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
+ }
+ }
+ else if(codec->is_imx)
+@@ -1422,7 +1422,7 @@
+ if(codec->pass == 1)
+ {
+ codec->stats_file = fopen(codec->stats_filename, "w");
+- codec->avctx->flags |= CODEC_FLAG_PASS1;
++ codec->avctx->flags |= AV_CODEC_FLAG_PASS1;
+ }
+ else if(codec->pass == codec->total_passes)
+ {
+@@ -1438,7 +1438,7 @@
+ fclose(codec->stats_file);
+ codec->stats_file = (FILE*)0;
+
+- codec->avctx->flags |= CODEC_FLAG_PASS2;
++ codec->avctx->flags |= AV_CODEC_FLAG_PASS2;
+ }
+ }
+ /* Open codec */
+@@ -1467,7 +1467,7 @@
+ }
+ // codec->lqt_colormodel = ffmepg_2_lqt(codec->com.ffcodec_enc);
+
+- if(codec->y_offset != 0 || codec->avctx->pix_fmt == PIX_FMT_ARGB)
++ if(codec->y_offset != 0 || codec->avctx->pix_fmt == AV_PIX_FMT_ARGB)
+ {
+ if(!codec->tmp_rows)
+ {
+@@ -1492,7 +1492,7 @@
+ vtrack->stream_cmodel,
+ 0, 0, 0, codec->y_offset);
+ }
+- else if(codec->avctx->pix_fmt == PIX_FMT_ARGB)
++ else if(codec->avctx->pix_fmt == AV_PIX_FMT_ARGB)
+ {
+ convert_rgba_to_argb(row_pointers[0], vtrack->stream_row_span,
+ codec->tmp_rows[0], codec->tmp_row_span,
+@@ -1516,7 +1516,7 @@
+ }
+
+ codec->frame->pts = vtrack->timestamp;
+- if(codec->avctx->flags & CODEC_FLAG_QSCALE)
++ if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE)
+ codec->frame->quality = codec->qscale;
+ #ifdef DO_INTERLACE
+ if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
+@@ -1558,12 +1558,12 @@
+
+ #endif
+
+- if(!was_initialized && codec->encoder->id == CODEC_ID_DNXHD)
++ if(!was_initialized && codec->encoder->id == AV_CODEC_ID_DNXHD)
+ setup_avid_atoms(file, vtrack, codec->buffer, bytes_encoded);
+
+ if(bytes_encoded)
+ {
+- if (pts == AV_NOPTS_VALUE || (codec->encoder->id == CODEC_ID_DNXHD && pts == 0))
++ if (pts == AV_NOPTS_VALUE || (codec->encoder->id == AV_CODEC_ID_DNXHD && pts == 0))
+ {
+ /* Some codecs don't bother generating presentation timestamps.
+ FFMpeg's DNxHD encoder doesn't even bother to set it to AV_NOPTS_VALUE. */
+@@ -1590,17 +1590,16 @@
+
+ if(codec->write_global_header && !codec->global_header_written)
+ {
+- if(codec->encoder->id == CODEC_ID_FFVHUFF)
++ if(codec->encoder->id == AV_CODEC_ID_FFVHUFF)
+ {
+ quicktime_user_atoms_add_atom(&trak->mdia.minf.stbl.stsd.table[0].user_atoms,
+ "glbl",
+ codec->avctx->extradata, codec->avctx->extradata_size );
+ }
+- else if(codec->encoder->id == CODEC_ID_MPEG4)
++ else if(codec->encoder->id == AV_CODEC_ID_MPEG4)
+ {
+ int advanced = 0;
+- if(codec->avctx->max_b_frames ||
+- (codec->avctx->flags & (CODEC_FLAG_QPEL|CODEC_FLAG_GMC)))
++ if(codec->avctx->max_b_frames)
+ advanced = 1;
+
+ setup_header_mpeg4(file, track, codec->avctx->extradata,
+@@ -1903,18 +1902,18 @@
+ codec_base->encode_video = lqt_ffmpeg_encode_video;
+ codec_base->set_pass = set_pass_ffmpeg;
+
+- if(encoder->id == CODEC_ID_MPEG4)
++ if(encoder->id == AV_CODEC_ID_MPEG4)
+ {
+ codec_base->writes_compressed = writes_compressed_mpeg4;
+ codec_base->init_compressed = init_compressed_mpeg4;
+ codec_base->write_packet = write_packet_mpeg4;
+ }
+- else if(encoder->id == CODEC_ID_MPEG2VIDEO)
++ else if(encoder->id == AV_CODEC_ID_MPEG2VIDEO)
+ {
+ codec_base->writes_compressed = writes_compressed_imx;
+ codec_base->init_compressed = init_compressed_imx;
+ }
+- else if(encoder->id == CODEC_ID_DVVIDEO)
++ else if(encoder->id == AV_CODEC_ID_DVVIDEO)
+ {
+ codec_base->init_compressed = init_compressed_dv;
+ }
+@@ -1922,7 +1921,7 @@
+ }
+ if(decoder)
+ {
+- if(decoder->id == CODEC_ID_H264)
++ if(decoder->id == AV_CODEC_ID_H264)
+ codec_base->read_packet = read_packet_h264;
+ codec_base->decode_video = lqt_ffmpeg_decode_video;
+ }
+diff -Naur a/src/util.c b/src/util.c
+--- a/src/util.c 2011-01-07 14:40:47.000000000 +0000
++++ b/src/util.c 2018-05-11 23:11:04.367991499 +0100
+@@ -340,9 +340,14 @@
+
+ void quicktime_read_pascal(quicktime_t *file, char *data)
+ {
+- char len = quicktime_read_char(file);
+- quicktime_read_data(file, (uint8_t*)data, len);
+- data[(int)len] = 0;
++ int len = quicktime_read_char(file);
++ if ((len > 0) && (len < 256)) {
++ /* data[] is expected to be 256 bytes long */
++ quicktime_read_data(file, (uint8_t*)data, len);
++ data[len] = 0;
++ } else {
++ data[0] = 0;
++ }
+ }
+
+ void quicktime_write_pascal(quicktime_t *file, char *data)
diff --git a/gnu/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch b/gnu/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch
new file mode 100644
index 0000000000..23cb586766
--- /dev/null
+++ b/gnu/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch
@@ -0,0 +1,73 @@
+Remove fixed search paths from autotools.
+
+--- a/m4/package_utilies.m4 1970-01-01 01:00:01.000000000 +0100
++++ b/m4/package_utilies.m4 2020-07-07 12:41:48.871661042 +0200
+@@ -23,32 +23,32 @@
+ AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
+
+ if test -z "$MAKE"; then
+- AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/freeware/bin)
++ AC_PATH_PROG(MAKE, gmake)
+ fi
+ if test -z "$MAKE"; then
+- AC_PATH_PROG(MAKE, make,, /usr/bin)
++ AC_PATH_PROG(MAKE, make)
+ fi
+ make=$MAKE
+ AC_SUBST(make)
+ AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
+
+ if test -z "$LIBTOOL"; then
+- AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
++ AC_PATH_PROG(LIBTOOL, glibtool)
+ fi
+ if test -z "$LIBTOOL"; then
+- AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
++ AC_PATH_PROG(LIBTOOL, libtool)
+ fi
+ libtool=$LIBTOOL
+ AC_SUBST(libtool)
+ AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
+
+ if test -z "$TAR"; then
+- AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
++ AC_PATH_PROG(TAR, tar)
+ fi
+ tar=$TAR
+ AC_SUBST(tar)
+ if test -z "$ZIP"; then
+- AC_PATH_PROG(ZIP, gzip,, /bin:/usr/local/bin:/usr/freeware/bin)
++ AC_PATH_PROG(ZIP, gzip)
+ fi
+
+ zip=$ZIP
+@@ -61,25 +61,25 @@
+ AC_SUBST(makedepend)
+
+ if test -z "$AWK"; then
+- AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
++ AC_PATH_PROG(AWK, awk)
+ fi
+ awk=$AWK
+ AC_SUBST(awk)
+
+ if test -z "$SED"; then
+- AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
++ AC_PATH_PROG(SED, sed)
+ fi
+ sed=$SED
+ AC_SUBST(sed)
+
+ if test -z "$ECHO"; then
+- AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
++ AC_PATH_PROG(ECHO, echo)
+ fi
+ echo=$ECHO
+ AC_SUBST(echo)
+
+ if test -z "$SORT"; then
+- AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
++ AC_PATH_PROG(SORT, sort)
+ fi
+ sort=$SORT
+ AC_SUBST(sort)
diff --git a/gnu/packages/patches/ola-readdir-r.patch b/gnu/packages/patches/ola-readdir-r.patch
deleted file mode 100644
index b4bd98137e..0000000000
--- a/gnu/packages/patches/ola-readdir-r.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-Fix build failure caused by use of the deprecated readdir_r(3) while
-building with -Werror=deprecated-declarations
-
-Patch copied from upstream source repository:
-https://github.com/daveol/ola/commit/9d8575ff38f76df698ea8889e07a3dee8f21bd68
-
-From 9d8575ff38f76df698ea8889e07a3dee8f21bd68 Mon Sep 17 00:00:00 2001
-From: Dave Olsthoorn <dave.olsthoorn@gmail.com>
-Date: Wed, 2 Mar 2016 11:22:17 +0100
-Subject: [PATCH] Use readdir instead of readdir_r
-
-This replacec the use of readdir_r with readdir since readdir seems to
-be both dangarous and deprecated in newer versions of glibc.
-
-This fixes #1055
----
- common/file/Util.cpp | 17 ++++++++---------
- 1 file changed, 8 insertions(+), 9 deletions(-)
-
-diff --git a/common/file/Util.cpp b/common/file/Util.cpp
-index e2261fd..0ffddd3 100644
---- a/common/file/Util.cpp
-+++ b/common/file/Util.cpp
-@@ -128,30 +128,29 @@ bool FindMatchingFiles(const string &directory,
- FindClose(h_find);
- #else
- DIR *dp;
-- struct dirent dir_ent;
-- struct dirent *dir_ent_p;
-+ struct dirent *dir_ent;
- if ((dp = opendir(directory.data())) == NULL) {
- OLA_WARN << "Could not open " << directory << ":" << strerror(errno);
- return false;
- }
-
-- if (readdir_r(dp, &dir_ent, &dir_ent_p)) {
-- OLA_WARN << "readdir_r(" << directory << "): " << strerror(errno);
-+ if ((dir_ent = readdir(dp)) == NULL) {
-+ OLA_WARN << "readdir(" << directory << "): " << strerror(errno);
- closedir(dp);
- return false;
- }
-
-- while (dir_ent_p != NULL) {
-+ while (dir_ent != NULL) {
- vector<string>::const_iterator iter;
- for (iter = prefixes.begin(); iter != prefixes.end(); ++iter) {
-- if (!strncmp(dir_ent_p->d_name, iter->data(), iter->size())) {
-+ if (!strncmp(dir_ent->d_name, iter->data(), iter->size())) {
- std::ostringstream str;
-- str << directory << PATH_SEPARATOR << dir_ent_p->d_name;
-+ str << directory << PATH_SEPARATOR << dir_ent->d_name;
- files->push_back(str.str());
- }
- }
-- if (readdir_r(dp, &dir_ent, &dir_ent_p)) {
-- OLA_WARN << "readdir_r(" << directory << "): " << strerror(errno);
-+ if ((dir_ent = readdir(dp)) == NULL) {
-+ OLA_WARN << "readdir(" << directory << "): " << strerror(errno);
- closedir(dp);
- return false;
- }
diff --git a/gnu/packages/patches/opencv-fix-build-of-grfmt_jpeg2000.cpp.patch b/gnu/packages/patches/opencv-fix-build-of-grfmt_jpeg2000.cpp.patch
new file mode 100644
index 0000000000..8deb60296a
--- /dev/null
+++ b/gnu/packages/patches/opencv-fix-build-of-grfmt_jpeg2000.cpp.patch
@@ -0,0 +1,39 @@
+From: Tobias Geerinckx-Rice <me@tobias.gr>
+Date: Thu, 13 Aug 2020 15:21:30 +0200
+Subject: [PATCH] gnu: opencv: Fix build with Jasper 2.0.19.
+
+Taken verbatim from upstream: <https://github.com/opencv/opencv/issues/17984>.
+
+From f66fc199a20882c546fa31142e9c0f5a8b3cf983 Mon Sep 17 00:00:00 2001
+From: Florian Jung <flo@windfis.ch>
+Date: Wed, 29 Jul 2020 18:51:55 +0200
+Subject: [PATCH] Fix build of grfmt_jpeg2000.cpp
+
+libjasper has recently changed `jas_matrix_get` from a macro to an inline function
+(389951d071 in https://github.com/jasper-software/jasper), causing the build to fail.
+---
+ modules/imgcodecs/src/grfmt_jpeg2000.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/modules/imgcodecs/src/grfmt_jpeg2000.cpp b/modules/imgcodecs/src/grfmt_jpeg2000.cpp
+index fe69f80c86f..0f4d28d6f4d 100644
+--- a/modules/imgcodecs/src/grfmt_jpeg2000.cpp
++++ b/modules/imgcodecs/src/grfmt_jpeg2000.cpp
+@@ -377,7 +377,7 @@ bool Jpeg2KDecoder::readComponent8u( uchar *data, void *_buffer,
+
+ for( y = 0; y < yend - ystart; )
+ {
+- jas_seqent_t* pix_row = &jas_matrix_get( buffer, y / ystep, 0 );
++ jas_seqent_t* pix_row = jas_matrix_getref( buffer, y / ystep, 0 );
+ uchar* dst = data + (y - yoffset) * step - xoffset;
+
+ if( xstep == 1 )
+@@ -443,7 +443,7 @@ bool Jpeg2KDecoder::readComponent16u( unsigned short *data, void *_buffer,
+
+ for( y = 0; y < yend - ystart; )
+ {
+- jas_seqent_t* pix_row = &jas_matrix_get( buffer, y / ystep, 0 );
++ jas_seqent_t* pix_row = jas_matrix_getref( buffer, y / ystep, 0 );
+ ushort* dst = data + (y - yoffset) * step - xoffset;
+
+ if( xstep == 1 )
diff --git a/gnu/packages/patches/opensles-add-license-file.patch b/gnu/packages/patches/opensles-add-license-file.patch
new file mode 100644
index 0000000000..c638b3886a
--- /dev/null
+++ b/gnu/packages/patches/opensles-add-license-file.patch
@@ -0,0 +1,45 @@
+From 3a78134a35b448d9d4136ffbc55175be7fab6644 Mon Sep 17 00:00:00 2001
+From: Raghav Gururajan <raghavgururajan@disroot.org>
+Date: Mon, 6 Jul 2020 00:34:20 -0400
+Subject: [PATCH] [PATCH]: Add license file.
+
+---
+ LICENSE.txt | 25 +++++++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+ create mode 100644 LICENSE.txt
+
+diff --git a/LICENSE.txt b/LICENSE.txt
+new file mode 100644
+index 0000000..0fce823
+--- /dev/null
++++ b/LICENSE.txt
+@@ -0,0 +1,25 @@
++/*
++ * Copyright (c) 2007-2011 The Khronos Group Inc.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a copy of
++ * this software and /or associated documentation files (the "Materials "), to
++ * deal in the Materials without restriction, including without limitation the
++ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
++ * sell copies of the Materials, and to permit persons to whom the Materials are
++ * 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 Materials.
++ *
++ * THE MATERIALS ARE 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 MATERIALS OR THE USE OR OTHER DEALINGS IN THE
++ * MATERIALS.
++ *
++ * OpenSLES_IID.c - OpenSL ES version 1.1
++ *
++ */
+\ No newline at end of file
+--
+2.26.2
+
diff --git a/gnu/packages/patches/pjproject-correct-the-cflags-field.patch b/gnu/packages/patches/pjproject-correct-the-cflags-field.patch
new file mode 100644
index 0000000000..8bc503580d
--- /dev/null
+++ b/gnu/packages/patches/pjproject-correct-the-cflags-field.patch
@@ -0,0 +1,121 @@
+From 44f8f6c1c71bec6bf00269b075a2dc801ae6fd45 Mon Sep 17 00:00:00 2001
+From: Vladimir Stoiakin <VStoiakin@lavabit.com>
+Date: Thu, 23 Apr 2020 14:06:40 +0300
+Subject: [PATCH 1/2] libpjproject.pc: correct the field 'cflags'
+
+---
+ Makefile | 6 ++----
+ aconfigure | 4 ++++
+ aconfigure.ac | 3 +++
+ build.mak.in | 7 +++----
+ libpjproject.pc.in | 4 ++--
+ 5 files changed, 14 insertions(+), 10 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ffaf638dd..3fd5cab40 100644
+--- a/Makefile
++++ b/Makefile
+@@ -132,10 +132,8 @@ install:
+ sed -e "s!@INCLUDEDIR@!$(includedir)!" | \
+ sed -e "s!@LIBDIR@!$(libdir)!" | \
+ sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \
+- sed -e "s!@PJ_LDLIBS@!!" | \
+- sed -e "s!@PJ_LDXXLIBS@!$(PJ_LDXXLIBS)!" | \
+- sed -e "s!@PJ_INSTALL_CFLAGS@!!" | \
+- sed -e "s!@PJ_INSTALL_CXXFLAGS@!$(PJ_INSTALL_CXXFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc
++ sed -e "s!@PJ_INSTALL_LDFLAGS@!$(PJ_INSTALL_LDFLAGS)!" | \
++ sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc
+
+ uninstall:
+ $(RM) $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc
+diff --git a/aconfigure b/aconfigure
+index 2abbcf533..1ab932bda 100755
+--- a/aconfigure
++++ b/aconfigure
+@@ -706,6 +706,7 @@ GREP
+ CPP
+ ac_cross_compile
+ ac_shlib_suffix
++ac_cflags
+ ac_build_mak_vars
+ ac_pjdir
+ CC_CFLAGS
+@@ -3952,6 +3953,7 @@ if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
+
+
+
++
+ case $host in
+ *mingw* | *cygw* | *win32* | *w32* )
+ if pwd -W 2&> /dev/null; then
+@@ -5138,8 +5140,10 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+ if test "x$ac_cv_c_bigendian" = "xyes"; then
+ CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
++ ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
+ else
+ CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
++ ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
+ fi
+
+
+diff --git a/aconfigure.ac b/aconfigure.ac
+index 83d3559ed..b1d493c08 100644
+--- a/aconfigure.ac
++++ b/aconfigure.ac
+@@ -71,6 +71,7 @@ AC_SUBST(CC_CFLAGS)
+
+ AC_SUBST(ac_pjdir)
+ AC_SUBST(ac_build_mak_vars)
++AC_SUBST(ac_cflags)
+
+ case $host in
+ *mingw* | *cygw* | *win32* | *w32* )
+@@ -144,8 +145,10 @@ AC_C_BIGENDIAN
+
+ if test "x$ac_cv_c_bigendian" = "xyes"; then
+ CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
++ ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
+ else
+ CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
++ ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
+ fi
+
+ dnl
+diff --git a/build.mak.in b/build.mak.in
+index abc0c4fa0..a9078bb25 100644
+--- a/build.mak.in
++++ b/build.mak.in
+@@ -299,7 +299,7 @@ export APP_LDXXLIBS := $(PJSUA2_LIB_LDLIB) \
+ -lstdc++ \
+ $(APP_LDLIBS)
+
+-# Here are the variabels to use if application is using the library
++# Here are the variables to use if application is using the library
+ # from within the source distribution
+ export PJ_CC := $(APP_CC)
+ export PJ_CXX := $(APP_CXX)
+@@ -317,6 +317,5 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FILES)
+ export PJ_INSTALL_DIR := @prefix@
+ export PJ_INSTALL_INC_DIR := @includedir@
+ export PJ_INSTALL_LIB_DIR := @libdir@
+-export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @CFLAGS@
+-export PJ_INSTALL_CXXFLAGS := @CXXFLAGS@ $(PJ_INSTALL_CFLAGS)
+-export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDLIBS)
++export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @ac_cflags@
++export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDXXLIBS)
+diff --git a/libpjproject.pc.in b/libpjproject.pc.in
+index fa8d39114..30ea05c07 100644
+--- a/libpjproject.pc.in
++++ b/libpjproject.pc.in
+@@ -9,5 +9,5 @@ Name: libpjproject
+ Description: Multimedia communication library
+ URL: http://www.pjsip.org
+ Version: @PJ_VERSION@
+-Libs: -L${libdir} @PJ_LDXXLIBS@
+-Cflags: -I${includedir} @PJ_INSTALL_CXXFLAGS@
++Libs: @PJ_INSTALL_LDFLAGS@
++Cflags: @PJ_INSTALL_CFLAGS@
+--
+2.27.0
+
diff --git a/gnu/packages/patches/pjproject-fix-pkg-config-ldflags.patch b/gnu/packages/patches/pjproject-fix-pkg-config-ldflags.patch
new file mode 100644
index 0000000000..1199d82f1e
--- /dev/null
+++ b/gnu/packages/patches/pjproject-fix-pkg-config-ldflags.patch
@@ -0,0 +1,79 @@
+From 9bcba7fb28055550961b134e517b695a8cd05b2a Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Mon, 3 Aug 2020 17:43:19 -0400
+Subject: [PATCH] libpjproject.pc: Move external libraries to Libs.private.
+
+This is done so users of a shared pjproject library do not get link
+directives (provided via pkg-config file of pjproject) to link against
+pjproject's own library dependencies.
+
+Static linking with pjproject is preserved by moving the external
+libraries link directives to the Libs.private field, which is
+specifically intended for this purpose, via for example:
+
+ $ pkg-config --static --libs libpjproject
+
+* build.mak.in (PJ_INSTALL_LDFLAGS_PRIVATE): New variable.
+(PJ_INSTALL_LDFLAGS): Filter out PJ_INSTALL_LDFLAGS_PRIVATE entries.
+* libpjproject.pc.in (Libs.private): New field.
+* Makefile: Substitute PJ_INSTALL_LDFLAGS_PRIVATE as the value for the
+Libs.private field.
+---
+ Makefile | 5 +++--
+ build.mak.in | 3 ++-
+ libpjproject.pc.in | 1 +
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 3fd5cab40..d67badfa4 100644
+--- a/Makefile
++++ b/Makefile
+@@ -54,14 +54,14 @@ doc:
+ exit 1; \
+ fi; \
+ done
+-
++
+ LIBS = pjlib/lib/libpj-$(TARGET_NAME).a \
+ pjlib-util/lib/libpjlib-util-$(TARGET_NAME).a \
+ pjnath/lib/libpjnath-$(TARGET_NAME).a \
+ pjmedia/lib/libpjmedia-$(TARGET_NAME).a \
+ pjmedia/lib/libpjmedia-audiodev-$(TARGET_NAME).a \
+ pjmedia/lib/libpjmedia-codec-$(TARGET_NAME).a \
+- pjsip/lib/libpjsip-$(TARGET_NAME).a \
++ pjsip/lib/libpjsip-$(TARGET_NAME).a \
+ pjsip/lib/libpjsip-ua-$(TARGET_NAME).a \
+ pjsip/lib/libpjsip-simple-$(TARGET_NAME).a \
+ pjsip/lib/libpjsua-$(TARGET_NAME).a
+@@ -133,6 +133,7 @@ install:
+ sed -e "s!@LIBDIR@!$(libdir)!" | \
+ sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \
+ sed -e "s!@PJ_INSTALL_LDFLAGS@!$(PJ_INSTALL_LDFLAGS)!" | \
++ sed -e "s!@PJ_INSTALL_LDFLAGS_PRIVATE@!$(PJ_INSTALL_LDFLAGS_PRIVATE)!" | \
+ sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc
+
+ uninstall:
+diff --git a/build.mak.in b/build.mak.in
+index a9078bb25..1a18a8513 100644
+--- a/build.mak.in
++++ b/build.mak.in
+@@ -318,4 +318,5 @@ export PJ_INSTALL_DIR := @prefix@
+ export PJ_INSTALL_INC_DIR := @includedir@
+ export PJ_INSTALL_LIB_DIR := @libdir@
+ export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @ac_cflags@
+-export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDXXLIBS)
++export PJ_INSTALL_LDFLAGS_PRIVATE := $(APP_THIRD_PARTY_LIBS) $(APP_THIRD_PARTY_EXT) @LIBS@
++export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(filter-out $(PJ_INSTALL_LDFLAGS_PRIVATE),$(APP_LDXXLIBS))
+diff --git a/libpjproject.pc.in b/libpjproject.pc.in
+index 30ea05c07..4372d5016 100644
+--- a/libpjproject.pc.in
++++ b/libpjproject.pc.in
+@@ -10,4 +10,5 @@ Description: Multimedia communication library
+ URL: http://www.pjsip.org
+ Version: @PJ_VERSION@
+ Libs: @PJ_INSTALL_LDFLAGS@
++Libs.private: @PJ_INSTALL_LDFLAGS_PRIVATE@
+ Cflags: @PJ_INSTALL_CFLAGS@
+--
+2.27.0
+
diff --git a/gnu/packages/patches/plotutils-spline-test.patch b/gnu/packages/patches/plotutils-spline-test.patch
new file mode 100644
index 0000000000..2f9feb96cf
--- /dev/null
+++ b/gnu/packages/patches/plotutils-spline-test.patch
@@ -0,0 +1,34 @@
+Description: Work around i386 testsuite error
+Author: Andreas Metzler <ametzler@debian.org>
+Origin: vendor
+Bug: http://lists.gnu.org/archive/html/bug-plotutils/2017-02/msg00001.html
+Bug-Debian: https://bugs.debian.org/856134
+Forwarded: http://lists.gnu.org/archive/html/bug-plotutils/2017-02/msg00002.html
+Last-Update: 2017-02-25
+
+--- a/test/spline.test
++++ b/test/spline.test
+@@ -3,12 +3,21 @@
+ echo 0 1 0.5 0.75 -0.25 0 | ../spline/spline -a -T 1 -n 120 \
+ --precision 5 -p >spline.out
+
++# Work around testsuite error
++# http://lists.gnu.org/archive/html/bug-plotutils/2016-04/msg00000.html
++#
+ # work around line end problems in installations with DJGPP under DOS
+-tr -d '\015' < spline.out > spline.dos
++tr -d '\015' < spline.out \
++ | head -n 120 | tail -n 119 \
++ > spline.dos
+
+-if cmp -s $SRCDIR/spline.xout spline.dos
++# cannot patch spline.xout, it is used as input for graph.test.
++head -n 120 $SRCDIR/spline.xout | tail -n 119 > spline.xout.4comp
++
++if cmp -s spline.xout.4comp spline.dos
+ then retval=0;
+ else retval=1;
+ fi;
+
++rm -f spline.xout.4comp
+ exit $retval
diff --git a/gnu/packages/patches/python-alembic-exceptions-cause.patch b/gnu/packages/patches/python-alembic-exceptions-cause.patch
deleted file mode 100644
index b9844e5ad0..0000000000
--- a/gnu/packages/patches/python-alembic-exceptions-cause.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-Fix a test failure with newer versions of SQLalchemy due to missing
-"causes" for some exceptions.
-
-diff --git a/alembic/operations/ops.py b/alembic/operations/ops.py
-index 5ec2762..7129472 100644
---- a/alembic/operations/ops.py
-+++ b/alembic/operations/ops.py
-@@ -108,6 +108,7 @@ def from_constraint(cls, constraint):
- "primary_key_constraint": "primary",
- "check_constraint": "check",
- "column_check_constraint": "check",
-+ "table_or_column_check_constraint": "check",
- }
-
- constraint_table = sqla_compat._table_for_constraint(constraint)
-@@ -707,6 +708,7 @@ def batch_create_foreign_key(
- "create_check_constraint", "batch_create_check_constraint"
- )
- @AddConstraintOp.register_add_constraint("check_constraint")
-+@AddConstraintOp.register_add_constraint("table_or_column_check_constraint")
- @AddConstraintOp.register_add_constraint("column_check_constraint")
- class CreateCheckConstraintOp(AddConstraintOp):
- """Represent a create check constraint operation."""
-diff --git a/alembic/testing/assertions.py b/alembic/testing/assertions.py
-index 3dc08f0..a78e5e8 100644
---- a/alembic/testing/assertions.py
-+++ b/alembic/testing/assertions.py
-@@ -2,10 +2,9 @@
-
- import re
-
-+from sqlalchemy import util
- from sqlalchemy.engine import default
- from sqlalchemy.testing.assertions import _expect_warnings
--from sqlalchemy.testing.assertions import assert_raises # noqa
--from sqlalchemy.testing.assertions import assert_raises_message # noqa
- from sqlalchemy.testing.assertions import eq_ # noqa
- from sqlalchemy.testing.assertions import is_ # noqa
- from sqlalchemy.testing.assertions import is_false # noqa
-@@ -17,6 +16,29 @@
- from ..util.compat import py3k
-
-
-+def assert_raises(except_cls, callable_, *args, **kw):
-+ try:
-+ callable_(*args, **kw)
-+ success = False
-+ except except_cls:
-+ success = True
-+
-+ # assert outside the block so it works for AssertionError too !
-+ assert success, "Callable did not raise an exception"
-+
-+
-+def assert_raises_message(except_cls, msg, callable_, *args, **kwargs):
-+ try:
-+ callable_(*args, **kwargs)
-+ assert False, "Callable did not raise an exception"
-+ except except_cls as e:
-+ assert re.search(msg, util.text_type(e), re.UNICODE), "%r !~ %s" % (
-+ msg,
-+ e,
-+ )
-+ print(util.text_type(e).encode("utf-8"))
-+
-+
- def eq_ignore_whitespace(a, b, msg=None):
- # sqlalchemy.testing.assertion has this function
- # but not with the special "!U" detection part
diff --git a/gnu/packages/patches/python-jedi-sort-project-test.patch b/gnu/packages/patches/python-jedi-sort-project-test.patch
deleted file mode 100644
index b2d602dfe6..0000000000
--- a/gnu/packages/patches/python-jedi-sort-project-test.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Sort the result of file system traversal to avoid test failure on different
-file systems.
-
-Taken from upstream:
-https://github.com/davidhalter/jedi/commit/7ff76bb7d0d94514e17cd1647f4ffaf533dd55f5
-
-diff --git a/test/test_api/test_project.py b/test/test_api/test_project.py
---- a/test/test_api/test_project.py
-+++ b/test/test_api/test_project.py
-@@ -135,7 +135,7 @@ def test_search(string, full_names, kwargs, skip_pre_python36):
- defs = project.complete_search(string, **kwargs)
- else:
- defs = project.search(string, **kwargs)
-- assert [('stub:' if d.is_stub() else '') + d.full_name for d in defs] == full_names
-+ assert sorted([('stub:' if d.is_stub() else '') + d.full_name for d in defs]) == full_names
-
-
- @pytest.mark.parametrize(
diff --git a/gnu/packages/patches/python-onnx-use-system-googletest.patch b/gnu/packages/patches/python-onnx-use-system-googletest.patch
new file mode 100644
index 0000000000..33d2fa12de
--- /dev/null
+++ b/gnu/packages/patches/python-onnx-use-system-googletest.patch
@@ -0,0 +1,54 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0aa9fda2..a573170c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,7 +22,7 @@ option(BUILD_ONNX_PYTHON "Build Python binaries" OFF)
+ option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON)
+ option(ONNX_WERROR "Build with Werror" OFF)
+ option(ONNX_COVERAGE "Build with coverage instrumentation" OFF)
+-option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF)
++option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" ON)
+ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
+ option(ONNXIFI_ENABLE_EXT "Enable onnxifi extensions." OFF)
+ if(NOT DEFINED ONNX_ML)
+@@ -82,8 +82,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ endif()
+
+ if(ONNX_BUILD_TESTS)
+- list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external)
+- include(googletest)
++ find_package(GTest REQUIRED)
++ if(NOT GTest_FOUND)
++ message(FATAL_ERROR "cannot find googletest")
++ endif()
+ endif()
+
+ if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf))
+diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake
+index e29a93ff..ae146390 100644
+--- a/cmake/unittest.cmake
++++ b/cmake/unittest.cmake
+@@ -6,8 +6,8 @@ include(${ONNX_ROOT}/cmake/Utils.cmake)
+
+ find_package(Threads)
+
+-set(${UT_NAME}_libs ${googletest_STATIC_LIBRARIES})
+-set(${ONNXIFI_TEST_DRIVER}_libs ${googletest_STATIC_LIBRARIES})
++set(${UT_NAME}_libs ${GTEST_LIBRARIES})
++set(${ONNXIFI_TEST_DRIVER}_libs ${GTEST_LIBRARIES})
+
+ list(APPEND ${UT_NAME}_libs onnx)
+ list(APPEND ${UT_NAME}_libs onnx_proto)
+@@ -31,10 +31,10 @@ function(AddTest)
+ list(REMOVE_DUPLICATES _UT_SOURCES)
+
+ add_executable(${_UT_TARGET} ${_UT_SOURCES})
+- add_dependencies(${_UT_TARGET} onnx onnx_proto googletest)
++ add_dependencies(${_UT_TARGET} onnx onnx_proto)
+
+ target_include_directories(${_UT_TARGET}
+- PUBLIC ${googletest_INCLUDE_DIRS}
++ PUBLIC ${GTEST_INCLUDE_DIRS}
+ ${ONNX_INCLUDE_DIRS}
+ ${PROTOBUF_INCLUDE_DIRS}
+ ${ONNX_ROOT}
diff --git a/gnu/packages/patches/python-slugify-depend-on-unidecode.patch b/gnu/packages/patches/python-slugify-depend-on-unidecode.patch
deleted file mode 100644
index 5ac749c19d..0000000000
--- a/gnu/packages/patches/python-slugify-depend-on-unidecode.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/setup.py b/setup.py
-index 4800173..6bdd77f 100755
---- a/setup.py
-+++ b/setup.py
-@@ -14,8 +14,7 @@ url = 'https://github.com/un33k/python-slugify'
- author = 'Val Neekman'
- author_email = 'info@neekware.com'
- license = 'MIT'
--install_requires = ['text-unidecode>=1.3']
--extras_require = {'unidecode': ['Unidecode>=1.1.1']}
-+install_requires = ['Unidecode']
-
- classifiers = [
- 'Development Status :: 5 - Production/Stable',
-@@ -67,7 +66,6 @@ setup(
- author_email=author_email,
- packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
- install_requires=install_requires,
-- extras_require=extras_require,
- classifiers=classifiers,
- entry_points={'console_scripts': ['slugify=slugify.slugify:main']},
- )
diff --git a/gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch b/gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch
new file mode 100644
index 0000000000..0947718059
--- /dev/null
+++ b/gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch
@@ -0,0 +1,59 @@
+Removes references to bundled libuv.
+
+--- a/src/Makevars 2020-07-31 11:53:30.576484531 +0200
++++ b/src/Makevars 2020-07-31 11:54:19.369863118 +0200
+@@ -5,7 +5,7 @@
+
+ UNAME := $(shell uname)
+
+-PKG_LIBS = ./libuv/.libs/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -pthread
++PKG_LIBS = -luv ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -pthread
+
+ ifeq ($(UNAME), Darwin)
+ PKG_LIBS += -framework CoreServices
+@@ -23,7 +23,7 @@
+
+ PKG_CFLAGS = $(C_VISIBILITY) -DSTRICT_R_HEADERS
+ PKG_CXXFLAGS = $(CXX_VISIBILITY) -DSTRICT_R_HEADERS
+-PKG_CPPFLAGS = -Ilibuv/include -pthread
++PKG_CPPFLAGS = -pthread
+
+ # To avoid spurious warnings from `R CMD check --as-cran`, about compiler
+ # warning flags like -Werror.
+@@ -43,35 +43,5 @@
+ # PKG_CPPFLAGS += -D_GLIBCXX_ASSERTIONS
+
+
+-$(SHLIB): libuv/.libs/libuv.a http-parser/http_parser.o sha1/sha1.o base64/base64.o
++$(SHLIB): http-parser/http_parser.o sha1/sha1.o base64/base64.o
+
+-# We needed to rename lt~obsolete.m4 because the name causes problems with R
+-# CMD check. Here we rename it back.
+-libuv/m4/lt~obsolete.m4: libuv/m4/lt_obsolete.m4
+- cp -p -f libuv/m4/lt_obsolete.m4 libuv/m4/lt~obsolete.m4
+-
+-# Run ./configure. We need to touch various autotools-related files to avoid
+-# it trying to run autotools programs again. We also need to make sure
+-# configure is executable, because on some platforms, calling unzip() in R
+-# does not preserve the executable bit.
+-#
+-# It's VERY IMPORTANT that mtime(aclocal.m4) <= mtime(configure), and also
+-# mtime(aclocal.m4) <= mtime(Makefile.in). On some platforms, passing multiple
+-# files to a single touch command gives them all the same time, but on others
+-# (Solaris and possibly some Fedoras) the timestamps are slightly increasing
+-# from one to the next, i.e. the order matters. To remove this fragility, we
+-# use "-r aclocal.m4" to ensure that all three files are guaranteed to have
+-# precisely the same timestamp value.
+-libuv/Makefile: libuv/m4/lt~obsolete.m4
+- (cd libuv \
+- && touch aclocal.m4 \
+- && touch -r aclocal.m4 configure Makefile.in \
+- && chmod +x configure \
+- && CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS) $(C_VISIBILITY)" AR="$(AR)" RANLIB="$(RANLIB)" LDFLAGS="$(LDFLAGS)" ./configure $(CONFIGURE_FLAGS))
+-
+-libuv/.libs/libuv.a: libuv/Makefile
+- $(MAKE) --directory=libuv \
+- HAVE_DTRACE=0
+-
+-clean:
+- $(MAKE) --directory=libuv distclean
diff --git a/gnu/packages/patches/remake-impure-dirs.patch b/gnu/packages/patches/remake-impure-dirs.patch
new file mode 100644
index 0000000000..698ac7476c
--- /dev/null
+++ b/gnu/packages/patches/remake-impure-dirs.patch
@@ -0,0 +1,30 @@
+Purity: don't look for library dependencies (of the form `-lfoo') in
+/lib and /usr/lib. Likewise, when searching for included Makefiles,
+don't look in /usr/include and friends.
+
+Borrowed from similar patch for GNU Make and adjusted for Remake.
+
+--- remake-4.3+dbg-1.5/src/read.c.orig 2020-03-14 17:06:16.000000000 -0500
++++ remake-4.3+dbg-1.5/src/read.c 2020-07-31 22:34:03.862383862 -0500
+@@ -104,7 +104,7 @@
+ # define INCLUDEDIR "."
+ #endif
+ INCLUDEDIR,
+-#ifndef _AMIGA
++#if 0
+ "/usr/gnu/include",
+ "/usr/local/include",
+ "/usr/include",
+--- remake-4.3+dbg-1.5/src/remake.c.orig 2020-03-14 17:06:16.000000000 -0500
++++ remake-4.3+dbg-1.5/src/remake.c 2020-07-31 22:34:26.798330508 -0500
+@@ -1665,8 +1665,10 @@
+ {
+ static const char *dirs[] =
+ {
++#if 0
+ "/lib",
+ "/usr/lib",
++#endif
+ #if defined(WINDOWS32) && !defined(LIBDIR)
+ /*
+ * This is completely up to the user at product install time. Just define
diff --git a/gnu/packages/patches/rnp-add-version.cmake.patch b/gnu/packages/patches/rnp-add-version.cmake.patch
new file mode 100644
index 0000000000..67e3b75457
--- /dev/null
+++ b/gnu/packages/patches/rnp-add-version.cmake.patch
@@ -0,0 +1,169 @@
+From b4326f4649ceb146d5cc74f8579b68d8dc8f51e6 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Mon, 27 Jul 2020 14:00:25 +0200
+Subject: [PATCH 3/3] Add external version.cmake.
+
+This file is maintained in an external repository. It is only
+included in released versions. For building snapshots of RNP, a fixed
+snapshot of version.cmake is downloaded on demand. To avoid this,
+this patch explicitly provides the file.
+---
+ cmake/version.cmake | 146 ++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 146 insertions(+)
+ create mode 100644 cmake/version.cmake
+
+diff --git a/cmake/version.cmake b/cmake/version.cmake
+new file mode 100644
+index 00000000..514027aa
+--- /dev/null
++++ b/cmake/version.cmake
+@@ -0,0 +1,146 @@
++# Copyright (c) 2018 Ribose Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions
++# are met:
++# 1. Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++# 2. Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
++# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
++# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++# POSSIBILITY OF SUCH DAMAGE.
++
++# desired length of commit hash
++set(GIT_REV_LEN 7)
++
++# call git, store output in var (can fail)
++macro(_git var)
++ execute_process(
++ COMMAND "${GIT_EXECUTABLE}" ${ARGN}
++ WORKING_DIRECTORY "${source_dir}"
++ RESULT_VARIABLE _git_ec
++ OUTPUT_VARIABLE ${var}
++ OUTPUT_STRIP_TRAILING_WHITESPACE
++ ERROR_QUIET
++ )
++endmacro()
++
++# call git, store output in var (can not fail)
++macro(git var)
++ _git(${var} ${ARGN})
++ if (NOT _git_ec EQUAL 0)
++ string(REPLACE ";" " " args "${ARGN}")
++ message(FATAL_ERROR "Failed to execute: git ${args}")
++ endif()
++endmacro()
++
++function(extract_version_info version var_prefix)
++ # extract the main components
++ # v1.9.0-3-g5b92266+1546836556
++ # v1.9.0-3-g5b92266-dirty+1546836556
++ string(REGEX MATCH "^v?([0-9]+\\.[0-9]+\\.[0-9]+)(-([0-9]+)-g([0-9a-f]+)(-dirty)?)?(\\+([0-9]+))?$" matches "${version}")
++ if (NOT matches)
++ message(FATAL_ERROR "Failed to extract version components.")
++ endif()
++ set(${var_prefix}_VERSION "${CMAKE_MATCH_1}" PARENT_SCOPE) # 1.9.0
++ if (NOT CMAKE_MATCH_3)
++ set(CMAKE_MATCH_3 "0")
++ endif()
++ set(${var_prefix}_VERSION_NCOMMITS "${CMAKE_MATCH_3}" PARENT_SCOPE) # 3
++ if (NOT CMAKE_MATCH_4)
++ set(CMAKE_MATCH_4 "0")
++ endif()
++ set(${var_prefix}_VERSION_GIT_REV "${CMAKE_MATCH_4}" PARENT_SCOPE) # 5b92266
++ if (CMAKE_MATCH_5 STREQUAL "-dirty")
++ set(${var_prefix}_VERSION_IS_DIRTY TRUE PARENT_SCOPE)
++ else()
++ set(${var_prefix}_VERSION_IS_DIRTY FALSE PARENT_SCOPE)
++ endif()
++ # timestamp is optional, default to 0
++ if (NOT CMAKE_MATCH_7)
++ set(CMAKE_MATCH_7 "0")
++ endif()
++ set(${var_prefix}_VERSION_COMMIT_TIMESTAMP "${CMAKE_MATCH_7}" PARENT_SCOPE) # 1546836556
++endfunction()
++
++function(determine_version source_dir var_prefix)
++ if (EXISTS "${source_dir}/.git")
++ # for GIT_EXECUTABLE
++ find_package(Git REQUIRED)
++ # get a description of the version, something like:
++ # v1.9.1-0-g38ffe82 (a tagged release)
++ # v1.9.1-0-g38ffe82-dirty (a tagged release with local modifications)
++ # v1.9.0-3-g5b92266 (post-release snapshot)
++ # v1.9.0-3-g5b92266-dirty (post-release snapshot with local modifications)
++ _git(version describe --abbrev=${GIT_REV_LEN} --match "v[0-9]*" --long --dirty)
++ if (NOT _git_ec EQUAL 0)
++ # no annotated tags, fake one
++ git(revision rev-parse --short=${GIT_REV_LEN} --verify HEAD)
++ set(version "v0.0.0-0-g${revision}")
++ # check if dirty (this won't detect untracked files, but should be ok)
++ _git(changes diff-index --quiet HEAD --)
++ if (NOT _git_ec EQUAL 0)
++ string(APPEND version "-dirty")
++ endif()
++ # append the commit timestamp of the most recent commit (only
++ # in non-release branches -- typically master)
++ git(commit_timestamp show -s --format=%ct)
++ string(APPEND version "+${commit_timestamp}")
++ endif()
++ else()
++ # same as above, but used for snapshots
++ file(STRINGS "${source_dir}/version.txt" version)
++ endif()
++ set(local_prefix "_determine_ver")
++ extract_version_info("${version}" "${local_prefix}")
++ foreach(suffix VERSION VERSION_NCOMMITS VERSION_GIT_REV VERSION_IS_DIRTY VERSION_COMMIT_TIMESTAMP)
++ if (NOT DEFINED ${local_prefix}_${suffix})
++ message(FATAL_ERROR "Unable to determine version.")
++ endif()
++ set(${var_prefix}_${suffix} "${${local_prefix}_${suffix}}" PARENT_SCOPE)
++ message(STATUS "${var_prefix}_${suffix}: ${${local_prefix}_${suffix}}")
++ endforeach()
++ # Set VERSION_SUFFIX and VERSION_FULL. When making changes, be aware that
++ # this is used in packaging as well and will affect ordering.
++ # | state | version_full |
++ # |------------------------------------------------|
++ # | exact tag | 0.9.0 |
++ # | exact tag, dirty | 0.9.0+git20180604 |
++ # | after tag | 0.9.0+git20180604.1.085039f |
++ # | no tag | 0.0.0+git20180604.2ee02af |
++ string(TIMESTAMP date "%Y%m%d" UTC)
++ set(version_suffix "")
++ if ((NOT ${local_prefix}_VERSION_NCOMMITS EQUAL 0) OR (${local_prefix}_VERSION STREQUAL "0.0.0"))
++ # 0.9.0+git20150604.4.289818b
++ string(APPEND version_suffix "+git${date}")
++ if (NOT ${local_prefix}_VERSION_NCOMMITS EQUAL 0)
++ string(APPEND version_suffix ".${${local_prefix}_VERSION_NCOMMITS}")
++ endif()
++ string(APPEND version_suffix ".${${local_prefix}_VERSION_GIT_REV}")
++ else()
++ if (${local_prefix}_VERSION_IS_DIRTY)
++ # 0.9.0+git20150604
++ string(APPEND version_suffix "+git${date}")
++ endif()
++ endif()
++ set(version_full "${${local_prefix}_VERSION}${version_suffix}")
++ # set the results
++ set(${var_prefix}_VERSION_SUFFIX "${version_suffix}" PARENT_SCOPE)
++ set(${var_prefix}_VERSION_FULL "${version_full}" PARENT_SCOPE)
++ # for informational purposes
++ message(STATUS "${var_prefix}_VERSION_SUFFIX: ${version_suffix}")
++ message(STATUS "${var_prefix}_VERSION_FULL: ${version_full}")
++endfunction()
++
+--
+2.20.1
+
diff --git a/gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch b/gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch
new file mode 100644
index 0000000000..5a75b6f40f
--- /dev/null
+++ b/gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch
@@ -0,0 +1,26 @@
+From 40e53d639d86337cf58be3a2b9750b6c97a3c740 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Tue, 21 Jul 2020 16:10:21 +0200
+Subject: [PATCH 2/2] Disable ruby-rnp tests.
+
+Prevents cmake from cloning the ruby-rnp repository in order to run its tests.
+---
+ src/tests/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
+index d3c4fbe6..e7e1965e 100644
+--- a/src/tests/CMakeLists.txt
++++ b/src/tests/CMakeLists.txt
+@@ -125,7 +125,7 @@ gtest_discover_tests(rnp_tests
+
+ # ruby-rnp
+ # cruby does not currently play nice with ASaN et al.
+-if (NOT ENABLE_SANITIZERS AND BUILD_SHARED_LIBS AND NOT WIN32)
++if (NOT ENABLE_SANITIZERS AND BUILD_SHARED_LIBS AND NOT WIN32 AND IGNORE)
+ include(ExternalProject)
+ set(_sourcedir "${CMAKE_BINARY_DIR}/ruby-rnp")
+ if (DEFINED ENV{RUBY_RNP_INSTALL})
+--
+2.20.1
+
diff --git a/gnu/packages/patches/rnp-unbundle-googletest.patch b/gnu/packages/patches/rnp-unbundle-googletest.patch
new file mode 100644
index 0000000000..b85bfd1f0e
--- /dev/null
+++ b/gnu/packages/patches/rnp-unbundle-googletest.patch
@@ -0,0 +1,43 @@
+From 4b4697c8dd66bd2b1e4d6b831bbde46e27d62c46 Mon Sep 17 00:00:00 2001
+From: Justus Winter <teythoon@avior.uberspace.de>
+Date: Tue, 21 Jul 2020 16:10:12 +0200
+Subject: [PATCH 1/2] Unbundle googletest.
+
+---
+ src/tests/CMakeLists.txt | 2 +-
+ src/tests/gtest-CMakeLists.txt.in | 6 +++---
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
+index 0a841666..d3c4fbe6 100644
+--- a/src/tests/CMakeLists.txt
++++ b/src/tests/CMakeLists.txt
+@@ -53,7 +53,7 @@ endif()
+ # maintain compiler/linker settings on Windows
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+ # add to our build (provides gtest_main target)
+-add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
++add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest-src
+ ${CMAKE_CURRENT_BINARY_DIR}/googletest-build
+ EXCLUDE_FROM_ALL)
+
+diff --git a/src/tests/gtest-CMakeLists.txt.in b/src/tests/gtest-CMakeLists.txt.in
+index a43e8e5d..3cc0ddd5 100644
+--- a/src/tests/gtest-CMakeLists.txt.in
++++ b/src/tests/gtest-CMakeLists.txt.in
+@@ -4,9 +4,9 @@ project(googletest-download NONE)
+
+ include(ExternalProject)
+ ExternalProject_Add(googletest
+- GIT_REPOSITORY https://github.com/google/googletest.git
+- GIT_TAG c43f710
+- SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
++# GIT_REPOSITORY https://github.com/google/googletest.git
++# GIT_TAG c43f710
++ SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/googletest-src"
+ BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+--
+2.20.1
+
diff --git a/gnu/packages/patches/seed-webkit.patch b/gnu/packages/patches/seed-webkit.patch
new file mode 100644
index 0000000000..55f15af12f
--- /dev/null
+++ b/gnu/packages/patches/seed-webkit.patch
@@ -0,0 +1,49 @@
+From 6d512b5c4d774a9853b51dae464a10cea7e3423a Mon Sep 17 00:00:00 2001
+From: Peter Rustler <peter.rustler@basyskom.com>
+Date: Mon, 7 Dec 2015 11:40:05 +0000
+Subject: [PATCH] Add support for new webkit version 4.0 to build system
+
+Add new configure value for option --with-webkit.
+Now you can add 4.0 as value to --with-webkit.
+Default is still 3.0.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=759171
+---
+ configure.ac | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2313c093..3d5d4823 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -77,12 +77,12 @@ dnl ==============================WebKit=======================================
+ m4_define([webkit_default], [3.0])
+
+ AC_ARG_WITH([webkit],
+- [AC_HELP_STRING([--with-webkit=@<:@3.0/1.0@:>@],
++ [AC_HELP_STRING([--with-webkit=@<:@4.0/3.0/1.0@:>@],
+ [Select the Webkit backend, default=3.0])],
+ [],
+ [with_webkit=webkit_default])
+
+-dnl=== support both 1.0 and 3.0 (default 3.0) ==
++dnl=== support all 1.0, 3.0 and 4.0 (default 3.0) ==
+ AS_CASE([$with_webkit],
+ [3.0], [
+ WEBKIT_PC=webkitgtk-3.0
+@@ -90,6 +90,12 @@ AS_CASE([$with_webkit],
+ AC_CHECK_LIB(webkitgtk-3.0, JSContextGroupCreate,,
+ AC_CHECK_LIB(javascriptcoregtk-3.0, JSContextGroupCreate,WEBKIT_PC=javascriptcoregtk-3.0))
+ ],
++ [4.0], [
++ WEBKIT_PC=webkitgtk-4.0
++ SEED_GTK_VERSION=-gtk4
++ AC_CHECK_LIB(webkitgtk-4.0, JSContextGroupCreate,,
++ AC_CHECK_LIB(javascriptcoregtk-4.0, JSContextGroupCreate,WEBKIT_PC=javascriptcoregtk-4.0))
++ ],
+ [1.0], [
+ AC_CHECK_LIB(webkitgtk-1.0, JSContextGroupCreate,WEBKIT_PC=webkitgtk-1.0,
+ AC_CHECK_LIB(javascriptcoregtk-1.0, JSContextGroupCreate,WEBKIT_PC=javascriptcoregtk-1.0,
+--
+GitLab
+
diff --git a/gnu/packages/patches/sooperlooper-build-with-wx-30.patch b/gnu/packages/patches/sooperlooper-build-with-wx-30.patch
deleted file mode 100644
index 43f4b9be69..0000000000
--- a/gnu/packages/patches/sooperlooper-build-with-wx-30.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-Downloaded from https://anonscm.debian.org/cgit/pkg-multimedia/sooperlooper.git/plain/debian/patches/04-build_with_wx_30.patch -O gnu/packages/patches/sooperlooper-build-with-wx-30.patch
-
-Author: Jaromír Mikeš <mira.mikes@seznam.cz>, Olly Betts <olly@survex.com>
-Description: build against wx 3.0.
-Forwarded: yes
-
-Index: sooperlooper/src/gui/main_panel.cpp
-===================================================================
---- sooperlooper.orig/src/gui/main_panel.cpp
-+++ sooperlooper/src/gui/main_panel.cpp
-@@ -448,7 +448,7 @@ MainPanel::init_loopers (int count)
- while (count < (int)_looper_panels.size()) {
- looperpan = _looper_panels.back();
- _looper_panels.pop_back();
-- _main_sizer->Remove(looperpan);
-+ _main_sizer->Detach(looperpan);
- looperpan->Destroy();
- }
- }
-@@ -1277,7 +1277,7 @@ void MainPanel::misc_action (bool releas
- }
-
-
-- wxString filename = do_file_selector (wxT("Choose file to save loop"), wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"), wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
-+ wxString filename = do_file_selector (wxT("Choose file to save loop"), wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"), wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);
-
- if ( !filename.empty() )
- {
-@@ -1296,7 +1296,7 @@ void MainPanel::misc_action (bool releas
- index = 0;
- }
-
-- wxString filename = do_file_selector (wxT("Choose file to open"), wxT(""), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
-+ wxString filename = do_file_selector (wxT("Choose file to open"), wxT(""), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);
-
- if ( !filename.empty() )
- {
-@@ -1408,7 +1408,7 @@ void MainPanel::set_curr_loop (int index
-
- void MainPanel::do_load_session ()
- {
-- wxString filename = do_file_selector (wxT("Choose session to load"), wxT("*.slsess"), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
-+ wxString filename = do_file_selector (wxT("Choose session to load"), wxT("*.slsess"), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);
-
- if ( !filename.empty() )
- {
-@@ -1419,7 +1419,7 @@ void MainPanel::do_load_session ()
-
- void MainPanel::do_save_session (bool write_audio)
- {
-- wxString filename = do_file_selector (wxT("Choose file to save session"), wxT("slsess"), wxT("*.slsess"), wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
-+ wxString filename = do_file_selector (wxT("Choose file to save session"), wxT("slsess"), wxT("*.slsess"), wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);
-
- if ( !filename.empty() )
- {
-Index: sooperlooper/src/gui/pix_button.cpp
-===================================================================
---- sooperlooper.orig/src/gui/pix_button.cpp
-+++ sooperlooper/src/gui/pix_button.cpp
-@@ -250,7 +250,7 @@ PixButton::OnMouseEvents (wxMouseEvent &
- pt.x += bounds.x;
- pt.y += bounds.y;
-
-- if (bounds.Inside(pt)) {
-+ if (bounds.Contains(pt)) {
- clicked (get_mouse_button(ev)); // emit
-
- if (ev.MiddleUp() && ev.ControlDown()) {
-Index: sooperlooper/src/gui/looper_panel.cpp
-===================================================================
---- sooperlooper.orig/src/gui/looper_panel.cpp
-+++ sooperlooper/src/gui/looper_panel.cpp
-@@ -1428,7 +1428,7 @@ LooperPanel::clicked_events (int button,
- if (cmd == wxT("save"))
- {
- wxString filename = _mainpanel->do_file_selector (wxT("Choose file to save loop"),
-- wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"), wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
-+ wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"), wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);
-
- if ( !filename.empty() )
- {
-@@ -1442,7 +1442,7 @@ LooperPanel::clicked_events (int button,
- }
- else if (cmd == wxT("load"))
- {
-- wxString filename = _mainpanel->do_file_selector(wxT("Choose file to open"), wxT(""), wxT("Audio files (*.wav,*.aif)|*.wav;*.WAV;*.Wav;*.aif;*.aiff;*.AIF;*.AIFF|All files (*.*)|*.*"), wxOPEN|wxCHANGE_DIR);
-+ wxString filename = _mainpanel->do_file_selector(wxT("Choose file to open"), wxT(""), wxT("Audio files (*.wav,*.aif)|*.wav;*.WAV;*.Wav;*.aif;*.aiff;*.AIF;*.AIFF|All files (*.*)|*.*"), wxFD_OPEN|wxFD_CHANGE_DIR);
-
- if ( !filename.empty() )
- {
-Index: sooperlooper/src/gui/keyboard_target.cpp
-===================================================================
---- sooperlooper.orig/src/gui/keyboard_target.cpp
-+++ sooperlooper/src/gui/keyboard_target.cpp
-@@ -553,10 +553,10 @@ KeyboardTarget::keycode_from_name (const
- keycode = WXK_RETURN;
- }
- else if ( keyname == wxT("PGUP") ) {
-- keycode = WXK_PRIOR;
-+ keycode = WXK_PAGEUP;
- }
- else if ( keyname == wxT("PGDN") ) {
-- keycode = WXK_NEXT;
-+ keycode = WXK_PAGEDOWN;
- }
- else if ( keyname == wxT("LEFT") ) {
- keycode = WXK_LEFT;
-@@ -630,10 +630,10 @@ wxString KeyboardTarget::name_from_keyco
- case WXK_RETURN:
- text += wxT("return");
- break;
-- case WXK_PRIOR:
-+ case WXK_PAGEUP:
- text += wxT("pageup");
- break;
-- case WXK_NEXT:
-+ case WXK_PAGEDOWN:
- text += wxT("pagedown");
- break;
- case WXK_LEFT:
-Index: sooperlooper/src/gui/check_box.cpp
-===================================================================
---- sooperlooper.orig/src/gui/check_box.cpp
-+++ sooperlooper/src/gui/check_box.cpp
-@@ -237,7 +237,7 @@ CheckBox::OnMouseEvents (wxMouseEvent &e
- }
- else if (ev.LeftUp())
- {
-- if (bounds.Inside(ev.GetPosition())) {
-+ if (bounds.Contains(ev.GetPosition())) {
- // toggle value
- _value = !_value;
-
-Index: sooperlooper/src/gui/midi_bind_panel.cpp
-===================================================================
---- sooperlooper.orig/src/gui/midi_bind_panel.cpp
-+++ sooperlooper/src/gui/midi_bind_panel.cpp
-@@ -880,7 +880,7 @@ void MidiBindPanel::on_button (wxCommand
- }
- else if (ev.GetId() == ID_LoadButton)
- {
-- wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to open"), wxT(""), wxT("*.slb"), wxOPEN|wxCHANGE_DIR);
-+ wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to open"), wxT(""), wxT("*.slb"), wxFD_OPEN|wxFD_CHANGE_DIR);
- if ( !filename.empty() )
- {
- _parent->get_loop_control().load_midi_bindings(filename, _append_check->GetValue());
-@@ -888,7 +888,7 @@ void MidiBindPanel::on_button (wxCommand
- }
- else if (ev.GetId() == ID_SaveButton)
- {
-- wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to save"), wxT(""), wxT("*.slb"), wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
-+ wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to save"), wxT(""), wxT("*.slb"), wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);
-
- if ( !filename.empty() )
- {
-Index: sooperlooper/src/gui/config_panel.cpp
-===================================================================
---- sooperlooper.orig/src/gui/config_panel.cpp
-+++ sooperlooper/src/gui/config_panel.cpp
-@@ -378,7 +378,7 @@ void ConfigPanel::on_button (wxCommandEv
- else if (ev.GetId() == ID_MidiBrowseButton) {
-
- _parent->get_keyboard().set_enabled(false);
-- wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to use"), wxT(""), wxT("*.slb"), wxOPEN|wxCHANGE_DIR);
-+ wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to use"), wxT(""), wxT("*.slb"), wxFD_OPEN|wxFD_CHANGE_DIR);
- _parent->get_keyboard().set_enabled(true);
-
- if ( !filename.empty() )
-@@ -389,8 +389,8 @@ void ConfigPanel::on_button (wxCommandEv
- else if (ev.GetId() == ID_SessionBrowseButton) {
-
- _parent->get_keyboard().set_enabled(false);
-- wxString filename = _parent->do_file_selector(wxT("Choose session file to use"), wxT(""), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
-- //wxString filename = wxFileSelector(wxT("Choose session file to use"), wxT(""), wxT(""), wxT(""), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
-+ wxString filename = _parent->do_file_selector(wxT("Choose session file to use"), wxT(""), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);
-+ //wxString filename = wxFileSelector(wxT("Choose session file to use"), wxT(""), wxT(""), wxT(""), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);
- _parent->get_keyboard().set_enabled(true);
-
- if ( !filename.empty() )
diff --git a/gnu/packages/patches/sphinxbase-fix-doxygen.patch b/gnu/packages/patches/sphinxbase-fix-doxygen.patch
new file mode 100644
index 0000000000..c8ebc52628
--- /dev/null
+++ b/gnu/packages/patches/sphinxbase-fix-doxygen.patch
@@ -0,0 +1,24 @@
+https://github.com/cmusphinx/sphinxbase/commit/6989c52a3fb9473fd61326e548440fff887525c2
+
+commit 6989c52a3fb9473fd61326e548440fff887525c2
+Author: Michel Zou <xantares09@hotmail.com>
+Date: Thu Feb 6 07:02:06 2020 +0100
+
+ Fix doxy2swig.py IndexError: list index out of range
+
+diff --git a/doc/doxy2swig.py b/doc/doxy2swig.py
+index 5589b0d..a01c4b1 100644
+--- a/doc/doxy2swig.py
++++ b/doc/doxy2swig.py
+@@ -299,7 +299,10 @@ class Doxy2SWIG:
+ name = first['name'].firstChild.data
+
+ for n in node.getElementsByTagName('param'):
+- arg_type = n.getElementsByTagName('type')[0]
++ elts = n.getElementsByTagName('type')
++ if len(elts) == 0:
++ continue
++ arg_type = elts[0]
+ ref = self.get_specific_nodes(arg_type, ('ref'))
+ if 'ref' in ref:
+ type_name = ref['ref'].firstChild.data
diff --git a/gnu/packages/patches/sssd-system-directories.patch b/gnu/packages/patches/sssd-system-directories.patch
new file mode 100644
index 0000000000..f2ab0182e1
--- /dev/null
+++ b/gnu/packages/patches/sssd-system-directories.patch
@@ -0,0 +1,56 @@
+Do not attempt to create $localstatedir and $sysconfdir (i.e., /var and /etc)
+upon "make install".
+
+diff --git a/Makefile.in b/Makefile.in
+index c32cb7d..77a5c00 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -7991,7 +7991,7 @@ sssdconfdir = $(sysconfdir)/sssd
+ sssddatadir = $(datadir)/sssd
+ sssdapiplugindir = $(sssddatadir)/sssd.api.d
+ sssdtapscriptdir = $(sssddatadir)/systemtap
+-dbuspolicydir = $(sysconfdir)/dbus-1/system.d
++dbuspolicydir = $(prefix)/etc/dbus-1/system.d
+ dbusservicedir = $(datadir)/dbus-1/system-services
+ sss_statedir = $(localstatedir)/lib/sss
+ pamlibdir = @pammoddir@
+@@ -8000,7 +8000,7 @@ nfslibdir = @nfsidmaplibdir@
+ keytabdir = $(sss_statedir)/keytabs
+ pkgconfigdir = $(libdir)/pkgconfig
+ sudolibdir = @sudolibpath@
+-pamconfdir = $(sysconfdir)/pam.d
++pamconfdir = $(prefix)/etc/pam.d
+ systemtap_tapdir = @tapset_dir@
+ sssdkcmdatadir = $(datadir)/sssd-kcm
+ deskprofilepath = $(sss_statedir)/deskprofile
+@@ -43733,7 +43733,6 @@ installsssddirs::
+ $(DESTDIR)$(bindir) \
+ $(DESTDIR)$(sbindir) \
+ $(DESTDIR)$(mandir) \
+- $(DESTDIR)$(pidpath) \
+ $(DESTDIR)$(pluginpath) \
+ $(DESTDIR)$(libdir)/ldb \
+ $(DESTDIR)$(dbuspolicydir) \
+@@ -43743,22 +43742,9 @@ installsssddirs::
+ $(DESTDIR)$(sssddatadir) \
+ $(DESTDIR)$(sudolibdir) \
+ $(DESTDIR)$(autofslibdir) \
+- $(DESTDIR)$(pipepath)/private \
+- $(SSSD_USER_DIRS) \
+ $(NULL);
+ @SSSD_USER_TRUE@ -chown $(SSSD_USER):$(SSSD_USER) $(SSSD_USER_DIRS)
+ @SSSD_USER_TRUE@ -chown $(SSSD_USER) $(DESTDIR)$(pipepath)/private
+- $(INSTALL) -d -m 0700 $(DESTDIR)$(dbpath) $(DESTDIR)$(logpath) \
+- $(DESTDIR)$(keytabdir) \
+- $(NULL)
+- $(INSTALL) -d -m 0750 $(DESTDIR)$(pipepath)/private
+- $(INSTALL) -d -m 0755 $(DESTDIR)$(mcpath) $(DESTDIR)$(pipepath) \
+- $(DESTDIR)$(pubconfpath) \
+- $(DESTDIR)$(pubconfpath)/krb5.include.d $(DESTDIR)$(gpocachepath)
+- $(INSTALL) -d -m 0711 $(DESTDIR)$(sssdconfdir) \
+- $(DESTDIR)$(sssdconfdir)/conf.d \
+- $(DESTDIR)$(sssdconfdir)/pki
+-@BUILD_SECRETS_TRUE@ $(MKDIR_P) $(DESTDIR)$(secdbpath)
+
+ @HAVE_DOXYGEN_TRUE@docs:
+ @HAVE_DOXYGEN_TRUE@ $(DOXYGEN) src/doxy.config
diff --git a/gnu/packages/patches/transcode-ffmpeg.patch b/gnu/packages/patches/transcode-ffmpeg.patch
new file mode 100644
index 0000000000..c547cbad2b
--- /dev/null
+++ b/gnu/packages/patches/transcode-ffmpeg.patch
@@ -0,0 +1,1408 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2018-05-14
+Initial Package Version: 1.1.7
+Upstream Status: Defunct
+Origin: From gentoo.
+Description: Accumulated fixes to build with ffmpeg-4.0 (but only
+with the limited functionality we had before).
+
+diff -Naur a/encode/encode_lavc.c b/encode/encode_lavc.c
+--- a/encode/encode_lavc.c 2011-11-19 16:50:27.000000000 +0000
++++ b/encode/encode_lavc.c 2018-05-14 01:58:58.346408791 +0100
+@@ -74,6 +74,16 @@
+ int lmin;
+ int lmax;
+ int me_method;
++ int luma_elim_threshold;
++ int chroma_elim_threshold;
++ int quantizer_noise_shaping;
++ int inter_quant_bias;
++ int intra_quant_bias;
++ int scenechange_factor;
++ int rc_strategy;
++ float rc_initial_cplx;
++ float rc_qsquish;
++ float border_masking;
+
+ /* same as above for flags */
+ struct {
+@@ -114,6 +124,7 @@
+
+ AVFrame ff_venc_frame;
+ AVCodecContext ff_vcontext;
++ AVDictionary * ff_opts;
+
+ AVCodec *ff_vcodec;
+
+@@ -164,6 +175,7 @@
+ TC_CODEC_ERROR
+ };
+
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ static const enum CodecID tc_lavc_internal_codecs[] = {
+ CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO, CODEC_ID_MPEG4,
+ CODEC_ID_H263I, CODEC_ID_H263P,
+@@ -176,6 +188,20 @@
+ CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3,
+ CODEC_ID_NONE
+ };
++#else
++static const enum AVCodecID tc_lavc_internal_codecs[] = {
++ AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, AV_CODEC_ID_MPEG4,
++ AV_CODEC_ID_H263I, AV_CODEC_ID_H263P,
++ AV_CODEC_ID_H264,
++ AV_CODEC_ID_WMV1, AV_CODEC_ID_WMV2,
++ AV_CODEC_ID_RV10,
++ AV_CODEC_ID_HUFFYUV, AV_CODEC_ID_FFV1,
++ AV_CODEC_ID_DVVIDEO,
++ AV_CODEC_ID_MJPEG, AV_CODEC_ID_LJPEG,
++ AV_CODEC_ID_MSMPEG4V2, AV_CODEC_ID_MSMPEG4V3,
++ AV_CODEC_ID_NONE
++};
++#endif
+
+ static const TCFormatID tc_lavc_formats[] = { TC_FORMAT_ERROR };
+
+@@ -214,7 +240,7 @@
+ vframe_list_t *vframe)
+ {
+ avpicture_fill((AVPicture *)&pd->ff_venc_frame, vframe->video_buf,
+- PIX_FMT_YUV420P,
++ AV_PIX_FMT_YUV420P,
+ pd->ff_vcontext.width, pd->ff_vcontext.height);
+ }
+
+@@ -228,7 +254,7 @@
+ IMG_YUV_DEFAULT,
+ pd->ff_vcontext.width, pd->ff_vcontext.height);
+ avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf,
+- PIX_FMT_YUV422P,
++ AV_PIX_FMT_YUV422P,
+ pd->ff_vcontext.width, pd->ff_vcontext.height);
+ ac_imgconvert(src, IMG_YUV_DEFAULT,
+ pd->ff_venc_frame.data, IMG_YUV422P,
+@@ -244,7 +270,7 @@
+ IMG_YUV422P,
+ pd->ff_vcontext.width, pd->ff_vcontext.height);
+ avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf,
+- PIX_FMT_YUV420P,
++ AV_PIX_FMT_YUV420P,
+ pd->ff_vcontext.width, pd->ff_vcontext.height);
+ ac_imgconvert(src, IMG_YUV422P,
+ pd->ff_venc_frame.data, IMG_YUV420P,
+@@ -266,7 +292,7 @@
+ vframe_list_t *vframe)
+ {
+ avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf,
+- PIX_FMT_YUV420P,
++ AV_PIX_FMT_YUV420P,
+ pd->ff_vcontext.width, pd->ff_vcontext.height);
+ ac_imgconvert(&vframe->video_buf, IMG_RGB_DEFAULT,
+ pd->ff_venc_frame.data, IMG_YUV420P,
+@@ -596,15 +622,15 @@
+ } else {
+ pd->tc_pix_fmt = TC_CODEC_YUV420P;
+ pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG)
+- ? PIX_FMT_YUVJ420P
+- : PIX_FMT_YUV420P;
++ ? AV_PIX_FMT_YUVJ420P
++ : AV_PIX_FMT_YUV420P;
+ pd->pre_encode_video = pre_encode_video_yuv420p;
+ }
+ break;
+ case CODEC_YUV422:
+ pd->tc_pix_fmt = TC_CODEC_YUV422P;
+ pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG)
+- ? PIX_FMT_YUVJ422P
++ ? AV_PIX_FMT_YUVJ422P
+ : PIX_FMT_YUV422P;
+ if (TC_VCODEC_ID(pd) == TC_CODEC_HUFFYUV) {
+ pd->pre_encode_video = pre_encode_video_yuv422p_huffyuv;
+@@ -617,8 +643,8 @@
+ pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_HUFFYUV)
+ ? PIX_FMT_YUV422P
+ : (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG)
+- ? PIX_FMT_YUVJ420P
+- : PIX_FMT_YUV420P;
++ ? AV_PIX_FMT_YUVJ420P
++ : AV_PIX_FMT_YUV420P;
+ pd->pre_encode_video = pre_encode_video_rgb24;
+ break;
+ default:
+@@ -665,7 +691,7 @@
+ switch (vob->divxmultipass) {
+ case 1:
+ CAN_DO_MULTIPASS(multipass_flag);
+- pd->ff_vcontext.flags |= CODEC_FLAG_PASS1;
++ pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS1;
+ pd->stats_file = fopen(vob->divxlogfile, "w");
+ if (pd->stats_file == NULL) {
+ tc_log_error(MOD_NAME, "could not create 2pass log file"
+@@ -675,7 +701,7 @@
+ break;
+ case 2:
+ CAN_DO_MULTIPASS(multipass_flag);
+- pd->ff_vcontext.flags |= CODEC_FLAG_PASS2;
++ pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS2;
+ pd->stats_file = fopen(vob->divxlogfile, "r");
+ if (pd->stats_file == NULL){
+ tc_log_error(MOD_NAME, "could not open 2pass log file \"%s\""
+@@ -704,7 +730,7 @@
+ break;
+ case 3:
+ /* fixed qscale :p */
+- pd->ff_vcontext.flags |= CODEC_FLAG_QSCALE;
++ pd->ff_vcontext.flags |= AV_CODEC_FLAG_QSCALE;
+ pd->ff_venc_frame.quality = vob->divxbitrate;
+ break;
+ }
+@@ -937,7 +963,11 @@
+ static void tc_lavc_config_defaults(TCLavcPrivateData *pd)
+ {
+ /* first of all reinitialize lavc data */
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ avcodec_get_context_defaults(&pd->ff_vcontext);
++#else
++ avcodec_get_context_defaults3(&pd->ff_vcontext, NULL);
++#endif
+
+ pd->confdata.thread_count = 1;
+
+@@ -947,7 +977,7 @@
+ pd->confdata.rc_buffer_size = 0;
+ pd->confdata.lmin = 2;
+ pd->confdata.lmax = 31;
+- pd->confdata.me_method = ME_EPZS;
++ pd->confdata.me_method = 0;
+
+ memset(&pd->confdata.flags, 0, sizeof(pd->confdata.flags));
+ pd->confdata.turbo_setup = 0;
+@@ -962,12 +992,12 @@
+ pd->ff_vcontext.me_range = 0;
+ pd->ff_vcontext.mb_decision = 0;
+ pd->ff_vcontext.scenechange_threshold = 0;
+- pd->ff_vcontext.scenechange_factor = 1;
++ pd->confdata.scenechange_factor = 1;
+ pd->ff_vcontext.b_frame_strategy = 0;
+ pd->ff_vcontext.b_sensitivity = 40;
+ pd->ff_vcontext.brd_scale = 0;
+ pd->ff_vcontext.bidir_refine = 0;
+- pd->ff_vcontext.rc_strategy = 2;
++ pd->confdata.rc_strategy = 2;
+ pd->ff_vcontext.b_quant_factor = 1.25;
+ pd->ff_vcontext.i_quant_factor = 0.8;
+ pd->ff_vcontext.b_quant_offset = 1.25;
+@@ -975,10 +1005,10 @@
+ pd->ff_vcontext.qblur = 0.5;
+ pd->ff_vcontext.qcompress = 0.5;
+ pd->ff_vcontext.mpeg_quant = 0;
+- pd->ff_vcontext.rc_initial_cplx = 0.0;
+- pd->ff_vcontext.rc_qsquish = 1.0;
+- pd->ff_vcontext.luma_elim_threshold = 0;
+- pd->ff_vcontext.chroma_elim_threshold = 0;
++ pd->confdata.rc_initial_cplx = 0.0;
++ pd->confdata.rc_qsquish = 1.0;
++ pd->confdata.luma_elim_threshold = 0;
++ pd->confdata.chroma_elim_threshold = 0;
+ pd->ff_vcontext.strict_std_compliance = 0;
+ pd->ff_vcontext.dct_algo = FF_DCT_AUTO;
+ pd->ff_vcontext.idct_algo = FF_IDCT_AUTO;
+@@ -987,7 +1017,7 @@
+ pd->ff_vcontext.temporal_cplx_masking = 0.0;
+ pd->ff_vcontext.spatial_cplx_masking = 0.0;
+ pd->ff_vcontext.p_masking = 0.0;
+- pd->ff_vcontext.border_masking = 0.0;
++ pd->confdata.border_masking = 0.0;
+ pd->ff_vcontext.me_pre_cmp = 0;
+ pd->ff_vcontext.me_cmp = 0;
+ pd->ff_vcontext.me_sub_cmp = 0;
+@@ -999,10 +1029,8 @@
+ pd->ff_vcontext.pre_me = 1;
+ pd->ff_vcontext.me_subpel_quality = 8;
+ pd->ff_vcontext.refs = 1;
+- pd->ff_vcontext.intra_quant_bias = FF_DEFAULT_QUANT_BIAS;
+- pd->ff_vcontext.inter_quant_bias = FF_DEFAULT_QUANT_BIAS;
+ pd->ff_vcontext.noise_reduction = 0;
+- pd->ff_vcontext.quantizer_noise_shaping = 0;
++ pd->confdata.quantizer_noise_shaping = 0;
+ pd->ff_vcontext.flags = 0;
+ }
+
+@@ -1023,27 +1051,22 @@
+ */
+ static void tc_lavc_dispatch_settings(TCLavcPrivateData *pd)
+ {
++ char buf[1024];
+ /* some translation... */
+ pd->ff_vcontext.bit_rate_tolerance = pd->confdata.vrate_tolerance * 1000;
+ pd->ff_vcontext.rc_min_rate = pd->confdata.rc_min_rate * 1000;
+ pd->ff_vcontext.rc_max_rate = pd->confdata.rc_max_rate * 1000;
+ pd->ff_vcontext.rc_buffer_size = pd->confdata.rc_buffer_size * 1024;
+- pd->ff_vcontext.lmin = (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5);
+- pd->ff_vcontext.lmax = (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5);
+- pd->ff_vcontext.me_method = ME_ZERO + pd->confdata.me_method;
++ snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5));
++ av_dict_set(&(pd->ff_opts), "lmin", buf, 0);
++ snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5));
++ av_dict_set(&(pd->ff_opts), "lmax", buf, 0);
+
+ pd->ff_vcontext.flags = 0;
+- SET_FLAG(pd, mv0);
+- SET_FLAG(pd, cbp);
+ SET_FLAG(pd, qpel);
+- SET_FLAG(pd, alt);
+- SET_FLAG(pd, vdpart);
+- SET_FLAG(pd, naq);
+ SET_FLAG(pd, ilme);
+ SET_FLAG(pd, ildct);
+ SET_FLAG(pd, aic);
+- SET_FLAG(pd, aiv);
+- SET_FLAG(pd, umv);
+ SET_FLAG(pd, psnr);
+ SET_FLAG(pd, trell);
+ SET_FLAG(pd, gray);
+@@ -1061,9 +1084,49 @@
+ }
+ if (pd->interlacing.active) {
+ /* enforce interlacing */
+- pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_DCT;
+- pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_ME;
++ pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_DCT;
++ pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_ME;
++ }
++ if (pd->confdata.flags.alt) {
++ av_dict_set(&(pd->ff_opts), "alternate_scan", "1", 0);
+ }
++ if (pd->confdata.flags.vdpart) {
++ av_dict_set(&(pd->ff_opts), "data_partitioning", "1", 0);
++ }
++ if (pd->confdata.flags.umv) {
++ av_dict_set(&(pd->ff_opts), "umv", "1", 0);
++ }
++ if (pd->confdata.flags.aiv) {
++ av_dict_set(&(pd->ff_opts), "aiv", "1", 0);
++ }
++ if (pd->confdata.flags.cbp) {
++ av_dict_set(&(pd->ff_opts), "mpv_flags", "+cbp_rd", 0);
++ }
++ if (pd->confdata.flags.mv0) {
++ av_dict_set(&(pd->ff_opts), "mpv_flags", "+mv0", 0);
++ }
++ if (pd->confdata.flags.naq) {
++ av_dict_set(&(pd->ff_opts), "mpv_flags", "+naq", 0);
++ }
++
++#define set_dict_opt(val, opt) \
++ snprintf(buf, sizeof(buf), "%i", pd->confdata.val);\
++ av_dict_set(&(pd->ff_opts), opt, buf, 0)
++#define set_dict_float_opt(val, opt) \
++ snprintf(buf, sizeof(buf), "%f", pd->confdata.val);\
++ av_dict_set(&(pd->ff_opts), opt, buf, 0)
++
++ set_dict_opt(luma_elim_threshold, "luma_elim_threshold");
++ set_dict_opt(chroma_elim_threshold, "chroma_elim_threshold");
++ set_dict_opt(quantizer_noise_shaping, "quantizer_noise_shaping");
++ set_dict_opt(inter_quant_bias, "pbias");
++ set_dict_opt(intra_quant_bias, "ibias");
++ set_dict_opt(me_method, "me_method");
++ set_dict_opt(scenechange_factor, "sc_factor");
++ set_dict_opt(rc_strategy, "rc_strategy");
++ set_dict_float_opt(rc_initial_cplx, "rc_init_cplx");
++ set_dict_float_opt(rc_qsquish, "qsquish");
++ set_dict_float_opt(border_masking, "border_mask");
+ }
+
+ #undef SET_FLAG
+@@ -1121,12 +1184,12 @@
+ { "lmin", PAUX(lmin), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 },
+ { "lmax", PAUX(lmax), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 },
+ { "vqdiff", PCTX(max_qdiff), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31 },
+- { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES },
++ { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX },
+ { "vme", PAUX(me_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16, },
+ { "me_range", PCTX(me_range), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000 },
+ { "mbd", PCTX(mb_decision), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
+ { "sc_threshold", PCTX(scenechange_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000 },
+- { "sc_factor", PCTX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 },
++ { "sc_factor", PAUX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 },
+ { "vb_strategy", PCTX(b_frame_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
+ { "b_sensitivity", PCTX(b_sensitivity), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 100 },
+ { "brd_scale", PCTX(brd_scale), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
+@@ -1137,7 +1200,7 @@
+ { "vrc_maxrate", PAUX(rc_max_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 },
+ { "vrc_minrate", PAUX(rc_min_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 },
+ { "vrc_buf_size", PAUX(rc_buffer_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000 },
+- { "vrc_strategy", PCTX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 },
++ { "vrc_strategy", PAUX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 },
+ { "vb_qfactor", PCTX(b_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 },
+ { "vi_qfactor", PCTX(i_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 },
+ { "vb_qoffset", PCTX(b_quant_offset), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0 },
+@@ -1147,11 +1210,11 @@
+ { "mpeg_quant", PCTX(mpeg_quant), TCCONF_TYPE_FLAG, 0, 0, 1 },
+ // { "vrc_eq", }, // not yet supported
+ { "vrc_override", rc_override_buf, TCCONF_TYPE_STRING, 0, 0, 0 },
+- { "vrc_init_cplx", PCTX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 },
++ { "vrc_init_cplx", PAUX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 },
+ // { "vrc_init_occupancy", }, // not yet supported
+- { "vqsquish", PCTX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 },
+- { "vlelim", PCTX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
+- { "vcelim", PCTX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
++ { "vqsquish", PAUX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 },
++ { "vlelim", PAUX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
++ { "vcelim", PAUX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
+ { "vstrict", PCTX(strict_std_compliance), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
+ { "vpsize", PCTX(rtp_payload_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000 },
+ { "dct", PCTX(dct_algo), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
+@@ -1161,7 +1224,7 @@
+ { "tcplx_mask", PCTX(temporal_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+ { "scplx_mask", PCTX(spatial_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+ { "p_mask", PCTX(p_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+- { "border_mask", PCTX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
++ { "border_mask", PAUX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+ { "pred", PCTX(prediction_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 4 },
+ { "precmp", PCTX(me_pre_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 },
+ { "cmp", PCTX(me_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 },
+@@ -1174,37 +1237,37 @@
+ { "pre_me", PCTX(pre_me), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+ { "subq", PCTX(me_subpel_quality), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8 },
+ { "refs", PCTX(refs), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 8 },
+- { "ibias", PCTX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
+- { "pbias", PCTX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
++ { "ibias", PAUX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
++ { "pbias", PAUX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
+ { "nr", PCTX(noise_reduction), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
+- { "qns", PCTX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
++ { "qns", PAUX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
+ { "inter_matrix_file", inter_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 },
+ { "intra_matrix_file", intra_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 },
+
+- { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0 },
+- { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD },
+- { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL },
+- { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN },
+- { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME },
+- { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_DCT },
+- { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_NORMALIZE_AQP },
+- { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART },
++ { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, 1 },
++ { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, 1 },
++ { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL },
++ { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, 1 },
++ { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME },
++ { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_DCT },
++ { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, 1 },
++ { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, 1 },
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC },
+ #else
+- { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED },
++ { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED },
+ #endif
+- { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIV },
+- { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV },
+- { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR },
++ { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, 1 },
++ { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, 1 },
++ { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR },
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ { "trell", PAUX(flags.trell), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT },
+ #else
+ { "trell", PCTX(trellis), TCCONF_TYPE_FLAG, 0, 0, 1 },
+ #endif
+- { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GRAY },
+- { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV },
+- { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP },
++ { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY },
++ { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV },
++ { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP },
+
+ // { "turbo", PAUX(turbo_setup), TCCONF_TYPE_FLAG, 0, 0, 1 }, // not yet supported
+ /* End of the config file */
+@@ -1345,6 +1408,8 @@
+
+ pd = self->userdata;
+
++ pd->ff_opts = NULL;
++
+ pd->flush_flag = vob->encoder_flush;
+
+ /* FIXME: move into core? */
+@@ -1387,7 +1452,7 @@
+ pd->confdata.thread_count,
+ (pd->confdata.thread_count > 1) ?"s" :"");
+ }
+- avcodec_thread_init(&pd->ff_vcontext, pd->confdata.thread_count);
++ pd->ff_vcontext.thread_count = pd->confdata.thread_count;
+
+ pd->ff_vcodec = avcodec_find_encoder(FF_VCODEC_ID(pd));
+ if (pd->ff_vcodec == NULL) {
+@@ -1397,11 +1462,11 @@
+ }
+
+ TC_LOCK_LIBAVCODEC;
+- ret = avcodec_open(&pd->ff_vcontext, pd->ff_vcodec);
++ ret = avcodec_open2(&pd->ff_vcontext, pd->ff_vcodec, &(pd->ff_opts));
+ TC_UNLOCK_LIBAVCODEC;
+
+ if (ret < 0) {
+- tc_log_error(MOD_NAME, "avcodec_open() failed");
++ tc_log_error(MOD_NAME, "avcodec_open2() failed");
+ goto failed;
+ }
+ /* finally, pass up the extradata, if any */
+diff -Naur a/export/aud_aux.c b/export/aud_aux.c
+--- a/export/aud_aux.c 2011-11-19 16:50:27.000000000 +0000
++++ b/export/aud_aux.c 2018-05-14 01:58:58.346408791 +0100
+@@ -326,10 +326,18 @@
+
+ switch (o_codec) {
+ case 0x50:
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ codeid = CODEC_ID_MP2;
++#else
++ codeid = AV_CODEC_ID_MP2;
++#endif
+ break;
+ case 0x2000:
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ codeid = CODEC_ID_AC3;
++#else
++ codeid = AV_CODEC_ID_AC3;
++#endif
+ break;
+ default:
+ tc_warn("cannot init ffmpeg with %x", o_codec);
+@@ -346,7 +354,7 @@
+
+ //-- set parameters (bitrate, channels and sample-rate) --
+ //--------------------------------------------------------
+- avcodec_get_context_defaults(&mpa_ctx);
++ avcodec_get_context_defaults3(&mpa_ctx, mpa_codec);
+ #if LIBAVCODEC_VERSION_MAJOR < 53
+ mpa_ctx.codec_type = CODEC_TYPE_AUDIO;
+ #else
+@@ -359,11 +367,16 @@
+ //-- open codec --
+ //----------------
+ TC_LOCK_LIBAVCODEC;
+- ret = avcodec_open(&mpa_ctx, mpa_codec);
++ ret = avcodec_open2(&mpa_ctx, mpa_codec, NULL);
+ TC_UNLOCK_LIBAVCODEC;
+ if (ret < 0) {
+ tc_warn("tc_audio_init_ffmpeg: could not open %s codec !",
+- (codeid == CODEC_ID_MP2) ?"mpa" :"ac3");
++#if LIBAVCODEC_VERSION_MAJOR < 55
++ (codeid == CODEC_ID_MP2)
++#else
++ (codeid == AV_CODEC_ID_MP2)
++#endif
++ ?"mpa" :"ac3");
+ return(TC_EXPORT_ERROR);
+ }
+
+diff -Naur a/export/export_ffmpeg.c b/export/export_ffmpeg.c
+--- a/export/export_ffmpeg.c 2011-11-19 16:50:27.000000000 +0000
++++ b/export/export_ffmpeg.c 2018-05-14 01:58:58.346408791 +0100
+@@ -122,6 +122,7 @@
+ static AVFrame *lavc_convert_frame = NULL;
+
+ static AVCodec *lavc_venc_codec = NULL;
++static AVDictionary *lavc_venc_opts = NULL;
+ static AVFrame *lavc_venc_frame = NULL;
+ static AVCodecContext *lavc_venc_context;
+ static avi_t *avifile = NULL;
+@@ -180,7 +181,7 @@
+
+
+ /* START: COPIED FROM ffmpeg-0.5_p22846(ffmpeg.c, cmdutils.c) */
+-#include <libavcodec/opt.h>
++#include <libavutil/opt.h>
+ #include <libavutil/avstring.h>
+ #include <libswscale/swscale.h>
+
+@@ -321,7 +322,7 @@
+ }
+
+ if(!f){
+- fprintf(stderr, "File for preset '%s' not found\n", arg);
++ tc_log_error(MOD_NAME, "File for preset '%s' not found", arg);
+ av_exit(1);
+ }
+
+@@ -470,7 +471,6 @@
+ }
+
+ TC_LOCK_LIBAVCODEC;
+- avcodec_init();
+ avcodec_register_all();
+ TC_UNLOCK_LIBAVCODEC;
+
+@@ -486,11 +486,11 @@
+ codec->name, codec->fourCC, codec->comments);
+ }
+
+- lavc_venc_context = avcodec_alloc_context();
++ lavc_venc_context = avcodec_alloc_context3(lavc_venc_codec);
+ lavc_venc_frame = avcodec_alloc_frame();
+
+ lavc_convert_frame= avcodec_alloc_frame();
+- size = avpicture_get_size(PIX_FMT_RGB24, vob->ex_v_width, vob->ex_v_height);
++ size = avpicture_get_size(AV_PIX_FMT_RGB24, vob->ex_v_width, vob->ex_v_height);
+ enc_buffer = tc_malloc(size);
+
+ if (lavc_venc_context == NULL || !enc_buffer || !lavc_convert_frame) {
+@@ -634,7 +634,7 @@
+ lavc_param_rc_max_rate = 2516;
+ lavc_param_rc_buffer_size = 224 * 8;
+ lavc_param_rc_buffer_aggressivity = 99;
+- lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
++ lavc_param_scan_offset = 1;
+
+ break;
+
+@@ -674,7 +674,7 @@
+
+ lavc_param_rc_buffer_size = 224 * 8;
+ lavc_param_rc_buffer_aggressivity = 99;
+- lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
++ lavc_param_scan_offset = 1;
+
+ break;
+
+@@ -828,18 +828,35 @@
+
+ lavc_venc_context->bit_rate = vob->divxbitrate * 1000;
+ lavc_venc_context->bit_rate_tolerance = lavc_param_vrate_tolerance * 1000;
+- lavc_venc_context->lmin= (int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5);
+- lavc_venc_context->lmax= (int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5);
+ lavc_venc_context->max_qdiff = lavc_param_vqdiff;
+ lavc_venc_context->qcompress = lavc_param_vqcompress;
+ lavc_venc_context->qblur = lavc_param_vqblur;
+ lavc_venc_context->max_b_frames = lavc_param_vmax_b_frames;
+ lavc_venc_context->b_quant_factor = lavc_param_vb_qfactor;
+- lavc_venc_context->rc_strategy = lavc_param_vrc_strategy;
+ lavc_venc_context->b_frame_strategy = lavc_param_vb_strategy;
+ lavc_venc_context->b_quant_offset = lavc_param_vb_qoffset;
+- lavc_venc_context->luma_elim_threshold= lavc_param_luma_elim_threshold;
+- lavc_venc_context->chroma_elim_threshold= lavc_param_chroma_elim_threshold;
++
++ char buf[1024];
++#define set_dict_opt(val, opt) \
++ snprintf(buf, sizeof(buf), "%i", val); \
++ av_dict_set(&lavc_venc_opts, opt, buf, 0)
++#define set_dict_float_opt(val, opt) \
++ snprintf(buf, sizeof(buf), "%f", val); \
++ av_dict_set(&lavc_venc_opts, opt, buf, 0)
++ set_dict_opt(lavc_param_luma_elim_threshold, "luma_elim_threshold");
++ set_dict_opt(lavc_param_chroma_elim_threshold, "chroma_elim_threshold");
++ set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5), "lmin");
++ set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5), "lmax");
++ set_dict_opt(lavc_param_vrc_strategy, "rc_strategy");
++ set_dict_float_opt(lavc_param_rc_qsquish, "qsquish");
++ set_dict_float_opt(lavc_param_rc_qmod_amp, "rc_qmod_amp");
++ set_dict_opt(lavc_param_rc_qmod_freq, "rc_qmod_freq");
++ set_dict_opt(lavc_param_rc_eq, "rc_eq");
++ set_dict_opt(lavc_param_vme, "me_method");
++ set_dict_opt(lavc_param_ibias, "ibias");
++ set_dict_opt(lavc_param_pbias, "pbias");
++ set_dict_float_opt(lavc_param_rc_buffer_aggressivity, "rc_buf_aggressivity");
++ set_dict_float_opt(lavc_param_rc_initial_cplx, "rc_init_cplx");
+ lavc_venc_context->rtp_payload_size = lavc_param_packet_size;
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ if (lavc_param_packet_size)
+@@ -848,15 +865,9 @@
+ lavc_venc_context->strict_std_compliance= lavc_param_strict;
+ lavc_venc_context->i_quant_factor = lavc_param_vi_qfactor;
+ lavc_venc_context->i_quant_offset = lavc_param_vi_qoffset;
+- lavc_venc_context->rc_qsquish = lavc_param_rc_qsquish;
+- lavc_venc_context->rc_qmod_amp = lavc_param_rc_qmod_amp;
+- lavc_venc_context->rc_qmod_freq = lavc_param_rc_qmod_freq;
+- lavc_venc_context->rc_eq = lavc_param_rc_eq;
+ lavc_venc_context->rc_max_rate = lavc_param_rc_max_rate * 1000;
+ lavc_venc_context->rc_min_rate = lavc_param_rc_min_rate * 1000;
+ lavc_venc_context->rc_buffer_size = lavc_param_rc_buffer_size * 1024;
+- lavc_venc_context->rc_buffer_aggressivity= lavc_param_rc_buffer_aggressivity;
+- lavc_venc_context->rc_initial_cplx = lavc_param_rc_initial_cplx;
+ lavc_venc_context->debug = lavc_param_debug;
+ lavc_venc_context->last_predictor_count= lavc_param_last_pred;
+ lavc_venc_context->pre_me = lavc_param_pre_me;
+@@ -864,13 +875,11 @@
+ lavc_venc_context->pre_dia_size = lavc_param_pre_dia_size;
+ lavc_venc_context->me_subpel_quality = lavc_param_me_subpel_quality;
+ lavc_venc_context->me_range = lavc_param_me_range;
+- lavc_venc_context->intra_quant_bias = lavc_param_ibias;
+- lavc_venc_context->inter_quant_bias = lavc_param_pbias;
+ lavc_venc_context->coder_type = lavc_param_coder;
+ lavc_venc_context->context_model = lavc_param_context;
+ lavc_venc_context->scenechange_threshold= lavc_param_sc_threshold;
+ lavc_venc_context->noise_reduction = lavc_param_noise_reduction;
+- lavc_venc_context->inter_threshold = lavc_param_inter_threshold;
++ set_dict_opt(lavc_param_inter_threshold, "inter_threshold");
+ lavc_venc_context->intra_dc_precision = lavc_param_intra_dc_precision;
+ lavc_venc_context->skip_top = lavc_param_skip_top;
+ lavc_venc_context->skip_bottom = lavc_param_skip_bottom;
+@@ -887,7 +896,7 @@
+ lavc_venc_context->thread_count);
+ }
+
+- avcodec_thread_init(lavc_venc_context, lavc_param_threads);
++ lavc_venc_context->thread_count = lavc_param_threads;
+
+ if (lavc_param_intra_matrix) {
+ char *tmp;
+@@ -1065,15 +1074,14 @@
+ lavc_venc_context->flags |= lavc_param_closedgop;
+ lavc_venc_context->flags |= lavc_param_trunc;
+ lavc_venc_context->flags |= lavc_param_aic;
+- lavc_venc_context->flags |= lavc_param_umv;
+ lavc_venc_context->flags |= lavc_param_v4mv;
+- lavc_venc_context->flags |= lavc_param_data_partitioning;
+- lavc_venc_context->flags |= lavc_param_cbp;
++ if(lavc_param_cbp)
++ av_dict_set(&lavc_venc_opts, "mpv_flags", "+cbp_rd", 0);
+ lavc_venc_context->flags |= lavc_param_mv0;
+- lavc_venc_context->flags |= lavc_param_qp_rd;
+- lavc_venc_context->flags |= lavc_param_scan_offset;
+- lavc_venc_context->flags |= lavc_param_ss;
+- lavc_venc_context->flags |= lavc_param_alt;
++ if(lavc_param_qp_rd)
++ av_dict_set(&lavc_venc_opts, "mpv_flags", "+qp_rd", 0);
++ if (lavc_param_normalize_aqp)
++ av_dict_set(&lavc_venc_opts, "mpv_flags", "+naq", 0);
+ lavc_venc_context->flags |= lavc_param_ilme;
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ lavc_venc_context->flags |= lavc_param_trell;
+@@ -1082,9 +1090,7 @@
+ #endif
+
+ if (lavc_param_gray)
+- lavc_venc_context->flags |= CODEC_FLAG_GRAY;
+- if (lavc_param_normalize_aqp)
+- lavc_venc_context->flags |= CODEC_FLAG_NORMALIZE_AQP;
++ lavc_venc_context->flags |= AV_CODEC_FLAG_GRAY;
+
+ switch(vob->encode_fields) {
+ case TC_ENCODE_FIELDS_TOP_FIRST:
+@@ -1102,9 +1108,9 @@
+ }
+
+ lavc_venc_context->flags |= interlacing_active ?
+- CODEC_FLAG_INTERLACED_DCT : 0;
++ AV_CODEC_FLAG_INTERLACED_DCT : 0;
+ lavc_venc_context->flags |= interlacing_active ?
+- CODEC_FLAG_INTERLACED_ME : 0;
++ AV_CODEC_FLAG_INTERLACED_ME : 0;
+
+ lavc_venc_context->flags |= lavc_param_psnr;
+ do_psnr = lavc_param_psnr;
+@@ -1112,7 +1118,7 @@
+ lavc_venc_context->prediction_method = lavc_param_prediction_method;
+
+ if(is_huffyuv)
+- lavc_venc_context->pix_fmt = PIX_FMT_YUV422P;
++ lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV422P;
+ else
+ {
+ switch(pix_fmt)
+@@ -1121,18 +1127,18 @@
+ case CODEC_RGB:
+ {
+ if(is_mjpeg)
+- lavc_venc_context->pix_fmt = PIX_FMT_YUVJ420P;
++ lavc_venc_context->pix_fmt = AV_PIX_FMT_YUVJ420P;
+ else
+- lavc_venc_context->pix_fmt = PIX_FMT_YUV420P;
++ lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV420P;
+ break;
+ }
+
+ case CODEC_YUV422:
+ {
+ if(is_mjpeg)
+- lavc_venc_context->pix_fmt = PIX_FMT_YUVJ422P;
++ lavc_venc_context->pix_fmt = AV_PIX_FMT_YUVJ422P;
+ else
+- lavc_venc_context->pix_fmt = PIX_FMT_YUV422P;
++ lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV422P;
+ break;
+ }
+
+@@ -1151,7 +1157,7 @@
+ "encoding.");
+ return TC_EXPORT_ERROR;
+ }
+- lavc_venc_context->flags |= CODEC_FLAG_PASS1;
++ lavc_venc_context->flags |= AV_CODEC_FLAG_PASS1;
+ stats_file = fopen(vob->divxlogfile, "w");
+ if (stats_file == NULL){
+ tc_log_warn(MOD_NAME, "Could not create 2pass log file \"%s\".",
+@@ -1165,7 +1171,7 @@
+ "encoding.");
+ return TC_EXPORT_ERROR;
+ }
+- lavc_venc_context->flags |= CODEC_FLAG_PASS2;
++ lavc_venc_context->flags |= AV_CODEC_FLAG_PASS2;
+ stats_file= fopen(vob->divxlogfile, "r");
+ if (stats_file==NULL){
+ tc_log_warn(MOD_NAME, "Could not open 2pass log file \"%s\" for "
+@@ -1196,18 +1202,16 @@
+ break;
+ case 3:
+ /* fixed qscale :p */
+- lavc_venc_context->flags |= CODEC_FLAG_QSCALE;
++ lavc_venc_context->flags |= AV_CODEC_FLAG_QSCALE;
+ lavc_venc_frame->quality = vob->divxbitrate;
+ break;
+ }
+
+- lavc_venc_context->me_method = ME_ZERO + lavc_param_vme;
+-
+
+ /* FIXME: transcode itself contains "broken ffmpeg default settings", thus we need to override them! */
+- if (lavc_param_video_preset) {
++ if (lavc_param_video_preset && strcmp(lavc_param_video_preset, "none")) {
+ avcodec_opts[AVMEDIA_TYPE_VIDEO] = lavc_venc_context;
+- video_codec_name = ffmpeg_codec_name(codec->name);
++ video_codec_name = av_strdup(ffmpeg_codec_name(codec->name));
+
+ const char *preset_start = lavc_param_video_preset;
+ while (preset_start) {
+@@ -1225,6 +1229,8 @@
+ if (opt_preset("vpre", preset_name) != 0) {
+ tc_log_warn(MOD_NAME, "Parsing ffmpeg preset '%s' failed", preset_name);
+ }
++ av_free(video_codec_name);
++ video_codec_name = NULL;
+ if (verbose) {
+ int i;
+ tc_log_info(MOD_NAME, "After parsing preset '%s', %i options are overridden:", preset_name, opt_name_count);
+@@ -1241,20 +1247,39 @@
+ }
+ }
+
++ if (lavc_param_scan_offset) {
++ av_dict_set(&lavc_venc_opts, "scan_offset", "1", 0);
++ }
++
++ if (lavc_param_ss) {
++ av_dict_set(&lavc_venc_opts, "structured_slices", "1", 0);
++ }
++
++ if (lavc_param_alt) {
++ av_dict_set(&lavc_venc_opts, "alternate_scan", "1", 0);
++ }
++
++ if (lavc_param_umv) {
++ av_dict_set(&lavc_venc_opts, "umv", "1", 0);
++ }
++
++ if (lavc_param_data_partitioning) {
++ av_dict_set(&lavc_venc_opts, "vdpart", "1", 0);
++ }
+
+ //-- open codec --
+ //----------------
+ TC_LOCK_LIBAVCODEC;
+- ret = avcodec_open(lavc_venc_context, lavc_venc_codec);
++ ret = avcodec_open2(lavc_venc_context, lavc_venc_codec, &lavc_venc_opts);
+ TC_UNLOCK_LIBAVCODEC;
+ if (ret < 0) {
+ tc_log_warn(MOD_NAME, "could not open FFMPEG codec");
+ return TC_EXPORT_ERROR;
+ }
+
+- if (lavc_venc_context->codec->encode == NULL) {
++ if (av_codec_is_encoder(lavc_venc_context->codec) == 0) {
+ tc_log_warn(MOD_NAME, "could not open FFMPEG codec "
+- "(lavc_venc_context->codec->encode == NULL)");
++ "(av_codec_is_encoder(lavc_venc_context->codec) == 0)");
+ return TC_EXPORT_ERROR;
+ }
+
+@@ -1598,7 +1623,7 @@
+ YUV_INIT_PLANES(src, param->buffer, IMG_YUV_DEFAULT,
+ lavc_venc_context->width, lavc_venc_context->height);
+ avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer,
+- PIX_FMT_YUV422P, lavc_venc_context->width,
++ AV_PIX_FMT_YUV422P, lavc_venc_context->width,
+ lavc_venc_context->height);
+ /* FIXME: can't use tcv_convert (see decode_lavc.c) */
+ ac_imgconvert(src, IMG_YUV_DEFAULT,
+@@ -1628,7 +1653,7 @@
+ lavc_venc_context->width,
+ lavc_venc_context->height);
+ avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer,
+- PIX_FMT_YUV420P, lavc_venc_context->width,
++ AV_PIX_FMT_YUV420P, lavc_venc_context->width,
+ lavc_venc_context->height);
+ ac_imgconvert(src, IMG_YUV422P,
+ lavc_venc_frame->data, IMG_YUV420P,
+@@ -1639,7 +1664,7 @@
+
+ case CODEC_RGB:
+ avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer,
+- PIX_FMT_YUV420P, lavc_venc_context->width,
++ AV_PIX_FMT_YUV420P, lavc_venc_context->width,
+ lavc_venc_context->height);
+ ac_imgconvert(&param->buffer, IMG_RGB_DEFAULT,
+ lavc_venc_frame->data, IMG_YUV420P,
+diff -Naur a/export/ffmpeg_cfg.c b/export/ffmpeg_cfg.c
+--- a/export/ffmpeg_cfg.c 2011-11-19 16:50:27.000000000 +0000
++++ b/export/ffmpeg_cfg.c 2018-05-14 01:58:58.346408791 +0100
+@@ -95,8 +95,8 @@
+ int lavc_param_pre_me= 1;
+ int lavc_param_me_subpel_quality= 8;
+ int lavc_param_me_range=0;
+-int lavc_param_ibias=FF_DEFAULT_QUANT_BIAS;
+-int lavc_param_pbias=FF_DEFAULT_QUANT_BIAS;
++int lavc_param_ibias=0;
++int lavc_param_pbias=0;
+ int lavc_param_coder=0;
+ int lavc_param_context=0;
+ char *lavc_param_intra_matrix = NULL;
+@@ -126,7 +126,7 @@
+ //int lavc_param_atag = 0;
+ //int lavc_param_abitrate = 224;
+
+-char *lavc_param_video_preset = "medium";
++char *lavc_param_video_preset = "none";
+ char *lavc_param_ffmpeg_datadir = "/usr/share/ffmpeg";
+
+ TCConfigEntry lavcopts_conf[]={
+@@ -138,7 +138,7 @@
+ {"vratetol", &lavc_param_vrate_tolerance, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000},
+ {"vhq", &lavc_param_mb_decision, TCCONF_TYPE_FLAG, 0, 0, 1},
+ {"mbd", &lavc_param_mb_decision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 9},
+- {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV},
++ {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV},
+ {"vme", &lavc_param_vme, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 5},
+ // {"vqscale", &lavc_param_vqscale, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31},
+ // {"vqmin", &lavc_param_vqmin, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31},
+@@ -151,7 +151,7 @@
+ {"vqcomp", &lavc_param_vqcompress, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0},
+ {"vqblur", &lavc_param_vqblur, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0},
+ {"vb_qfactor", &lavc_param_vb_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
+- {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES},
++ {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX},
+ // {"vpass", &lavc_param_vpass, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2},
+ {"vrc_strategy", &lavc_param_vrc_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2},
+ {"vb_strategy", &lavc_param_vb_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
+@@ -160,9 +160,9 @@
+ {"vcelim", &lavc_param_chroma_elim_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
+ {"vpsize", &lavc_param_packet_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000},
+ {"vstrict", &lavc_param_strict, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
+- {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},
++ {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, 1},
+ // {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0},
+- {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},
++ {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY},
+ {"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1},
+ {"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
+ {"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0},
+@@ -188,7 +188,7 @@
+ {"pred", &lavc_param_prediction_method, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 20},
+ {"format", &lavc_param_format, TCCONF_TYPE_STRING, 0, 0, 0},
+ {"debug", &lavc_param_debug, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000},
+- {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR},
++ {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR},
+ {"precmp", &lavc_param_me_pre_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+ {"cmp", &lavc_param_me_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+ {"subcmp", &lavc_param_me_sub_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+@@ -196,9 +196,9 @@
+ {"ildctcmp", &lavc_param_ildct_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+ {"predia", &lavc_param_pre_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000},
+ {"dia", &lavc_param_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000},
+- {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL},
++ {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL},
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+- {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT},
++ {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRELLIS_QUANT},
+ #else
+ {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, 1},
+ #endif
+@@ -207,32 +207,32 @@
+ {"subq", &lavc_param_me_subpel_quality, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8},
+ {"me_range", &lavc_param_me_range, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000},
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+- {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC},
++ {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_H263P_AIC},
+ #else
+- {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED},
++ {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED},
+ #endif
+- {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV},
++ {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, 1},
+ {"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
+ {"pbias", &lavc_param_pbias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
+ {"coder", &lavc_param_coder, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
+ {"context", &lavc_param_context, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
+ {"intra_matrix", &lavc_param_intra_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
+ {"inter_matrix", &lavc_param_inter_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
+- {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD},
+- {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0},
++ {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, 1},
++ {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, 1},
+ {"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
+- {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD},
++ {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, 1},
+ {"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16},
+- {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_SLICE_STRUCT},
+- {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_SVCD_SCAN_OFFSET},
+- {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN},
+- {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME},
++ {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, 1},
++ {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, 1},
++ {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, 1},
++ {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME},
+ {"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
+ {"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
+ {"top", &lavc_param_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1, 1},
+- {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GMC},
+- {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRUNCATED},
+- {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP},
++ {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, 1},
++ {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRUNCATED},
++ {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP},
+ {"intra_dc_precision", &lavc_param_intra_dc_precision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16},
+ {"skip_top", &lavc_param_skip_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
+ {"skip_bottom", &lavc_param_skip_bottom, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
+diff -Naur a/filter/filter_pp.c b/filter/filter_pp.c
+--- a/filter/filter_pp.c 2011-11-19 16:50:27.000000000 +0000
++++ b/filter/filter_pp.c 2018-05-14 01:58:58.347408780 +0100
+@@ -38,8 +38,8 @@
+
+ /* FIXME: these use the filter ID as an index--the ID can grow
+ * arbitrarily large, so this needs to be fixed */
+-static pp_mode_t *mode[100];
+-static pp_context_t *context[100];
++static pp_mode *mode[100];
++static pp_context *context[100];
+ static int width[100], height[100];
+ static int pre[100];
+
+diff -Naur a/filter/filter_resample.c b/filter/filter_resample.c
+--- a/filter/filter_resample.c 2011-11-19 16:50:27.000000000 +0000
++++ b/filter/filter_resample.c 2018-05-14 01:58:58.347408780 +0100
+@@ -37,6 +37,7 @@
+ #include "libtc/optstr.h"
+ #include "libtc/tcavcodec.h"
+ #include "libtc/tcmodule-plugin.h"
++#include <libavresample/avresample.h>
+
+
+ typedef struct {
+@@ -45,7 +46,7 @@
+
+ int bytes_per_sample;
+
+- ReSampleContext *resample_ctx;
++ AVAudioResampleContext *resample_ctx;
+ } ResamplePrivateData;
+
+ static const char resample_help[] = ""
+diff -Naur a/filter/subtitler/load_font.c b/filter/subtitler/load_font.c
+--- a/filter/subtitler/load_font.c 2011-11-19 16:50:27.000000000 +0000
++++ b/filter/subtitler/load_font.c 2018-05-14 01:58:58.347408780 +0100
+@@ -47,8 +47,8 @@
+ // FreeType specific includes
+ #include <ft2build.h>
+ #include FT_FREETYPE_H
++#include FT_GLYPH_H
+
+-#include <freetype/ftglyph.h>
+
+ /**
+ * @file bswap.h
+diff -Naur a/import/decode_lavc.c b/import/decode_lavc.c
+--- a/import/decode_lavc.c 2011-11-19 16:50:27.000000000 +0000
++++ b/import/decode_lavc.c 2018-05-14 01:58:58.347408780 +0100
+@@ -57,6 +57,7 @@
+ };
+
+ // fourCC to ID mapping taken from MPlayer's codecs.conf
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ static struct ffmpeg_codec ffmpeg_codecs[] = {
+ {CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
+ {"MP41", "DIV1", ""}},
+@@ -91,6 +92,42 @@
+ {CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video",
+ {"MPG2", ""}},
+ {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#else
++static struct ffmpeg_codec ffmpeg_codecs[] = {
++ {AV_CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
++ {"MP41", "DIV1", ""}},
++ {AV_CODEC_ID_MSMPEG4V2, TC_CODEC_MP42, "mp42",
++ {"MP42", "DIV2", ""}},
++ {AV_CODEC_ID_MSMPEG4V3, TC_CODEC_DIVX3, "msmpeg4",
++ {"DIV3", "DIV5", "AP41", "MPG3", "MP43", ""}},
++ {AV_CODEC_ID_MPEG4, TC_CODEC_DIVX4, "mpeg4",
++ {"DIVX", "XVID", "MP4S", "M4S2", "MP4V", "UMP4", "DX50", ""}},
++ {AV_CODEC_ID_MJPEG, TC_CODEC_MJPEG, "mjpeg",
++ {"MJPG", "AVRN", "AVDJ", "JPEG", "MJPA", "JFIF", ""}},
++ {AV_CODEC_ID_MPEG1VIDEO, TC_CODEC_MPEG1VIDEO, "mpeg1video",
++ {"MPG1", ""}},
++ {AV_CODEC_ID_DVVIDEO, TC_CODEC_DV, "dvvideo",
++ {"DVSD", ""}},
++ {AV_CODEC_ID_WMV1, TC_CODEC_WMV1, "wmv1",
++ {"WMV1", ""}},
++ {AV_CODEC_ID_WMV2, TC_CODEC_WMV2, "wmv2",
++ {"WMV2", ""}},
++ {AV_CODEC_ID_HUFFYUV, TC_CODEC_HUFFYUV, "hfyu",
++ {"HFYU", ""}},
++ {AV_CODEC_ID_H263I, TC_CODEC_H263I, "h263i",
++ {"I263", ""}},
++ {AV_CODEC_ID_H263P, TC_CODEC_H263P, "h263p",
++ {"H263", "U263", "VIV1", ""}},
++ {AV_CODEC_ID_RV10, TC_CODEC_RV10, "rv10",
++ {"RV10", "RV13", ""}},
++ {AV_CODEC_ID_SVQ1, TC_CODEC_SVQ1, "svq1",
++ {"SVQ1", ""}},
++ {AV_CODEC_ID_SVQ3, TC_CODEC_SVQ3, "svq3",
++ {"SVQ3", ""}},
++ {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video",
++ {"MPG2", ""}},
++ {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#endif
+
+
+ static struct ffmpeg_codec *find_ffmpeg_codec_id(unsigned int transcode_id)
+@@ -170,7 +207,7 @@
+
+ // Set these to the expected values so that ffmpeg's decoder can
+ // properly detect interlaced input.
+- lavc_dec_context = avcodec_alloc_context();
++ lavc_dec_context = avcodec_alloc_context3(NULL);
+ if (lavc_dec_context == NULL) {
+ tc_log_error(__FILE__, "Could not allocate enough memory.");
+ goto decoder_error;
+@@ -181,12 +218,12 @@
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ lavc_dec_context->error_resilience = 2;
+ #else
+- lavc_dec_context->error_recognition = 2;
++ lavc_dec_context->err_recognition = 2;
+ #endif
+ lavc_dec_context->error_concealment = 3;
+ lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT;
+
+- if (avcodec_open(lavc_dec_context, lavc_dec_codec) < 0) {
++ if (avcodec_open2(lavc_dec_context, lavc_dec_codec, NULL) < 0) {
+ tc_log_error(__FILE__, "Could not initialize the '%s' codec.",
+ codec->name);
+ goto decoder_error;
+@@ -290,8 +327,8 @@
+
+ // Convert avcodec image to the requested YUV or RGB format
+ switch (lavc_dec_context->pix_fmt) {
+- case PIX_FMT_YUVJ420P:
+- case PIX_FMT_YUV420P:
++ case AV_PIX_FMT_YUVJ420P:
++ case AV_PIX_FMT_YUV420P:
+ // Remove "dead space" at right edge of planes, if any
+ if (picture.linesize[0] != lavc_dec_context->width) {
+ int y;
+@@ -315,7 +352,7 @@
+ pix_fmt==TC_CODEC_YUV420P ? IMG_YUV420P : IMG_RGB_DEFAULT,
+ lavc_dec_context->width, lavc_dec_context->height);
+ break;
+- case PIX_FMT_YUV411P:
++ case AV_PIX_FMT_YUV411P:
+ if (picture.linesize[0] != lavc_dec_context->width) {
+ int y;
+ for (y = 0; y < lavc_dec_context->height; y++) {
+@@ -334,8 +371,8 @@
+ pix_fmt==TC_CODEC_YUV420P ? IMG_YUV420P : IMG_RGB_DEFAULT,
+ lavc_dec_context->width, lavc_dec_context->height);
+ break;
+- case PIX_FMT_YUVJ422P:
+- case PIX_FMT_YUV422P:
++ case AV_PIX_FMT_YUVJ422P:
++ case AV_PIX_FMT_YUV422P:
+ if (picture.linesize[0] != lavc_dec_context->width) {
+ int y;
+ for (y = 0; y < lavc_dec_context->height; y++) {
+@@ -354,8 +391,8 @@
+ pix_fmt==TC_CODEC_YUV420P ? IMG_YUV420P : IMG_RGB_DEFAULT,
+ lavc_dec_context->width, lavc_dec_context->height);
+ break;
+- case PIX_FMT_YUVJ444P:
+- case PIX_FMT_YUV444P:
++ case AV_PIX_FMT_YUVJ444P:
++ case AV_PIX_FMT_YUV444P:
+ if (picture.linesize[0] != lavc_dec_context->width) {
+ int y;
+ for (y = 0; y < lavc_dec_context->height; y++) {
+diff -Naur a/import/import_ffmpeg.c b/import/import_ffmpeg.c
+--- a/import/import_ffmpeg.c 2011-11-19 16:50:27.000000000 +0000
++++ b/import/import_ffmpeg.c 2018-05-14 01:58:58.347408780 +0100
+@@ -58,6 +58,7 @@
+ };
+
+ // fourCC to ID mapping taken from MPlayer's codecs.conf
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ static struct ffmpeg_codec ffmpeg_codecs[] = {
+ {CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
+ {"MP41", "DIV1", ""}},
+@@ -106,6 +107,56 @@
+ {CODEC_ID_RAWVIDEO, TC_CODEC_YUV422P, "raw",
+ {"Y42B", ""}},
+ {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#else
++static struct ffmpeg_codec ffmpeg_codecs[] = {
++ {AV_CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
++ {"MP41", "DIV1", ""}},
++ {AV_CODEC_ID_MSMPEG4V2, TC_CODEC_MP42, "mp42",
++ {"MP42", "DIV2", ""}},
++ {AV_CODEC_ID_MSMPEG4V3, TC_CODEC_DIVX3, "msmpeg4",
++ {"DIV3", "DIV5", "AP41", "MPG3", "MP43", ""}},
++ {AV_CODEC_ID_MPEG4, TC_CODEC_DIVX4, "mpeg4",
++ {"DIVX", "XVID", "MP4S", "M4S2", "MP4V", "UMP4", "DX50", ""}},
++ {AV_CODEC_ID_MJPEG, TC_CODEC_MJPEG, "mjpeg",
++ {"MJPG", "AVRN", "AVDJ", "JPEG", "MJPA", "JFIF", ""}},
++ {AV_CODEC_ID_MPEG1VIDEO, TC_CODEC_MPG1, "mpeg1video",
++ {"MPG1", ""}},
++ {AV_CODEC_ID_DVVIDEO, TC_CODEC_DV, "dvvideo",
++ {"DVSD", ""}},
++ {AV_CODEC_ID_WMV1, TC_CODEC_WMV1, "wmv1",
++ {"WMV1", ""}},
++ {AV_CODEC_ID_WMV2, TC_CODEC_WMV2, "wmv2",
++ {"WMV2", ""}},
++ {AV_CODEC_ID_HUFFYUV, TC_CODEC_HUFFYUV, "hfyu",
++ {"HFYU", ""}},
++ {AV_CODEC_ID_H263I, TC_CODEC_H263I, "h263i",
++ {"I263", ""}},
++ {AV_CODEC_ID_H263P, TC_CODEC_H263P, "h263p",
++ {"H263", "U263", "VIV1", ""}},
++ {AV_CODEC_ID_H264, TC_CODEC_H264, "h264",
++ {"H264", "h264", "X264", "x264", "avc1", ""}},
++ {AV_CODEC_ID_RV10, TC_CODEC_RV10, "rv10",
++ {"RV10", "RV13", ""}},
++ {AV_CODEC_ID_SVQ1, TC_CODEC_SVQ1, "svq1",
++ {"SVQ1", ""}},
++ {AV_CODEC_ID_SVQ3, TC_CODEC_SVQ3, "svq3",
++ {"SVQ3", ""}},
++ {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video",
++ {"MPG2", ""}},
++ {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG, "mpeg2video",
++ {"MPG2", ""}},
++ {AV_CODEC_ID_ASV1, TC_CODEC_ASV1, "asv1",
++ {"ASV1", ""}},
++ {AV_CODEC_ID_ASV2, TC_CODEC_ASV2, "asv2",
++ {"ASV2", ""}},
++ {AV_CODEC_ID_FFV1, TC_CODEC_FFV1, "ffv1",
++ {"FFV1", ""}},
++ {AV_CODEC_ID_RAWVIDEO, TC_CODEC_YUV420P, "raw",
++ {"I420", "IYUV", ""}},
++ {AV_CODEC_ID_RAWVIDEO, TC_CODEC_YUV422P, "raw",
++ {"Y42B", ""}},
++ {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#endif
+
+ #define BUFFER_SIZE SIZE_RGB_FRAME
+
+@@ -302,7 +353,7 @@
+
+ // Set these to the expected values so that ffmpeg's decoder can
+ // properly detect interlaced input.
+- lavc_dec_context = avcodec_alloc_context();
++ lavc_dec_context = avcodec_alloc_context3(lavc_dec_codec);
+ if (lavc_dec_context == NULL) {
+ tc_log_error(MOD_NAME, "Could not allocate enough memory.");
+ return TC_IMPORT_ERROR;
+@@ -310,11 +361,11 @@
+ lavc_dec_context->width = x_dim;
+ lavc_dec_context->height = y_dim;
+
+- if (vob->decolor) lavc_dec_context->flags |= CODEC_FLAG_GRAY;
++ if (vob->decolor) lavc_dec_context->flags |= AV_CODEC_FLAG_GRAY;
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+ lavc_dec_context->error_resilience = 2;
+ #else
+- lavc_dec_context->error_recognition = 2;
++ lavc_dec_context->err_recognition = 2;
+ #endif
+ lavc_dec_context->error_concealment = 3;
+ lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT;
+@@ -324,6 +375,7 @@
+ // XXX: some codecs need extra data
+ switch (codec->id)
+ {
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ case CODEC_ID_MJPEG: extra_data_size = 28; break;
+ case CODEC_ID_LJPEG: extra_data_size = 28; break;
+ case CODEC_ID_HUFFYUV: extra_data_size = 1000; break;
+@@ -331,6 +383,15 @@
+ case CODEC_ID_ASV2: extra_data_size = 8; break;
+ case CODEC_ID_WMV1: extra_data_size = 4; break;
+ case CODEC_ID_WMV2: extra_data_size = 4; break;
++#else
++ case AV_CODEC_ID_MJPEG: extra_data_size = 28; break;
++ case AV_CODEC_ID_LJPEG: extra_data_size = 28; break;
++ case AV_CODEC_ID_HUFFYUV: extra_data_size = 1000; break;
++ case AV_CODEC_ID_ASV1: extra_data_size = 8; break;
++ case AV_CODEC_ID_ASV2: extra_data_size = 8; break;
++ case AV_CODEC_ID_WMV1: extra_data_size = 4; break;
++ case AV_CODEC_ID_WMV2: extra_data_size = 4; break;
++#endif
+ default: extra_data_size = 0; break;
+ }
+
+@@ -344,7 +405,7 @@
+ }
+
+ TC_LOCK_LIBAVCODEC;
+- ret = avcodec_open(lavc_dec_context, lavc_dec_codec);
++ ret = avcodec_open2(lavc_dec_context, lavc_dec_codec, NULL);
+ TC_UNLOCK_LIBAVCODEC;
+ if (ret < 0) {
+ tc_log_warn(MOD_NAME, "Could not initialize the '%s' codec.",
+@@ -360,7 +421,11 @@
+ frame_size = x_dim*y_dim + 2*UV_PLANE_SIZE(IMG_YUV_DEFAULT,x_dim,y_dim);
+
+ // we adapt the color space
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ if(codec->id == CODEC_ID_MJPEG) {
++#else
++ if(codec->id == AV_CODEC_ID_MJPEG) {
++#endif
+ enable_levels_filter();
+ }
+ break;
+@@ -434,7 +499,11 @@
+ }
+
+ // we adapt the color space
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ if(codec->id == CODEC_ID_MJPEG) {
++#else
++ if(codec->id == AV_CODEC_ID_MJPEG) {
++#endif
+ enable_levels_filter();
+ }
+
+@@ -504,13 +573,25 @@
+ int bkey = 0;
+
+ // check for keyframes
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ if (codec->id == CODEC_ID_MSMPEG4V3) {
++#else
++ if (codec->id == AV_CODEC_ID_MSMPEG4V3) {
++#endif
+ if (divx3_is_key(buffer)) bkey = 1;
+ }
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ else if (codec->id == CODEC_ID_MPEG4) {
++#else
++ else if (codec->id == AV_CODEC_ID_MPEG4) {
++#endif
+ if (mpeg4_is_key(buffer, bytes_read)) bkey = 1;
+ }
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ else if (codec->id == CODEC_ID_MJPEG) {
++#else
++ else if (codec->id == AV_CODEC_ID_MJPEG) {
++#endif
+ bkey = 1;
+ }
+
+@@ -580,8 +661,8 @@
+
+ // Convert avcodec image to our internal YUV or RGB format
+ switch (lavc_dec_context->pix_fmt) {
+- case PIX_FMT_YUVJ420P:
+- case PIX_FMT_YUV420P:
++ case AV_PIX_FMT_YUVJ420P:
++ case AV_PIX_FMT_YUV420P:
+ src_fmt = IMG_YUV420P;
+ YUV_INIT_PLANES(src_planes, frame, src_fmt,
+ lavc_dec_context->width, lavc_dec_context->height);
+@@ -612,7 +693,7 @@
+ }
+ break;
+
+- case PIX_FMT_YUV411P:
++ case AV_PIX_FMT_YUV411P:
+ src_fmt = IMG_YUV411P;
+ YUV_INIT_PLANES(src_planes, frame, src_fmt,
+ lavc_dec_context->width, lavc_dec_context->height);
+@@ -640,8 +721,8 @@
+ }
+ break;
+
+- case PIX_FMT_YUVJ422P:
+- case PIX_FMT_YUV422P:
++ case AV_PIX_FMT_YUVJ422P:
++ case AV_PIX_FMT_YUV422P:
+ src_fmt = IMG_YUV422P;
+ YUV_INIT_PLANES(src_planes, frame, src_fmt,
+ lavc_dec_context->width, lavc_dec_context->height);
+@@ -669,8 +750,8 @@
+ }
+ break;
+
+- case PIX_FMT_YUVJ444P:
+- case PIX_FMT_YUV444P:
++ case AV_PIX_FMT_YUVJ444P:
++ case AV_PIX_FMT_YUV444P:
+ src_fmt = IMG_YUV444P;
+ YUV_INIT_PLANES(src_planes, frame, src_fmt,
+ lavc_dec_context->width, lavc_dec_context->height);
+diff -Naur a/import/probe_ffmpeg.c b/import/probe_ffmpeg.c
+--- a/import/probe_ffmpeg.c 2011-11-19 16:50:27.000000000 +0000
++++ b/import/probe_ffmpeg.c 2018-05-14 01:58:58.347408780 +0100
+@@ -51,8 +51,8 @@
+ info->bitrate = st->codec->bit_rate / 1000;
+ info->width = st->codec->width;
+ info->height = st->codec->height;
+- if (st->r_frame_rate.num > 0 && st->r_frame_rate.den > 0) {
+- info->fps = av_q2d(st->r_frame_rate);
++ if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0) {
++ info->fps = av_q2d(st->avg_frame_rate);
+ } else {
+ /* watch out here */
+ info->fps = 1.0/av_q2d(st->codec->time_base);
+@@ -99,8 +99,8 @@
+
+ TC_INIT_LIBAVCODEC;
+
+- ret = av_open_input_file(&lavf_dmx_context, ipipe->name,
+- NULL, 0, NULL);
++ ret = avformat_open_input(&lavf_dmx_context, ipipe->name,
++ NULL, NULL);
+ if (ret != 0) {
+ tc_log_error(__FILE__, "unable to open '%s'"
+ " (libavformat failure)",
+@@ -109,7 +109,7 @@
+ return;
+ }
+
+- ret = av_find_stream_info(lavf_dmx_context);
++ ret = avformat_find_stream_info(lavf_dmx_context, NULL);
+ if (ret < 0) {
+ tc_log_error(__FILE__, "unable to fetch informations from '%s'"
+ " (libavformat failure)",
+@@ -120,7 +120,11 @@
+
+ translate_info(lavf_dmx_context, ipipe->probe_info);
+
++#if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(53,25,0)
++ avformat_close_input(&lavf_dmx_context);
++#else
+ av_close_input_file(lavf_dmx_context);
++#endif
+ return;
+ }
+
+diff -Naur a/libtc/tcavcodec.h b/libtc/tcavcodec.h
+--- a/libtc/tcavcodec.h 2011-11-19 16:50:27.000000000 +0000
++++ b/libtc/tcavcodec.h 2018-05-14 01:58:58.347408780 +0100
+@@ -53,7 +53,6 @@
+
+ #define TC_INIT_LIBAVCODEC do { \
+ TC_LOCK_LIBAVCODEC; \
+- avcodec_init(); \
+ avcodec_register_all(); \
+ TC_UNLOCK_LIBAVCODEC; \
+ } while (0)
diff --git a/gnu/packages/patches/ttfautohint-source-date-epoch.patch b/gnu/packages/patches/ttfautohint-source-date-epoch.patch
deleted file mode 100644
index e42fdbf6b0..0000000000
--- a/gnu/packages/patches/ttfautohint-source-date-epoch.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-Honour an external definition of SOURCE_DATE_EPOCH when updating the embedded
-modification date in TTF/TTC files.
-
---- a/lib/tatime.c
-+++ b/lib/tatime.c
-@@ -15,6 +15,8 @@
-
- #include <time.h>
- #include <stdint.h>
-+#include <errno.h>
-+#include <limits.h>
-
- #include "ta.h"
-
-@@ -27,12 +29,51 @@ TA_get_current_time(FT_ULong* high,
- {
- /* there have been 24107 days between January 1st, 1904 (the epoch of */
- /* OpenType), and January 1st, 1970 (the epoch of the `time' function) */
-- TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60;
-- TA_ULongLong seconds_to_today = seconds_to_1970 + (TA_ULongLong)time(NULL);
-+ const TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60;
-+ TA_ULongLong seconds_to_build;
-
-+ time_t now;
-+ char *source_date_epoch, *endptr;
-+ TA_ULongLong epoch;
-+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
-+ if (source_date_epoch) {
-+ errno = 0;
-+ epoch = strtoull(source_date_epoch, &endptr, 10);
-+ if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
-+ || (errno != 0 && epoch == 0)) {
-+ fprintf(stderr,
-+ "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n",
-+ strerror(errno));
-+ exit(EXIT_FAILURE);
-+ }
-+ if (endptr == source_date_epoch) {
-+ fprintf(stderr,
-+ "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n",
-+ endptr);
-+ exit(EXIT_FAILURE);
-+ }
-+ if (*endptr != '\0') {
-+ fprintf(stderr,
-+ "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n",
-+ endptr);
-+ exit(EXIT_FAILURE);
-+ }
-+ if (epoch > ULONG_MAX) {
-+ fprintf(stderr,
-+ "Environment variable $SOURCE_DATE_EPOCH: value must be smaller "
-+ "than or equal to: %lu but was found to be: %llu \n",
-+ ULONG_MAX, epoch);
-+ exit(EXIT_FAILURE);
-+ }
-+ now = epoch;
-+ } else {
-+ now = time(NULL);
-+ }
-
-- *high = (FT_ULong)(seconds_to_today >> 32);
-- *low = (FT_ULong)seconds_to_today;
-+ seconds_to_build = seconds_to_1970 + (TA_ULongLong)now;
-+
-+ *high = (FT_ULong)(seconds_to_build >> 32);
-+ *low = (FT_ULong)seconds_to_build;
- }
-
- /* end of tatime.c */
diff --git a/gnu/packages/patches/unknown-horizons-python-3.8-distro.patch b/gnu/packages/patches/unknown-horizons-python-3.8-distro.patch
new file mode 100644
index 0000000000..d43a4f3e4a
--- /dev/null
+++ b/gnu/packages/patches/unknown-horizons-python-3.8-distro.patch
@@ -0,0 +1,52 @@
+From: Tobias Geerinckx-Rice <me@tobias.gr>
+Date: Wed, 19 Aug 2020 22:58:32 +0200
+Subject: [PATCH] gnu: unknown-horizons: Replace ‘dist’ with ‘distro’.
+
+This fixes builds with Python >= 3.8. Taken verbatim from upstream[0].
+
+[0]: https://github.com/unknown-horizons/unknown-horizons/commit/c40fb866f3f72ac1049d6fa7859b17d8a48fe9e1
+
+From c40fb866f3f72ac1049d6fa7859b17d8a48fe9e1 Mon Sep 17 00:00:00 2001
+From: MarkusHackspacher <hackspacher@gmx.de>
+Date: Thu, 18 Jul 2019 11:46:39 +0200
+Subject: [PATCH] replace deprecated to distro package
+
+---
+ requirements.txt | 1 +
+ setup.py | 4 +++-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/requirements.txt b/requirements.txt
+index a5edf794fb..b58179bfa8 100644
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -1,6 +1,7 @@
+ coverage==4.4.1
+ coveralls==1.1
+ crayons==0.1.2
++distro
+ future==0.16.0
+ greenlet==0.4.15
+ isort==4.3.4
+diff --git a/setup.py b/setup.py
+index 6d63a5ce15..6a237a8749 100755
+--- a/setup.py
++++ b/setup.py
+@@ -32,6 +32,8 @@
+ from distutils.spawn import find_executable
+ from shutil import copytree, rmtree
+
++import distro
++
+ import horizons
+ from horizons.constants import VERSION
+ from horizons.ext import polib
+@@ -39,7 +41,7 @@
+ # Ensure we are in the correct directory
+ os.chdir(os.path.realpath(os.path.dirname(__file__)))
+
+-if platform.dist()[0].lower() in ('debian', 'ubuntu'):
++if distro.linux_distribution(full_distribution_name=False)[0] in ('debian', 'mint', 'ubuntu'):
+ executable_path = 'games'
+ else:
+ executable_path = 'bin'
diff --git a/gnu/packages/patches/vcflib-use-shared-libraries.patch b/gnu/packages/patches/vcflib-use-shared-libraries.patch
new file mode 100644
index 0000000000..e198ec663c
--- /dev/null
+++ b/gnu/packages/patches/vcflib-use-shared-libraries.patch
@@ -0,0 +1,135 @@
+This patch is a combination of many of the patches from Debian:
+https://sources.debian.org/src/libvcflib/1.0.1+dfsg-3/debian/patches/
+
+---
+ Makefile | 63 +++++++++++---------------------------------------------
+ 1 file changed, 12 insertions(+), 51 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 6b13350..be85f22 100644
+--- a/Makefile
++++ b/Makefile
+@@ -114,43 +114,25 @@ BIN_SOURCES = src/vcfecho.cpp \
+ src/vcfnull2ref.cpp \
+ src/vcfinfosummarize.cpp
+
+-# when we can figure out how to build on mac
+-# src/vcfsom.cpp
+-
+ #BINS = $(BIN_SOURCES:.cpp=)
+ BINS = $(addprefix $(BIN_DIR)/,$(notdir $(BIN_SOURCES:.cpp=)))
+ SHORTBINS = $(notdir $(BIN_SOURCES:.cpp=))
+
+-TABIX = tabixpp/tabix.o
+-FASTAHACK = fastahack/Fasta.o
+-SMITHWATERMAN = smithwaterman/SmithWatermanGotoh.o
+-REPEATS = smithwaterman/Repeats.o
+-INDELALLELE = smithwaterman/IndelAllele.o
+-DISORDER = smithwaterman/disorder.o
+-LEFTALIGN = smithwaterman/LeftAlign.o
+-FSOM = fsom/fsom.o
+ FILEVERCMP = filevercmp/filevercmp.o
+
+-# Work out how to find htslib
+-# Use the one we ship in tabixpp unless told otherwise by the environment
+-HTS_LIB ?= $(VCF_LIB_LOCAL)/tabixpp/htslib/libhts.a
+-HTS_INCLUDES ?= -I$(VCF_LIB_LOCAL)/tabixpp/htslib
+-HTS_LDFLAGS ?= -L$(VCF_LIB_LOCAL)/tabixpp/htslib -lhts -lbz2 -lm -lz -llzma -pthread
+-
+-
+-INCLUDES = $(HTS_INCLUDES) -I$(INC_DIR)
+-LDFLAGS = -L$(LIB_DIR) -lvcflib $(HTS_LDFLAGS) -lpthread -lz -lm -llzma -lbz2
++INCLUDES = -I$(INC_DIR) $(shell pkg-config --cflags htslib fastahack smithwaterman tabixpp)
++LDFLAGS = -L$(LIB_DIR) -lvcflib -lpthread -lz -lstdc++ -lm -llzma -lbz2 $(shell pkg-config --libs htslib fastahack smithwaterman tabixpp)
+
+
+
+-all: $(OBJECTS) $(BINS) scriptToBin
++all: $(OBJECTS) $(BINS) scriptToBin libvcflib.a
+
+ scriptToBin: $(BINS)
+ $(CP) scripts/* $(BIN_DIR)
+
+ GIT_VERSION += $(shell git describe --abbrev=4 --dirty --always)
+
+-CXXFLAGS = -Ofast -D_FILE_OFFSET_BITS=64 -std=c++0x
++CXXFLAGS = -Ofast -D_FILE_OFFSET_BITS=64 -std=c++0x -fPIC
+ #CXXFLAGS = -O2
+ #CXXFLAGS = -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual
+
+@@ -168,7 +150,7 @@ profiling:
+ gprof:
+ $(MAKE) CXXFLAGS="$(CXXFLAGS) -pg" all
+
+-$(OBJECTS): $(SOURCES) $(HEADERS) $(TABIX) multichoose pre $(SMITHWATERMAN) $(FILEVERCMP) $(FASTAHACK)
++$(OBJECTS): $(SOURCES) $(HEADERS) multichoose pre $(FILEVERCMP)
+ $(CXX) -c -o $@ src/$(*F).cpp $(INCLUDES) $(LDFLAGS) $(CXXFLAGS) && $(CP) src/*.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
+
+ multichoose: pre
+@@ -177,39 +159,22 @@ multichoose: pre
+ intervaltree: pre
+ cd intervaltree && $(MAKE) && $(CP) *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
+
+-$(TABIX): pre
+- cd tabixpp && INCLUDES="$(HTS_INCLUDES)" LIBPATH="-L. $(HTS_LDFLAGS)" HTSLIB="$(HTS_LIB)" $(MAKE) && $(CP) *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
+-
+-$(SMITHWATERMAN): pre
+- cd smithwaterman && $(MAKE) && $(CP) *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/ && $(CP) *.o $(VCF_LIB_LOCAL)/$(OBJ_DIR)/
+-
+-$(DISORDER): $(SMITHWATERMAN)
+-
+-$(REPEATS): $(SMITHWATERMAN)
+-
+-$(LEFTALIGN): $(SMITHWATERMAN)
+-
+-$(INDELALLELE): $(SMITHWATERMAN)
+-
+-$(FASTAHACK): pre
+- cd fastahack && $(MAKE) && $(CP) *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/ && $(CP) Fasta.o $(VCF_LIB_LOCAL)/$(OBJ_DIR)/
+-
+-#$(FSOM):
+-# cd fsom && $(CXX) $(CXXFLAGS) -c fsom.c -lm
+-
+ $(FILEVERCMP): pre
+ cd filevercmp && make && $(CP) *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/ && $(CP) *.o $(VCF_LIB_LOCAL)/$(INC_DIR)/
+
+ $(SHORTBINS): pre
+ $(MAKE) $(BIN_DIR)/$@
+
+-$(BINS): $(BIN_SOURCES) libvcflib.a $(OBJECTS) $(SMITHWATERMAN) $(FASTAHACK) $(DISORDER) $(LEFTALIGN) $(INDELALLELE) $(SSW) $(FILEVERCMP) pre intervaltree
++$(BINS): $(BIN_SOURCES) libvcflib.so $(OBJECTS) $(SSW) $(FILEVERCMP) pre intervaltree
+ $(CXX) src/$(notdir $@).cpp -o $@ $(INCLUDES) $(LDFLAGS) $(CXXFLAGS) -DVERSION=\"$(GIT_VERSION)\"
+
+-libvcflib.a: $(OBJECTS) $(SMITHWATERMAN) $(REPEATS) $(FASTAHACK) $(DISORDER) $(LEFTALIGN) $(INDELALLELE) $(SSW) $(FILEVERCMP) $(TABIX) pre
+- ar rs libvcflib.a $(OBJECTS) smithwaterman/sw.o $(FASTAHACK) $(SSW) $(FILEVERCMP) $(TABIX)
++libvcflib.a: $(OBJECTS) $(SSW) $(FILEVERCMP) pre
++ ar rs libvcflib.a $(OBJECTS) $(SSW) $(FILEVERCMP)
+ $(CP) libvcflib.a $(LIB_DIR)
+
++libvcflib.so: $(OBJECTS) $(SSW) $(FILEVERCMP) pre
++ $(CXX) -shared -o libvcflib.so $(OBJECTS) $(SSW) $(FILEVERCMP)
++ $(CP) libvcflib.so $(LIB_DIR)
+
+ test: $(BINS)
+ @prove -Itests/lib -w tests/*.t
+@@ -230,16 +195,12 @@ clean:
+ $(RM) $(BINS) $(OBJECTS)
+ $(RM) ssw_cpp.o ssw.o
+ $(RM) libvcflib.a
++ $(RM) libvcflib.so
+ $(RM) -r $(BIN_DIR)
+ $(RM) -r $(LIB_DIR)
+ $(RM) -r $(INC_DIR)
+ $(RM) -r $(OBJ_DIR)
+- $(MAKE) clean -C tabixpp
+- $(MAKE) clean -C smithwaterman
+- $(MAKE) clean -C fastahack
+ $(MAKE) clean -C multichoose
+- $(MAKE) clean -C fsom
+- $(MAKE) clean -C libVCFH
+ $(MAKE) clean -C test
+ $(MAKE) clean -C filevercmp
+ $(MAKE) clean -C intervaltree
+--
+2.28.0
+
diff --git a/gnu/packages/patches/webkitgtk-bind-all-fonts.patch b/gnu/packages/patches/webkitgtk-bind-all-fonts.patch
new file mode 100644
index 0000000000..3fe9704727
--- /dev/null
+++ b/gnu/packages/patches/webkitgtk-bind-all-fonts.patch
@@ -0,0 +1,26 @@
+Add fonts from all XDG_DATA_DIRS, not just XDG_DATA_HOME.
+
+See <http://bugs.gnu.org/41174>.
+Author: Leo Prikler <leo.prikler@student.tugraz.at>
+Index: webkitgtk-2.28.2/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
+===================================================================
+--- a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
++++ b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
+@@ -387,6 +387,7 @@ static void bindFonts(Vector<CString>& args)
+ const char* homeDir = g_get_home_dir();
+ const char* dataDir = g_get_user_data_dir();
+ const char* cacheDir = g_get_user_cache_dir();
++ const char* const * dataDirs = g_get_system_data_dirs();
+
+ // Configs can include custom dirs but then we have to parse them...
+ GUniquePtr<char> fontConfig(g_build_filename(configDir, "fontconfig", nullptr));
+@@ -403,6 +404,10 @@ static void bindFonts(Vector<CString>& args)
+ bindIfExists(args, fontHomeConfigDir.get());
+ bindIfExists(args, fontData.get());
+ bindIfExists(args, fontHomeData.get());
++ for (auto dataDir = dataDirs; dataDir != nullptr && *dataDir != nullptr; dataDir++) {
++ GUniquePtr<char> fontDataDir(g_build_filename(*dataDir, "fonts", nullptr));
++ bindIfExists(args, fontDataDir.get());
++ }
+ bindIfExists(args, "/var/cache/fontconfig"); // Used by Debian.
+ }
diff --git a/gnu/packages/patches/wgetpaste-update-bpaste.patch b/gnu/packages/patches/wgetpaste-update-bpaste.patch
new file mode 100644
index 0000000000..f92a0c17ed
--- /dev/null
+++ b/gnu/packages/patches/wgetpaste-update-bpaste.patch
@@ -0,0 +1,27 @@
+From: Tobias Geerinckx-Rice <me@tobias.gr>
+Date: Tue, 01 Sep 2020 04:23:25 +0200
+Subject: [PATCH] Update bpaste URL & regular expressions.
+
+diff -Naur wgetpaste-2.30/wgetpaste wgetpaste-2.30a/wgetpaste
+--- wgetpaste-2.30/wgetpaste 2020-07-31 23:56:05.000000000 +0200
++++ wgetpaste-2.30a/wgetpaste 2020-09-01 04:22:37.499898403 +0200
+@@ -16,7 +16,7 @@
+ SERVICES="codepad bpaste dpaste gists snippets"
+ # bpaste
+ ENGINE_bpaste=pinnwand
+-URL_bpaste="https://bpaste.net/"
++URL_bpaste="https://bpa.st/"
+ DEFAULT_EXPIRATION_bpaste="1week"
+ DEFAULT_LANGUAGE_bpaste="text"
+ # codepad
+@@ -194,8 +194,8 @@
+ xml+velocity xml xquery xslt xtend yaml"
+ EXPIRATIONS_pinnwand="1day 1week 1month never"
+ POST_pinnwand="submit=Paste! % % lexer expiry % code"
+-REGEX_LOC_pinnwand="\(/show/[^ ]*\).*$|https://bpaste.net\1"
+-REGEX_RAW_pinnwand='s|^\(https\?://[^/]*/\)show\(/[^ ]*/\?\)$|\1raw\2|'
++REGEX_LOC_pinnwand="\(/[^ ]*\).*$|https://bpa.st\1"
++REGEX_RAW_pinnwand='s|^\(https\?://[^/]*\)\(/[^ ]*/\?\)$|\1/raw\2|'
+
+ ### errors
+ die() {
diff --git a/gnu/packages/patches/xf86-video-geode-glibc-2.20.patch b/gnu/packages/patches/xf86-video-geode-glibc-2.20.patch
deleted file mode 100644
index 4dc69e3611..0000000000
--- a/gnu/packages/patches/xf86-video-geode-glibc-2.20.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Allow builds with glibc 2.20.
-Based on a patch by Peter Hutterer <peter.hutterer@who-t.net>.
-See <https://raw.githubusercontent.com/openembedded/oe-core/master/meta/recipes-graphics/xorg-driver/xf86-input-synaptics/always_include_xorg_server.h.patch>.
-
---- xf86-video-geode-2.11.16/src/lx_memory.c.~1~ 2014-07-16 16:59:37.000000000 -0400
-+++ xf86-video-geode-2.11.16/src/lx_memory.c 2014-12-19 00:38:11.753388268 -0500
-@@ -23,6 +23,8 @@
- * software without specific prior written permission.
- */
-
-+#include <xorg-server.h>
-+
- #include "xf86.h"
- #include "geode.h"
- #include "cim/cim_regs.h"
diff --git a/gnu/packages/patches/xf86-video-sis-xorg-compat.patch b/gnu/packages/patches/xf86-video-sis-xorg-compat.patch
deleted file mode 100644
index ebe9715d13..0000000000
--- a/gnu/packages/patches/xf86-video-sis-xorg-compat.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Remove use of interface no longer provided by xorg-server.
-
-Patch taken from upstream:
-https://cgit.freedesktop.org/xorg/driver/xf86-video-sis/commit/?id=4b1356a2b7fd06e9a05d134caa4033681c939737
-
-diff --git a/src/sis_driver.c b/src/sis_driver.c
-index 8f06164..513f68b 100644
---- a/src/sis_driver.c
-+++ b/src/sis_driver.c
-@@ -2738,7 +2738,7 @@ SiSPrintModes(ScrnInfoPtr pScrn)
- float hsync, refresh = 0.0;
- char *desc, *desc2, *prefix, *uprefix, *output;
-
-- xf86DrvMsg(pScrn->scrnIndex, pScrn->virtualFrom, "Virtual size is %dx%d "
-+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Virtual size is %dx%d "
- "(pitch %d)\n", pScrn->virtualX, pScrn->virtualY,
- pScrn->displayWidth);
-
diff --git a/gnu/packages/patches/xmonad-dynamic-linking.patch b/gnu/packages/patches/xmonad-dynamic-linking.patch
new file mode 100644
index 0000000000..4f3386e53a
--- /dev/null
+++ b/gnu/packages/patches/xmonad-dynamic-linking.patch
@@ -0,0 +1,16 @@
+This patch is required for xmonad to make use of shared libraries.
+Without it, xmonad will not work since we do not (by default) use
+statically linked Haskell libraries.
+
+diff -ruN xmonad-0.15-a/src/XMonad/Core.hs xmonad-0.15-b/src/XMonad/Core.hs
+--- xmonad-0.15-a/src/XMonad/Core.hs 1969-12-31 19:00:00.000000000 -0500
++++ xmonad-0.15-b/src/XMonad/Core.hs 1969-12-31 19:00:00.000000000 -0500
+@@ -681,6 +681,8 @@
+ compileGHC bin dir errHandle =
+ runProcess "ghc" ["--make"
+ , "xmonad.hs"
++ , "-dynamic"
++ , "-fPIC"
+ , "-i"
+ , "-ilib"
+ , "-fforce-recomp"