From 71b6617cdb5042458030b3aec5bfce81273e6de0 Mon Sep 17 00:00:00 2001
From: Scott McCreary <scottmc2@gmail.com>
Date: Mon May 23 16:13:13 2011 +0000
Subject: Fixed directories for htmldoc.


diff --git a/configure.in b/configure.in
index 640f8ac..5ef51a8 100644
--- a/configure.in
+++ b/configure.in
@@ -109,7 +109,7 @@ LDFLAGS="${LDFLAGS:=}"
 AC_SUBST(LDFLAGS)
 
 AC_CHECK_LIB(m,pow)
-AC_SEARCH_LIBS(socket, socket)
+AC_SEARCH_LIBS(socket, network socket)
 AC_SEARCH_LIBS(gethostbyaddr, nsl)
 AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
 AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
@@ -316,8 +316,8 @@ if test "$bindir" = "\${exec_prefix}/bin"; then
     bindir="$exec_prefix/bin"
 fi
 
-AC_DEFINE_UNQUOTED(DOCUMENTATION, "$prefix/share/doc/htmldoc")
-AC_DEFINE_UNQUOTED(HTML_DATA, "$prefix/share/htmldoc")
+AC_DEFINE_UNQUOTED(DOCUMENTATION, "$prefix/data/doc/htmldoc")
+AC_DEFINE_UNQUOTED(HTML_DATA, "$prefix/data/htmldoc")
 
 dnl Update compiler options...
 if test -n "$GXX"; then
diff --git a/data/Makefile b/data/Makefile
index ee9b7de..f416fad 100644
--- a/data/Makefile
+++ b/data/Makefile
@@ -53,11 +53,11 @@ all:
 #
 
 install:
-	if [ ! -d $(datadir)/htmldoc/data ]; then\
-		$(MKDIR) $(datadir)/htmldoc/data;\
+	if [ ! -d $(DESTDIR)$(datadir)/htmldoc/data ]; then\
+		$(MKDIR) $(DESTDIR)$(datadir)/htmldoc/data;\
 	fi
