media-gfx/xv: Fix -Werror=format-security errors
authorDavid Seifert <soap@gentoo.org>
Mon, 25 Jan 2016 10:57:17 +0000 (11:57 +0100)
committerDavid Seifert <soap@gentoo.org>
Mon, 25 Jan 2016 10:57:31 +0000 (11:57 +0100)
Gentoo-Bug: 542134
* EAPI=6
* Amended all patches to be compatible with -p1

Package-Manager: portage-2.2.27

media-gfx/xv/files/xv-3.10a-disable-jp2k-20070520.patch
media-gfx/xv/files/xv-3.10a-libpng15-r1.patch
media-gfx/xv/files/xv-3.10a-osx-bsd-20070520.patch
media-gfx/xv/files/xv-3.10a-vdcomp-osx-20070520.patch
media-gfx/xv/files/xv-3.10a-wformat-security.patch [new file with mode: 0644]
media-gfx/xv/xv-3.10a-r18.ebuild [new file with mode: 0644]

index 41d30235e5be056a70833d12f6cb1f33e33ddc9b..7e42484abf48c515538d09b1a8f2e2096b7fa9c1 100644 (file)
@@ -1,5 +1,5 @@
---- Makefile~  2007-06-24 15:41:58 -0600
-+++ Makefile   2007-06-24 15:42:43 -0600
+--- xv-3.10a/Makefile~ 2007-06-24 15:41:58 -0600
++++ xv-3.10a/Makefile  2007-06-24 15:42:43 -0600
 @@ -176,16 +176,16 @@
  ### if, for whatever reason, you're unable to get the JasPer JPEG-2000 library
  ### to compile on your machine, *COMMENT OUT* the following lines
index b3eaeef9847e5def152f7ee520c1164d4aa8b25c..9905c4b8ae7e2afab8fcd2956d13a46db8f2951e 100644 (file)
@@ -1,5 +1,5 @@
---- xvinfo.c
-+++ xvinfo.c
+--- xv-3.10a/xvinfo.c
++++ xv-3.10a/xvinfo.c
 @@ -26,7 +26,7 @@
  #define INFOHIGH 270
  
@@ -9,8 +9,8 @@
  
  /* baseline of top line of text */
  #define TOPBASE (36 + penn_height/2 + 4 + 8 + ASCENT)
---- xvpng.c
-+++ xvpng.c
+--- xv-3.10a/xvpng.c
++++ xv-3.10a/xvpng.c
 @@ -31,6 +31,7 @@
  
  #ifdef HAVE_PNG
index 59a768ebceb17015f04a0bb2e97090cb97497bf1..ecafd1ddf56ee6cb93c60f74da29dc07e16f6764 100644 (file)
@@ -1,5 +1,5 @@
---- xv.h~      2007-06-24 14:30:42 -0600
-+++ xv.h       2007-06-24 14:42:04 -0600
+--- xv-3.10a/xv.h~     2007-06-24 14:30:42 -0600
++++ xv-3.10a/xv.h      2007-06-24 14:42:04 -0600
 @@ -158,7 +158,7 @@
  
  #ifndef VMS
index 06e9f8a8d97842222659c6ab541a5f9633b5826e..2c82b1ae43e6a2ae09ecf2145ea344bd04126800 100644 (file)
@@ -1,5 +1,5 @@
---- vdcomp.c~  2007-06-24 14:30:42 -0600
-+++ vdcomp.c   2007-06-24 14:48:12 -0600
+--- xv-3.10a/vdcomp.c~ 2007-06-24 14:30:42 -0600
++++ xv-3.10a/vdcomp.c  2007-06-24 14:48:12 -0600
 @@ -123,6 +123,8 @@
  
  #    if defined(hp300) || defined(hp800) || defined(NeXT)
