summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media-libs/libpng/Manifest5
-rw-r--r--media-libs/libpng/files/libpng-1.6.2-flashing-image.patch115
-rw-r--r--media-libs/libpng/files/libpng-1.6.2-noexecstack.patch29
-rw-r--r--media-libs/libpng/libpng-1.6.2.ebuild56
4 files changed, 205 insertions, 0 deletions
diff --git a/media-libs/libpng/Manifest b/media-libs/libpng/Manifest
new file mode 100644
index 0000000..b6d6068
--- /dev/null
+++ b/media-libs/libpng/Manifest
@@ -0,0 +1,5 @@
+AUX libpng-1.6.2-flashing-image.patch 3630 SHA256 46d4367b05993e142c7affcbf7bc15846920a6431adc432c00436e3910d677dc SHA512 ffb7244e3e0aa2a35a0ed7602b3452dea5a894a2bf587b302d06bda0e025aae091f318eccb21dd2df8ce3b7e6cf3d811b41d705c3712d34d5cb1229a53d27760 WHIRLPOOL ddde5cebf77194c8ae0347ef32b2dd4cf4ebe213230a5be39775f9e7a6ffd948c38a054c180d59eefa9e188813d7e28eec8b4abe4dabf29b6646470086e4cb05
+AUX libpng-1.6.2-noexecstack.patch 880 SHA256 3c2ad9b7cd4300f0c8f7dbee45fa249775d5dc7b3ca13bd32562594246a94055 SHA512 c9f540c5b61b677e819f927303677bffecf294fb714d3951cac5b4f89060e9518e5ff45f7ae403021883a136934b13e8ef994216a42762e279f934172210bfa8 WHIRLPOOL af318b17812a03fe9f2ab0986c6f5d981f11a5b7e1e97d3224b2c5db43e3c9a8ac6427f921f331b15b2014c9b3e20bc6942c9fa7b636fac63573305caf219b6b
+DIST libpng-1.6.2-apng.patch.gz 9571 SHA256 10dd088c443f8d233884bd73b8258d005c92fb0cf35d350ce5dc9ebac7b4eed8 SHA512 f2d1078b40494ecdfff125c0855049bd4a8db667fd4f2dd727a5768363a1a755f43d66147228dd8d5cbbd7148ee51adc74afe6175f8e4075ef3536141a95b898 WHIRLPOOL 9f12de4a838661633205a082c72128b54e14a9454bd705e8b8df951e8eaaa42dbe75c1ff91e4b73037649d319c67577c25f3dab50bcef5fb8c8dcdb2062870cc
+DIST libpng-1.6.2.tar.xz 836536 SHA256 1c97a90bc22107e50f04f77a0115f4ec890d5c6a373ac4c560e8fb87259e92de SHA512 01b1699a2ac1e687631f413458e7534b71f63b673c95b0d6e3501904a1b6e8aa82d8b4495033f4a90278963c1d4c40d81a7a17e976caf87690a23fb191ef75b3 WHIRLPOOL fb04df108af35bd789ef224addfedd0cb04959ae31899e4f3dbd1e9376e4242a93f34ad4c8fd8507bf13872b49f8a01b23bb7bc2129041a09be17434ceee993e
+EBUILD libpng-1.6.2.ebuild 1697 SHA256 0f4b660336482a1f616475844dc2ae749c61c84c80a1abd233e37975fa0928e3 SHA512 93841af51edebc1ac26ce5a2f79eccc52180c6697669752195fc805b593a08cbb485319619fc93d460c17922446319045102e4cf959e124a3028450aec326d1d WHIRLPOOL 1483d921764e3c1f6dee38c511b17073314743d74132866842a8ae5198a66a37464cb70a30106de3f6b3bba35fa6de01e04eb6500589592686b1d4cd5e865f5b
diff --git a/media-libs/libpng/files/libpng-1.6.2-flashing-image.patch b/media-libs/libpng/files/libpng-1.6.2-flashing-image.patch
new file mode 100644
index 0000000..fe27f32
--- /dev/null
+++ b/media-libs/libpng/files/libpng-1.6.2-flashing-image.patch
@@ -0,0 +1,115 @@
+diff --git a/pngrutil.c b/pngrutil.c
+index 01c3679..9c10e26 100644
+--- a/pngrutil.c
++++ b/pngrutil.c
+@@ -18,8 +18,6 @@
+
+ #ifdef PNG_READ_SUPPORTED
+
+-#define png_strtod(p,a,b) strtod(a,b)
+-
+ png_uint_32 PNGAPI
+ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
+ {
+@@ -4165,6 +4163,75 @@ png_read_finish_row(png_structrp png_ptr)
+ }
+ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
+
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++/* This is the code to to select a windowBits value to match the smallest
++ * possible sliding window needed to contain the entire uncompressed image.
++ */
++static unsigned int
++required_window_bits(png_alloc_size_t data_size)
++{
++ unsigned int windowBits = 15;
++ if (data_size <= 16384) /* else windowBits must be 15 */
++ {
++ unsigned int half_z_window_size = 1U << (windowBits-1); /* 16384 */
++
++ do
++ {
++ half_z_window_size >>= 1;
++ --windowBits;
++ }
++ while (windowBits > 8 && data_size <= half_z_window_size);
++ }
++ return windowBits;
++}
++/* This is used below to find the size of an image to pass to png_deflate_claim,
++ * so it only needs to be accurate if the size is less than 16384 bytes (the
++ * point at which a lower LZ window size can be used.)
++ *
++ * To do: merge this with png_image_size() in pngwutil.c and put the result
++ * in png.c as a PNG_INTERNAL_FUNCTION.
++ */
++static png_alloc_size_t
++png_read_image_size(png_structrp png_ptr)
++{
++ /* Only return sizes up to the maximum of a png_uint_32, do this by limiting
++ * the width and height used to 15 bits.
++ */
++ png_uint_32 h = png_ptr->height;
++
++ if (png_ptr->rowbytes < 32768 && h < 32768)
++ {
++ if (png_ptr->interlaced)
++ {
++ /* Interlacing makes the image larger because of the replication of
++ * both the filter byte and the padding to a byte boundary.
++ */
++ png_uint_32 w = png_ptr->width;
++ unsigned int pd = png_ptr->pixel_depth;
++ png_alloc_size_t cb_base;
++ int pass;
++
++ for (cb_base=0, pass=0; pass<=6; ++pass)
++ {
++ png_uint_32 pw = PNG_PASS_COLS(w, pass);
++
++ if (pw > 0)
++ cb_base += (PNG_ROWBYTES(pd, pw)+1) * PNG_PASS_ROWS(h, pass);
++ }
++
++ return cb_base;
++ }
++
++ else
++ return (png_ptr->rowbytes+1) * h;
++ }
++
++ else
++ return 0xffffffffU;
++}
++
++#endif /* PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED */
++
+ void /* PRIVATE */
+ png_read_start_row(png_structrp png_ptr)
+ {
+@@ -4449,14 +4515,19 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+ png_free(png_ptr, buffer);
+ }
+
+- /* Finally claim the zstream for the inflate of the IDAT data, use the bits
+- * value from the stream (note that this will result in a fatal error if the
+- * IDAT stream has a bogus deflate header window_bits value, but this should
+- * not be happening any longer!)
++ /* Finally claim the zstream for the inflate of the IDAT data, using the
++ * windowBts predicted from the uncompressed data size, not the value from
++ * the stream. If READ_OPTIMIZE_WINDOWBITS_SUPPORTED is not defined, then
++ * simply use a 32kbyte window (windowBits=15).
+ */
+- if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++ if (png_inflate_claim(png_ptr, png_IDAT,
++ required_window_bits(png_read_image_size(png_ptr))) != Z_OK)
++#else
++ if (png_inflate_claim(png_ptr, png_IDAT, 15) != Z_OK)
++#endif
+ png_error(png_ptr, png_ptr->zstream.msg);
+
+ png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
+ #endif /* PNG_READ_SUPPORTED */
+
diff --git a/media-libs/libpng/files/libpng-1.6.2-noexecstack.patch b/media-libs/libpng/files/libpng-1.6.2-noexecstack.patch
new file mode 100644
index 0000000..e7fca51
--- /dev/null
+++ b/media-libs/libpng/files/libpng-1.6.2-noexecstack.patch
@@ -0,0 +1,29 @@
+This patch is only for the 1.6.2 release, see bug #465010#c39
+
+--- a/arm/filter_neon.S
++++ b/arm/filter_neon.S
+@@ -16,11 +16,11 @@
+ #define PNG_VERSION_INFO_ONLY
+ #include "../pngpriv.h"
+
+-#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
+- defined(__ARM_NEON__)
+ #if defined(__linux__) && defined(__ELF__)
+ .section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
+ #endif
++#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
++ defined(__ARM_NEON__)
+
+ #ifdef __ELF__
+ # define ELF
+--- a/configure
++++ b/configure
+@@ -12812,7 +12812,7 @@ fi
+ # Because GCC by default assembles code with an executable stack, even though it
+ # compiles C code with a non-executable stack, it is necessary to do a fixup
+ # here (this may by GCC specific)
+-AM_CCASFLAGS=-Wa,--noexecstack
++AM_CCASFLAGS=
+
+
+ # Check whether --enable-arm-neon was given.
diff --git a/media-libs/libpng/libpng-1.6.2.ebuild b/media-libs/libpng/libpng-1.6.2.ebuild
new file mode 100644
index 0000000..90beb1d
--- /dev/null
+++ b/media-libs/libpng/libpng-1.6.2.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/libpng-1.6.2.ebuild,v 1.2 2013/05/03 14:51:11 ssuominen Exp $
+
+EAPI=5
+
+inherit eutils libtool multilib
+
+DESCRIPTION="Portable Network Graphics library"
+HOMEPAGE="http://www.libpng.org/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz
+ apng? ( mirror://sourceforge/apng/${P}-apng.patch.gz )"
+
+LICENSE="libpng"
+SLOT="0/16"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+IUSE="apng neon static-libs"
+
+RDEPEND="sys-libs/zlib:="
+DEPEND="${RDEPEND}
+ app-arch/xz-utils"
+
+DOCS=( ANNOUNCE CHANGES libpng-manual.txt README TODO )
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-noexecstack.patch #465010#c39
+ epatch "${FILESDIR}"/${P}-flashing-image.patch
+
+ if use apng; then
+ epatch "${WORKDIR}"/${PN}-*-apng.patch
+ # Don't execute symbols check with apng patch wrt #378111
+ sed -i -e '/^check/s:scripts/symbols.chk::' Makefile.in || die
+ fi
+ elibtoolize
+}
+
+src_configure() {
+ econf \
+ $(use_enable static-libs static) \
+ --enable-arm-neon=$(usex neon on off)
+}
+
+src_install() {
+ default
+ prune_libtool_files --all
+}
+
+pkg_preinst() {
+ has_version ${CATEGORY}/${PN}:1.5 && return 0
+ preserve_old_lib /usr/$(get_libdir)/libpng15$(get_libname 15)
+}
+
+pkg_postinst() {
+ has_version ${CATEGORY}/${PN}:1.5 && return 0
+ preserve_old_lib_notify /usr/$(get_libdir)/libpng15$(get_libname 15)
+}