-	$(CP) $(FILES) $(datadir)/htmldoc/data
-	$(CHMOD) ugo+r $(datadir)/htmldoc/data/*
+	$(CP) $(FILES) $(DESTDIR)$(datadir)/htmldoc/data
+	$(CHMOD) ugo+r $(DESTDIR)$(datadir)/htmldoc/data/*
 
 
 #
diff --git a/doc/Makefile b/doc/Makefile
index 87292f6..666c80d 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -57,16 +57,16 @@ all: $(DOCUMENTS)
 #
 
 install: $(DOCUMENTS)
-	if [ ! -d $(datadir)/doc/htmldoc ]; then\
-		$(MKDIR) $(datadir)/doc/htmldoc;\
+	if [ ! -d $(DESTDIR)$(mandir)/doc/htmldoc ]; then\
+		$(MKDIR) $(DESTDIR)$(mandir)/doc/htmldoc;\
 	fi
-	$(CP) $(DOCFILES) $(datadir)/doc/htmldoc
-	$(CHMOD) ugo+r $(datadir)/doc/htmldoc/*
-	if [ ! -d $(mandir)/man1 ]; then\
-		$(MKDIR) $(mandir)/man1;\
+	$(CP) $(DOCFILES) $(DESTDIR)/$(mandir)/doc/htmldoc
+	$(CHMOD) ugo+r $(DESTDIR)/$(mandir)/doc/htmldoc/*
+	if [ ! -d $(DESTDIR)$(mandir)/man1 ]; then\
+		$(MKDIR) $(DESTDIR)/$(mandir)/man1;\
 	fi
-	$(CP) htmldoc.man $(mandir)/man1/htmldoc.1
-	$(CHMOD) ugo+r $(mandir)/man1/htmldoc.1
+	$(CP) htmldoc.man $(DESTDIR)/$(mandir)/man1/htmldoc.1
+	$(CHMOD) ugo+r $(DESTDIR)/$(mandir)/man1/htmldoc.1
 
 
 #
diff --git a/fonts/Makefile b/fonts/Makefile
index 3afefa3..a0a396a 100644
--- a/fonts/Makefile
+++ b/fonts/Makefile
@@ -75,14 +75,14 @@ all:
 
 install:
 	echo "Installing font files in $(datadir)/htmldoc/fonts..."
-	if [ ! -d $(datadir)/htmldoc/fonts ]; then\
-		$(MKDIR) $(datadir)/htmldoc/fonts;\
+	if [ ! -d $(DESTDIR)/$(datadir)/htmldoc/fonts ]; then\
+		$(MKDIR) $(DESTDIR)/$(datadir)/htmldoc/fonts;\
 	fi
 	for font in $(FONTS); do \
-		$(CP) $$font.afm $(datadir)/htmldoc/fonts; \
-		$(CP) $$font.pfa $(datadir)/htmldoc/fonts; \
+		$(CP) $$font.afm $(DESTDIR)/$(datadir)/htmldoc/fonts; \
+		$(CP) $$font.pfa $(DESTDIR)/$(datadir)/htmldoc/fonts; \
 	done
-	$(CHMOD) ugo+r $(datadir)/htmldoc/fonts/*
+	$(CHMOD) ugo+r $(DESTDIR)/$(datadir)/htmldoc/fonts/*
 
 
 #
diff --git a/htmldoc/Makefile b/htmldoc/Makefile
index 9ebc412..c17b6d0 100644
--- a/htmldoc/Makefile
+++ b/htmldoc/Makefile
@@ -50,11 +50,11 @@ all:	htmldoc$(EXEEXT)
 #
 
 install:	all
-	if [ ! -d $(bindir) ]; then\
-		$(MKDIR) $(bindir);\
+	if [ ! -d $(DESTDIR)/$(bindir) ]; then\
+		$(MKDIR) $(DESTDIR)/$(bindir);\
 	fi
-	cp htmldoc$(EXEEXT) $(bindir)
-	chmod ugo+rx $(bindir)/htmldoc$(EXEEXT)
+	cp htmldoc$(EXEEXT) $(DESTDIR)/$(bindir)
+	chmod ugo+rx $(DESTDIR)/$(bindir)/htmldoc$(EXEEXT)
 
 
 #
diff --git a/htmldoc/http.h b/htmldoc/http.h
index 4012f92..b3b9b09 100644
--- a/htmldoc/http.h
+++ b/htmldoc/http.h
@@ -102,6 +102,8 @@ extern "C" {
 #    define s6_addr32	_S6_un._S6_u32
 #  elif defined(__FreeBSD__) || defined(__APPLE__)
 #    define s6_addr32	__u6_addr.__u6_addr32
+#  elif defined(__HAIKU__)
+#    define s6_addr32   s6_addr
 #  elif defined(__osf__)
 #    define s6_addr32	s6_un.sa6_laddr
 #  elif defined(WIN32)
-- 
1.7.5


From 33b0369d77315b32c03d311112add0df8eb63fad Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@gmx.de>
Date: Sun, 16 Jun 2013 02:59:17 +0200
Subject: image.cxx: libpng 1.5 fixes


diff --git a/htmldoc/image.cxx b/htmldoc/image.cxx
index 574ff7c..9a35db2 100644
--- a/htmldoc/image.cxx
+++ b/htmldoc/image.cxx
@@ -55,6 +55,7 @@ extern "C" {		/* Workaround for JPEG header problems... */
 #include <jpeglib.h>	/* JPEG/JFIF image definitions */
 }
 
+#define PNG_SETJMP_SUPPORTED
 #include <png.h>	/* Portable Network Graphics (PNG) definitions */
 
 
@@ -1472,6 +1473,9 @@ image_load_png(image_t *img,	/* I - Image pointer */
   png_bytep	*rows;		/* PNG row pointers */
   uchar		*inptr,		/* Input pixels */
 		*outptr;	/* Output pixels */
+  png_bytep trans_alpha;
+  png_color_16p trans_color;
+  int num_trans = 0;
 
 
  /*
@@ -1499,7 +1503,7 @@ image_load_png(image_t *img,	/* I - Image pointer */
 
   rows = NULL;
 
-  if (setjmp(pp->jmpbuf)) 
+  if (setjmp(png_jmpbuf(pp))) 
   {
     progress_error(HD_ERROR_BAD_FORMAT, "PNG file contains errors!");
 
@@ -1526,7 +1530,7 @@ image_load_png(image_t *img,	/* I - Image pointer */
 
   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 +1539,15 @@ image_load_png(image_t *img,	/* I - Image pointer */
     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 +1558,12 @@ image_load_png(image_t *img,	/* I - Image pointer */
     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 +1577,14 @@ image_load_png(image_t *img,	/* I - Image pointer */
 
 #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 +1600,9 @@ image_load_png(image_t *img,	/* I - Image pointer */
   * Allocate pointers...
   */
 
-  rows = (png_bytep *)calloc(info->height, sizeof(png_bytep));
+  rows = (png_bytep *)calloc(img->height, sizeof(png_bytep));
 
-  for (i = 0; i < (int)info->height; i ++)
+  for (i = 0; i < (int)img->height; i ++)
     rows[i] = img->pixels + i * img->width * depth;
 
  /*
@@ -1610,7 +1616,7 @@ image_load_png(image_t *img,	/* I - Image pointer */
   * 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 +1645,7 @@ image_load_png(image_t *img,	/* I - Image pointer */
   * 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...
-- 
1.7.5

