From fb2e664a05a1f3ba62885897cf8aa694d0c10d38 Mon Sep 17 00:00:00 2001
From: Samuli Suominen <ssuominen@gentoo.org>
Date: Wed, 14 Sep 2011 11:31:48 +0000
Subject: Fix building with libpng15 wrt #381413 by Diego Elio Pettenò
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(Portage version: 2.2.0_alpha55/cvs/Linux x86_64)
---
 media-gfx/fbv/ChangeLog                     |  6 ++++-
 media-gfx/fbv/fbv-1.0b.ebuild               | 35 +++++++++++++++++------------
 media-gfx/fbv/files/fbv-1.0b-libpng15.patch | 20 +++++++++++++++++
 3 files changed, 46 insertions(+), 15 deletions(-)
 create mode 100644 media-gfx/fbv/files/fbv-1.0b-libpng15.patch

diff --git a/media-gfx/fbv/ChangeLog b/media-gfx/fbv/ChangeLog
index 1d5f0af33c6a..6a88ff03cc8a 100644
--- a/media-gfx/fbv/ChangeLog
+++ b/media-gfx/fbv/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog for media-gfx/fbv
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/fbv/ChangeLog,v 1.19 2011/07/20 14:32:29 pacho Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/fbv/ChangeLog,v 1.20 2011/09/14 11:31:48 ssuominen Exp $
+
+  14 Sep 2011; Samuli Suominen <ssuominen@gentoo.org> fbv-1.0b.ebuild,
+  +files/fbv-1.0b-libpng15.patch:
+  Fix building with libpng15 wrt #381413 by Diego Elio Pettenò
 
   20 Jul 2011; Pacho Ramos <pacho@gentoo.org> metadata.xml:
   Drop maintainer due retirement, bug #34534
diff --git a/media-gfx/fbv/fbv-1.0b.ebuild b/media-gfx/fbv/fbv-1.0b.ebuild
index 1d2d0861bf23..c53d51354ddc 100644
--- a/media-gfx/fbv/fbv-1.0b.ebuild
+++ b/media-gfx/fbv/fbv-1.0b.ebuild
@@ -1,8 +1,9 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/fbv/fbv-1.0b.ebuild,v 1.14 2011/02/26 17:08:40 signals Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/fbv/fbv-1.0b.ebuild,v 1.15 2011/09/14 11:31:48 ssuominen Exp $
 
-inherit toolchain-funcs eutils
+EAPI=4
+inherit eutils toolchain-funcs
 
 DESCRIPTION="simple program to view pictures on a linux framebuffer device"
 HOMEPAGE="http://freshmeat.net/projects/fbv/"
@@ -13,33 +14,39 @@ SLOT="0"
 KEYWORDS="~amd64 arm ~ppc ppc64 sh x86"
 IUSE="gif jpeg png"
 
-DEPEND="gif? ( media-libs/giflib )
+RDEPEND="gif? ( media-libs/giflib )
 	jpeg? ( virtual/jpeg )
 	png? ( media-libs/libpng )"
+DEPEND="${RDEPEND}"
 
-src_unpack() {
-	unpack ${A}
-	cd "${S}"
-	epatch "${FILESDIR}"/oob-segfault-fbv-${PV}.diff
-	sed -e 's/-lungif/-lgif/g' -i Makefile -i configure
+src_prepare() {
+	epatch \
+		"${FILESDIR}"/oob-segfault-fbv-${PV}.diff \
+		"${FILESDIR}"/${P}-libpng15.patch
+
+	sed -i -e 's:-lungif:-lgif:g' configure Makefile || die
 }
 
-src_compile() {
-	local myconf=""
-	myconf="${myconf} --without-bmp"
+src_configure() {
+	local myconf="--without-bmp"
+
 	use png || myconf="${myconf} --without-libpng"
 	use gif || myconf="${myconf} --without-libungif"
 	use jpeg || myconf="${myconf} --without-libjpeg"
+
 	./configure \
 		--prefix=/usr \
 		--mandir=/usr/share/man \
 		--infodir=/usr/share/info \
-		${myconf} || die "configure failed"
-	emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake failed"
+		${myconf} || die
+}
+
+src_compile() {
+	emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
 }
 
 src_install() {
-	dobin fbv || die "dobin failed"
+	dobin fbv
 	doman fbv.1
 	dodoc ChangeLog README TODO VERSION
 }
diff --git a/media-gfx/fbv/files/fbv-1.0b-libpng15.patch b/media-gfx/fbv/files/fbv-1.0b-libpng15.patch
new file mode 100644
index 000000000000..dffbe48c3734
--- /dev/null
+++ b/media-gfx/fbv/files/fbv-1.0b-libpng15.patch
@@ -0,0 +1,20 @@
+--- png.c
++++ png.c
+@@ -69,7 +69,7 @@
+         fclose(fh); return(FH_ERROR_FORMAT);
+     }
+     rp=0;
+-    if (setjmp(png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(png_ptr)))
+     {
+ 	png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+         if(rp) free(rp);
+@@ -161,7 +161,7 @@
+         fclose(fh); return(FH_ERROR_FORMAT);
+     }
+     rp=0;
+-    if (setjmp(png_ptr->jmpbuf))
++    if (setjmp(png_jmpbuf(png_ptr)))
+     {
+ 	png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+         if(rp) free(rp);
-- 
cgit v1.2.3-65-gdbad