Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/anarchy:master commit in: media-libs/libpng/files/, media-libs/libpng/
Date: Wed, 22 May 2013 13:25:45
Message-Id: 1369229100.5f26fc75223a5b14c3b00c79407d742fdcfa3b38.anarchy@gentoo
1 commit: 5f26fc75223a5b14c3b00c79407d742fdcfa3b38
2 Author: Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 22 13:25:00 2013 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Wed May 22 13:25:00 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/anarchy.git;a=commit;h=5f26fc75
7
8 workaround busted png icons when using libpng-1.6.2
9
10 ---
11 media-libs/libpng/Manifest | 5 +
12 .../libpng/files/libpng-1.6.2-flashing-image.patch | 115 ++++++++++++++++++++
13 .../libpng/files/libpng-1.6.2-noexecstack.patch | 29 +++++
14 media-libs/libpng/libpng-1.6.2.ebuild | 56 ++++++++++
15 4 files changed, 205 insertions(+), 0 deletions(-)
16
17 diff --git a/media-libs/libpng/Manifest b/media-libs/libpng/Manifest
18 new file mode 100644
19 index 0000000..b6d6068
20 --- /dev/null
21 +++ b/media-libs/libpng/Manifest
22 @@ -0,0 +1,5 @@
23 +AUX libpng-1.6.2-flashing-image.patch 3630 SHA256 46d4367b05993e142c7affcbf7bc15846920a6431adc432c00436e3910d677dc SHA512 ffb7244e3e0aa2a35a0ed7602b3452dea5a894a2bf587b302d06bda0e025aae091f318eccb21dd2df8ce3b7e6cf3d811b41d705c3712d34d5cb1229a53d27760 WHIRLPOOL ddde5cebf77194c8ae0347ef32b2dd4cf4ebe213230a5be39775f9e7a6ffd948c38a054c180d59eefa9e188813d7e28eec8b4abe4dabf29b6646470086e4cb05
24 +AUX libpng-1.6.2-noexecstack.patch 880 SHA256 3c2ad9b7cd4300f0c8f7dbee45fa249775d5dc7b3ca13bd32562594246a94055 SHA512 c9f540c5b61b677e819f927303677bffecf294fb714d3951cac5b4f89060e9518e5ff45f7ae403021883a136934b13e8ef994216a42762e279f934172210bfa8 WHIRLPOOL af318b17812a03fe9f2ab0986c6f5d981f11a5b7e1e97d3224b2c5db43e3c9a8ac6427f921f331b15b2014c9b3e20bc6942c9fa7b636fac63573305caf219b6b
25 +DIST libpng-1.6.2-apng.patch.gz 9571 SHA256 10dd088c443f8d233884bd73b8258d005c92fb0cf35d350ce5dc9ebac7b4eed8 SHA512 f2d1078b40494ecdfff125c0855049bd4a8db667fd4f2dd727a5768363a1a755f43d66147228dd8d5cbbd7148ee51adc74afe6175f8e4075ef3536141a95b898 WHIRLPOOL 9f12de4a838661633205a082c72128b54e14a9454bd705e8b8df951e8eaaa42dbe75c1ff91e4b73037649d319c67577c25f3dab50bcef5fb8c8dcdb2062870cc
26 +DIST libpng-1.6.2.tar.xz 836536 SHA256 1c97a90bc22107e50f04f77a0115f4ec890d5c6a373ac4c560e8fb87259e92de SHA512 01b1699a2ac1e687631f413458e7534b71f63b673c95b0d6e3501904a1b6e8aa82d8b4495033f4a90278963c1d4c40d81a7a17e976caf87690a23fb191ef75b3 WHIRLPOOL fb04df108af35bd789ef224addfedd0cb04959ae31899e4f3dbd1e9376e4242a93f34ad4c8fd8507bf13872b49f8a01b23bb7bc2129041a09be17434ceee993e
27 +EBUILD libpng-1.6.2.ebuild 1697 SHA256 0f4b660336482a1f616475844dc2ae749c61c84c80a1abd233e37975fa0928e3 SHA512 93841af51edebc1ac26ce5a2f79eccc52180c6697669752195fc805b593a08cbb485319619fc93d460c17922446319045102e4cf959e124a3028450aec326d1d WHIRLPOOL 1483d921764e3c1f6dee38c511b17073314743d74132866842a8ae5198a66a37464cb70a30106de3f6b3bba35fa6de01e04eb6500589592686b1d4cd5e865f5b
28
29 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
30 new file mode 100644
31 index 0000000..fe27f32
32 --- /dev/null
33 +++ b/media-libs/libpng/files/libpng-1.6.2-flashing-image.patch
34 @@ -0,0 +1,115 @@
35 +diff --git a/pngrutil.c b/pngrutil.c
36 +index 01c3679..9c10e26 100644
37 +--- a/pngrutil.c
38 ++++ b/pngrutil.c
39 +@@ -18,8 +18,6 @@
40 +
41 + #ifdef PNG_READ_SUPPORTED
42 +
43 +-#define png_strtod(p,a,b) strtod(a,b)
44 +-
45 + png_uint_32 PNGAPI
46 + png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
47 + {
48 +@@ -4165,6 +4163,75 @@ png_read_finish_row(png_structrp png_ptr)
49 + }
50 + #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
51 +
52 ++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
53 ++/* This is the code to to select a windowBits value to match the smallest
54 ++ * possible sliding window needed to contain the entire uncompressed image.
55 ++ */
56 ++static unsigned int
57 ++required_window_bits(png_alloc_size_t data_size)
58 ++{
59 ++ unsigned int windowBits = 15;
60 ++ if (data_size <= 16384) /* else windowBits must be 15 */
61 ++ {
62 ++ unsigned int half_z_window_size = 1U << (windowBits-1); /* 16384 */
63 ++
64 ++ do
65 ++ {
66 ++ half_z_window_size >>= 1;
67 ++ --windowBits;
68 ++ }
69 ++ while (windowBits > 8 && data_size <= half_z_window_size);
70 ++ }
71 ++ return windowBits;
72 ++}
73 ++/* This is used below to find the size of an image to pass to png_deflate_claim,
74 ++ * so it only needs to be accurate if the size is less than 16384 bytes (the
75 ++ * point at which a lower LZ window size can be used.)
76 ++ *
77 ++ * To do: merge this with png_image_size() in pngwutil.c and put the result
78 ++ * in png.c as a PNG_INTERNAL_FUNCTION.
79 ++ */
80 ++static png_alloc_size_t
81 ++png_read_image_size(png_structrp png_ptr)
82 ++{
83 ++ /* Only return sizes up to the maximum of a png_uint_32, do this by limiting
84 ++ * the width and height used to 15 bits.
85 ++ */
86 ++ png_uint_32 h = png_ptr->height;
87 ++
88 ++ if (png_ptr->rowbytes < 32768 && h < 32768)
89 ++ {
90 ++ if (png_ptr->interlaced)
91 ++ {
92 ++ /* Interlacing makes the image larger because of the replication of
93 ++ * both the filter byte and the padding to a byte boundary.
94 ++ */
95 ++ png_uint_32 w = png_ptr->width;
96 ++ unsigned int pd = png_ptr->pixel_depth;
97 ++ png_alloc_size_t cb_base;
98 ++ int pass;
99 ++
100 ++ for (cb_base=0, pass=0; pass<=6; ++pass)
101 ++ {
102 ++ png_uint_32 pw = PNG_PASS_COLS(w, pass);
103 ++
104 ++ if (pw > 0)
105 ++ cb_base += (PNG_ROWBYTES(pd, pw)+1) * PNG_PASS_ROWS(h, pass);
106 ++ }
107 ++
108 ++ return cb_base;
109 ++ }
110 ++
111 ++ else
112 ++ return (png_ptr->rowbytes+1) * h;
113 ++ }
114 ++
115 ++ else
116 ++ return 0xffffffffU;
117 ++}
118 ++
119 ++#endif /* PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED */
120 ++
121 + void /* PRIVATE */
122 + png_read_start_row(png_structrp png_ptr)
123 + {
124 +@@ -4449,14 +4515,19 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
125 + png_free(png_ptr, buffer);
126 + }
127 +
128 +- /* Finally claim the zstream for the inflate of the IDAT data, use the bits
129 +- * value from the stream (note that this will result in a fatal error if the
130 +- * IDAT stream has a bogus deflate header window_bits value, but this should
131 +- * not be happening any longer!)
132 ++ /* Finally claim the zstream for the inflate of the IDAT data, using the
133 ++ * windowBts predicted from the uncompressed data size, not the value from
134 ++ * the stream. If READ_OPTIMIZE_WINDOWBITS_SUPPORTED is not defined, then
135 ++ * simply use a 32kbyte window (windowBits=15).
136 + */
137 +- if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
138 ++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
139 ++ if (png_inflate_claim(png_ptr, png_IDAT,
140 ++ required_window_bits(png_read_image_size(png_ptr))) != Z_OK)
141 ++#else
142 ++ if (png_inflate_claim(png_ptr, png_IDAT, 15) != Z_OK)
143 ++#endif
144 + png_error(png_ptr, png_ptr->zstream.msg);
145 +
146 + png_ptr->flags |= PNG_FLAG_ROW_INIT;
147 + }
148 + #endif /* PNG_READ_SUPPORTED */
149 +
150
151 diff --git a/media-libs/libpng/files/libpng-1.6.2-noexecstack.patch b/media-libs/libpng/files/libpng-1.6.2-noexecstack.patch
152 new file mode 100644
153 index 0000000..e7fca51
154 --- /dev/null
155 +++ b/media-libs/libpng/files/libpng-1.6.2-noexecstack.patch
156 @@ -0,0 +1,29 @@
157 +This patch is only for the 1.6.2 release, see bug #465010#c39
158 +
159 +--- a/arm/filter_neon.S
160 ++++ b/arm/filter_neon.S
161 +@@ -16,11 +16,11 @@
162 + #define PNG_VERSION_INFO_ONLY
163 + #include "../pngpriv.h"
164 +
165 +-#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
166 +- defined(__ARM_NEON__)
167 + #if defined(__linux__) && defined(__ELF__)
168 + .section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
169 + #endif
170 ++#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
171 ++ defined(__ARM_NEON__)
172 +
173 + #ifdef __ELF__
174 + # define ELF
175 +--- a/configure
176 ++++ b/configure
177 +@@ -12812,7 +12812,7 @@ fi
178 + # Because GCC by default assembles code with an executable stack, even though it
179 + # compiles C code with a non-executable stack, it is necessary to do a fixup
180 + # here (this may by GCC specific)
181 +-AM_CCASFLAGS=-Wa,--noexecstack
182 ++AM_CCASFLAGS=
183 +
184 +
185 + # Check whether --enable-arm-neon was given.
186
187 diff --git a/media-libs/libpng/libpng-1.6.2.ebuild b/media-libs/libpng/libpng-1.6.2.ebuild
188 new file mode 100644
189 index 0000000..90beb1d
190 --- /dev/null
191 +++ b/media-libs/libpng/libpng-1.6.2.ebuild
192 @@ -0,0 +1,56 @@
193 +# Copyright 1999-2013 Gentoo Foundation
194 +# Distributed under the terms of the GNU General Public License v2
195 +# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/libpng-1.6.2.ebuild,v 1.2 2013/05/03 14:51:11 ssuominen Exp $
196 +
197 +EAPI=5
198 +
199 +inherit eutils libtool multilib
200 +
201 +DESCRIPTION="Portable Network Graphics library"
202 +HOMEPAGE="http://www.libpng.org/"
203 +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz
204 + apng? ( mirror://sourceforge/apng/${P}-apng.patch.gz )"
205 +
206 +LICENSE="libpng"
207 +SLOT="0/16"
208 +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"
209 +IUSE="apng neon static-libs"
210 +
211 +RDEPEND="sys-libs/zlib:="
212 +DEPEND="${RDEPEND}
213 + app-arch/xz-utils"
214 +
215 +DOCS=( ANNOUNCE CHANGES libpng-manual.txt README TODO )
216 +
217 +src_prepare() {
218 + epatch "${FILESDIR}"/${P}-noexecstack.patch #465010#c39
219 + epatch "${FILESDIR}"/${P}-flashing-image.patch
220 +
221 + if use apng; then
222 + epatch "${WORKDIR}"/${PN}-*-apng.patch
223 + # Don't execute symbols check with apng patch wrt #378111
224 + sed -i -e '/^check/s:scripts/symbols.chk::' Makefile.in || die
225 + fi
226 + elibtoolize
227 +}
228 +
229 +src_configure() {
230 + econf \
231 + $(use_enable static-libs static) \
232 + --enable-arm-neon=$(usex neon on off)
233 +}
234 +
235 +src_install() {
236 + default
237 + prune_libtool_files --all
238 +}
239 +
240 +pkg_preinst() {
241 + has_version ${CATEGORY}/${PN}:1.5 && return 0
242 + preserve_old_lib /usr/$(get_libdir)/libpng15$(get_libname 15)
243 +}
244 +
245 +pkg_postinst() {
246 + has_version ${CATEGORY}/${PN}:1.5 && return 0
247 + preserve_old_lib_notify /usr/$(get_libdir)/libpng15$(get_libname 15)
248 +}