summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Arnold <nerdboy@gentoo.org>2006-06-28 03:57:00 +0000
committerSteve Arnold <nerdboy@gentoo.org>2006-06-28 03:57:00 +0000
commit02655c06114f0a062edd88205f4d9620a25143ff (patch)
treebb6ddd798b55f89ea3400e0bc7912bc5973976c0 /media-libs
parentversion bump (bug #138039) (diff)
downloadhistorical-02655c06114f0a062edd88205f4d9620a25143ff.tar.gz
historical-02655c06114f0a062edd88205f4d9620a25143ff.tar.bz2
historical-02655c06114f0a062edd88205f4d9620a25143ff.zip
fixes for bug 135881 (and related) plus the jbig patch for hylafax
Package-Manager: portage-2.1.1_pre1-r2
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/tiff/ChangeLog10
-rw-r--r--media-libs/tiff/Manifest37
-rw-r--r--media-libs/tiff/files/digest-tiff-3.8.2-r13
-rw-r--r--media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch20
-rw-r--r--media-libs/tiff/files/tiff-buffer.patch11
-rw-r--r--media-libs/tiff/files/tiff-jbig.patch510
-rw-r--r--media-libs/tiff/tiff-3.8.2-r1.ebuild52
7 files changed, 628 insertions, 15 deletions
diff --git a/media-libs/tiff/ChangeLog b/media-libs/tiff/ChangeLog
index 5e82c8ea75f2..7d5af95a477f 100644
--- a/media-libs/tiff/ChangeLog
+++ b/media-libs/tiff/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for media-libs/tiff
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/tiff/ChangeLog,v 1.82 2006/06/18 19:38:49 kloeri Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/tiff/ChangeLog,v 1.83 2006/06/28 03:57:00 nerdboy Exp $
+
+*tiff-3.8.2-r1 (28 Jun 2006)
+
+ 28 Jun 2006; Steve Arnold <nerdboy@gentoo.org>
+ +files/tiff-3.8.2-tiffsplit.patch, +files/tiff-buffer.patch,
+ +files/tiff-jbig.patch, +tiff-3.8.2-r1.ebuild:
+ Fixes for bug 135881 (and related) plus the jbig patch for hylafax.
+ Please test and stablize early if possible...
18 Jun 2006; Bryan Østergaard <kloeri@gentoo.org> tiff-3.8.2.ebuild:
Stable on ia64, bug 129675.
diff --git a/media-libs/tiff/Manifest b/media-libs/tiff/Manifest
index a6afb02f011a..705d2a4808f4 100644
--- a/media-libs/tiff/Manifest
+++ b/media-libs/tiff/Manifest
@@ -1,10 +1,19 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
AUX tiff-3.7.4-assign-dont-compare.patch 404 RMD160 beb5e0c36567189013b672a37bc51ceb7846f69b SHA1 59616d5e4fae78a4f4ec34b099e1cc3a35b81453 SHA256 9944cf632ebc5ea0c2895bf05ff8bda4815b517bb42e54385c0d656c51e7396e
MD5 94f0e7d5e8a574073ec05f7c24c81fc1 files/tiff-3.7.4-assign-dont-compare.patch 404
RMD160 beb5e0c36567189013b672a37bc51ceb7846f69b files/tiff-3.7.4-assign-dont-compare.patch 404
SHA256 9944cf632ebc5ea0c2895bf05ff8bda4815b517bb42e54385c0d656c51e7396e files/tiff-3.7.4-assign-dont-compare.patch 404
+AUX tiff-3.8.2-tiffsplit.patch 646 RMD160 14633a8b89b71f6c9aa027c25233854331d8633f SHA1 445b7bbdeaadf8362127173a4908f7e5f31ac30d SHA256 79f88d303634d52478fe36fff972aa133d3bf1d23ab4c8ad35d3baba40461a48
+MD5 249c0366a5e5befd2f27417dad3c3e2c files/tiff-3.8.2-tiffsplit.patch 646
+RMD160 14633a8b89b71f6c9aa027c25233854331d8633f files/tiff-3.8.2-tiffsplit.patch 646
+SHA256 79f88d303634d52478fe36fff972aa133d3bf1d23ab4c8ad35d3baba40461a48 files/tiff-3.8.2-tiffsplit.patch 646
+AUX tiff-buffer.patch 461 RMD160 d3cfd4c59d51c8eacf1bde2b3d840dec1be6294d SHA1 7efceeec3d93a4a8b4a3cbb256b5bbc274a30f39 SHA256 c312510be0f5f77008b3eab627733fbb175b869cf9d3bc6d6b424b7117d70548
+MD5 39245e30947f19319a8ed59be48dd733 files/tiff-buffer.patch 461
+RMD160 d3cfd4c59d51c8eacf1bde2b3d840dec1be6294d files/tiff-buffer.patch 461
+SHA256 c312510be0f5f77008b3eab627733fbb175b869cf9d3bc6d6b424b7117d70548 files/tiff-buffer.patch 461
+AUX tiff-jbig.patch 14636 RMD160 88f8069cda0e1a897961e2c69e6b787a7776124d SHA1 293c174bd1137c63a85dbfc761616752d2f3644f SHA256 73e70f6cf3e63abfd7b5569e2aae0a6811020c883065dfc36d563ca2e547ccd1
+MD5 779a4a34809ef096e82c1b89667537f9 files/tiff-jbig.patch 14636
+RMD160 88f8069cda0e1a897961e2c69e6b787a7776124d files/tiff-jbig.patch 14636
+SHA256 73e70f6cf3e63abfd7b5569e2aae0a6811020c883065dfc36d563ca2e547ccd1 files/tiff-jbig.patch 14636
DIST tiff-3.7.3.tar.gz 1272719 RMD160 9d50199ddf1fed8ce1b7ac4986a317f39bb15ed9 SHA1 8e55ade017a21a1f701d7eaa75d700cd159e5d7a SHA256 6906ffd9651398df4fa8d3097bb30613ff484313ba864767fe1518429bc3793a
DIST tiff-3.7.4.tar.gz 1282627 RMD160 9445eeb6a49991d5b16980acf75a7088c3f673fe SHA1 0ff822b63069ab7044dad0d2098440b83b3df572 SHA256 4d8fd7c3443208461c4acaad88c2d69a3136d4dc4e985632fa77a141bcff5313
DIST tiff-3.8.2.tar.gz 1336295 RMD160 1b4d825e3be08764e953fc58246d0c25ab4dd17d SHA1 549e67b6a15b42bfcd72fe17cda7c9a198a393eb SHA256 be88f037080b93ce0a337b2b3ca5e8195f76885deb6c558cc3aa872ee848fc76
@@ -16,14 +25,18 @@ EBUILD tiff-3.7.4.ebuild 1036 RMD160 42052a85913463a7cf4aac9dbe7f861e6544c706 SH
MD5 c3b3e0b1520885b87b2525a74c2c4e10 tiff-3.7.4.ebuild 1036
RMD160 42052a85913463a7cf4aac9dbe7f861e6544c706 tiff-3.7.4.ebuild 1036
SHA256 7827744e17e2cd5ad053e4f5f61ffd72341ed9f7fe482b2773f0fd648da3b35f tiff-3.7.4.ebuild 1036
+EBUILD tiff-3.8.2-r1.ebuild 1595 RMD160 0ec60135e3a5c71bcf9965e0d2392253faae05ae SHA1 42721ae8496f0c565deb7a256658b10c468801bd SHA256 ac8336e12c7c08277009477e3131f44b2c0ec53a55a59006224fdb13c6029852
+MD5 2b6d807b6f7cd32420cc059c31fac437 tiff-3.8.2-r1.ebuild 1595
+RMD160 0ec60135e3a5c71bcf9965e0d2392253faae05ae tiff-3.8.2-r1.ebuild 1595
+SHA256 ac8336e12c7c08277009477e3131f44b2c0ec53a55a59006224fdb13c6029852 tiff-3.8.2-r1.ebuild 1595
EBUILD tiff-3.8.2.ebuild 994 RMD160 1018d2045a5901829eb162bcc684fa8aa35fb89f SHA1 2afbb9c519afecd5c9d6083d3690bf5bb1e6774a SHA256 48d7407d31f2f68dbccaf4772ad5822d3604a32e6f054d498548249bfe20be53
MD5 8c581486654aeb9fe8b3de8ef9c62e6e tiff-3.8.2.ebuild 994
RMD160 1018d2045a5901829eb162bcc684fa8aa35fb89f tiff-3.8.2.ebuild 994
SHA256 48d7407d31f2f68dbccaf4772ad5822d3604a32e6f054d498548249bfe20be53 tiff-3.8.2.ebuild 994
-MISC ChangeLog 11369 RMD160 9fa3085d2e0f7cbea03c4c9be437c76c4964d26f SHA1 1f82a04460cdd3f70318ef8f711b7873dacaee81 SHA256 57963f2407d18409d226c9c2e89c485b798d962dd48fe5dc334d3098081ed8c6
-MD5 ee4a9890a444787cc5ca024c944b86e1 ChangeLog 11369
-RMD160 9fa3085d2e0f7cbea03c4c9be437c76c4964d26f ChangeLog 11369
-SHA256 57963f2407d18409d226c9c2e89c485b798d962dd48fe5dc334d3098081ed8c6 ChangeLog 11369
+MISC ChangeLog 11680 RMD160 54648af1a507c71abc8f81131be6a9fd222db3ec SHA1 213e27da2d1025ea3bd4196b7ff595b85f814288 SHA256 39e7f6472f8d0e2cd2c0c395b1f63e76533e5fb84a961cce91f883a06d7b9dd3
+MD5 7abae798308731bdc7f0ea7e238d573a ChangeLog 11680
+RMD160 54648af1a507c71abc8f81131be6a9fd222db3ec ChangeLog 11680
+SHA256 39e7f6472f8d0e2cd2c0c395b1f63e76533e5fb84a961cce91f883a06d7b9dd3 ChangeLog 11680
MISC metadata.xml 447 RMD160 8df7883ab02a353acd993037450e7bbc984c052d SHA1 8ffef6a88ae70afbdea7f3be25e1e9a28b6698c5 SHA256 ee7391b2521ef9676ead67466ad7249f05f8d3c9bd8d8984bc0ceac8dcb804b3
MD5 085bf925a1dc6f9756f484ac688a92f9 metadata.xml 447
RMD160 8df7883ab02a353acd993037450e7bbc984c052d metadata.xml 447
@@ -37,10 +50,6 @@ SHA256 f702ff05ae29d2f9e205cff0c3b8aba479a7deaff177f64692c2ba607853fd1b files/di
MD5 ddd782654fb63cdc51a0de8be7ee84b0 files/digest-tiff-3.8.2 235
RMD160 a1ce4589a4521fbf2112b45c8d449ff838303892 files/digest-tiff-3.8.2 235
SHA256 e182619ef0f268c21bb0936827f3360e092f6dbcc73283b707673f4e4932a5d0 files/digest-tiff-3.8.2 235
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.3 (GNU/Linux)
-
-iD8DBQFEni5iamhnQswr0vIRAj0rAJoDTZujPsZs+6RFG9aX8JLUnEM+bACfZDY0
-spQvWFpY9Uud/OgUir7yF88=
-=7F4j
------END PGP SIGNATURE-----
+MD5 ddd782654fb63cdc51a0de8be7ee84b0 files/digest-tiff-3.8.2-r1 235
+RMD160 a1ce4589a4521fbf2112b45c8d449ff838303892 files/digest-tiff-3.8.2-r1 235
+SHA256 e182619ef0f268c21bb0936827f3360e092f6dbcc73283b707673f4e4932a5d0 files/digest-tiff-3.8.2-r1 235
diff --git a/media-libs/tiff/files/digest-tiff-3.8.2-r1 b/media-libs/tiff/files/digest-tiff-3.8.2-r1
new file mode 100644
index 000000000000..713fa2f6af3e
--- /dev/null
+++ b/media-libs/tiff/files/digest-tiff-3.8.2-r1
@@ -0,0 +1,3 @@
+MD5 fbb6f446ea4ed18955e2714934e5b698 tiff-3.8.2.tar.gz 1336295
+RMD160 1b4d825e3be08764e953fc58246d0c25ab4dd17d tiff-3.8.2.tar.gz 1336295
+SHA256 be88f037080b93ce0a337b2b3ca5e8195f76885deb6c558cc3aa872ee848fc76 tiff-3.8.2.tar.gz 1336295
diff --git a/media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch b/media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch
new file mode 100644
index 000000000000..5422e74fba63
--- /dev/null
+++ b/media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch
@@ -0,0 +1,20 @@
+diff -ruN tiff-3.7.4-old/tools/tiffsplit.c tiff-3.7.4/tools/tiffsplit.c
+--- tiff-3.7.4-old/tools/tiffsplit.c 2005-05-26 20:38:48.000000000 +0200
++++ tiff-3.7.4/tools/tiffsplit.c 2006-06-01 16:00:11.000000000 +0200
+@@ -60,14 +60,13 @@
+ return (-3);
+ }
+ if (argc > 2)
+- strcpy(fname, argv[2]);
++ snprintf(fname, sizeof(fname), "%s", argv[2]);
+ in = TIFFOpen(argv[1], "r");
+ if (in != NULL) {
+ do {
+ char path[1024+1];
+ newfilename();
+- strcpy(path, fname);
+- strcat(path, ".tif");
++ snprintf(path, sizeof(path), "%s.tif", fname);
+ out = TIFFOpen(path, TIFFIsBigEndian(in)?"wb":"wl");
+ if (out == NULL)
+ return (-2);
diff --git a/media-libs/tiff/files/tiff-buffer.patch b/media-libs/tiff/files/tiff-buffer.patch
new file mode 100644
index 000000000000..b5ff2ee30769
--- /dev/null
+++ b/media-libs/tiff/files/tiff-buffer.patch
@@ -0,0 +1,11 @@
+--- tools/tiff2pdf.c.orig 2006-06-04 18:26:40.000000000 -0700
++++ tools/tiff2pdf.c 2006-06-04 18:27:22.000000000 -0700
+@@ -3668,7 +3668,7 @@
+ written += TIFFWriteFile(output, (tdata_t) "(", 1);
+ for (i=0;i<len;i++){
+ if((pdfstr[i]&0x80) || (pdfstr[i]==127) || (pdfstr[i]<32)){
+- sprintf(buffer, "\\%.3o", pdfstr[i]);
++ snprintf(buffer, "\\%.3o", pdfstr[i]);
+ written += TIFFWriteFile(output, (tdata_t) buffer, 4);
+ } else {
+ switch (pdfstr[i]){
diff --git a/media-libs/tiff/files/tiff-jbig.patch b/media-libs/tiff/files/tiff-jbig.patch
new file mode 100644
index 000000000000..58d079d63bf9
--- /dev/null
+++ b/media-libs/tiff/files/tiff-jbig.patch
@@ -0,0 +1,510 @@
+--- configure.orig 2005-09-12 06:52:41.000000000 -0700
++++ configure 2006-06-06 19:41:22.000000000 -0700
+@@ -23648,6 +23648,25 @@
+ fi
+
+
++HAVE_JBIG=no
++# Check whether --enable-jbig or --disable-jbig was given.
++if test "${enable_jbig+set}" = set; then
++ enableval="$enable_jbig"
++ HAVE_JBIG=$enableval
++else
++ HAVE_JBIG=no
++fi;
++
++if test "$HAVE_JBIG" = "yes" ; then
++
++cat >>confdefs.h <<\_ACEOF
++#define JBIG_SUPPORT 1
++_ACEOF
++
++ LIBS="-ljbig $LIBS"
++fi
++
++
+ # Check whether --enable-cxx or --disable-cxx was given.
+ if test "${enable_cxx+set}" = set; then
+ enableval="$enable_cxx"
+@@ -27680,6 +27699,7 @@
+ echo " Pixar log-format algorithm: ${HAVE_PIXARLOG}"
+ echo " JPEG support: ${HAVE_JPEG}"
+ echo " Old JPEG support: ${HAVE_OJPEG}"
++echo " JBIG support: ${HAVE_JBIG}"
+ echo ""
+ echo " C++ support: ${HAVE_CXX}"
+ echo ""
+--- configure.ac.orig 2005-09-12 06:52:41.000000000 -0700
++++ configure.ac 2006-06-06 19:35:23.000000000 -0700
+@@ -387,6 +387,22 @@
+ fi
+
+ dnl ---------------------------------------------------------------------------
++dnl Check for JBIG.
++dnl ---------------------------------------------------------------------------
++
++HAVE_JBIG=no
++AC_ARG_ENABLE(jbig,
++ AS_HELP_STRING([--disable-jbig],
++ [disable support for JBIG]),
++ [HAVE_JBIG=$enableval], [HAVE_JBIG=no])
++
++if test "$HAVE_JBIG" = "yes" ; then
++ AC_DEFINE(JBIG_SUPPORT, 1,
++ [Support JBIG])
++ LIBS="-ljbig $LIBS"
++fi
++
++dnl ---------------------------------------------------------------------------
+ dnl Check for C++.
+ dnl ---------------------------------------------------------------------------
+
+--- libtiff/Makefile.in.orig 2005-09-12 09:33:05.000000000 -0700
++++ libtiff/Makefile.in 2006-06-06 19:35:23.000000000 -0700
+@@ -97,7 +97,7 @@
+ tif_compress.lo tif_dir.lo tif_dirinfo.lo tif_dirread.lo \
+ tif_dirwrite.lo tif_dumpmode.lo tif_error.lo tif_extension.lo \
+ tif_fax3.lo tif_fax3sm.lo tif_flush.lo tif_getimage.lo \
+- tif_jpeg.lo tif_luv.lo tif_lzw.lo tif_next.lo tif_ojpeg.lo \
++ tif_jpeg.lo tif_jbig.lo tif_luv.lo tif_lzw.lo tif_next.lo tif_ojpeg.lo \
+ tif_open.lo tif_packbits.lo tif_pixarlog.lo tif_predict.lo \
+ tif_print.lo tif_read.lo tif_strip.lo tif_swab.lo \
+ tif_thunder.lo tif_tile.lo tif_unix.lo tif_version.lo \
+@@ -306,6 +306,7 @@
+ tif_flush.c \
+ tif_getimage.c \
+ tif_jpeg.c \
++ tif_jbig.c \
+ tif_luv.c \
+ tif_lzw.c \
+ tif_next.c \
+@@ -480,6 +481,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_flush.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_getimage.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_jpeg.Plo@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_jbig.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_luv.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_lzw.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_next.Plo@am__quote@
+--- libtiff/tif_config.h.in.orig 2005-07-12 09:02:04.000000000 -0700
++++ libtiff/tif_config.h.in 2006-06-06 19:35:23.000000000 -0700
+@@ -146,6 +146,9 @@
+ /* Support JPEG compression (requires IJG JPEG library) */
+ #undef JPEG_SUPPORT
+
++/* Support JBIG compression (requires JBIG-KIT library) */
++#undef JBIG_SUPPORT
++
+ /* Support LogLuv high dynamic range encoding */
+ #undef LOGLUV_SUPPORT
+
+--- libtiff/tif_jbig.c.orig 2006-06-06 19:32:40.000000000 -0700
++++ libtiff/tif_jbig.c 2006-06-06 19:35:23.000000000 -0700
+@@ -0,0 +1,340 @@
++/*
++ * Copyright (c) 1988-1997 Sam Leffler
++ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and
++ * its documentation for any purpose is hereby granted without fee, provided
++ * that (i) the above copyright notices and this permission notice appear in
++ * all copies of the software and related documentation, and (ii) the names of
++ * Sam Leffler and Silicon Graphics may not be used in any advertising or
++ * publicity relating to the software without the specific, prior written
++ * permission of Sam Leffler and Silicon Graphics.
++ *
++ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
++ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
++ *
++ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
++ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
++ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
++ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
++ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
++ * OF THIS SOFTWARE.
++ */
++
++/*
++ * TIFF Library.
++ *
++ * JBIG Compression Algorithm Support.
++ */
++
++#include "tiffio.h"
++#include "tiffiop.h"
++
++#ifdef JBIG_SUPPORT
++#include "jbig.h"
++
++struct JBIGState
++{
++ uint32 recvparams; /* encoded Class 2 session params */
++ char* subaddress; /* subaddress string */
++ uint32 recvtime; /* time spend receiving in seconds */
++ char* faxdcs; /* encoded fax parameters (DCS, Table 2/T.30) */
++
++ TIFFVGetMethod vgetparent;
++ TIFFVSetMethod vsetparent;
++};
++
++#define GetJBIGState(tif) ((struct JBIGState*)(tif)->tif_data)
++#define N(a) (sizeof (a) / sizeof (a[0]))
++
++#define FIELD_RECVPARAMS (FIELD_CODEC+0)
++#define FIELD_SUBADDRESS (FIELD_CODEC+1)
++#define FIELD_RECVTIME (FIELD_CODEC+2)
++#define FIELD_FAXDCS (FIELD_CODEC+3)
++
++static const TIFFFieldInfo jbigFieldInfo[] =
++{
++ {TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, FIELD_RECVPARAMS, TRUE, FALSE, "FaxRecvParams"},
++ {TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, FIELD_SUBADDRESS, TRUE, FALSE, "FaxSubAddress"},
++ {TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, FIELD_RECVTIME, TRUE, FALSE, "FaxRecvTime"},
++ {TIFFTAG_FAXDCS, -1, -1, TIFF_ASCII, FIELD_FAXDCS, TRUE, FALSE, "FaxDcs"},
++};
++
++static int JBIGSetupDecode(TIFF* tif)
++{
++ if (TIFFNumberOfStrips(tif) != 1)
++ {
++ TIFFError("JBIG", "Multistrip images not supported in decoder");
++ return 0;
++ }
++
++ return 1;
++}
++
++static int JBIGDecode(TIFF* tif, tidata_t buffer, tsize_t size, tsample_t s)
++{
++ struct jbg_dec_state decoder;
++ int decodeStatus = 0;
++ unsigned char* pImage = NULL;
++
++ if (isFillOrder(tif, tif->tif_dir.td_fillorder))
++ {
++ TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdatasize);
++ }
++
++ jbg_dec_init(&decoder);
++ jbg_newlen(tif->tif_rawdata, tif->tif_rawdatasize);
++ /*
++ * I do not check the return status of jbg_newlen because even if this function
++ * fails it does not necessarily mean that decoding the image will fail. It is
++ * generally only needed for received fax images that do not contain the actual
++ * length of the image in the BIE header. I do not log when an error occurs
++ * because that will cause problems when converting JBIG encoded TIFF's to
++ * PostScript. As long as the actual image length is contained in the BIE header
++ * jbg_dec_in should succeed.
++ */
++
++ decodeStatus = jbg_dec_in(&decoder, tif->tif_rawdata, tif->tif_rawdatasize, NULL);
++ if (JBG_EOK != decodeStatus)
++ {
++ TIFFError("JBIG", "Error (%d) decoding: %s", decodeStatus, jbg_strerror(decodeStatus, JBG_EN));
++ return 0;
++ }
++
++ pImage = jbg_dec_getimage(&decoder, 0);
++ _TIFFmemcpy(buffer, pImage, jbg_dec_getsize(&decoder));
++ jbg_dec_free(&decoder);
++ return 1;
++}
++
++static int JBIGSetupEncode(TIFF* tif)
++{
++ TIFFDirectory* dir = &tif->tif_dir;
++
++ if (TIFFNumberOfStrips(tif) != 1)
++ {
++ TIFFError("JBIG", "Multistrip images not supported in encoder");
++ return 0;
++ }
++
++ return 1;
++}
++
++static int JBIGCopyEncodedData(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
++{
++ (void) s;
++ while (cc > 0)
++ {
++ tsize_t n = cc;
++
++ if (tif->tif_rawcc + n > tif->tif_rawdatasize)
++ {
++ n = tif->tif_rawdatasize - tif->tif_rawcc;
++ }
++
++ assert(n > 0);
++ _TIFFmemcpy(tif->tif_rawcp, pp, n);
++ tif->tif_rawcp += n;
++ tif->tif_rawcc += n;
++ pp += n;
++ cc -= n;
++ if (tif->tif_rawcc >= tif->tif_rawdatasize &&
++ !TIFFFlushData1(tif))
++ {
++ return (-1);
++ }
++ }
++
++ return (1);
++}
++
++static void JBIGOutputBie(unsigned char* buffer, size_t len, void *userData)
++{
++ TIFF* tif = (TIFF*)userData;
++
++ if (isFillOrder(tif, tif->tif_dir.td_fillorder))
++ {
++ TIFFReverseBits(buffer, len);
++ }
++
++ JBIGCopyEncodedData(tif, buffer, len, 0);
++}
++
++static int JBIGEncode(TIFF* tif, tidata_t buffer, tsize_t size, tsample_t s)
++{
++ TIFFDirectory* dir = &tif->tif_dir;
++ struct jbg_enc_state encoder;
++
++ jbg_enc_init(&encoder,
++ dir->td_imagewidth,
++ dir->td_imagelength,
++ 1,
++ &buffer,
++ JBIGOutputBie,
++ tif);
++ /*
++ * jbg_enc_out does the "real" encoding. As data is encoded, JBIGOutputBie
++ * is called, which writes the data to the directory.
++ */
++ jbg_enc_out(&encoder);
++ jbg_enc_free(&encoder);
++
++ return 1;
++}
++
++static void JBIGCleanup(TIFF* tif)
++{
++ if (NULL != tif->tif_data)
++ {
++ _TIFFfree(tif->tif_data);
++ tif->tif_data = NULL;
++ }
++}
++
++static void JBIGPrintDir(TIFF* tif, FILE* fd, long flags)
++{
++ struct JBIGState* codec = GetJBIGState(tif);
++ (void)flags;
++
++ if (TIFFFieldSet(tif, FIELD_RECVPARAMS))
++ {
++ fprintf(fd,
++ " Fax Receive Parameters: %08lx\n",
++ (unsigned long)codec->recvparams);
++ }
++
++ if (TIFFFieldSet(tif, FIELD_SUBADDRESS))
++ {
++ fprintf(fd,
++ " Fax SubAddress: %s\n",
++ codec->subaddress);
++ }
++
++ if (TIFFFieldSet(tif, FIELD_RECVTIME))
++ {
++ fprintf(fd,
++ " Fax Receive Time: %lu secs\n",
++ (unsigned long)codec->recvtime);
++ }
++
++ if (TIFFFieldSet(tif, FIELD_FAXDCS))
++ {
++ fprintf(fd,
++ " Fax DCS: %s\n",
++ codec->faxdcs);
++ }
++}
++
++static int JBIGVGetField(TIFF* tif, ttag_t tag, va_list ap)
++{
++ struct JBIGState* codec = GetJBIGState(tif);
++
++ switch (tag)
++ {
++ case TIFFTAG_FAXRECVPARAMS:
++ *va_arg(ap, uint32*) = codec->recvparams;
++ break;
++
++ case TIFFTAG_FAXSUBADDRESS:
++ *va_arg(ap, char**) = codec->subaddress;
++ break;
++
++ case TIFFTAG_FAXRECVTIME:
++ *va_arg(ap, uint32*) = codec->recvtime;
++ break;
++
++ case TIFFTAG_FAXDCS:
++ *va_arg(ap, char**) = codec->faxdcs;
++ break;
++
++ default:
++ return (*codec->vgetparent)(tif, tag, ap);
++ }
++
++ return 1;
++}
++
++static int JBIGVSetField(TIFF* tif, ttag_t tag, va_list ap)
++{
++ struct JBIGState* codec = GetJBIGState(tif);
++
++ switch (tag)
++ {
++ case TIFFTAG_FAXRECVPARAMS:
++ codec->recvparams = va_arg(ap, uint32);
++ break;
++
++ case TIFFTAG_FAXSUBADDRESS:
++ _TIFFsetString(&codec->subaddress, va_arg(ap, char*));
++ break;
++
++ case TIFFTAG_FAXRECVTIME:
++ codec->recvtime = va_arg(ap, uint32);
++ break;
++
++ case TIFFTAG_FAXDCS:
++ _TIFFsetString(&codec->faxdcs, va_arg(ap, char*));
++ break;
++
++ default:
++ return (*codec->vsetparent)(tif, tag, ap);
++ }
++
++ TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
++ tif->tif_flags |= TIFF_DIRTYDIRECT;
++ return 1;
++}
++
++int TIFFInitJBIG(TIFF* tif, int scheme)
++{
++ struct JBIGState* codec = NULL;
++
++ /* Allocate memory for the JBIGState structure.*/
++ tif->tif_data = (tdata_t)_TIFFmalloc(sizeof(struct JBIGState));
++ if (tif->tif_data == NULL)
++ {
++ TIFFError("TIFFInitJBIG", "Not enough memory for JBIGState");
++ return 0;
++ }
++ _TIFFmemset(tif->tif_data, 0, sizeof(struct JBIGState));
++ codec = GetJBIGState(tif);
++
++ /* Initialize codec private fields */
++ codec->recvparams = 0;
++ codec->subaddress = NULL;
++ codec->faxdcs = NULL;
++ codec->recvtime = 0;
++
++ /* Register codec private fields with libtiff and setup function pointers*/
++ _TIFFMergeFieldInfo(tif, jbigFieldInfo, N(jbigFieldInfo));
++
++ codec->vgetparent = tif->tif_tagmethods.vgetfield;
++ codec->vsetparent = tif->tif_tagmethods.vsetfield;
++
++ tif->tif_tagmethods.vgetfield = JBIGVGetField;
++ tif->tif_tagmethods.vsetfield = JBIGVSetField;
++ tif->tif_tagmethods.printdir = JBIGPrintDir;
++
++
++ /*
++ * These flags are set so the JBIG Codec can control when to reverse bits and when
++ * not to and to allow the jbig decoder and bit reverser to write to memory
++ * when necessary.
++ */
++ tif->tif_flags |= TIFF_NOBITREV;
++ tif->tif_flags &= ~TIFF_MAPPED;
++
++ /* Setup the function pointers for encode, decode, and cleanup. */
++ tif->tif_setupdecode = JBIGSetupDecode;
++ tif->tif_decodestrip = JBIGDecode;
++
++ tif->tif_setupencode = JBIGSetupEncode;
++ tif->tif_encodestrip = JBIGEncode;
++
++ tif->tif_cleanup = JBIGCleanup;
++
++ return 1;
++}
++
++#endif /* JBIG_SUPPORT */
+--- libtiff/tiffconf.h.in.orig 2005-07-28 01:49:24.000000000 -0700
++++ libtiff/tiffconf.h.in 2006-06-06 19:35:23.000000000 -0700
+@@ -40,6 +40,9 @@
+ /* Support JPEG compression (requires IJG JPEG library) */
+ #undef JPEG_SUPPORT
+
++/* Support JBIG compression (requires JBIG-KIT library) */
++#undef JBIG_SUPPORT
++
+ /* Support LogLuv high dynamic range encoding */
+ #undef LOGLUV_SUPPORT
+
+--- libtiff/tiffconf.h.vc.orig 2005-07-28 01:49:24.000000000 -0700
++++ libtiff/tiffconf.h.vc 2006-06-06 19:35:23.000000000 -0700
+@@ -41,6 +41,9 @@
+ /* Support JPEG compression (requires IJG JPEG library) */
+ /* #undef JPEG_SUPPORT */
+
++/* Support JBIG compression (requires JBIG-KIT library) */
++#undef JBIG_SUPPORT
++
+ /* Support LogLuv high dynamic range encoding */
+ #define LOGLUV_SUPPORT 1
+
+--- tools/tiffcp.c.orig 2005-07-08 02:03:49.000000000 -0700
++++ tools/tiffcp.c 2006-06-06 19:44:44.000000000 -0700
+@@ -349,6 +349,8 @@
+ if (cp)
+ defpredictor = atoi(cp+1);
+ defcompression = COMPRESSION_ADOBE_DEFLATE;
++ } else if (strneq(opt, "jbig", 4)) {
++ defcompression = COMPRESSION_JBIG;
+ } else
+ return (0);
+ return (1);
+@@ -648,6 +650,12 @@
+ TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+ TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+ break;
++ case COMPRESSION_JBIG:
++ CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);
++ CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);
++ CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
++ CopyTag(TIFFTAG_FAXDCS, 1, TIFF_ASCII);
++ break;
+ case COMPRESSION_LZW:
+ case COMPRESSION_ADOBE_DEFLATE:
+ case COMPRESSION_DEFLATE:
+--- libtiff/Makefile.vc.orig 2006-06-06 19:58:40.000000000 -0700
++++ libtiff/Makefile.vc 2006-06-06 19:59:32.000000000 -0700
+@@ -29,7 +29,7 @@
+
+ !INCLUDE ..\nmake.opt
+
+-INCL = -I. $(JPEG_INCLUDE) $(ZLIB_INCLUDE)
++INCL = -I. $(JPEG_INCLUDE) $(ZLIB_INCLUDE) $(JBIG_INCLUDE)
+
+ !IFDEF USE_WIN_CRT_LIB
+ OBJ_SYSDEP_MODULE = tif_unix.obj
+@@ -74,6 +74,7 @@
+ tif_warning.obj \
+ tif_write.obj \
+ tif_zip.obj \
++ tif_jbig.obj \
+ $(OBJ_SYSDEP_MODULE)
+
+ all: libtiff.lib $(DLLNAME)
diff --git a/media-libs/tiff/tiff-3.8.2-r1.ebuild b/media-libs/tiff/tiff-3.8.2-r1.ebuild
new file mode 100644
index 000000000000..34f5ff3456bf
--- /dev/null
+++ b/media-libs/tiff/tiff-3.8.2-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/tiff/tiff-3.8.2-r1.ebuild,v 1.1 2006/06/28 03:57:00 nerdboy Exp $
+
+inherit eutils libtool
+
+DESCRIPTION="Library for manipulation of TIFF (Tag Image File Format) images"
+HOMEPAGE="http://www.libtiff.org/"
+SRC_URI="ftp://ftp.remotesensing.org/pub/libtiff/${P}.tar.gz"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc-macos ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="jpeg jbig nocxx zlib"
+
+DEPEND="jpeg? ( >=media-libs/jpeg-6b )
+ jbig? ( media-libs/jbigkit )
+ zlib? ( >=sys-libs/zlib-1.1.3-r2 )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch ${DISTDIR}/${P}-tiff2pdf.patch.bz2 || die "epatch tiff2pdf failed"
+ epatch ${FILESDIR}/${P}-tiffsplit.patch || die "epatch tiffsplit failed"
+ use jbig && epatch "${FILESDIR}"/${PN}-jbig.patch || die "epatch jbig failed"
+ use ppc-macos || elibtoolize
+}
+
+src_compile() {
+ econf \
+ $(use_enable !nocxx cxx) \
+ $(use_enable zlib) \
+ $(use_enable jpeg) \
+ $(use_enable jbig) \
+ --with-pic --without-x \
+ || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make install DESTDIR="${D}" || die "make install failed"
+ dodoc README TODO VERSION
+}
+
+pkg_postinst() {
+ echo
+ einfo "JBIG support is intended for Hylafax fax compression, so we"
+ einfo "really need more feedback in other areas (most testing has"
+ einfo "been done with fax). Be sure to recompile anything linked"
+ einfo "against tiff if you rebuild it with jbig support."
+ echo
+}