add patches
authorTavis Ormandy <taviso@gentoo.org>
Tue, 4 Jan 2005 14:10:18 +0000 (14:10 +0000)
committerTavis Ormandy <taviso@gentoo.org>
Tue, 4 Jan 2005 14:10:18 +0000 (14:10 +0000)
media-gfx/xv/ChangeLog
media-gfx/xv/Manifest
media-gfx/xv/files/digest-xv-3.10a-r9 [new file with mode: 0644]
media-gfx/xv/files/xv-optimize-jpeg.diff [new file with mode: 0644]
media-gfx/xv/files/xv-postscript-double-free.diff [new file with mode: 0644]
media-gfx/xv/files/xv-smoothing-algorithm.diff [new file with mode: 0644]
media-gfx/xv/xv-3.10a-r8.ebuild
media-gfx/xv/xv-3.10a-r9.ebuild [new file with mode: 0644]

index 93de0901a8e67279b5448e5f4d5500bc5ffac59d..62f08c22b0249662e317edc4facb7793794f8d68 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for media-gfx/xv
-# Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/ChangeLog,v 1.40 2004/12/16 10:51:08 corsair Exp $
+# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/ChangeLog,v 1.41 2005/01/04 14:10:17 taviso Exp $
+
+*xv-3.10a-r9 (04 Jan 2005)
+
+  04 Jan 2005; Tavis Ormandy <taviso@gentoo.org> +files/xv-optimize-jpeg.diff,
+  +files/xv-postscript-double-free.diff, +files/xv-smoothing-algorithm.diff,
+  +xv-3.10a-r9.ebuild:
+  everyone can use getcwd() instead of getwd().
+  apply patches from dave coffin, http://www.cybercom.net/~dcoffin/dcraw/.
 
   16 Dec 2004; Markus Rothe <corsair@gentoo.org> xv-3.10a-r8.ebuild:
   Stable on ppc64
index 70973f0eae367d309cf00c92d663c3b9a31e3a90..5862b3e5330f386afb98b1dd02035cbaefbfe570 100644 (file)
@@ -1,7 +1,12 @@
-MD5 8c876463dd837a2d479bda5f1b3320bd ChangeLog 6808
+MD5 a89b6fc6eab4e5dac42ef667da81aff3 xv-3.10a-r9.ebuild 2362
+MD5 579d25372aebbac36ed16bf4c83a3bff xv-3.10a-r8.ebuild 2181
+MD5 39e5120af8bee5272c60f405e4666276 ChangeLog 7138
 MD5 8fc22f08ecb2e292e60ce7553c58d0c2 metadata.xml 222
-MD5 5e3cbf82aac9cb8cf84f78ffb71d0613 xv-3.10a-r8.ebuild 2182
 MD5 3b193d08268519822ea55ef0534c805a files/digest-xv-3.10a-r8 127
+MD5 3b193d08268519822ea55ef0534c805a files/digest-xv-3.10a-r9 127
 MD5 4b034e22d5bb0502e383afcfeb8ea4b0 files/xv-3.10a-ppc.patch 359
 MD5 123bdb40134767bb438eeaccb50f1646 files/xv-3.10a-security.diff 4079
 MD5 cda66dd1f3a032802881a6ae4430e0d6 files/xv-use-getcwd.patch 222
