media-gfx/optipng: Apply upstream patch for bug #561882
authorSebastian Pipping <sping@gentoo.org>
Sun, 11 Oct 2015 19:10:43 +0000 (21:10 +0200)
committerSebastian Pipping <sping@gentoo.org>
Sun, 11 Oct 2015 19:11:41 +0000 (21:11 +0200)
Package-Manager: portage-2.2.23

media-gfx/optipng/files/optipng-0.7.5-gifread.patch [new file with mode: 0644]
media-gfx/optipng/optipng-0.7.5-r1.ebuild [new file with mode: 0644]

diff --git a/media-gfx/optipng/files/optipng-0.7.5-gifread.patch b/media-gfx/optipng/files/optipng-0.7.5-gifread.patch
new file mode 100644 (file)
index 0000000..14b3719
--- /dev/null
@@ -0,0 +1,12 @@
+diff --git a/src/gifread/gifread.c b/src/gifread/gifread.c
+index b24aa6e..2896493 100644
+--- a/src/gifread/gifread.c
++++ b/src/gifread/gifread.c
+@@ -357,6 +357,7 @@ static int LZWGetCode(int code_size, int init_flag, FILE *stream)
+     {
+         curbit = 0;
+         lastbit = 0;
++        last_byte = 2;
+         done = LZW_FALSE;
+         return 0;
+     }
diff --git a/media-gfx/optipng/optipng-0.7.5-r1.ebuild b/media-gfx/optipng/optipng-0.7.5-r1.ebuild
new file mode 100644 (file)
index 0000000..b3b4528
--- /dev/null
@@ -0,0 +1,57 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Compress PNG files without affecting image quality"
+HOMEPAGE="http://optipng.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris"
+IUSE=""
+
+RDEPEND="sys-libs/zlib
+       media-libs/libpng:0"
+DEPEND="${RDEPEND}
+       sys-apps/findutils"
+
+src_prepare() {
+       epatch "${FILESDIR}"/${P}-gifread.patch  # bug #561882
+       epatch "${FILESDIR}"/${P}-estonian.patch
+
+       rm -R src/{libpng,zlib} || die
+       find . -type d -name build -exec rm -R {} + || die
+
+       # next release is almost a complete rewrite, so plug this compilation
+       # problem in anticipation of the much (c)leaner(?) rewrite
+       sed -i \
+               -e 's/^#ifdef AT_FDCWD/#if defined(AT_FDCWD) \&\& !(defined (__SVR4) \&\& defined (__sun))/' \
+               src/optipng/osys.c || die
+
+       tc-export CC AR RANLIB
+       export LD=$(tc-getCC)
+}
+
+src_configure() {
+       ./configure \
+               -with-system-libpng \
+               -with-system-zlib \
+               || die "configure failed"
+}
+
+src_compile() {
+       emake -C src/optipng
+}
+
+src_install() {
+       dodoc README.txt doc/*.txt
+       dohtml doc/*.html
+       doman src/${PN}/man/${PN}.1
+
+       dobin src/${PN}/${PN}
+}