diff --git a/media-gfx/xv/files/xv-3.10a-wformat-security.patch b/media-gfx/xv/files/xv-3.10a-wformat-security.patch
new file mode 100644 (file)
index 0000000..34d2c19
--- /dev/null
@@ -0,0 +1,19 @@
+Fix errors caused by -Wformat -Werror=format-security
+https://bugs.gentoo.org/show_bug.cgi?id=542134
+
+* xvpbm.c:888:4: error: format not a string literal and no format arguments [-Werror=format-security]
+*     if (*pix) fprintf(fp,str1);
+
+--- xv-3.10a/xvpbm.c
++++ xv-3.10a/xvpbm.c
+@@ -885,8 +885,8 @@
+         }
+       }
+       else {
+-        if (*pix) fprintf(fp,str1);
+-             else fprintf(fp,str0);
++        if (*pix) fprintf(fp,"%s",str1);
++             else fprintf(fp,"%s",str0);
+         len+=2;
+         if (len>68) { fprintf(fp,"\n"); len=0; }
+       }
diff --git a/media-gfx/xv/xv-3.10a-r18.ebuild b/media-gfx/xv/xv-3.10a-r18.ebuild
new file mode 100644 (file)
index 0000000..795224b
--- /dev/null
@@ -0,0 +1,86 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit eutils flag-o-matic
+
+JUMBOV=20070520
+DESCRIPTION="Interactive image manipulation program supporting a wide variety of formats"
+HOMEPAGE="http://www.trilon.com/xv/index.html http://www.sonic.net/~roelofs/greg_xv.html"
+SRC_URI="mirror://sourceforge/png-mng/${P}-jumbo-patches-${JUMBOV}.tar.gz
+       ftp://ftp.cis.upenn.edu/pub/xv/${P}.tar.gz
+       mirror://gentoo/${P}.png.bz2"
+
+LICENSE="xv"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="jpeg tiff png"
+
+DEPEND="x11-libs/libXt
+       jpeg? ( virtual/jpeg:0 )
+       tiff? ( media-libs/tiff:0 )
+       png? ( >=media-libs/libpng-1.2:0= sys-libs/zlib )"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${WORKDIR}/${P}-jumbo-fix-enh-patch-${JUMBOV}.txt"
+       "${FILESDIR}/${P}-osx-bsd-${JUMBOV}.patch"
+       "${FILESDIR}/${P}-vdcomp-osx-${JUMBOV}.patch"
+       "${FILESDIR}/${P}-disable-jp2k-${JUMBOV}.patch"
+       "${FILESDIR}/${P}-fix-wait-${JUMBOV}.patch"
+       "${FILESDIR}/${P}-add-ldflags-${JUMBOV}.patch"
+       "${FILESDIR}/${P}-libpng15-r1.patch"
+       "${FILESDIR}/${P}-wformat-security.patch"
+)
+
+src_prepare() {
+       default
+
+       append-cppflags -DUSE_GETCWD -DLINUX -DUSLEEP
+       use jpeg && append-cppflags -DDOJPEG
+       use png && append-cppflags -DDOPNG
+       use tiff && append-cppflags -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX
+
+       # Link with various image libraries depending on use flags
+       IMAGE_LIBS=""
+       use jpeg && IMAGE_LIBS="${IMAGE_LIBS} -ljpeg"
+       use png && IMAGE_LIBS="${IMAGE_LIBS} -lz -lpng"
+       use tiff && IMAGE_LIBS="${IMAGE_LIBS} -ltiff"
+
+       sed -i \
+               -e 's/\(^JPEG.*\)/#\1/g' \
+               -e 's/\(^PNG.*\)/#\1/g' \
+               -e 's/\(^TIFF.*\)/#\1/g' \
+               -e "s/\(^LIBS = .*\)/\1${IMAGE_LIBS}/g" Makefile || die
+
+       # /usr/bin/gzip => /bin/gzip
+       sed -i -e 's#/usr\(/bin/gzip\)#'"${EPREFIX}"'\1#g' config.h || die
+
+       # Fix installation of ps docs
+       sed -i -e 's#$(DESTDIR)$(LIBDIR)#$(LIBDIR)#g' Makefile || die
+}
+
+src_compile() {
+       emake \
+               CC="$(tc-getCC)" CCOPTS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
+               PREFIX="${EPREFIX}"/usr \
+               DOCDIR="${EPREFIX}/usr/share/doc/${PF}" \
+               LIBDIR="${T}"
+}
+
+src_install() {
+       dodir /usr/bin
+       dodir /usr/share/man/man1
+
+       emake \
+               DESTDIR="${D}" \
+               PREFIX="${EPREFIX}"/usr \
+               DOCDIR="${EPREFIX}/usr/share/doc/${PF}" \
+               LIBDIR="${T}" install
+
+       dodoc CHANGELOG BUGS IDEAS
+       newicon "${WORKDIR}"/${P}.png ${PN}.png
+       make_desktop_entry xv "" "" "Graphics;Viewer"
+}