+MD5 8edd408b62a85896b2b76411f7839c60 files/xv-smoothing-algorithm.diff 6418
+MD5 a5b5fd8ad9fbef9a63f360d83f55e546 files/xv-optimize-jpeg.diff 553
+MD5 f555e07727c8b51042dae772ae474f42 files/xv-postscript-double-free.diff 864
diff --git a/media-gfx/xv/files/digest-xv-3.10a-r9 b/media-gfx/xv/files/digest-xv-3.10a-r9
new file mode 100644 (file)
index 0000000..2bb5f3f
--- /dev/null
@@ -0,0 +1,2 @@
+MD5 2d4fbeec1561304362781cc8e2f7f72d xv-3.10a.tar.gz 2259124
+MD5 f8b8a8f7d76e5108b4abe3e7a5901f3e xv-3.10a-gentoo.tar.gz 52394
diff --git a/media-gfx/xv/files/xv-optimize-jpeg.diff b/media-gfx/xv/files/xv-optimize-jpeg.diff
new file mode 100644 (file)
index 0000000..bcd1879
--- /dev/null
@@ -0,0 +1,18 @@
+--- xvjpeg.c.orig      2005-01-04 13:49:48.074362760 +0000
++++ xvjpeg.c   2005-01-04 13:51:04.286776712 +0000
+@@ -761,6 +761,7 @@
+   jpeg_set_defaults(&cinfo);
+   jpeg_set_quality(&cinfo, (int)qDial.val, TRUE);
+   cinfo.smoothing_factor = (int)smDial.val;
++  cinfo.optimize_coding = TRUE;
+ 
+ 
+   jpeg_start_compress(&cinfo, TRUE);
+--- jpeg/jconfig.cfg.orig      1994-12-22 22:35:00.000000000 +0000
++++ jpeg/jconfig.cfg   2005-01-04 13:51:04.285776864 +0000
+@@ -42,3 +42,5 @@
+ #undef PROGRESS_REPORT
+ 
+ #endif /* JPEG_CJPEG_DJPEG */
++
++#define JDCT_DEFAULT JDCT_FLOAT
diff --git a/media-gfx/xv/files/xv-postscript-double-free.diff b/media-gfx/xv/files/xv-postscript-double-free.diff
new file mode 100644 (file)
index 0000000..740dafc
--- /dev/null
@@ -0,0 +1,30 @@
+--- xv-3.10a/xvps.c    Thu Dec 22 14:12:17 1994
++++ xv-3.10a/xvps.c    Sun Nov 30 22:55:21 1997
+@@ -891,7 +891,7 @@
+   int   i, j, q, err, rpix, gpix, bpix, nc, ptype;
+   int   iw, ih, ox, oy, slen, lwidth, bits, colorps, w, h, pfree;
+   double iwf, ihf;
+-  byte *inpix, *rmap, *gmap, *bmap;
++  byte *save_inpix, *inpix, *rmap, *gmap, *bmap;
+ 
+   slen = bits = colorps = 0;
+ 
+@@ -901,7 +901,8 @@
+ 
+   WaitCursor();
+   
+-  inpix = GenSavePic(&ptype, &w, &h, &pfree, &nc, &rmap, &gmap, &bmap);
++  save_inpix = inpix =
++      GenSavePic(&ptype, &w, &h, &pfree, &nc, &rmap, &gmap, &bmap);
+ 
+     
+   /* printed image will have size iw,ih (in picas) */
+@@ -1123,7 +1124,7 @@
+   fprintf(fp,"origstate restore\n\n");
+   fprintf(fp,"%%%%Trailer\n");
+ 
+-  if (pfree) free(inpix);
++  if (pfree) free(save_inpix);
+ 
+   if (CloseOutFile(fp, filename, (err==EOF)) == 0) {
+     DirBox(0);
diff --git a/media-gfx/xv/files/xv-smoothing-algorithm.diff b/media-gfx/xv/files/xv-smoothing-algorithm.diff
new file mode 100644 (file)
index 0000000..e551696
--- /dev/null
@@ -0,0 +1,172 @@
+diff -urN old/xv-3.10a/xvsmooth.c xv-3.10a/xvsmooth.c
+--- old/xv-3.10a/xvsmooth.c    Thu Dec 22 17:34:42 1994
++++ xv-3.10a/xvsmooth.c        Sun Aug 17 14:07:58 1997
+@@ -65,10 +65,13 @@
+      returns a dwide*dhigh 24bit image, or NULL on failure (malloc) */
+   /* rmap,gmap,bmap should be 'desired' colors */
+ 
++  /* DANGER:  This code assumes that a right-shift on signed integers is
++     performed arithmetically, i.e. the sign bit is copied to the right.  */
++
+   byte *pic24, *pp;
+-  int  *cxtab, *pxtab;
+-  int   y1Off, cyOff;
+-  int   ex, ey, cx, cy, px, py, apx, apy, x1, y1;
++  int  *pxtab;
++  int   ex, ey, px, py, x0, x1, y0, y1;
++  int   y0off, y1off;
+   int   cA, cB, cC, cD;
+   int   pA, pB, pC, pD;
+   int   retval, bperpix;
+@@ -98,69 +101,61 @@
+   else {
+     /* dwide >= swide && dhigh >= shigh */
+ 
+-    /* cx,cy = original pixel in pic824.  px,py = relative position 
+-       of pixel ex,ey inside of cx,cy as percentages +-50%, +-50%.  
+-       0,0 = middle of pixel */
+-
+-    /* we can save a lot of time by precomputing cxtab[] and pxtab[], both
+-       dwide arrays of ints that contain values for the equations:
+-         cx = (ex * swide) / dwide;
+-         px = ((ex * swide * 100) / dwide) - (cx * 100) - 50; */
+-
+-    cxtab = (int *) malloc(dwide * sizeof(int));
+-    if (!cxtab) { free(pic24);  return NULL; }
++    /* px, py = location on original image, in units of 1/256 pixel
++       We can save time by precomputing all values of px.  */
+ 
+     pxtab = (int *) malloc(dwide * sizeof(int));
+-    if (!pxtab) { free(pic24);  free(cxtab);  return NULL; }
+-
+-    for (ex=0; ex<dwide; ex++) {
+-      cxtab[ex] = (ex * swide) / dwide;
+-      pxtab[ex] = (((ex * swide)* 100) / dwide) 
+-                 - (cxtab[ex] * 100) - 50;
+-    }
++    if (!pxtab) { free(pic24);  return NULL; }
+     
+-    for (ey=0; ey<dhigh; ey++) {
++    for (ex=0; ex < dwide; ex++)
++      pxtab[ex] = ((ex << 8) + 128) * swide / dwide - 128;
++    
++    for (ey=0; ey < dhigh; ey++) {
+       byte *pptr, rA, gA, bA, rB, gB, bB, rC, gC, bC, rD, gD, bD;
+ 
+       ProgressMeter(0, (dhigh)-1, ey, "Smooth");
+ 
+-      cy = (ey * shigh) / dhigh;
+-      py = (((ey * shigh) * 100) / dhigh) - (cy * 100) - 50;
+-      if (py<0) { y1 = cy-1;  if (y1<0) y1=0; }
+-           else { y1 = cy+1;  if (y1>shigh-1) y1=shigh-1; }
++      py = ((ey << 8) + 128) * shigh / dhigh - 128;
++      y0 = py >> 8;                   /* Put integer part in y0 */
++      y1 = y0 + 1;
++      py &= 255;                      /* Keep fractional part in py */
++
++      if (y0 < 0)     y0 = y1 = 0;
++      if (y1 >= shigh)        y0 = y1 = shigh-1;
+ 
+-      cyOff = cy * swide * bperpix;    /* current line */
+-      y1Off = y1 * swide * bperpix;    /* up or down one line, depending */
++      y0off = y0 * swide * bperpix;   /* current line */
++      y1off = y1 * swide * bperpix;   /* one line down */
+ 
+       if ((ey&15) == 0) WaitCursor();
+ 
+-      for (ex=0; ex<dwide; ex++) {
+-      rA = rB = rC = rD = gA = gB = gC = gD = bA = bB = bC = bD = 0;
++      for (ex=0; ex < dwide; ex++) {
+ 
+-      cx = cxtab[ex];
+       px = pxtab[ex];
++      x0 = px >> 8;                   /* Put integer part in x0 */
++      x1 = x0 + 1;
++      px &= 255;                      /* Keep fractional part in px */
+ 
+-      if (px<0) { x1 = cx-1;  if (x1<0) x1=0; }
+-           else { x1 = cx+1;  if (x1>swide-1) x1=swide-1; }
++      if (x0 < 0)       x0 = x1 = 0;
++      if (x1 >= swide)  x0 = x1 = swide-1;
+ 
+       if (is24) {
+-        pptr = pic824 + y1Off + x1*bperpix;   /* corner pixel */
++        pptr = pic824 + y0off + x0*bperpix;   /* upper left pixel */
+         rA = *pptr++;  gA = *pptr++;  bA = *pptr++;
+ 
+-        pptr = pic824 + y1Off + cx*bperpix;   /* up/down center pixel */
++        pptr = pic824 + y0off + x1*bperpix;   /* upper right pixel */
+         rB = *pptr++;  gB = *pptr++;  bB = *pptr++;
+ 
+-        pptr = pic824 + cyOff + x1*bperpix;   /* left/right center pixel */
++        pptr = pic824 + y1off + x0*bperpix;   /* lower left pixel */
+         rC = *pptr++;  gC = *pptr++;  bC = *pptr++;
+ 
+-        pptr = pic824 + cyOff + cx*bperpix;   /* center pixel */
++        pptr = pic824 + y1off + x1*bperpix;   /* lower right pixel */
+         rD = *pptr++;  gD = *pptr++;  bD = *pptr++;
+       }
+       else {  /* 8-bit picture */
+-        cA = pic824[y1Off + x1];   /* corner pixel */
+-        cB = pic824[y1Off + cx];   /* up/down center pixel */
+-        cC = pic824[cyOff + x1];   /* left/right center pixel */
+-        cD = pic824[cyOff + cx];   /* center pixel */
++        cA = pic824[y0off + x0];      /* upper left pixel */
++        cB = pic824[y0off + x1];      /* upper right pixel */
++        cC = pic824[y1off + x0];      /* lower left pixel */
++        cD = pic824[y1off + x1];      /* lower right pixel */
+       }
+        
+       /* quick check */
+@@ -170,38 +165,30 @@
+       }
+ 
+       else {
+-        /* compute weighting factors */
+-        apx = abs(px);  apy = abs(py);
+-        pA = (apx * apy) / 100;
+-        pB = (apy * (100 - apx)) / 100;
+-        pC = (apx * (100 - apy)) / 100;
+-        pD = 100 - (pA + pB + pC);
++        pA = (256-px)*(256-py);       /* compute weighting factors */
++        pB = px * (256-py);           /* total weight is exactly 2^16 */
++        pC = (256-px) * py;
++        pD = px * py;
+ 
+         if (is24) {
+-          *pp++ = ((int) (pA * rA))/100 + ((int) (pB * rB))/100 + 
+-                  ((int) (pC * rC))/100 + ((int) (pD * rD))/100;
+-
+-          *pp++ = ((int) (pA * gA))/100 + ((int) (pB * gB))/100 + 
+-                  ((int) (pC * gC))/100 + ((int) (pD * gD))/100;
+-
+-          *pp++ = ((int) (pA * bA))/100 + ((int) (pB * bB))/100 + 
+-                  ((int) (pC * bC))/100 + ((int) (pD * bD))/100;
++          *pp++ = (pA * rA + pB * rB + pC * rC + pD * rD) + 32768 >> 16;
++          *pp++ = (pA * gA + pB * gB + pC * gC + pD * gD) + 32768 >> 16;
++          *pp++ = (pA * bA + pB * bB + pC * bC + pD * bD) + 32768 >> 16;
+         }
+         else {  /* 8-bit pic */
+-          *pp++ = ((int) (pA * rmap[cA]))/100 + ((int)(pB * rmap[cB]))/100 + 
+-                  ((int) (pC * rmap[cC]))/100 + ((int)(pD * rmap[cD]))/100;
++          *pp++ = (pA * rmap[cA] + pB * rmap[cB] + pC * rmap[cC] +
++                   pD * rmap[cD]) + 32768 >> 16;
+ 
+-          *pp++ = ((int) (pA * gmap[cA]))/100 + ((int)(pB * gmap[cB]))/100 + 
+-                  ((int) (pC * gmap[cC]))/100 + ((int)(pD * gmap[cD]))/100;
++          *pp++ = (pA * gmap[cA] + pB * gmap[cB] + pC * gmap[cC] +
++                   pD * gmap[cD]) + 32768 >> 16;
+ 
+-          *pp++ = ((int)(pA * bmap[cA]))/100 + ((int)(pB * bmap[cB]))/100 + 
+-                  ((int)(pC * bmap[cC]))/100 + ((int)(pD * bmap[cD]))/100;
++          *pp++ = (pA * bmap[cA] + pB * bmap[cB] + pC * bmap[cC] +
++                   pD * bmap[cD]) + 32768 >> 16;
+         }
+       }
+       }
+     }
+ 
+-    free(cxtab);  
+     free(pxtab);
+     retval = 0;    /* okay */
+   }
index dbee907f0bb34ce9c5848f930df5cf356d0f273d..3403501927a2241cc57d0aacbd4f499715631a06 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2004 Gentoo Foundation
+# Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/xv-3.10a-r8.ebuild,v 1.4 2004/12/16 10:51:08 corsair Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/xv-3.10a-r8.ebuild,v 1.5 2005/01/04 14:10:17 taviso Exp $
 
 inherit ccc flag-o-matic eutils
 
diff --git a/media-gfx/xv/xv-3.10a-r9.ebuild b/media-gfx/xv/xv-3.10a-r9.ebuild
new file mode 100644 (file)
index 0000000..28b918f
--- /dev/null
@@ -0,0 +1,79 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/xv-3.10a-r9.ebuild,v 1.1 2005/01/04 14:10:17 taviso Exp $
+
+inherit ccc flag-o-matic eutils
+
+DESCRIPTION="An interactive image manipulation program for X which can deal with a wide variety of image formats"
+HOMEPAGE="http://www.trilon.com/xv/index.html"
+SRC_URI="ftp://ftp.cis.upenn.edu/pub/xv/${P}.tar.gz
+       mirror://gentoo/${P}-gentoo.tar.gz"
+
+LICENSE="xv"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips ~hppa ~ia64 ~amd64 ~ppc64"
+IUSE="jpeg tiff png"
+
+DEPEND="virtual/x11
+       jpeg? ( >=media-libs/jpeg-6b )
+       tiff? ( >=media-libs/tiff-3.6.1-r2 )
+       png? ( >=media-libs/libpng-1.2 >=sys-libs/zlib-1.1.4 )"
+
+src_unpack() {
+       unpack ${A}
+
+       cd ${S}
+
+       use ppc && epatch ${FILESDIR}/${P}-ppc.patch
+
+       epatch ../${P}-enhanced-Nu.patch || die
+       epatch ../${P}-gentoo-Nu.patch || die
+       epatch ${FILESDIR}/xv-use-getcwd.patch || die
+       # fix security issues #61619
+       epatch ${FILESDIR}/${P}-security.diff || die
+
+       # These patches from Dave Coffin
+       # http://www.cybercom.net/~dcoffin/dcraw/
+       epatch ${FILESDIR}/xv-smoothing-algorithm.diff || die
+       epatch ${FILESDIR}/xv-optimize-jpeg.diff || die
+       epatch ${FILESDIR}/xv-postscript-double-free.diff || die
+}
+
+src_compile() {
+       if use jpeg; then
+               append-flags -DDOJPEG
+       else
+               sed -i -e "s:JPEGLIB = -ljpeg:JPEGLIB =:" Makefile || die "sed jpeg failed"
+       fi
+       if use png; then
+               append-flags -DDOPNG
+       else
+               sed -i -e "s:PNGLIB = -lpng:PNGLIB =:" Makefile || die "sed png failed"
+               sed -i -e "s:ZLIBLIB = -lz:ZLIBLIB =:" Makefile || die "sed zlib failed"
+       fi
+       if use tiff; then
+               append-flags -DDOTIFF
+       else
+               sed -i -e "s:TIFFLIB = -ltiff:TIFFLIB =:" Makefile || die "sed tiff failed"
+       fi
+       sed -i 's:CCOPTS = -O:CCOPTS = $(E_CFLAGS):' Makefile || die "sed Makefile failed"
+       sed -i 's:COPTS=\t-O:COPTS= $(E_CFLAGS):' tiff/Makefile || die "sed tiff/Makefile failed"
+       is-ccc && replace-cc-hardcode
+       echo make E_CFLAGS="${CFLAGS}" > go.sh
+       make E_CFLAGS="${CFLAGS}" || die
+}
+
+src_install() {
+       dodir /usr/bin
+       dodir /usr/share/man/man1
+
+       # LIBDIR is where xv installs xvdocs.ps and we dodoc it below
+       make \
+               DESTDIR=${D} \
+               BINDIR=${D}/usr/bin \
+               MANDIR=${D}/usr/share/man/man1 \
+               LIBDIR=/dev/null \
+               install || die
+
+       dodoc README INSTALL CHANGELOG BUGS IDEAS docs/*.ps docs/*.doc
+}