[htmldoc] fix build against libpng-1.5
Rex Dieter
rdieter at fedoraproject.org
Sat Jan 14 04:35:52 UTC 2012
commit 8f9734e45c60b0317de2672635a5451d1961f6f4
Author: Rex Dieter <rdieter at fedoraproject.org>
Date: Fri Jan 13 22:35:48 2012 -0600
fix build against libpng-1.5
htmldoc-1.8.27-libpng15.patch | 117 +++++++++++++++++++++++++++++++++++++++++
htmldoc.spec | 11 ++++-
2 files changed, 127 insertions(+), 1 deletions(-)
---
diff --git a/htmldoc-1.8.27-libpng15.patch b/htmldoc-1.8.27-libpng15.patch
new file mode 100644
index 0000000..f886dd8
--- /dev/null
+++ b/htmldoc-1.8.27-libpng15.patch
@@ -0,0 +1,117 @@
+$NetBSD: patch-ae,v 1.1 2011/01/16 13:02:38 wiz Exp $
+
+Fix build with png-1.5.
+
+--- htmldoc/image.cxx.orig 2006-05-31 19:00:02.000000000 +0000
++++ htmldoc/image.cxx
+@@ -1472,6 +1472,9 @@ image_load_png(image_t *img, /* I - Imag
+ png_bytep *rows; /* PNG row pointers */
+ uchar *inptr, /* Input pixels */
+ *outptr; /* Output pixels */
++ png_bytep trans_alpha;
++ int num_trans;
++ png_color_16p trans_color;
+
+
+ /*
+@@ -1499,7 +1502,7 @@ image_load_png(image_t *img, /* I - Imag
+
+ rows = NULL;
+
+- if (setjmp(pp->jmpbuf))
++ if (setjmp(png_jmpbuf(pp)))
+ {
+ progress_error(HD_ERROR_BAD_FORMAT, "PNG file contains errors!");
+
+@@ -1526,7 +1529,7 @@ image_load_png(image_t *img, /* I - Imag
+
+ png_read_info(pp, info);
+
+- if (info->color_type & PNG_COLOR_MASK_PALETTE)
++ if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
+ {
+ png_set_expand(pp);
+
+@@ -1535,15 +1538,15 @@ image_load_png(image_t *img, /* I - Imag
+ if (Encryption)
+ img->use ++;
+ }
+- else if (info->bit_depth < 8)
++ else if (png_get_bit_depth(pp, info) < 8)
+ {
+ png_set_packing(pp);
+ png_set_expand(pp);
+ }
+- else if (info->bit_depth == 16)
++ else if (png_get_bit_depth(pp, info) == 16)
+ png_set_strip_16(pp);
+
+- if (info->color_type & PNG_COLOR_MASK_COLOR)
++ if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
+ {
+ depth = 3;
+ img->depth = gray ? 1 : 3;
+@@ -1554,10 +1557,11 @@ image_load_png(image_t *img, /* I - Imag
+ img->depth = 1;
+ }
+
+- img->width = info->width;
+- img->height = info->height;
++ img->width = png_get_image_width(pp, info);
++ img->height = png_get_image_height(pp, info);
+
+- if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
++ png_get_tRNS(pp, info, &trans_alpha, &num_trans, &trans_color);
++ if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
+ {
+ if ((PSLevel == 0 && PDFVersion >= 14) || PSLevel == 3)
+ image_need_mask(img, 8);
+@@ -1571,14 +1575,14 @@ image_load_png(image_t *img, /* I - Imag
+
+ #ifdef DEBUG
+ printf("color_type=0x%04x, depth=%d, img->width=%d, img->height=%d, img->depth=%d\n",
+- info->color_type, depth, img->width, img->height, img->depth);
+- if (info->color_type & PNG_COLOR_MASK_COLOR)
++ png_get_color_type(pp, info), depth, img->width, img->height, img->depth);
++ if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
+ puts(" COLOR");
+ else
+ puts(" GRAYSCALE");
+- if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
++ if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
+ puts(" ALPHA");
+- if (info->color_type & PNG_COLOR_MASK_PALETTE)
++ if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
+ puts(" PALETTE");
+ #endif // DEBUG
+
+@@ -1594,9 +1598,9 @@ image_load_png(image_t *img, /* I - Imag
+ * Allocate pointers...
+ */
+
+- rows = (png_bytep *)calloc(info->height, sizeof(png_bytep));
++ rows = (png_bytep *)calloc(png_get_image_height(pp, info), sizeof(png_bytep));
+
+- for (i = 0; i < (int)info->height; i ++)
++ for (i = 0; i < (int)png_get_image_height(pp, info); i ++)
+ rows[i] = img->pixels + i * img->width * depth;
+
+ /*
+@@ -1610,7 +1614,7 @@ image_load_png(image_t *img, /* I - Imag
+ * Generate the alpha mask as necessary...
+ */
+
+- if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
++ if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
+ {
+ #ifdef DEBUG
+ for (inptr = img->pixels, i = 0; i < img->height; i ++)
+@@ -1639,7 +1643,7 @@ image_load_png(image_t *img, /* I - Imag
+ * Reformat the data as necessary for the reader...
+ */
+
+- if (gray && info->color_type & PNG_COLOR_MASK_COLOR)
++ if (gray && png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
+ {
+ /*
+ * Greyscale output needed...
diff --git a/htmldoc.spec b/htmldoc.spec
index 2b8e969..1536449 100644
--- a/htmldoc.spec
+++ b/htmldoc.spec
@@ -1,6 +1,6 @@
Name: htmldoc
Version: 1.8.27
-Release: 17%{?dist}
+Release: 18%{?dist}
Summary: Converter from HTML into indexed HTML, PostScript, or PDF
Group: Applications/Publishing
@@ -16,6 +16,9 @@ Patch2: htmldoc-1.8.27-system-fonts.patch
Patch3: htmldoc-1.8.27-scanf-overflows.patch
Patch4: htmldoc-1.8.27-fortify-fail.patch
Patch5: htmldoc-1.8.27-fixdso.patch
+# http://www.htmldoc.org/str.php?L243+P0+S-2+C0+I0+E0+M10+Q
+# http://www.htmldoc.org/strfiles/243/patch-ae
+Patch6: htmldoc-1.8.27-libpng15.patch
BuildRequires: openssl-devel libjpeg-devel libpng-devel zlib-devel
BuildRequires: fltk-devel libXpm-devel desktop-file-utils
@@ -107,6 +110,9 @@ cd ..
# fix limitation of -D_FORTIFY_SOURCE=2
%patch4 -p1 -b .fortify-fail
+# fix build with libpng-1.5+
+%patch6 -p1 -b .libpng15
+
%build
%configure
@@ -184,6 +190,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Fri Jan 13 2012 Rex Dieter <rdieter at fedoraproject.org> 1.8.27-18
+- fix build against libpng-1.5
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.8.27-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list