summaryrefslogtreecommitdiffstats
path: root/gentoo/media-libs
diff options
context:
space:
mode:
Diffstat (limited to 'gentoo/media-libs')
-rw-r--r--gentoo/media-libs/lcms/Manifest3
-rw-r--r--gentoo/media-libs/lcms/files/lcms-1.19-disable_static_modules.patch20
-rw-r--r--gentoo/media-libs/lcms/files/lcms-1.19-implicit.patch49
-rw-r--r--gentoo/media-libs/lcms/lcms-1.19-r1.ebuild103
-rw-r--r--gentoo/media-libs/lcms/metadata.xml16
-rw-r--r--gentoo/media-libs/libart_lgpl/Manifest4
-rw-r--r--gentoo/media-libs/libart_lgpl/files/0001-gentoo-do-not-build-tests-if-not-required.patch22
-rw-r--r--gentoo/media-libs/libart_lgpl/files/0002-TDE-fix-a-number-of-problems.patch402
-rw-r--r--gentoo/media-libs/libart_lgpl/files/0003-TDE-Clean-up-debug-spew.patch120
-rw-r--r--gentoo/media-libs/libart_lgpl/libart_lgpl-2.3.21-r2.ebuild49
-rw-r--r--gentoo/media-libs/libart_lgpl/metadata.xml16
11 files changed, 804 insertions, 0 deletions
diff --git a/gentoo/media-libs/lcms/Manifest b/gentoo/media-libs/lcms/Manifest
new file mode 100644
index 000000000..665770687
--- /dev/null
+++ b/gentoo/media-libs/lcms/Manifest
@@ -0,0 +1,3 @@
+AUX lcms-1.19-disable_static_modules.patch 578 SHA256 bd56a283da65a7ab262d35c890a99e8b103a3a73e50b997e404c3c0ac3ae467e SHA512 fba391dd6d69122217cdcde985d2154dfc2fd9b9aed5a50a013248e024ee54fe07a98acf917fd0e889578616512a2bdf155f0cbe782795e406d96a90b10bbb33 WHIRLPOOL d40c77d18ab5249252e4cadd5b6e2e40c1e43c0f761758908f2afa06d29dce41d56de52d33fe043d7441180c40ca572571fb7c27b87c43406991e5f1e25ff22c
+AUX lcms-1.19-implicit.patch 1308 SHA256 327eb96faafac582362f57800727896bd5c2206a7bb150f12ef7787e84f3ddd9 SHA512 120db0ea4c5a77563dffef55507a8e7fa172ee73ad3943b6ba55c4a01f4a0a2ae21794f4775d58f0d8ba6b5fbdc28c461622416981683063ff746db9a38c724b WHIRLPOOL df45ecfc6fe36db90c676e25f053b370af466648e36e752acfd9f5c0d5acc25a445bf0a8a476f0913ca5c7f0304940c3af35bf56c021fa34045cfdb1e52419bc
+DIST lcms-1.19.tar.gz 927752 SHA256 80ae32cb9f568af4dc7ee4d3c05a4c31fc513fc3e31730fed0ce7378237273a9 SHA512 85a55ad0673f0df2aaa80d18caa50314319f8da5ee4d84eed919059d0dad9861d684ef6353ce0ec6f9892a4603ce8e8e12f84d46858e23f52846b8aefd3cf449 WHIRLPOOL cb6bcb5497798ff2fa86ff433eae6afea38408306345156da6103aa8af6fc0d48fa1d730c5958c027ba06ea023236328bcb00be60f600d987d060625385c820b
diff --git a/gentoo/media-libs/lcms/files/lcms-1.19-disable_static_modules.patch b/gentoo/media-libs/lcms/files/lcms-1.19-disable_static_modules.patch
new file mode 100644
index 000000000..15e19eeb9
--- /dev/null
+++ b/gentoo/media-libs/lcms/files/lcms-1.19-disable_static_modules.patch
@@ -0,0 +1,20 @@
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -22,7 +22,7 @@
+
+ endif
+
+-_lcms_la_LDFLAGS = -no-undefined -module -avoid-version \
++_lcms_la_LDFLAGS = -no-undefined -module -avoid-version -shared \
+ -L$(LCMS_PYLIB)/config
+
+ _lcms_la_LIBADD = $(top_builddir)/src/liblcms.la -lpython$(PYTHON_VERSION)
+@@ -31,7 +31,7 @@
+
+ _lcms_la_CPPFLAGS = -I$(PYTHON_PREFIX)/include/python$(PYTHON_VERSION) \
+ -I$(LCMS_PYINCLUDE) \
+- $(AM_CPPFLAGS)
++ $(AM_CPPFLAGS) -shared
+
+
+ EXTRA_DIST = lcms.py lcms.i testbed swig_lcms
diff --git a/gentoo/media-libs/lcms/files/lcms-1.19-implicit.patch b/gentoo/media-libs/lcms/files/lcms-1.19-implicit.patch
new file mode 100644
index 000000000..d80472273
--- /dev/null
+++ b/gentoo/media-libs/lcms/files/lcms-1.19-implicit.patch
@@ -0,0 +1,49 @@
+cmsio1.c: In function 'AdjustEndianessArray16':
+cmsio1.c:118: warning: implicit declaration of function 'swab'
+testcms.c: In function 'CheckSwab':
+testcms.c:113: warning: implicit declaration of function 'swab'
+================================================================================
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -6,6 +6,9 @@
+ # Don't require all the GNU mandated files
+ AUTOMAKE_OPTIONS = 1.7 foreign
+
++# _XOPEN_SOURCE is required for swab() but undefines strcasecmp(), so add _GNU_SOURCE as well:
++AM_CPPFLAGS = -D_XOPEN_SOURCE -D_GNU_SOURCE
++
+ includedir = ${prefix}/include
+
+ # Shared libraries built in this directory
+--- a/src/cmsio1.c
++++ b/src/cmsio1.c
+@@ -24,6 +24,7 @@
+
+
+ #include "lcms.h"
++#include <unistd.h>
+
+ // ----------------------------------------------------------------- Tag Serialization
+
+--- a/testbed/Makefile.am
++++ b/testbed/Makefile.am
+@@ -6,6 +6,9 @@
+ # Don't require all the GNU mandated files
+ AUTOMAKE_OPTIONS = 1.7 foreign
+
++# Required for swab()
++AM_CPPFLAGS = -D_XOPEN_SOURCE
++
+ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
+
+ check_PROGRAMS = testcms
+--- a/testbed/testcms.c
++++ b/testbed/testcms.c
+@@ -36,6 +36,7 @@
+ #include <time.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <unistd.h>
+
+ #ifndef NON_WINDOWS
+ #include <icm.h>
diff --git a/gentoo/media-libs/lcms/lcms-1.19-r1.ebuild b/gentoo/media-libs/lcms/lcms-1.19-r1.ebuild
new file mode 100644
index 000000000..d680c9058
--- /dev/null
+++ b/gentoo/media-libs/lcms/lcms-1.19-r1.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="6"
+PYTHON_COMPAT=( python2_{6,7} )
+
+inherit autotools eutils python-r1
+
+DESCRIPTION="A lightweight, speed optimized color management engine"
+HOMEPAGE="http://www.littlecms.com/"
+SRC_URI="http://www.littlecms.com/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="jpeg python static-libs tiff zlib"
+
+RDEPEND="tiff? ( media-libs/tiff:0 )
+ jpeg? ( virtual/jpeg:0 )
+ zlib? ( sys-libs/zlib )
+ python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+ python? ( >=dev-lang/swig-1.3.31 )"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+PATCHES=(
+ "${FILESDIR}/${P}-disable_static_modules.patch"
+ "${FILESDIR}/${P}-implicit.patch"
+)
+
+src_prepare() {
+ # Python bindings are built/installed manually.
+ sed -e "/SUBDIRS =/s/ python//" -i Makefile.am
+
+ default
+
+ eautoreconf
+
+ # run swig to regenerate lcms_wrap.cxx and lcms.py (bug #148728)
+ if use python; then
+ cd python
+ ./swig_lcms || die "swig failed to regenerate files"
+ fi
+}
+
+src_configure() {
+ econf \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --bindir="${EPREFIX}"/usr/bin \
+ --disable-dependency-tracking \
+ $(use_enable static-libs static) \
+ $(use_with jpeg) \
+ $(use_with python) \
+ $(use_with tiff) \
+ $(use_with zlib)
+}
+
+src_compile() {
+ default
+
+ if use python; then
+ local BUILD_DIR
+ BUILD_DIR=python
+
+ python_copy_sources
+
+ building() {
+ emake \
+ LCMS_PYEXECDIR="${EPREFIX}$(python_get_sitedir)" \
+ LCMS_PYINCLUDE="${EPREFIX}$(python_get_includedir)"
+# No corresponding functions in python-r1
+# LCMS_PYLIB="${EPREFIX}$(python_get_libdir)" \
+# PYTHON_VERSION="$(python_get_version)"
+ }
+ python_foreach_impl run_in_build_dir building
+ fi
+}
+
+src_install() {
+ DOCS=(AUTHORS README* INSTALL NEWS doc/*)
+
+ default
+
+ if use python; then
+ local BUILD_DIR
+ BUILD_DIR=python
+
+ installation() {
+ emake \
+ DESTDIR="${D}" \
+ LCMS_PYEXECDIR="${EPREFIX}$(python_get_sitedir)" \
+ install
+ }
+ python_foreach_impl run_in_build_dir installation
+ fi
+
+ insinto /usr/share/lcms/profiles
+ doins testbed/*.icm
+
+ find "${D}" -name '*.la' -exec rm -f '{}' +
+}
diff --git a/gentoo/media-libs/lcms/metadata.xml b/gentoo/media-libs/lcms/metadata.xml
new file mode 100644
index 000000000..8a119fbe6
--- /dev/null
+++ b/gentoo/media-libs/lcms/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>fatzer2@gmail.com</email>
+ <name>Alexander Golubev</name>
+ <description>The maintainer of the package in the overlay</description>
+ </maintainer>
+ <maintainer type="project">
+ <email>printing@gentoo.org</email>
+ <name>Gentoo Printing Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">lcms</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/gentoo/media-libs/libart_lgpl/Manifest b/gentoo/media-libs/libart_lgpl/Manifest
new file mode 100644
index 000000000..417816c00
--- /dev/null
+++ b/gentoo/media-libs/libart_lgpl/Manifest
@@ -0,0 +1,4 @@
+AUX 0001-gentoo-do-not-build-tests-if-not-required.patch 529 SHA256 15eae8cfbe4e8218be9dadd5e6a77830d7b47d4732499dd0a1ba4b325ef51f3c SHA512 6efe371e2a51211698ca0ae9c3c498331ea69342a3be2cf98a9ad060aa062738d6b49830f4c5f65529bb14df5993f516fb14d4c977e9d2263158819ed8c7d67d WHIRLPOOL 2a598d0d2d487592ed0125bef51cfb8c5e4d645fb9011f250e11cec4b65629a9219e884dc5d6e3ee567fb1e135bd52d5f393fd8ed1cc71f508c8de843040890f
+AUX 0002-TDE-fix-a-number-of-problems.patch 11281 SHA256 faa31cb9cfe45539f1b478d9f6792651b913525db8492d9aab980e784f92ee0a SHA512 6ea308b5857e8339994dd1530962c2dd8d225f4f3b553d65003266c84eb79095f7a79c52fba2469e8683aa47f2db0d85dbb1841945ed2fe6d78a4c7efd1662a7 WHIRLPOOL 8a623b5247f8f4002fc28c578b8cd2d16bef7b6c939056f294011b14227d14e6e7c3b4ec07b7191bf7e7a2d80c4e23a9d8368e1aaa8390921dbd16a0d52f4bd7
+AUX 0003-TDE-Clean-up-debug-spew.patch 3607 SHA256 5a1b797b31623bc0b79a51ac15c6573e70fd76306c114f7e781bc8295c9888c8 SHA512 83c651c9e7ac6cdcb28b9a2e1a7542150bfec522e9b9bb05f4679830621164a4e49a4a2e881765e1edf1efcb0a8af9b6252cc004dd33628ea59dd03ca4a8c8d3 WHIRLPOOL 823a59a127709ff2c023e739553ca99749a18786a13c817645159373506cebd45fd17b58529add2b3770fceef529ca04384a818c8621aca0bf441997a55356dd
+DIST libart_lgpl-2.3.21.tar.bz2 329102 SHA256 fdc11e74c10fc9ffe4188537e2b370c0abacca7d89021d4d303afdf7fd7476fa SHA512 8a632a6a4da59e5e8c02ec2f5a57e36d182b325b46513765425e5f171ff9ae326af1b133725beba28f7e76654309e001aee9bace727b5b4c8589405256a3c020 WHIRLPOOL 1e524326519b5e8b12a6bc708bcd9c8e9789a79d2a3cd6bf71fd526b6868407436af7d5b00ece7e41b7ea7419cb700ef0b417e7f22ebcfe4aace2cbfa02bcd80
diff --git a/gentoo/media-libs/libart_lgpl/files/0001-gentoo-do-not-build-tests-if-not-required.patch b/gentoo/media-libs/libart_lgpl/files/0001-gentoo-do-not-build-tests-if-not-required.patch
new file mode 100644
index 000000000..29b80d405
--- /dev/null
+++ b/gentoo/media-libs/libart_lgpl/files/0001-gentoo-do-not-build-tests-if-not-required.patch
@@ -0,0 +1,22 @@
+From f2288355d0709b183b749b10ca0a3c6587cd2ddc Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <eva@gentoo.org>
+Date: Tue, 6 Apr 2010 15:11:46 +0200
+Subject: [PATCH 1/3] gentoo: do not build tests if not required
+
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index aec6c5d..95952da 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,4 +1,4 @@
+-noinst_PROGRAMS = testart testuta
++check_PROGRAMS = testart testuta
+
+ bin_SCRIPTS = \
+ libart2-config
+--
+1.8.1.5
+
diff --git a/gentoo/media-libs/libart_lgpl/files/0002-TDE-fix-a-number-of-problems.patch b/gentoo/media-libs/libart_lgpl/files/0002-TDE-fix-a-number-of-problems.patch
new file mode 100644
index 000000000..b00967e08
--- /dev/null
+++ b/gentoo/media-libs/libart_lgpl/files/0002-TDE-fix-a-number-of-problems.patch
@@ -0,0 +1,402 @@
+From 12ea00aa1898e33a467e2d8e18b6ebad43a181f3 Mon Sep 17 00:00:00 2001
+From: Golubev Alexander <fatzer2@gmail.com>
+Date: Thu, 15 Aug 2013 02:08:26 +0400
+Subject: [PATCH 2/3] TDE: fix a number of problems
+
+Conflicts:
+ art_config.h
+---
+ ChangeLog | 2 +
+ README | 14 ++++++
+ art_render_gradient.c | 28 ++++++++++++
+ art_render_gradient.h | 3 +-
+ art_vpath_bpath.c | 119 ++++++++++++++++++++++++--------------------------
+ gen_art_config.sh.in | 6 +++
+ libart-config.in | 13 +++++-
+ testart.c | 6 +++
+ 8 files changed, 127 insertions(+), 64 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 6861cf3..e274c9c 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,5 @@
++*** PLEASE SEE THE GIT COMMIT LOG FOR NEWER CHANGES ***
++
+ 2009-01-14 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ * gen_art_config.c: remove
+diff --git a/README b/README
+index 882527e..a88ec40 100644
+--- a/README
++++ b/README
+@@ -17,3 +17,17 @@ For more information about libart, see the web page:
+ There's also a libart tutorial available at
+ http://www.gnome.org/~mathieu/libart/libart.html
+
++======================================================================
++
++NOTE: The TDE project has take over maintinance of this library,
++starting with the sources from the final upstream release v2.3.21.
++
++This allows the TDE project to resolve remaining issues that cause
++problems or crashes within TDE.
++
++This patched library is only available under the terms of the
++GPL/LGPL, and is NOT for sale by the original author as mentioned
++above, as patch copyright has NOT been transferred to the original
++author and we have no plans to do so.
++
++======================================================================
+diff --git a/art_render_gradient.c b/art_render_gradient.c
+index bf93c6f..008d61a 100644
+--- a/art_render_gradient.c
++++ b/art_render_gradient.c
+@@ -30,7 +30,9 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
++#if 0
+ #include <assert.h>
++#endif
+
+ /* Hack to find out how to define alloca on different platforms.
+ * Modified version of glib/galloca.h.
+@@ -203,7 +205,9 @@ calc_color_at (ArtGradientStop *stops,
+ }
+
+ printf ("WARNING! bad ix %d in calc_color_at() [internal error]\n", ix);
++#if 0
+ assert (0);
++#endif
+ }
+
+ static void
+@@ -331,6 +335,7 @@ art_render_gradient_linear_render_8 (ArtRenderCallback *self,
+ printf ("Initial ix: %d\n", ix);
+ #endif
+
++#if 0
+ assert (ix > 0);
+ assert (ix < n_stops);
+ assert ((stops[ix-1].offset <= offset_fraction + EPSILON) ||
+@@ -344,6 +349,17 @@ art_render_gradient_linear_render_8 (ArtRenderCallback *self,
+ assert ((offset_fraction != stops[ix].offset) ||
+ (d_offset <= 0.0));
+ */
++#else
++ if (!( (ix > 0) && (ix < n_stops)
++ && ((stops[ix-1].offset <= offset_fraction + EPSILON) ||
++ ((stops[ix].offset > (1.0 - EPSILON))
++ && (offset_fraction < EPSILON /* == 0.0*/)))
++ && (offset_fraction <= stops[ix].offset)))
++ {
++ printf ("art_render_gradient.c:%d: Old assert() failed!\n", __LINE__);
++ return;
++ }
++#endif
+
+ while (width > 0)
+ {
+@@ -663,6 +679,18 @@ art_render_gradient_radial_render (ArtRenderCallback *self, ArtRender *render,
+ z = b_a + sqrt (rad);
+ else
+ z = b_a;
++
++ if (gradient->spread == ART_GRADIENT_PAD)
++ z = z;
++ else if (gradient->spread == ART_GRADIENT_REPEAT)
++ z = z - floor (z);
++ else /* (gradient->spread == ART_GRADIENT_REFLECT) */
++ {
++ double tmp;
++
++ tmp = z - 2 * floor (0.5 * z);
++ z = tmp > 1 ? 2 - tmp : tmp;
++ }
+ art_render_gradient_setpix (render, bufp, n_stops, stops, z);
+ bufp += pixstride;
+ b_a += db_a;
+diff --git a/art_render_gradient.h b/art_render_gradient.h
+index ef5da95..7e8e0c8 100644
+--- a/art_render_gradient.h
++++ b/art_render_gradient.h
+@@ -52,14 +52,15 @@ struct _ArtGradientLinear {
+ double a;
+ double b;
+ double c;
+- ArtGradientSpread spread;
+ int n_stops;
+ ArtGradientStop *stops;
++ ArtGradientSpread spread;
+ };
+
+ struct _ArtGradientRadial {
+ double affine[6]; /* transforms user coordinates to unit circle */
+ double fx, fy; /* focal point in unit circle coords */
++ ArtGradientSpread spread;
+ int n_stops;
+ ArtGradientStop *stops;
+ };
+diff --git a/art_vpath_bpath.c b/art_vpath_bpath.c
+index 3f9afe7..2459f23 100644
+--- a/art_vpath_bpath.c
++++ b/art_vpath_bpath.c
+@@ -123,18 +123,6 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max,
+ double x3, double y3,
+ double flatness)
+ {
+- double x3_0, y3_0;
+- double z3_0_dot;
+- double z1_dot, z2_dot;
+- double z1_perp, z2_perp;
+- double max_perp_sq;
+-
+- double x_m, y_m;
+- double xa1, ya1;
+- double xa2, ya2;
+- double xb1, yb1;
+- double xb2, yb2;
+-
+ /* It's possible to optimize this routine a fair amount.
+
+ First, once the _dot conditions are met, they will also be met in
+@@ -157,70 +145,79 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max,
+ just that I have this undying quest for more speed...
+
+ */
+-
+- x3_0 = x3 - x0;
+- y3_0 = y3 - y0;
+-
+- /* z3_0_dot is dist z0-z3 squared */
+- z3_0_dot = x3_0 * x3_0 + y3_0 * y3_0;
+-
+- if (z3_0_dot < 0.001)
++ do
+ {
+- /* if start and end point are almost identical, the flatness tests
+- * don't work properly, so fall back on testing whether both of
+- * the other two control points are the same as the start point,
+- * too.
+- */
+- if (hypot(x1 - x0, y1 - y0) < 0.001
+- && hypot(x2 - x0, y2 - y0) < 0.001)
+- goto nosubdivide;
+- else
+- goto subdivide;
+- }
++ /* don't subdivide inside this */
++ double x3_0, y3_0;
++ double z3_0_dot;
++ double z1_dot, z2_dot;
++ double z1_perp, z2_perp;
++ double max_perp_sq;
+
+- /* we can avoid subdivision if:
++ x3_0 = x3 - x0;
++ y3_0 = y3 - y0;
+
+- z1 has distance no more than flatness from the z0-z3 line
++ /* z3_0_dot is dist z0-z3 squared */
++ z3_0_dot = x3_0 * x3_0 + y3_0 * y3_0;
+
+- z1 is no more z0'ward than flatness past z0-z3
++ if (z3_0_dot > 0.001)
++ {
++ /* we can avoid subdivision if:
+
+- z1 is more z0'ward than z3'ward on the line traversing z0-z3
++ z1 has distance no more than flatness from the z0-z3 line
+
+- and correspondingly for z2 */
++ z1 is no more z0'ward than flatness past z0-z3
+
+- /* perp is distance from line, multiplied by dist z0-z3 */
+- max_perp_sq = flatness * flatness * z3_0_dot;
++ z1 is more z0'ward than z3'ward on the line traversing z0-z3
+
+- z1_perp = (y1 - y0) * x3_0 - (x1 - x0) * y3_0;
+- if (z1_perp * z1_perp > max_perp_sq)
+- goto subdivide;
++ and correspondingly for z2 */
+
+- z2_perp = (y3 - y2) * x3_0 - (x3 - x2) * y3_0;
+- if (z2_perp * z2_perp > max_perp_sq)
+- goto subdivide;
++ /* perp is distance from line, multiplied by dist z0-z3 */
++ max_perp_sq = flatness * flatness * z3_0_dot;
+
+- z1_dot = (x1 - x0) * x3_0 + (y1 - y0) * y3_0;
+- if (z1_dot < 0 && z1_dot * z1_dot > max_perp_sq)
+- goto subdivide;
++ z1_perp = (y1 - y0) * x3_0 - (x1 - x0) * y3_0;
++ if (z1_perp * z1_perp > max_perp_sq)
++ break;
+
+- z2_dot = (x3 - x2) * x3_0 + (y3 - y2) * y3_0;
+- if (z2_dot < 0 && z2_dot * z2_dot > max_perp_sq)
+- goto subdivide;
++ z2_perp = (y3 - y2) * x3_0 - (x3 - x2) * y3_0;
++ if (z2_perp * z2_perp > max_perp_sq)
++ break;
+
+- if (z1_dot + z1_dot > z3_0_dot)
+- goto subdivide;
++ z1_dot = (x1 - x0) * x3_0 + (y1 - y0) * y3_0;
++ if (z1_dot < 0 && z1_dot * z1_dot > max_perp_sq)
++ break;
+
+- if (z2_dot + z2_dot > z3_0_dot)
+- goto subdivide;
++ if (z1_dot + z1_dot > z3_0_dot)
++ break;
+
+-
+- nosubdivide:
+- /* don't subdivide */
+- art_vpath_add_point (p_vpath, pn, pn_max,
+- ART_LINETO, x3, y3);
+- return;
++ z2_dot = (x3 - x2) * x3_0 + (y3 - y2) * y3_0;
++ if (z2_dot < 0 && z2_dot * z2_dot > max_perp_sq)
++ break;
+
+- subdivide:
++ if (z2_dot + z2_dot > z3_0_dot)
++ break;
++ }
++ else
++ {
++ /* if start and end point are almost identical, the flatness tests
++ * don't work properly, so fall back on testing whether both of
++ * the other two control points are the same as the start point,
++ * too.
++ */
++ if (hypot(x1 - x0, y1 - y0) > 0.001
++ || hypot(x2 - x0, y2 - y0) > 0.001)
++ break;
++ }
++
++ art_vpath_add_point (p_vpath, pn, pn_max,
++ ART_LINETO, x3, y3);
++ return;
++ } while (0);
++ double x_m, y_m;
++ double xa1, ya1;
++ double xa2, ya2;
++ double xb1, yb1;
++ double xb2, yb2;
+
+ xa1 = (x0 + x1) * 0.5;
+ ya1 = (y0 + y1) * 0.5;
+diff --git a/gen_art_config.sh.in b/gen_art_config.sh.in
+index 79843bc..8c525bd 100644
+--- a/gen_art_config.sh.in
++++ b/gen_art_config.sh.in
+@@ -8,6 +8,9 @@
+
+ echo "/* Automatically generated by gen_art_config */"
+ echo
++echo "#ifndef _ART_CONFIG_H_"
++echo "#define _ART_CONFIG_H_"
++echo
+ echo "#define ART_SIZEOF_CHAR @ART_SIZEOF_CHAR@"
+ echo "#define ART_SIZEOF_SHORT @ART_SIZEOF_SHORT@"
+ echo "#define ART_SIZEOF_INT @ART_SIZEOF_INT@"
+@@ -39,5 +42,8 @@ else
+ fi
+ fi
+
++echo
++echo "#endif /* _ART_CONFIG_H_ */"
++
+ exit 0
+ }
+diff --git a/libart-config.in b/libart-config.in
+index 0a2f3a9..e32f010 100644
+--- a/libart-config.in
++++ b/libart-config.in
+@@ -3,6 +3,8 @@
+ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ exec_prefix_set=no
++libs=""
++output_libs=no
+
+ usage="\
+ Usage: libart-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]"
+@@ -43,8 +45,11 @@ while test $# -gt 0; do
+ echo $includes
+ ;;
+ --libs)
+- libdirs=-L@libdir@
+- echo $libdirs -lart_lgpl_2 -lm
++ libs="$libs -L@libdir@ -lart_lgpl_2"
++ output_libs=yes
++ ;;
++ --static)
++ libs="$libs -lm"
+ ;;
+ *)
+ echo "${usage}" 1>&2
+@@ -54,3 +59,7 @@ while test $# -gt 0; do
+ shift
+ done
+
++if test $output_libs = yes ; then
++ echo $libs
++fi
++
+diff --git a/testart.c b/testart.c
+index f20b292..994c7ba 100644
+--- a/testart.c
++++ b/testart.c
+@@ -228,6 +228,7 @@ make_testpat (void)
+ art_free (vpath3);
+ #else
+ svp2 = art_svp_from_vpath (vpath2);
++ art_free (vpath2);
+ #endif
+
+ #if 1
+@@ -361,6 +362,7 @@ test_dist (void)
+ 4,
+ 0.5);
+ #endif
++ art_free (vpath);
+
+ art_rgb_svp_aa (svp, 0, 0, 512, 512,
+ 0xffe0a0, 0x100040,
+@@ -431,10 +433,12 @@ test_render_gradient (art_u8 *buf)
+
+ vpath = randstar (50);
+ svp = art_svp_from_vpath (vpath);
++ art_free (vpath);
+
+ render = art_render_new (0, 0, 512, 512, buf, 512 * 3, 3, 8, ART_ALPHA_NONE,
+ NULL);
+ art_render_svp (render, svp);
++ art_svp_free (svp);
+ art_render_gradient_linear (render, &gradient, ART_FILTER_NEAREST);
+ art_render_invoke (render);
+
+@@ -467,6 +471,7 @@ test_render_rad_gradient (art_u8 *buf)
+
+ vpath = randstar (50);
+ svp = art_svp_from_vpath (vpath);
++ art_free (vpath);
+
+ render = art_render_new (0, 0, 512, 512, buf, 512 * 3, 3, 8, ART_ALPHA_NONE,
+ NULL);
+@@ -489,6 +494,7 @@ test_gradient (void)
+
+ vpath = randstar (50);
+ svp = art_svp_from_vpath (vpath);
++ art_free (vpath);
+
+ for (i = 0; i < n_iter; i++)
+ {
+--
+1.8.1.5
+
diff --git a/gentoo/media-libs/libart_lgpl/files/0003-TDE-Clean-up-debug-spew.patch b/gentoo/media-libs/libart_lgpl/files/0003-TDE-Clean-up-debug-spew.patch
new file mode 100644
index 000000000..07f0b59e4
--- /dev/null
+++ b/gentoo/media-libs/libart_lgpl/files/0003-TDE-Clean-up-debug-spew.patch
@@ -0,0 +1,120 @@
+From 2d8f80350005641824e90447234352dc311a3c9d Mon Sep 17 00:00:00 2001
+From: Golubev Alexander <fatzer2@gmail.com>
+Date: Thu, 15 Aug 2013 02:10:16 +0400
+Subject: [PATCH 3/3] TDE: Clean up debug spew
+
+Clean up README file
+---
+ README | 2 +-
+ art_render_gradient.c | 28 ++++------------------------
+ art_render_gradient.h | 2 +-
+ art_svp_intersect.c | 2 ++
+ 4 files changed, 8 insertions(+), 26 deletions(-)
+
+diff --git a/README b/README
+index a88ec40..dc912f9 100644
+--- a/README
++++ b/README
+@@ -19,7 +19,7 @@ http://www.gnome.org/~mathieu/libart/libart.html
+
+ ======================================================================
+
+-NOTE: The TDE project has take over maintinance of this library,
++NOTE: The TDE project has taken over maintenance of this library,
+ starting with the sources from the final upstream release v2.3.21.
+
+ This allows the TDE project to resolve remaining issues that cause
+diff --git a/art_render_gradient.c b/art_render_gradient.c
+index 008d61a..c0638f8 100644
+--- a/art_render_gradient.c
++++ b/art_render_gradient.c
+@@ -30,9 +30,6 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+-#if 0
+-#include <assert.h>
+-#endif
+
+ /* Hack to find out how to define alloca on different platforms.
+ * Modified version of glib/galloca.h.
+@@ -205,9 +202,6 @@ calc_color_at (ArtGradientStop *stops,
+ }
+
+ printf ("WARNING! bad ix %d in calc_color_at() [internal error]\n", ix);
+-#if 0
+- assert (0);
+-#endif
+ }
+
+ static void
+@@ -334,33 +328,19 @@ art_render_gradient_linear_render_8 (ArtRenderCallback *self,
+ #ifdef DEBUG_SPEW
+ printf ("Initial ix: %d\n", ix);
+ #endif
+-
+-#if 0
+- assert (ix > 0);
+- assert (ix < n_stops);
+- assert ((stops[ix-1].offset <= offset_fraction + EPSILON) ||
+- ((stops[ix].offset > (1.0 - EPSILON)) && (offset_fraction < EPSILON /* == 0.0*/)));
+- assert (offset_fraction <= stops[ix].offset);
+- /* FIXME: These asserts may be broken, it is for now
+- safer to not use them. Should be fixed!
+- See bug #121850
+- assert ((offset_fraction != stops[ix-1].offset) ||
+- (d_offset >= 0.0));
+- assert ((offset_fraction != stops[ix].offset) ||
+- (d_offset <= 0.0));
+- */
+-#else
++
+ if (!( (ix > 0) && (ix < n_stops)
+ && ((stops[ix-1].offset <= offset_fraction + EPSILON) ||
+ ((stops[ix].offset > (1.0 - EPSILON))
+ && (offset_fraction < EPSILON /* == 0.0*/)))
+ && (offset_fraction <= stops[ix].offset)))
+ {
++#ifdef DEBUG_SPEW
+ printf ("art_render_gradient.c:%d: Old assert() failed!\n", __LINE__);
++#endif
+ return;
+ }
+-#endif
+-
++
+ while (width > 0)
+ {
+ #ifdef DEBUG_SPEW
+diff --git a/art_render_gradient.h b/art_render_gradient.h
+index 7e8e0c8..79ed4f8 100644
+--- a/art_render_gradient.h
++++ b/art_render_gradient.h
+@@ -60,9 +60,9 @@ struct _ArtGradientLinear {
+ struct _ArtGradientRadial {
+ double affine[6]; /* transforms user coordinates to unit circle */
+ double fx, fy; /* focal point in unit circle coords */
+- ArtGradientSpread spread;
+ int n_stops;
+ ArtGradientStop *stops;
++ ArtGradientSpread spread;
+ };
+
+ struct _ArtGradientStop {
+diff --git a/art_svp_intersect.c b/art_svp_intersect.c
+index 4ece5f4..69ddd39 100644
+--- a/art_svp_intersect.c
++++ b/art_svp_intersect.c
+@@ -601,7 +601,9 @@ art_svp_intersect_add_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg)
+ #ifdef CHEAP_SANITYCHECK
+ if (seg->flags & ART_ACTIVE_FLAGS_IN_HORIZ)
+ {
++#ifdef VERBOSE
+ art_warn ("*** attempt to put segment in horiz list twice\n");
++#endif
+ return;
+ }
+ seg->flags |= ART_ACTIVE_FLAGS_IN_HORIZ;
+--
+1.8.1.5
+
diff --git a/gentoo/media-libs/libart_lgpl/libart_lgpl-2.3.21-r2.ebuild b/gentoo/media-libs/libart_lgpl/libart_lgpl-2.3.21-r2.ebuild
new file mode 100644
index 000000000..a568e11b4
--- /dev/null
+++ b/gentoo/media-libs/libart_lgpl/libart_lgpl-2.3.21-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+GCONF_DEBUG="no"
+GNOME_TARBALL_SUFFIX="bz2"
+
+inherit autotools eutils gnome2
+
+DESCRIPTION="a LGPL version of libart"
+HOMEPAGE="http://www.levien.com/libart"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE=""
+
+RDEPEND=""
+DEPEND="virtual/pkgconfig"
+
+# The provided tests are interactive only
+RESTRICT="test"
+
+DOCS="AUTHORS ChangeLog NEWS README"
+
+pkg_setup() {
+ G2CONF="${G2CONF} --disable-static"
+}
+
+src_prepare() {
+ gnome2_src_prepare
+
+ # Fix crosscompiling, bug #185684
+ rm "${S}"/art_config.h
+ # NOTE patch is removed automake should handle it
+
+ # Do not build tests if not required
+ epatch "$FILESDIR/0001-gentoo-do-not-build-tests-if-not-required.patch"
+
+ # apply TDE patches
+ epatch "$FILESDIR/0002-TDE-fix-a-number-of-problems.patch"
+ epatch "$FILESDIR/0003-TDE-Clean-up-debug-spew.patch"
+
+ # apply user-provided patches
+ epatch_user
+
+ AT_NOELIBTOOLIZE=yes eautoreconf
+}
diff --git a/gentoo/media-libs/libart_lgpl/metadata.xml b/gentoo/media-libs/libart_lgpl/metadata.xml
new file mode 100644
index 000000000..7e0f0408d
--- /dev/null
+++ b/gentoo/media-libs/libart_lgpl/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="person">
+ <email>fatzer2@gmail.com</email>
+ <name>Alexander Golubev</name>
+ <description>The maintainer of the package in the overlay, please don't report bugs to the gnome team.</description>
+</maintainer>
+<maintainer type="project">
+ <email>gnome@gentoo.org</email>
+ <name>Gentoo GNOME Desktop</name>
+</maintainer>
+<upstream>
+ <bugs-to>https://bugs.trinitydesktop.org/buglist.cgi?quicksearch=ALL</bugs-to>
+</upstream>
+</pkgmetadata>