There is a major new release in the "super stable" release series
(which is the only one with tarballs) that would take us from 10.35
to 10.47.  While a lot newer than 10.35, it is still years out of
date.  In particular, it still hasn't caught up with libpng >1.4.
After manually redoing the 900-line patch-converter_other_pngtopnm_c,
I figured that spending this much effort on code that is already way
obsolete doesn't make sense.

We need to bite the bullet.  The diff below brings us up to 10.74
from the "advanced" release series, i.e., the very latest releases.
Unfortunately, releases there are only marked in Subversion, so we
have to create our own distfiles when we update the port.  I have
included a convenience target in Makefile for this purpose.

The new code now also comes with a regression test suite.  I started
patching out the GNU-isms but eventually decided it wasn't worth
the effort and added the dependencies.

Finally, the port now uses srand_deterministic().  There are a lot
of tools that take seed values on the command line, which was broken.

Comments?  OK?


PS: The Makefile patches are mostly about our idea of how to build
shared and static libraries.  If we followed upstream and created
the static lib (which nothing uses...) from the -fPIC object files,
this would be much simpler.  On the other hand, these patches aren't
particularly intrusive or hard to maintaun. *shrug*


Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/netpbm/Makefile,v
retrieving revision 1.74
diff -u -p -r1.74 Makefile
--- Makefile    9 Mar 2016 18:22:52 -0000       1.74
+++ Makefile    26 Apr 2016 12:30:53 -0000
@@ -1,44 +1,74 @@
 # $OpenBSD: Makefile,v 1.74 2016/03/09 18:22:52 naddy Exp $
 
-COMMENT=       toolkit for converting images between different formats
+COMMENT=       toolkit for manipulation and conversion of graphic images
 
-DISTNAME=      netpbm-10.35.97
-SHARED_LIBS=   netpbm  2.0
+DISTNAME=      netpbm-10.74.02
+SHARED_LIBS=   netpbm  3.0
 CATEGORIES=    graphics
 HOMEPAGE=      http://netpbm.sourceforge.net/
 
 PERMIT_PACKAGE_CDROM=  Yes
 
-WANTLIB += X11 Xau Xdmcp c jasper jbig jpeg m png pthread pthread-stubs
-WANTLIB += tiff xcb xml2 z
+WANTLIB=       X11 c jasper jbig jpeg m png tiff xml2 z
 
-MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=netpbm/}
-EXTRACT_SUFX=  .tgz
+MASTER_SITES=  http://shell.uugrn.org/~naddy/
+EXTRACT_SUFX=  .tar.xz
 
-MODULES=       converters/libiconv
 LIB_DEPENDS=   graphics/tiff \
                graphics/jpeg \
                graphics/png \
-               graphics/jbigkit>=2.0 \
+               graphics/jbigkit \
                graphics/jasper \
                textproc/libxml
 
 USE_GMAKE=     Yes
 MAKE_FILE=     GNUmakefile
-ALL_TARGET=
 INSTALL_TARGET=        install.bin install.lib install.data \
                install.hdr install.staticlib
 
 MAKE_FLAGS=    CC="${CC}" \
                LIBnetpbm_VERSION=${LIBnetpbm_VERSION}
-FAKE_FLAGS=    PKGDIR="${WRKINST}${TRUEPREFIX}"
+# programs can take seed on command line
+MAKE_FLAGS+=   CFLAGS_CONFIG="-Dsrand=srand_deterministic"
 
-pre-build:
-       ${SUBST_CMD} ${WRKSRC}/pm_config.in.h
-       cp ${FILESDIR}/Makefile.config.OpenBSD ${WRKSRC}/Makefile.config
-# Missing in some releases
-       cd ${WRKSRC}; buildtools/stamp-date >lib/compile.h
+FAKE_FLAGS=    pkgdir="${WRKINST}${TRUEPREFIX}"
 
-NO_TEST=       Yes
+do-configure:
+       cp ${FILESDIR}/config.mk ${WRKSRC}
+
+TEST_DEPENDS=  shells/bash sysutils/coreutils
+TEST_TARGET=   check
+TEST_FLAGS=    pkgdir="${WRKINST}${PREFIX}" \
+               resultdir="${WRKDIR}/tests" \
+               RGBDEF="${WRKINST}${PREFIX}/share/netpbm/rgb.txt"
+
+# cp -v, head -c, mv -T, seq
+pre-test:
+       @for i in cp head mv seq; do \
+               ln -s ${LOCALBASE}/bin/g$$i ${WRKDIR}/bin/$$i; \
+       done
+       @sed -i '1 s:^.*bin/bash:#!${LOCALBASE}/bin/bash:' \
+           ${WRKSRC}/test/Execute-Tests ${WRKSRC}/test/*.test
+
+# must run after fake
+test: fake
+
+# Get the latest release in a release series from Netpbm Subversion.
+# Requires devel/subversion.
+distfile:
+       @REPO=https://svn.code.sf.net/p/netpbm/code; \
+       SERIES=advanced; \
+       REV=`svn info $$REPO/$$SERIES/version.mk | \
+           sed -n 's/Last Changed Rev: //p'`; \
+       VERSION=`(svn cat -r$$REV $$REPO/$$SERIES/version.mk; \
+           echo 'all:'; \
+           echo '      @printf "%02d.%02d.%02d" \\'; \
+           echo '          $${NETPBM_MAJOR_RELEASE} \\'; \
+           echo '          $${NETPBM_MINOR_RELEASE} \\'; \
+           echo '          $${NETPBM_POINT_RELEASE}'; \
+           ) | make -f-`; \
+       svn export -r$$REV $$REPO/$$SERIES "netpbm-$$VERSION"; \
+       tar cf - "netpbm-$$VERSION" | xz >"netpbm-$$VERSION".tar.xz; \
+       rm -rf "netpbm-$$VERSION"
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/graphics/netpbm/distinfo,v
retrieving revision 1.29
diff -u -p -r1.29 distinfo
--- distinfo    29 Oct 2015 11:46:49 -0000      1.29
+++ distinfo    26 Apr 2016 12:30:53 -0000
@@ -1,2 +1,2 @@
-SHA256 (netpbm-10.35.97.tgz) = b05fdTGxpOtoPClDbF/MKutwiwEoFL4s78F3tEpP0Wo=
-SIZE (netpbm-10.35.97.tgz) = 2560007
+SHA256 (netpbm-10.74.02.tar.xz) = m64nzMrfiUxxrnWfyNwIFUP8x2yLGJW+eoLq9KI6Kdg=
+SIZE (netpbm-10.74.02.tar.xz) = 1997320
Index: files/Makefile.config.OpenBSD
===================================================================
RCS file: files/Makefile.config.OpenBSD
diff -N files/Makefile.config.OpenBSD
--- files/Makefile.config.OpenBSD       9 Mar 2016 18:22:52 -0000       1.11
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-# $OpenBSD: Makefile.config.OpenBSD,v 1.11 2016/03/09 18:22:52 naddy Exp $
-# Indented variables are unchanged from the defaults in Makefile.config.in.
-# Commented out variables are set in MAKE_FLAGS.
-#
- DEFAULT_TARGET = nonmerge
- BUILD_FIASCO = Y
-#CC
- LD = $(CC)
- LINKERISCOMPILER=Y
- LINKER_CAN_DO_EXPLICIT_LIBRARY=N
- INTTYPES_H = <inttypes.h>
- HAVE_INT64 = Y
- CC_FOR_BUILD = $(CC)
- LD_FOR_BUILD = $(LD)
- CFLAGS_FOR_BUILD = $(CFLAGS)
-#INSTALL = $(SRCDIR)/buildtools/install.sh
- STRIPFLAG = -s
- SYMLINK = ln -s
- MANPAGE_FORMAT = nroff
- AR = ar
- RANLIB = ranlib
- LEX = flex
-#CFLAGS =
- EXE =
- LDFLAGS =
-LDSHLIB = -shared
- LDRELOC = NONE
-CFLAGS_SHLIB = -fPIC
- SHLIB_CLIB =
- NEED_RUNTIME_PATH = N
- NETPBMLIB_RUNTIME_PATH =
-TIFFLIB = -L$(LOCALBASE)/lib -ltiff
-TIFFHDR_DIR = $(LOCALBASE)/include
- TIFFLIB_NEEDS_JPEG = Y
- TIFFLIB_NEEDS_Z = Y
-JPEGLIB = -L$(LOCALBASE)/lib -ljpeg
-JPEGHDR_DIR = $(LOCALBASE)/include
- PNGVER = 
-ZLIB = -lz
- ZHDR_DIR =
-JBIGLIB = -L$(LOCALBASE)/lib -ljbig
-JBIGHDR_DIR = $(LOCALBASE)/include
-JASPERLIB = -L$(LOCALBASE)/lib -ljasper
-JASPERHDR_DIR = $(LOCALBASE)/include
- URTLIB = $(BUILDDIR)/urt/librle.a
- URTHDR_DIR = $(SRCDIR)/urt
-X11LIB = -L$(X11BASE)/lib -lX11 -lXau -lXdmcp -lxcb -lpthread-stubs
-X11HDR_DIR = $(X11BASE)/include
- LINUXSVGALIB = NONE
- OMIT_NETWORK =
- NETWORKLD =
- VMS =
- DONT_HAVE_PROCESS_MGMT = N
-#PKGDIR_DEFAULT = /tmp/netpbm
- PKGMANDIR = man
- INSTALL_PERM_BIN =  755
- INSTALL_PERM_LIBD = 755
- INSTALL_PERM_LIBS = 644
- INSTALL_PERM_HDR =  644
- INSTALL_PERM_MAN =  644
- INSTALL_PERM_DATA = 644
- SUFFIXMANUALS1 = 1
- SUFFIXMANUALS3 = 3
- SUFFIXMANUALS5 = 5
- NETPBMLIBTYPE = unixshared
- NETPBMLIBSUFFIX = so
- STATICLIB_TOO = y
- STATICLIBSUFFIX = a
- SHLIBPREFIXLIST = lib
- NETPBMSHLIBPREFIX = $(firstword $(SHLIBPREFIXLIST))
- DLLVER =
- NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/
Index: files/config.mk
===================================================================
RCS file: files/config.mk
diff -N files/config.mk
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/config.mk     26 Apr 2016 12:30:53 -0000
@@ -0,0 +1,82 @@
+# $OpenBSD$
+# Indented variables are unchanged from the defaults in config.mk.in.
+# Commented out variables are set in MAKE_FLAGS.
+#
+ DEFAULT_TARGET = nonmerge
+ BUILD_FIASCO = Y
+#CC = cc
+ LD = $(CC)
+ LINKERISCOMPILER=Y
+ LINKER_CAN_DO_EXPLICIT_LIBRARY=N
+ INTTYPES_H = <inttypes.h>
+ HAVE_INT64 = Y
+ WANT_SSE = N
+ CC_FOR_BUILD = $(CC)
+ LD_FOR_BUILD = $(LD)
+ CFLAGS_FOR_BUILD = $(CFLAGS_CONFIG)
+ LDFLAGS_FOR_BUILD = $(LDFLAGS)
+ WINDRES = windres
+INSTALL = install
+ STRIPFLAG = -s
+ SYMLINK = ln -s
+ MANPAGE_FORMAT = nroff
+ AR = ar
+ RANLIB = ranlib
+ LEX = flex
+#CFLAGS =
+ EXE =
+ LDFLAGS =
+LDSHLIB = -shared
+ LDRELOC = NONE
+CFLAGS_SHLIB = -fPIC
+ SHLIB_CLIB = -lc
+ NEED_RUNTIME_PATH = N
+ RPATHOPTNAME = -rpath
+ NETPBMLIB_RUNTIME_PATH = 
+TIFFLIB = -L$(LOCALBASE)/lib -ltiff
+TIFFHDR_DIR = $(LOCALBASE)/include
+ TIFFLIB_NEEDS_JPEG = Y
+ TIFFLIB_NEEDS_Z = Y
+JPEGLIB = -L$(LOCALBASE)/lib -ljpeg
+JPEGHDR_DIR = $(LOCALBASE)/include
+ PNGLIB = NONE
+ PNGHDR_DIR =
+ PNGVER = 
+ZLIB = -lz
+ ZHDR_DIR = 
+JBIGLIB = -L$(LOCALBASE)/lib -ljbig
+JBIGHDR_DIR = $(LOCALBASE)/include
+JASPERLIB = -L$(LOCALBASE)/lib -ljasper
+JASPERHDR_DIR = $(LOCALBASE)/include
+ JASPERDEPLIBS =
+ URTLIB = $(BUILDDIR)/urt/librle.a
+ URTHDR_DIR = $(SRCDIR)/urt
+X11LIB = -L$(X11BASE)/lib -lX11
+X11HDR_DIR = $(X11BASE)/include
+ LINUXSVGALIB = NONE
+ LINUXSVGAHDR_DIR = 
+ WINICON_OBJECT =
+ OMIT_NETWORK =
+ NETWORKLD = 
+ DONT_HAVE_PROCESS_MGMT = N
+#PKGDIR_DEFAULT = /tmp/netpbm
+#RESULTDIR_DEFAULT = /tmp/netpbm-test
+ PKGMANDIR = man
+INSTALL_PERM_BIN =  $(BINMODE)
+INSTALL_PERM_LIBD = $(DIRMODE)
+INSTALL_PERM_LIBS = $(NONBINMODE)
+INSTALL_PERM_HDR =  $(NONBINMODE)
+INSTALL_PERM_MAN =  $(MANMODE)
+INSTALL_PERM_DATA = $(NONBINMODE)
+ SUFFIXMANUALS1 = 1
+ SUFFIXMANUALS3 = 3
+ SUFFIXMANUALS5 = 5
+ NETPBMLIBTYPE = unixshared
+ NETPBMLIBSUFFIX = so
+ STATICLIB_TOO = Y
+ STATICLIBSUFFIX = a
+ SHLIBPREFIXLIST = lib
+ NETPBMSHLIBPREFIX = $(firstword $(SHLIBPREFIXLIST))
+ DLLVER =
+ NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/
+ RGB_DB_PATH = $(PREFIX)/share/netpbm/rgb.txt:/usr/X11R6/share/X11/rgb.txt
Index: patches/patch-GNUmakefile
===================================================================
RCS file: patches/patch-GNUmakefile
diff -N patches/patch-GNUmakefile
--- patches/patch-GNUmakefile   20 Apr 2014 16:55:07 -0000      1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-GNUmakefile,v 1.6 2014/04/20 16:55:07 naddy Exp $
---- GNUmakefile.orig   Sat Mar 29 22:42:44 2014
-+++ GNUmakefile        Sun Apr 20 18:49:00 2014
-@@ -363,7 +363,7 @@ install-dev: install.hdr install.staticlib install.lib
- install.hdr: $(PKGDIR)/include
-       $(MAKE) -C lib -f $(SRCDIR)/lib/Makefile \
-           SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) install.hdr
--      $(INSTALL) -c -m $(INSTALL_PERM_HDR) \
-+      $(BSD_INSTALL_DATA) \
-           $(BUILDDIR)/pm_config.h $(PKGDIR)/include
- 
- ifeq ($(STATICLIB_TOO),y)
Index: patches/patch-Makefile_common
===================================================================
RCS file: patches/patch-Makefile_common
diff -N patches/patch-Makefile_common
--- patches/patch-Makefile_common       11 Jul 2012 09:53:52 -0000      1.8
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-$OpenBSD: patch-Makefile_common,v 1.8 2012/07/11 09:53:52 giovanni Exp $
---- Makefile.common.orig       Thu Jun 21 22:40:36 2012
-+++ Makefile.common    Tue Jul 10 00:10:52 2012
-@@ -417,19 +417,19 @@ install.bin: $(BINARIES:%=%_installbin) $(SCRIPTS:%=%_
- INSTALLBIN_TARGETS = $(BINARIES:%=%_installbin) netpbm_installbin
- .PHONY: $(INSTALLBIN_TARGETS)
- $(INSTALLBIN_TARGETS): $(PKGDIR)/bin
--      $(INSTALL) -c $(STRIPFLAG) -m $(INSTALL_PERM_BIN) \
-+      $(BSD_INSTALL_PROGRAM) \
-         $(@:%_installbin=%) $<
- 
- $(SCRIPTS:%=%_installscript): $(PKGDIR)/bin
--      $(INSTALL) -c -m $(INSTALL_PERM_BIN) \
-+      $(BSD_INSTALL_SCRIPT) \
-         $(SRCDIR)/$(SUBDIR)/$(@:%_installscript=%) $<
- 
- .PHONY: install.data
- install.data: $(DATAFILES:%=%_installdata) $(SUBDIRS:%=%/install.data)
- 
- .PHONY: $(DATAFILES:%=%_installdata) 
--$(DATAFILES:%=%_installdata): $(PKGDIR)/misc
--      $(INSTALL) -c -m $(INSTALL_PERM_DATA) \
-+$(DATAFILES:%=%_installdata): $(PKGDIR)/share/netpbm
-+      $(BSD_INSTALL_DATA) \
-         $(SRCDIR)/$(SUBDIR)/$(@:%_installdata=%) $<
- 
- 
Index: patches/patch-common_mk
===================================================================
RCS file: patches/patch-common_mk
diff -N patches/patch-common_mk
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-common_mk     26 Apr 2016 12:30:53 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- common.mk.orig     Sat Sep 26 21:59:25 2015
++++ common.mk  Mon Apr 25 19:43:02 2016
+@@ -470,7 +470,7 @@ endif
+ 
+ PKGMANSUBDIRS = man1 man3 man5 web
+ 
+-PKGSUBDIRS = bin include include/netpbm lib link misc \
++PKGSUBDIRS = bin include include/netpbm lib link share/netpbm \
+   $(PKGMANSUBDIRS:%=$(PKGMANDIR)/%)
+ 
+ $(PKGSUBDIRS:%=$(PKGDIR)/%):
+@@ -504,7 +504,7 @@ $(SCRIPTS:%=%_installscript): $(PKGDIR)/bin
+ install.data: $(DATAFILES:%=%_installdata) $(SUBDIRS:%=%/install.data)
+ 
+ .PHONY: $(DATAFILES:%=%_installdata) 
+-$(DATAFILES:%=%_installdata): $(PKGDIR)/misc
++$(DATAFILES:%=%_installdata): $(PKGDIR)/share/netpbm
+       $(INSTALL) -c -m $(INSTALL_PERM_DATA) \
+         $(SRCDIR)/$(SUBDIR)/$(@:%_installdata=%) $<
+ 
Index: patches/patch-converter_other_jbig_jbigtopnm_c
===================================================================
RCS file: patches/patch-converter_other_jbig_jbigtopnm_c
diff -N patches/patch-converter_other_jbig_jbigtopnm_c
--- patches/patch-converter_other_jbig_jbigtopnm_c      13 Apr 2013 08:53:47 
-0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-$OpenBSD: patch-converter_other_jbig_jbigtopnm_c,v 1.1 2013/04/13 08:53:47 
ajacoutot Exp $
-
-Fix with jbigkit>=2.0:
-jbg_strerror() no longer has a language attribute and the JBG_EN,
-JBG_DE_8859_1, JBG_DE_UTF_8 constants no longer exist.
-
---- converter/other/jbig/jbigtopnm.c.orig      Sat Apr 13 10:01:50 2013
-+++ converter/other/jbig/jbigtopnm.c   Sat Apr 13 10:01:32 2013
-@@ -231,7 +231,7 @@ int main (int argc, char **argv)
-         pm_error("Problem while reading input file '%s", fnin);
-     if (result != JBG_EOK && result != JBG_EOK_INTR) 
-         pm_error("Problem with input file '%s': %s\n", 
--                 fnin, jbg_strerror(result, JBG_EN));
-+                 fnin, jbg_strerror(result));
-     if (plane >= 0 && jbg_dec_getplanes(&s) <= plane) 
-         pm_error("Image has only %d planes!\n", jbg_dec_getplanes(&s));
- 
Index: patches/patch-converter_other_pamrgbatopng_c
===================================================================
RCS file: patches/patch-converter_other_pamrgbatopng_c
diff -N patches/patch-converter_other_pamrgbatopng_c
--- patches/patch-converter_other_pamrgbatopng_c        8 Jul 2011 20:36:09 
-0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-converter_other_pamrgbatopng_c,v 1.1 2011/07/08 20:36:09 naddy 
Exp $
-
-Fix build with png-1.5.
-
---- converter/other/pamrgbatopng.c.orig        Fri Aug 18 21:12:28 2006
-+++ converter/other/pamrgbatopng.c     Mon Jul  4 14:21:23 2011
-@@ -101,10 +101,8 @@ writePng(const struct pam * const pamP,
-     if (!infoP)
-         pm_error("Could not allocate PNG info structure");
-     else {
--        infoP->width      = pamP->width;
--        infoP->height     = pamP->height;
--        infoP->bit_depth  = 8;
--        infoP->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
-+        png_set_IHDR(pngP, infoP, pamP->width, pamP->height,
-+                     8, PNG_COLOR_TYPE_RGB_ALPHA, 0, 0, 0);
-         
-         png_init_io(pngP, ofP);
- 
Index: patches/patch-converter_other_pngtopnm_c
===================================================================
RCS file: patches/patch-converter_other_pngtopnm_c
diff -N patches/patch-converter_other_pngtopnm_c
--- patches/patch-converter_other_pngtopnm_c    13 Dec 2011 21:39:17 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,894 +0,0 @@
-$OpenBSD: patch-converter_other_pngtopnm_c,v 1.2 2011/12/13 21:39:17 naddy Exp 
$
-
-Fix build with png-1.5.
-
---- converter/other/pngtopnm.c.orig    Fri Nov 25 01:15:46 2011
-+++ converter/other/pngtopnm.c Tue Dec 13 22:25:03 2011
-@@ -44,12 +44,6 @@
- #include "nstring.h"
- #include "shhopt.h"
- 
--#if PNG_LIBPNG_VER >= 10400
--#error Your PNG library (<png.h>) is incompatible with this Netpbm source 
code.
--#error You need either an older PNG library (older than 1.4)
--#error newer Netpbm source code (at least 10.48)
--#endif
--
- typedef struct _jmpbuf_wrapper {
-   jmp_buf jmpbuf;
- } jmpbuf_wrapper;
-@@ -187,7 +181,7 @@ parseCommandLine(int                 argc, 
- 
- 
- 
--#define get_png_val(p) _get_png_val (&(p), info_ptr->bit_depth)
-+#define get_png_val(p) _get_png_val (&(p), png_get_bit_depth(png_ptr, 
info_ptr))
- 
- static png_uint_16
- _get_png_val (png_byte ** const pp,
-@@ -266,33 +260,39 @@ png_color c;
- }
- 
- #ifdef __STDC__
--static void save_text (png_info *info_ptr, FILE *tfp)
-+static void save_text (png_structp png_ptr, png_info *info_ptr, FILE *tfp)
- #else
--static void save_text (info_ptr, tfp)
-+static void save_text (png_ptr, info_ptr, tfp)
-+png_structp png_ptr;
- png_info *info_ptr;
- FILE *tfp;
- #endif
- {
-   int i, j, k;
-+  png_textp text_ptr;
-+  int num_text;
- 
--  for (i = 0 ; i < info_ptr->num_text ; i++) {
-+  if (png_get_text(png_ptr, info_ptr, &text_ptr, &num_text) == 0)
-+    return;
-+
-+  for (i = 0 ; i < num_text ; i++) {
-     j = 0;
--    while (info_ptr->text[i].key[j] != '\0' && info_ptr->text[i].key[j] != ' 
')
-+    while (text_ptr[i].key[j] != '\0' && text_ptr[i].key[j] != ' ')
-       j++;    
--    if (info_ptr->text[i].key[j] != ' ') {
--      fprintf (tfp, "%s", info_ptr->text[i].key);
--      for (j = strlen (info_ptr->text[i].key) ; j < 15 ; j++)
-+    if (text_ptr[i].key[j] != ' ') {
-+      fprintf (tfp, "%s", text_ptr[i].key);
-+      for (j = strlen (text_ptr[i].key) ; j < 15 ; j++)
-         putc (' ', tfp);
-     } else {
--      fprintf (tfp, "\"%s\"", info_ptr->text[i].key);
--      for (j = strlen (info_ptr->text[i].key) ; j < 13 ; j++)
-+      fprintf (tfp, "\"%s\"", text_ptr[i].key);
-+      for (j = strlen (text_ptr[i].key) ; j < 13 ; j++)
-         putc (' ', tfp);
-     }
-     putc (' ', tfp); /* at least one space between key and text */
-     
--    for (j = 0 ; j < info_ptr->text[i].text_length ; j++) {
--      putc (info_ptr->text[i].text[j], tfp);
--      if (info_ptr->text[i].text[j] == '\n')
-+    for (j = 0 ; j < text_ptr[i].text_length ; j++) {
-+      putc (text_ptr[i].text[j], tfp);
-+      if (text_ptr[i].text[j] == '\n')
-         for (k = 0 ; k < 16 ; k++)
-           putc ((int)' ', tfp);
-     }
-@@ -301,9 +301,10 @@ FILE *tfp;
- }
- 
- #ifdef __STDC__
--static void show_time (png_info *info_ptr)
-+static void show_time (png_structp png_ptr, png_info *info_ptr)
- #else
--static void show_time (info_ptr)
-+static void show_time (png_ptr, info_ptr)
-+png_structp png_ptr;
- png_info *info_ptr;
- #endif
- {
-@@ -311,19 +312,20 @@ png_info *info_ptr;
-         "", "January", "February", "March", "April", "May", "June",
-         "July", "August", "September", "October", "November", "December"
-     };
-+  png_timep mod_time;
- 
--  if (info_ptr->valid & PNG_INFO_tIME) {
--    if (info_ptr->mod_time.month < 1 ||
--      info_ptr->mod_time.month >= ARRAY_SIZE(month)) {
-+  if (png_get_tIME(png_ptr, info_ptr, &mod_time) & PNG_INFO_tIME) {
-+    if (mod_time->month < 1 ||
-+      mod_time->month >= ARRAY_SIZE(month)) {
-       pm_message("tIME chunk in PNG input is invalid; "
-                  "modification time of image is unknown.  "
-                  "The month value, which should be in the range "
--                 "1-12, is %u", info_ptr->mod_time.month);
-+                 "1-12, is %u", mod_time->month);
-     } else
-     pm_message ("modification time: %02d %s %d %02d:%02d:%02d",
--                info_ptr->mod_time.day, month[info_ptr->mod_time.month],
--                info_ptr->mod_time.year, info_ptr->mod_time.hour,
--                info_ptr->mod_time.minute, info_ptr->mod_time.second);
-+                mod_time->day, month[mod_time->month],
-+                mod_time->year, mod_time->hour,
-+                mod_time->minute, mod_time->second);
-   }
- }
- 
-@@ -360,12 +362,28 @@ png_const_charp msg;
- 
- 
- static void
--dump_png_info(png_info *info_ptr) {
-+dump_png_info(png_structp png_ptr, png_info *info_ptr) {
- 
-     const char *type_string;
-     const char *filter_string;
-+    png_color_16p background;
-+    int num_trans;
-+    double gamma;
-+    png_color_8p sig_bit;
-+    png_colorp palette;
-+    int num_palette;
-+    png_uint_16p hist;
-+    int res_x, res_y, unit_type;
-+    png_int_32 offset_x, offset_y;
-+    png_timep mod_time;
-+    png_charp purpose;
-+    png_int_32 X0, X1;
-+    int type, nparams;
-+    png_charp units;
-+    png_charpp params;
-+    int file_srgb_intent;
- 
--    switch (info_ptr->color_type) {
-+    switch (png_get_color_type(png_ptr, info_ptr)) {
-       case PNG_COLOR_TYPE_GRAY:
-         type_string = "gray";
-         break;
-@@ -387,90 +405,101 @@ dump_png_info(png_info *info_ptr) {
-         break;
-     }
- 
--    switch (info_ptr->filter_type) {
-+    switch (png_get_filter_type(png_ptr, info_ptr)) {
-     case PNG_FILTER_TYPE_BASE:
-         asprintfN(&filter_string, "base filter");
-         break;
-     default:
-         asprintfN(&filter_string, "unknown filter type %d", 
--                  info_ptr->filter_type);
-+                  png_get_filter_type(png_ptr, info_ptr));
-     }
- 
--    pm_message("reading a %ldw x %ldh image, %d bit%s",
--               info_ptr->width, info_ptr->height,
--               info_ptr->bit_depth, info_ptr->bit_depth > 1 ? "s" : "");
-+    pm_message("reading a %uw x %uh image, %d bit%s",
-+               png_get_image_width(png_ptr, info_ptr),
-+               png_get_image_height(png_ptr, info_ptr),
-+               png_get_bit_depth(png_ptr, info_ptr),
-+               png_get_bit_depth(png_ptr, info_ptr) > 1 ? "s" : "");
-     pm_message("%s, %s, %s",
-                type_string,
--               info_ptr->interlace_type ? 
-+               png_get_interlace_type(png_ptr, info_ptr) ? 
-                "Adam7 interlaced" : "not interlaced",
-                filter_string);
--    pm_message("background {index, gray, red, green, blue} = "
--               "{%d, %d, %d, %d, %d}",
--               info_ptr->background.index,
--               info_ptr->background.gray,
--               info_ptr->background.red,
--               info_ptr->background.green,
--               info_ptr->background.blue);
- 
-+    if (png_get_bKGD(png_ptr, info_ptr, &background) & PNG_INFO_bKGD) {
-+      pm_message("background {index, gray, red, green, blue} = "
-+                 "{%d, %d, %d, %d, %d}",
-+                 background->index,
-+                 background->gray,
-+                 background->red,
-+                 background->green,
-+                 background->blue);
-+   }
-+
-     strfree(filter_string);
- 
--    if (info_ptr->valid & PNG_INFO_tRNS)
-+    if (png_get_tRNS(png_ptr, info_ptr,
-+                     NULL, &num_trans, NULL) & PNG_INFO_tRNS)
-         pm_message("tRNS chunk (transparency): %u entries",
--                   info_ptr->num_trans);
-+                   num_trans);
-     else
-         pm_message("tRNS chunk (transparency): not present");
- 
--    if (info_ptr->valid & PNG_INFO_gAMA)
--        pm_message("gAMA chunk (image gamma): gamma = %4.2f", 
info_ptr->gamma);
-+    if (png_get_gAMA(png_ptr, info_ptr, &gamma) & PNG_INFO_gAMA)
-+        pm_message("gAMA chunk (image gamma): gamma = %4.2f", gamma);
-     else
-         pm_message("gAMA chunk (image gamma): not present");
- 
--    if (info_ptr->valid & PNG_INFO_sBIT)
-+    if (png_get_sBIT(png_ptr, info_ptr, &sig_bit) & PNG_INFO_sBIT)
-         pm_message("sBIT chunk: present");
-     else
-         pm_message("sBIT chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_cHRM)
-+    if (png_get_cHRM(png_ptr, info_ptr,
-+                     NULL, NULL, NULL, NULL,
-+                     NULL, NULL, NULL, NULL) & PNG_INFO_cHRM)
-         pm_message("cHRM chunk: present");
-     else
-         pm_message("cHRM chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_PLTE)
--        pm_message("PLTE chunk: %d entries", info_ptr->num_palette);
-+    if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) & 
PNG_INFO_PLTE)
-+        pm_message("PLTE chunk: %d entries", num_palette);
-     else
-         pm_message("PLTE chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_bKGD)
-+    if (png_get_bKGD(png_ptr, info_ptr, &background) & PNG_INFO_bKGD)
-         pm_message("bKGD chunk: present");
-     else
-         pm_message("bKGD chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_hIST)
-+    if (png_get_hIST(png_ptr, info_ptr, &hist) & PNG_INFO_hIST)
-         pm_message("hIST chunk: present");
-     else
-         pm_message("hIST chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_pHYs)
-+    if (png_get_pHYs(png_ptr, info_ptr,
-+                     &res_x, &res_y, &unit_type) & PNG_INFO_pHYs)
-         pm_message("pHYs chunk: present");
-     else
-         pm_message("pHYs chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_oFFs)
-+    if (png_get_oFFs(png_ptr, info_ptr,
-+                     &offset_x, &offset_y, &unit_type) & PNG_INFO_oFFs)
-         pm_message("oFFs chunk: present");
-     else
-         pm_message("oFFs chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_tIME)
-+    if (png_get_tIME(png_ptr, info_ptr, &mod_time) & PNG_INFO_tIME)
-         pm_message("tIME chunk: present");
-     else
-         pm_message("tIME chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_pCAL)
-+    if (png_get_pCAL(png_ptr, info_ptr, &purpose, &X0, &X1,
-+                     &type, &nparams, &units, &params) & PNG_INFO_pCAL)
-         pm_message("pCAL chunk: present");
-     else
-         pm_message("pCAL chunk: not present");
- 
--    if (info_ptr->valid & PNG_INFO_sRGB)
-+    if (png_get_sRGB(png_ptr, info_ptr, &file_srgb_intent) & PNG_INFO_sRGB)
-         pm_message("sRGB chunk: present");
-     else
-         pm_message("sRGB chunk: not present");
-@@ -479,19 +508,19 @@ dump_png_info(png_info *info_ptr) {
- 
- 
- static bool
--isTransparentColor(pngcolor   const color,
--                   png_info * const info_ptr,
--                   double     const totalgamma) {
-+isTransparentColor(pngcolor    const color,
-+                   png_structp const png_ptr,
-+                   png_info  * const info_ptr,
-+                   double      const totalgamma) {
- /*----------------------------------------------------------------------------
-    Return TRUE iff pixels of color 'color' are supposed to be transparent
-    everywhere they occur.  Assume it's an RGB image.
- 
-----------------------------------------------------------------------------*/
-     bool retval;
-+    png_color_16p transColorP;
- 
--    if (info_ptr->valid & PNG_INFO_tRNS) {
--        const png_color_16 * const transColorP = &info_ptr->trans_values;
--    
--
-+    if (png_get_tRNS(png_ptr, info_ptr,
-+                     NULL, NULL, &transColorP) & PNG_INFO_tRNS) {
-         /* There seems to be a problem here: you can't compare real
-            numbers for equality.  Also, I'm not sure the gamma
-            corrected/uncorrected color spaces are right here.  
-@@ -537,9 +566,11 @@ setupGammaCorrection(png_struct * const png_ptr,
-     if (displaygamma == -1.0)
-         *totalgammaP = -1.0;
-     else {
-+        double fileGamma;
-         float imageGamma;
--        if (info_ptr->valid & PNG_INFO_gAMA)
--            imageGamma = info_ptr->gamma;
-+
-+        if (png_get_gAMA(png_ptr, info_ptr, &fileGamma) & PNG_INFO_gAMA)
-+            imageGamma = fileGamma;
-         else {
-             if (verbose)
-                 pm_message("PNG doesn't specify image gamma.  Assuming 1.0");
-@@ -555,10 +586,14 @@ setupGammaCorrection(png_struct * const png_ptr,
-         } else {
-             png_set_gamma(png_ptr, displaygamma, imageGamma);
-             *totalgammaP = imageGamma * displaygamma;
-+#ifdef NOT_SUPPORTED_ANYMORE
-+            /* The API doesn't clearing PNG_INFO_sBIT. */
-+
-             /* in case of gamma-corrections, sBIT's as in the
-                PNG-file are not valid anymore 
-             */
-             info_ptr->valid &= ~PNG_INFO_sBIT;
-+#endif
-             if (verbose)
-                 pm_message("image gamma is %4.2f, "
-                            "converted for display gamma of %4.2f",
-@@ -570,20 +605,24 @@ setupGammaCorrection(png_struct * const png_ptr,
- 
- 
- static bool
--paletteHasPartialTransparency(png_info * const info_ptr) {
-+paletteHasPartialTransparency(png_structp png_ptr, png_info * const info_ptr) 
{
- 
-     bool retval;
- 
--    if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
--        if (info_ptr->valid & PNG_INFO_tRNS) {
-+    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {
-+      png_bytep trans_alpha;
-+      int num_trans;
-+
-+      if (png_get_tRNS(png_ptr, info_ptr,
-+                       &trans_alpha, &num_trans, NULL) & PNG_INFO_tRNS) {
-             bool foundGray;
-             unsigned int i;
-             
-             for (i = 0, foundGray = FALSE;
--                 i < info_ptr->num_trans && !foundGray;
-+                 i < num_trans && !foundGray;
-                  ++i) {
--                if (info_ptr->trans[i] != 0 &&
--                    info_ptr->trans[i] != maxval) {
-+                if (trans_alpha[i] != 0 &&
-+                    trans_alpha[i] != maxval) {
-                     foundGray = TRUE;
-                 }
-             }
-@@ -611,14 +650,16 @@ setupSignificantBits(png_struct *        const png_ptr
- 
-   Return the result as *maxvalP.
- 
-----------------------------------------------------------------------------*/
-+    png_color_8p sig_bit;
-+
-     /* Initial assumption of maxval */
--    if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
-+    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {
-         if (alpha == ALPHA_ONLY) {
--            if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
--                info_ptr->color_type == PNG_COLOR_TYPE_RGB)
-+            if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY 
||
-+                png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB)
-                 /* The alpha mask will be all opaque, so maxval 1 is plenty */
-                 *maxvalP = 1;
--            else if (paletteHasPartialTransparency(info_ptr))
-+            else if (paletteHasPartialTransparency(png_ptr, info_ptr))
-                 /* Use same maxval as PNG transparency palette for 
simplicity*/
-                 *maxvalP = 255;
-             else
-@@ -628,7 +669,7 @@ setupSignificantBits(png_struct *        const png_ptr
-             /* Use same maxval as PNG palette for simplicity */
-             *maxvalP = 255;
-     } else {
--        *maxvalP = (1l << info_ptr->bit_depth) - 1;
-+        *maxvalP = (1l << png_get_bit_depth(png_ptr, info_ptr)) - 1;
-     }
- 
-     /* sBIT handling is very tricky. If we are extracting only the
-@@ -641,20 +682,26 @@ setupSignificantBits(png_struct *        const png_ptr
-        is used 
-     */
-     
--    if (info_ptr->valid & PNG_INFO_sBIT) {
-+    if (png_get_sBIT(png_ptr, info_ptr, &sig_bit) & PNG_INFO_sBIT) {
-+        png_byte color_type;
-+        png_bytep trans_alpha;
-+        int num_trans;
-+
-+        color_type = png_get_color_type(png_ptr, info_ptr);
-         switch (alpha) {
-         case ALPHA_MIX:
--            if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
--                info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-+            if (color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
-+                color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-                 break;
--            if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
--                (info_ptr->valid & PNG_INFO_tRNS)) {
-+            if (color_type == PNG_COLOR_TYPE_PALETTE &&
-+                png_get_tRNS(png_ptr, info_ptr,
-+                             &trans_alpha, &num_trans, NULL) & PNG_INFO_tRNS) 
{
- 
-                 bool trans_mix;
-                 unsigned int i;
-                 trans_mix = TRUE;
--                for (i = 0; i < info_ptr->num_trans; ++i)
--                    if (info_ptr->trans[i] != 0 && info_ptr->trans[i] != 255) 
{
-+                for (i = 0; i < num_trans; ++i)
-+                    if (trans_alpha[i] != 0 && trans_alpha[i] != 255) {
-                         trans_mix = FALSE;
-                         break;
-                     }
-@@ -665,70 +712,76 @@ setupSignificantBits(png_struct *        const png_ptr
-             /* else fall though to normal case */
- 
-         case ALPHA_NONE:
--            if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
--                 info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
--                 info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
--                (info_ptr->sig_bit.red != info_ptr->sig_bit.green ||
--                 info_ptr->sig_bit.red != info_ptr->sig_bit.blue) &&
-+            if ((color_type == PNG_COLOR_TYPE_PALETTE ||
-+                 color_type == PNG_COLOR_TYPE_RGB ||
-+                 color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
-+                (sig_bit->red != sig_bit->green ||
-+                 sig_bit->red != sig_bit->blue) &&
-                 alpha == ALPHA_NONE) {
-                 pm_message("This program cannot handle "
-                            "different bit depths for color channels");
-                 pm_message("writing file with %d bit resolution",
--                           info_ptr->bit_depth);
-+                           png_get_bit_depth(png_ptr, info_ptr));
-                 *errorlevelP = PNMTOPNG_WARNING_LEVEL;
-             } else {
--                if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) &&
--                    (info_ptr->sig_bit.red < 255)) {
-+                png_colorp palette;
-+                int num_palette;
-+
-+                if ((color_type == PNG_COLOR_TYPE_PALETTE) &&
-+                    (sig_bit->red < 255) &&
-+                    png_get_PLTE(png_ptr, info_ptr,
-+                                 &palette, &num_palette) & PNG_INFO_PLTE) {
-                     unsigned int i;
--                    for (i = 0; i < info_ptr->num_palette; ++i) {
--                        info_ptr->palette[i].red   >>=
--                            (8 - info_ptr->sig_bit.red);
--                        info_ptr->palette[i].green >>=
--                            (8 - info_ptr->sig_bit.green);
--                        info_ptr->palette[i].blue  >>=
--                            (8 - info_ptr->sig_bit.blue);
-+
-+                    for (i = 0; i < num_palette; ++i) {
-+                        palette[i].red   >>=
-+                            (8 - sig_bit->red);
-+                        palette[i].green >>=
-+                            (8 - sig_bit->green);
-+                        palette[i].blue  >>=
-+                            (8 - sig_bit->blue);
-                     }
--                    *maxvalP = (1l << info_ptr->sig_bit.red) - 1;
-+                    *maxvalP = (1l << sig_bit->red) - 1;
-                     if (verbose)
-                         pm_message ("image has fewer significant bits, "
-                                     "writing file with %d bits per channel", 
--                                    info_ptr->sig_bit.red);
-+                                    sig_bit->red);
-                 } else
--                    if ((info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
--                         info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
--                        (info_ptr->sig_bit.red < info_ptr->bit_depth)) {
--                        png_set_shift (png_ptr, &(info_ptr->sig_bit));
--                        *maxvalP = (1l << info_ptr->sig_bit.red) - 1;
-+                    if ((color_type == PNG_COLOR_TYPE_RGB ||
-+                         color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
-+                        (sig_bit->red < png_get_bit_depth(png_ptr, 
info_ptr))) {
-+                        png_set_shift (png_ptr, sig_bit);
-+                        *maxvalP = (1l << sig_bit->red) - 1;
-                         if (verbose)
-                             pm_message("image has fewer significant bits, "
-                                        "writing file with %d "
-                                        "bits per channel", 
--                                       info_ptr->sig_bit.red);
-+                                       sig_bit->red);
-                     } else 
--                        if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
--                             info_ptr->color_type ==
-+                        if ((color_type == PNG_COLOR_TYPE_GRAY ||
-+                             color_type ==
-                                  PNG_COLOR_TYPE_GRAY_ALPHA) &&
--                            (info_ptr->sig_bit.gray < info_ptr->bit_depth)) {
--                            png_set_shift (png_ptr, &(info_ptr->sig_bit));
--                            *maxvalP = (1l << info_ptr->sig_bit.gray) - 1;
-+                            (sig_bit->gray < png_get_bit_depth(png_ptr, 
info_ptr))) {
-+                            png_set_shift (png_ptr, sig_bit);
-+                            *maxvalP = (1l << sig_bit->gray) - 1;
-                             if (verbose)
-                                 pm_message("image has fewer significant bits, 
"
-                                            "writing file with %d bits",
--                                           info_ptr->sig_bit.gray);
-+                                           sig_bit->gray);
-                         }
-             }
-             break;
- 
-         case ALPHA_ONLY:
--            if ((info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
--                 info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) && 
--                (info_ptr->sig_bit.gray < info_ptr->bit_depth)) {
--                png_set_shift (png_ptr, &(info_ptr->sig_bit));
-+            if ((color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
-+                 color_type == PNG_COLOR_TYPE_GRAY_ALPHA) && 
-+                (sig_bit->gray < png_get_bit_depth(png_ptr, info_ptr))) {
-+                png_set_shift (png_ptr, sig_bit);
-                 if (verbose)
-                     pm_message ("image has fewer significant bits, "
-                                 "writing file with %d bits", 
--                                info_ptr->sig_bit.alpha);
--                *maxvalP = (1l << info_ptr->sig_bit.alpha) - 1;
-+                                sig_bit->alpha);
-+                *maxvalP = (1l << sig_bit->alpha) - 1;
-             }
-             break;
- 
-@@ -739,22 +792,28 @@ setupSignificantBits(png_struct *        const png_ptr
- 
- 
- static bool
--imageHasColor(png_info * const info_ptr) {
-+imageHasColor(png_structp const png_ptr, png_info * const info_ptr) {
- 
-     bool retval;
-+    png_byte color_type;
-+    png_colorp palette;
-+    int num_palette;
- 
--    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
--        info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-+    color_type = png_get_color_type(png_ptr, info_ptr);
-+    if (color_type == PNG_COLOR_TYPE_GRAY ||
-+        color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
- 
-         retval = FALSE;
--    else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
-+    else if (color_type == PNG_COLOR_TYPE_PALETTE &&
-+             png_get_PLTE(png_ptr, info_ptr,
-+                          &palette, &num_palette) & PNG_INFO_PLTE) {
-         bool foundColor;
-         unsigned int i;
-             
-         for (i = 0, foundColor = FALSE;
--             i < info_ptr->num_palette && !foundColor;
-+             i < num_palette && !foundColor;
-              ++i) {
--            if (iscolor(info_ptr->palette[i]))
-+            if (iscolor(palette[i]))
-                 foundColor = TRUE;
-         }
-         retval = foundColor;
-@@ -767,14 +826,15 @@ imageHasColor(png_info * const info_ptr) {
- 
- 
- static void
--determineOutputType(png_info *          const info_ptr,
-+determineOutputType(png_structp         const png_ptr,
-+                    png_info *          const info_ptr,
-                     enum alpha_handling const alphaHandling,
-                     pngcolor            const bgColor,
-                     xelval              const maxval,
-                     int *               const pnmTypeP) {
- 
-     if (alphaHandling != ALPHA_ONLY &&
--        (imageHasColor(info_ptr) || !isGrayscale(bgColor)))
-+        (imageHasColor(png_ptr, info_ptr) || !isGrayscale(bgColor)))
-         *pnmTypeP = PPM_TYPE;
-     else {
-         if (maxval > 1)
-@@ -787,7 +847,8 @@ determineOutputType(png_info *          const info_ptr
- 
- 
- static void
--getBackgroundColor(png_info *        const info_ptr,
-+getBackgroundColor(png_structp       const png_ptr,
-+                   png_info *        const info_ptr,
-                    const char *      const requestedColor,
-                    float             const totalgamma,
-                    xelval            const maxval,
-@@ -798,6 +859,8 @@ getBackgroundColor(png_info *        const info_ptr,
-    Otherwise, if the PNG specifies a background color, that's the one.
-    And otherwise, it's white.
- 
-----------------------------------------------------------------------------*/
-+    png_color_16p background;
-+
-     if (requestedColor) {
-         /* Background was specified from the command-line; we always
-            use that.  I chose to do no gamma-correction in this case;
-@@ -809,27 +872,32 @@ getBackgroundColor(png_info *        const info_ptr,
-         bgColorP->g = PPM_GETG(backcolor);
-         bgColorP->b = PPM_GETB(backcolor);
- 
--    } else if (info_ptr->valid & PNG_INFO_bKGD) {
-+    } else if (png_get_bKGD(png_ptr, info_ptr, &background) & PNG_INFO_bKGD) {
-         /* didn't manage to get libpng to work (bugs?) concerning background
-            processing, therefore we do our own.
-         */
--        switch (info_ptr->color_type) {
-+        switch (png_get_color_type(png_ptr, info_ptr)) {
-         case PNG_COLOR_TYPE_GRAY:
-         case PNG_COLOR_TYPE_GRAY_ALPHA:
-             bgColorP->r = bgColorP->g = bgColorP->b = 
--                gamma_correct(info_ptr->background.gray, totalgamma);
-+                gamma_correct(background->gray, totalgamma);
-             break;
-         case PNG_COLOR_TYPE_PALETTE: {
--            png_color const rawBgcolor = 
--                info_ptr->palette[info_ptr->background.index];
--            bgColorP->r = gamma_correct(rawBgcolor.red, totalgamma);
--            bgColorP->g = gamma_correct(rawBgcolor.green, totalgamma);
--            bgColorP->b = gamma_correct(rawBgcolor.blue, totalgamma);
-+            png_colorp palette;
-+            int num_palette;
-+
-+            if (png_get_PLTE(png_ptr, info_ptr,
-+                             &palette, &num_palette) & PNG_INFO_PLTE) {
-+                png_color const rawBgcolor = palette[background->index];
-+                bgColorP->r = gamma_correct(rawBgcolor.red, totalgamma);
-+                bgColorP->g = gamma_correct(rawBgcolor.green, totalgamma);
-+                bgColorP->b = gamma_correct(rawBgcolor.blue, totalgamma);
-+             }
-         }
-         break;
-         case PNG_COLOR_TYPE_RGB:
-         case PNG_COLOR_TYPE_RGB_ALPHA: {
--            png_color_16 const rawBgcolor = info_ptr->background;
-+            png_color_16 const rawBgcolor = *background;
-             
-             bgColorP->r = gamma_correct(rawBgcolor.red,   totalgamma);
-             bgColorP->g = gamma_correct(rawBgcolor.green, totalgamma);
-@@ -848,6 +916,7 @@ static void
- writePnm(FILE *              const ofP,
-          xelval              const maxval,
-          int                 const pnm_type,
-+         png_structp         const png_ptr, 
-          png_info *          const info_ptr,
-          png_byte **         const png_image,
-          pngcolor            const bgColor,
-@@ -865,6 +934,7 @@ writePnm(FILE *              const ofP,
- 
-----------------------------------------------------------------------------*/
-     xel * xelrow;
-     unsigned int row;
-+    png_uint_32 width, height;
- 
-     if (verbose)
-         pm_message ("writing a %s file (maxval=%u)",
-@@ -874,27 +944,35 @@ writePnm(FILE *              const ofP,
-                     "UNKNOWN!", 
-                     maxval);
-     
--    xelrow = pnm_allocrow(info_ptr->width);
-+    xelrow = pnm_allocrow(png_get_image_width(png_ptr, info_ptr));
- 
--    pnm_writepnminit(stdout, info_ptr->width, info_ptr->height, maxval,
--                     pnm_type, FALSE);
-+    width = png_get_image_width(png_ptr, info_ptr);
-+    height = png_get_image_height(png_ptr, info_ptr);
- 
--    for (row = 0; row < info_ptr->height; ++row) {
-+    pnm_writepnminit(stdout, width, height, maxval, pnm_type, FALSE);
-+
-+    for (row = 0; row < height; ++row) {
-         png_byte * png_pixelP;
-         int col;
- 
-         png_pixelP = &png_image[row][0];  /* initial value */
--        for (col = 0; col < info_ptr->width; ++col) {
--            switch (info_ptr->color_type) {
-+        for (col = 0; col < width; ++col) {
-+            switch (png_get_color_type(png_ptr, info_ptr)) {
-             case PNG_COLOR_TYPE_GRAY: {
-                 pngcolor fgColor;
-+                png_color_16p trans_color;
-+
-                 fgColor.r = fgColor.g = fgColor.b = get_png_val(png_pixelP);
--                setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
--                       ((info_ptr->valid & PNG_INFO_tRNS) &&
--                        (fgColor.r == 
--                         gamma_correct(info_ptr->trans_values.gray,
--                                       totalgamma))) ?
--                       0 : maxval);
-+
-+                if (png_get_tRNS(png_ptr, info_ptr,
-+                                 NULL, NULL, &trans_color) & PNG_INFO_tRNS &&
-+                    (fgColor.r ==  gamma_correct(trans_color->gray,
-+                                                 totalgamma))) {
-+                    setXel(&xelrow[col], fgColor, bgColor, alpha_handling, 0);
-+                } else {
-+                    setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
-+                           maxval);
-+                }
-             }
-             break;
- 
-@@ -909,19 +987,31 @@ writePnm(FILE *              const ofP,
-             break;
- 
-             case PNG_COLOR_TYPE_PALETTE: {
--                png_uint_16 const index        = get_png_val(png_pixelP);
--                png_color   const paletteColor = info_ptr->palette[index];
-+                png_uint_16 const index = get_png_val(png_pixelP);
-+                png_colorp palette;
-+                int num_palette;
- 
--                pngcolor fgColor;
-+                if (png_get_PLTE(png_ptr, info_ptr,
-+                                 &palette, &num_palette) & PNG_INFO_PLTE) {
-+                    png_color const paletteColor = palette[index];
-+                    pngcolor fgColor;
-+                    png_bytep trans_alpha;
-+                    int num_trans;
- 
--                fgColor.r = paletteColor.red;
--                fgColor.g = paletteColor.green;
--                fgColor.b = paletteColor.blue;
-+                    fgColor.r = paletteColor.red;
-+                    fgColor.g = paletteColor.green;
-+                    fgColor.b = paletteColor.blue;
- 
--                setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
--                       (info_ptr->valid & PNG_INFO_tRNS) &&
--                       index < info_ptr->num_trans ?
--                       info_ptr->trans[index] : maxval);
-+                    if (png_get_tRNS(png_ptr, info_ptr,
-+                                     &trans_alpha,
-+                                     &num_trans, NULL) & PNG_INFO_tRNS) {
-+                        setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
-+                               index < num_trans ? trans_alpha[index] : 
maxval);
-+                     } else {
-+                        setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
-+                               maxval);
-+                     }
-+                }
-             }
-             break;
-                 
-@@ -932,8 +1022,8 @@ writePnm(FILE *              const ofP,
-                 fgColor.g = get_png_val(png_pixelP);
-                 fgColor.b = get_png_val(png_pixelP);
-                 setXel(&xelrow[col], fgColor, bgColor, alpha_handling,
--                       isTransparentColor(fgColor, info_ptr, totalgamma) ?
--                       0 : maxval);
-+                       isTransparentColor(fgColor, png_ptr, info_ptr,
-+                                          totalgamma) ? 0 : maxval);
-             }
-             break;
- 
-@@ -950,10 +1040,10 @@ writePnm(FILE *              const ofP,
-             break;
- 
-             default:
--                pm_error ("unknown PNG color type: %d", info_ptr->color_type);
-+                pm_error ("unknown PNG color type: %d", 
png_get_color_type(png_ptr, info_ptr));
-             }
-         }
--        pnm_writepnmrow(ofP, xelrow, info_ptr->width, maxval, pnm_type, 
FALSE);
-+        pnm_writepnmrow(ofP, xelrow, width, maxval, pnm_type, FALSE);
-     }
-     pnm_freerow (xelrow);
- }
-@@ -974,6 +1064,7 @@ convertpng(FILE *             const ifp, 
-     int pnm_type;
-     pngcolor bgColor;
-     float totalgamma;
-+    int res_x, res_y, unit_type;
- 
-     *errorlevelP = 0;
- 
-@@ -996,28 +1087,28 @@ convertpng(FILE *             const ifp, 
-     png_set_sig_bytes (png_ptr, SIG_CHECK_SIZE);
-     png_read_info (png_ptr, info_ptr);
- 
--    MALLOCARRAY(png_image, info_ptr->height);
-+    MALLOCARRAY(png_image, png_get_image_height(png_ptr, info_ptr));
-     if (png_image == NULL) {
-         png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp)NULL);
-         pm_closer (ifp);
-         pm_error ("couldn't allocate space for image");
-     }
- 
--    if (info_ptr->bit_depth == 16)
--        linesize = 2 * info_ptr->width;
-+    if (png_get_bit_depth(png_ptr, info_ptr) == 16)
-+        linesize = 2 * png_get_image_width(png_ptr, info_ptr);
-     else
--        linesize = info_ptr->width;
-+        linesize = png_get_image_width(png_ptr, info_ptr);
- 
--    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-+    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
-         linesize *= 2;
-     else
--        if (info_ptr->color_type == PNG_COLOR_TYPE_RGB)
-+        if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB)
-             linesize *= 3;
-         else
--            if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-+            if (png_get_color_type(png_ptr, info_ptr) == 
PNG_COLOR_TYPE_RGB_ALPHA)
-                 linesize *= 4;
- 
--    for (y = 0 ; y < info_ptr->height ; y++) {
-+    for (y = 0 ; y < png_get_image_height(png_ptr, info_ptr) ; y++) {
-         png_image[y] = malloc (linesize);
-         if (png_image[y] == NULL) {
-             for (x = 0 ; x < y ; x++)
-@@ -1029,7 +1120,7 @@ convertpng(FILE *             const ifp, 
-         }
-     }
- 
--    if (info_ptr->bit_depth < 8)
-+    if (png_get_bit_depth(png_ptr, info_ptr) < 8)
-         png_set_packing (png_ptr);
- 
-     setupGammaCorrection(png_ptr, info_ptr, cmdline.gamma, &totalgamma);
-@@ -1037,8 +1128,8 @@ convertpng(FILE *             const ifp, 
-     setupSignificantBits(png_ptr, info_ptr, cmdline.alpha,
-                          &maxval, errorlevelP);
- 
--    getBackgroundColor(info_ptr, cmdline.background, totalgamma, maxval,
--                       &bgColor);
-+    getBackgroundColor(png_ptr, info_ptr, cmdline.background, totalgamma,
-+                       maxval, &bgColor);
- 
-     png_read_image (png_ptr, png_image);
-     png_read_end (png_ptr, info_ptr);
-@@ -1048,16 +1139,17 @@ convertpng(FILE *             const ifp, 
-        completes.  That's because it comes from chunks that are at the
-        end of the stream.
-     */
--        dump_png_info(info_ptr);
-+        dump_png_info(png_ptr, info_ptr);
- 
-     if (mtime)
--        show_time (info_ptr);
-+        show_time (png_ptr, info_ptr);
-     if (tfp)
--        save_text (info_ptr, tfp);
-+        save_text (png_ptr, info_ptr, tfp);
- 
--    if (info_ptr->valid & PNG_INFO_pHYs) {
-+    if (png_get_pHYs(png_ptr, info_ptr,
-+                     &res_x, &res_y, &unit_type) & PNG_INFO_pHYs) {
-         float r;
--        r = (float)info_ptr->x_pixels_per_unit / info_ptr->y_pixels_per_unit;
-+        r = (float)res_x / res_y;
-         if (r != 1.0) {
-             pm_message ("warning - non-square pixels; "
-                         "to fix do a 'pamscale -%cscale %g'",
-@@ -1067,13 +1159,13 @@ convertpng(FILE *             const ifp, 
-         }
-     }
- 
--    determineOutputType(info_ptr, cmdline.alpha, bgColor, maxval, &pnm_type);
-+    determineOutputType(png_ptr, info_ptr, cmdline.alpha, bgColor, maxval, 
&pnm_type);
- 
--    writePnm(stdout, maxval, pnm_type, info_ptr, png_image, bgColor, 
-+    writePnm(stdout, maxval, pnm_type, png_ptr, info_ptr, png_image, bgColor, 
-              cmdline.alpha, totalgamma);
- 
-     fflush(stdout);
--    for (y = 0 ; y < info_ptr->height ; y++)
-+    for (y = 0 ; y < png_get_image_height(png_ptr, info_ptr) ; y++)
-         free (png_image[y]);
-     free (png_image);
-     png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp)NULL);
Index: patches/patch-converter_other_pngtxt_c
===================================================================
RCS file: patches/patch-converter_other_pngtxt_c
diff -N patches/patch-converter_other_pngtxt_c
--- patches/patch-converter_other_pngtxt_c      8 Jul 2011 20:36:09 -0000       
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,80 +0,0 @@
-$OpenBSD: patch-converter_other_pngtxt_c,v 1.1 2011/07/08 20:36:09 naddy Exp $
-
-Fix build with png-1.5.
-
---- converter/other/pngtxt.c.orig      Fri Aug 18 21:12:28 2006
-+++ converter/other/pngtxt.c   Mon Jul  4 14:21:23 2011
-@@ -240,7 +240,8 @@ handleArrayAllocation(png_text **    const arrayP,
- 
- 
- void 
--pnmpng_read_text (png_info * const info_ptr, 
-+pnmpng_read_text (png_struct * png_ptr,
-+                  png_info * info_ptr, 
-                   FILE *     const tfp, 
-                   bool       const ztxt,
-                   bool       const verbose) {
-@@ -250,6 +251,7 @@ pnmpng_read_text (png_info * const info_ptr, 
-     unsigned int commentIdx;
-     bool noCommentsYet;
-     bool eof;
-+    png_textp text_ptr;
-     unsigned int allocatedComments;
-         /* Number of entries currently allocated for the info_ptr->text
-            array 
-@@ -257,8 +259,8 @@ pnmpng_read_text (png_info * const info_ptr, 
- 
-     allocatedComments = 256;  /* initial value */
- 
--    MALLOCARRAY(info_ptr->text, allocatedComments);
--    if (info_ptr->text == NULL) 
-+    MALLOCARRAY(text_ptr, allocatedComments);
-+    if (text_ptr == NULL) 
-         pm_error("unable to allocate memory for comment array");
- 
-     commentIdx = 0;
-@@ -273,7 +275,7 @@ pnmpng_read_text (png_info * const info_ptr, 
-             if (lineLength == 0) {
-                 /* skip this empty line */
-             } else {
--                handleArrayAllocation(&info_ptr->text, &allocatedComments,
-+                handleArrayAllocation(&text_ptr, &allocatedComments,
-                                       commentIdx);
-                 if ((textline[0] != ' ') && (textline[0] != '\t')) {
-                     /* Line doesn't start with white space, which
-@@ -285,7 +287,7 @@ pnmpng_read_text (png_info * const info_ptr, 
-                         ++commentIdx;
-                     noCommentsYet = FALSE;
- 
--                    startComment(&info_ptr->text[commentIdx], 
-+                    startComment(&text_ptr[commentIdx], 
-                                  textline, lineLength, ztxt);
-                 } else {
-                     /* Line starts with whitespace, which means it is
-@@ -295,20 +297,20 @@ pnmpng_read_text (png_info * const info_ptr, 
-                         pm_error("Invalid comment file format: "
-                                  "first line is a continuation line! "
-                                  "(It starts with whitespace)");
--                    continueComment(&info_ptr->text[commentIdx], 
-+                    continueComment(&text_ptr[commentIdx], 
-                                     textline, lineLength);
-                 }
-             }
-             strfree(textline);
-         }
-     } 
--    if (noCommentsYet)
--        info_ptr->num_text = 0;
--    else
--        info_ptr->num_text = commentIdx + 1;
-+    if (!noCommentsYet)
-+        png_set_text(png_ptr, info_ptr, text_ptr, commentIdx + 1);
- 
-     if (verbose)
--        pm_message("%d comments placed in text chunk", info_ptr->num_text);
-+        pm_message("%d comments placed in text chunk", commentIdx + 1);
-+
-+    free(text_ptr);
- }
- 
- 
Index: patches/patch-converter_other_pngtxt_h
===================================================================
RCS file: patches/patch-converter_other_pngtxt_h
diff -N patches/patch-converter_other_pngtxt_h
--- patches/patch-converter_other_pngtxt_h      8 Jul 2011 20:36:09 -0000       
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-converter_other_pngtxt_h,v 1.1 2011/07/08 20:36:09 naddy Exp $
-
-Fix build with png-1.5.
-
---- converter/other/pngtxt.h.orig      Fri Aug 18 21:12:28 2006
-+++ converter/other/pngtxt.h   Mon Jul  4 14:21:23 2011
-@@ -5,7 +5,8 @@
- #include <png.h>
- 
- void 
--pnmpng_read_text (png_info * const info_ptr, 
-+pnmpng_read_text (png_struct * png_ptr,
-+                  png_info * const info_ptr, 
-                   FILE *     const tfp, 
-                   bool const ztxt,
-                   bool const verbose);
Index: patches/patch-converter_other_pnmtopng_c
===================================================================
RCS file: patches/patch-converter_other_pnmtopng_c
diff -N patches/patch-converter_other_pnmtopng_c
--- patches/patch-converter_other_pnmtopng_c    13 Dec 2011 21:39:17 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,402 +0,0 @@
-$OpenBSD: patch-converter_other_pnmtopng_c,v 1.2 2011/12/13 21:39:17 naddy Exp 
$
-
-Fix build with png-1.5.
-
---- converter/other/pnmtopng.c.orig    Sun Sep 25 20:51:44 2011
-+++ converter/other/pnmtopng.c Tue Dec 13 22:22:04 2011
-@@ -61,7 +61,8 @@
- #include <assert.h>
- #include <string.h> /* strcat() */
- #include <limits.h>
--#include <png.h>    /* includes zlib.h and setjmp.h */
-+#include <png.h>    /* includes setjmp.h */
-+#include <zlib.h>
- #include "pnm.h"
- #include "pngtxt.h"
- #include "shhopt.h"
-@@ -69,13 +70,6 @@
- #include "nstring.h"
- #include "version.h"
- 
--#if PNG_LIBPNG_VER >= 10400
--#error Your PNG library (<png.h>) is incompatible with this Netpbm source 
code.
--#error You need either an older PNG library (older than 1.4)
--#error newer Netpbm source code (at least 10.47.04)
--#endif
--
--
- struct zlibCompression {
-     /* These are parameters that describe a form of zlib compression.
-        Values have the same meaning as the similarly named arguments to
-@@ -2098,6 +2092,7 @@ makePngLine(png_byte *           const line,
-             gray *               const alpha_mask,
-             colorhash_table      const cht,
-             coloralphahash_table const caht,
-+            png_struct *         const png_ptr,
-             png_info *           const info_ptr,
-             xelval               const png_maxval,
-             unsigned int         const depth) {
-@@ -2110,20 +2105,20 @@ makePngLine(png_byte *           const line,
-         xel p_png;
-         xel const p = xelrow[col];
-         PPM_DEPTH(p_png, p, maxval, png_maxval);
--        if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
--            info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
-+        if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
-+            png_get_color_type(png_ptr, info_ptr) == 
PNG_COLOR_TYPE_GRAY_ALPHA) {
-             if (depth == 16)
-                 *pp++ = PNM_GET1(p_png) >> 8;
-             *pp++ = PNM_GET1(p_png) & 0xff;
--        } else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
-+        } else if (png_get_color_type(png_ptr, info_ptr) == 
PNG_COLOR_TYPE_PALETTE) {
-             unsigned int paletteIndex;
-             if (alpha)
-                 paletteIndex = lookupColorAlpha(caht, &p, &alpha_mask[col]);
-             else
-                 paletteIndex = ppm_lookupcolor(cht, &p);
-             *pp++ = paletteIndex;
--        } else if (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
--                   info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-+        } else if (png_get_color_type(png_ptr, info_ptr) == 
PNG_COLOR_TYPE_RGB ||
-+                   png_get_color_type(png_ptr, info_ptr) == 
PNG_COLOR_TYPE_RGB_ALPHA) {
-             if (depth == 16)
-                 *pp++ = PPM_GETR(p_png) >> 8;
-             *pp++ = PPM_GETR(p_png) & 0xff;
-@@ -2136,7 +2131,7 @@ makePngLine(png_byte *           const line,
-         } else
-             pm_error("INTERNAL ERROR: undefined color_type");
-                 
--        if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) {
-+        if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA) {
-             int const png_alphaval = (int)
-                 alpha_mask[col] * (float) png_maxval / maxval + 0.5;
-             if (depth == 16)
-@@ -2193,7 +2188,7 @@ writeRaster(png_struct *         const png_ptr,
-             
-             makePngLine(line, xelrow, cols, maxval,
-                         alpha, alpha ? alpha_mask[row] : NULL,
--                        cht, caht, info_ptr, png_maxval, depth);
-+                        cht, caht, png_ptr, info_ptr, png_maxval, depth);
- 
-             png_write_row(png_ptr, line);
-         }
-@@ -2205,12 +2200,12 @@ writeRaster(png_struct *         const png_ptr,
- 
- static void
- doGamaChunk(struct cmdlineInfo const cmdline,
-+            png_struct *       const png_ptr,
-             png_info *         const info_ptr) {
-             
-     if (cmdline.gammaSpec) {
-         /* gAMA chunk */
--        info_ptr->valid |= PNG_INFO_gAMA;
--        info_ptr->gamma = cmdline.gamma;
-+        png_set_gAMA(png_ptr, info_ptr, cmdline.gamma);
-     }
- }
- 
-@@ -2218,20 +2213,15 @@ doGamaChunk(struct cmdlineInfo const cmdline,
- 
- static void
- doChrmChunk(struct cmdlineInfo const cmdline,
-+            png_struct *       const png_ptr,
-             png_info *         const info_ptr) {
- 
-     if (cmdline.rgbSpec) {
-         /* cHRM chunk */
--        info_ptr->valid |= PNG_INFO_cHRM;
--
--        info_ptr->x_white = cmdline.rgb.wx;
--        info_ptr->y_white = cmdline.rgb.wy;
--        info_ptr->x_red   = cmdline.rgb.rx;
--        info_ptr->y_red   = cmdline.rgb.ry;
--        info_ptr->x_green = cmdline.rgb.gx;
--        info_ptr->y_green = cmdline.rgb.gy;
--        info_ptr->x_blue  = cmdline.rgb.bx;
--        info_ptr->y_blue  = cmdline.rgb.by;
-+      
-+        png_set_cHRM (png_ptr, info_ptr, cmdline.rgb.wx, cmdline.rgb.wy,
-+                      cmdline.rgb.rx, cmdline.rgb.ry, cmdline.rgb.gx,
-+                      cmdline.rgb.gy, cmdline.rgb.bx, cmdline.rgb.by);
-     }
- }
- 
-@@ -2239,15 +2229,12 @@ doChrmChunk(struct cmdlineInfo const cmdline,
- 
- static void
- doPhysChunk(struct cmdlineInfo const cmdline,
-+            png_struct *       const png_ptr,
-             png_info *         const info_ptr) {
- 
-     if (cmdline.sizeSpec) {
-         /* pHYS chunk */
--        info_ptr->valid |= PNG_INFO_pHYs;
--
--        info_ptr->x_pixels_per_unit = cmdline.size.x;
--        info_ptr->y_pixels_per_unit = cmdline.size.y;
--        info_ptr->phys_unit_type    = cmdline.size.unit;
-+        png_set_pHYs(png_ptr, info_ptr, cmdline.size.x, cmdline.size.y, 
cmdline.size.unit);
-     }
- }
- 
-@@ -2256,26 +2243,28 @@ doPhysChunk(struct cmdlineInfo const cmdline,
- 
- static void
- doTimeChunk(struct cmdlineInfo const cmdline,
-+            png_struct *       const png_ptr,
-             png_info *         const info_ptr) {
- 
-     if (cmdline.modtimeSpec) {
-         /* tIME chunk */
--        info_ptr->valid |= PNG_INFO_tIME;
--
--        png_convert_from_time_t(&info_ptr->mod_time, cmdline.modtime);
-+        png_timep ptime;
-+        png_convert_from_time_t(ptime, cmdline.modtime);
-+        png_set_tIME(png_ptr, info_ptr, ptime);
-     }
- }
- 
- 
- 
- static void
--doSbitChunk(png_info * const pngInfoP,
-+doSbitChunk(png_struct * const pngP,
-+            png_info * const pngInfoP,
-             xelval     const pngMaxval,
-             xelval     const maxval,
-             bool       const alpha,
-             xelval     const alphaMaxval) {
- 
--    if (pngInfoP->color_type != PNG_COLOR_TYPE_PALETTE &&
-+    if (png_get_color_type(pngP, pngInfoP) != PNG_COLOR_TYPE_PALETTE &&
-         (pngMaxval > maxval || (alpha && pngMaxval > alphaMaxval))) {
- 
-         /* We're writing in a bit depth that doesn't match the maxval
-@@ -2294,27 +2283,29 @@ doSbitChunk(png_info * const pngInfoP,
-            sBIT chunk.
-         */
- 
--        pngInfoP->valid |= PNG_INFO_sBIT;
--
-         {
-             int const sbitval = pm_maxvaltobits(MIN(maxval, pngMaxval));
-+            png_color_8 sbit;
- 
--            if (pngInfoP->color_type & PNG_COLOR_MASK_COLOR) {
--                pngInfoP->sig_bit.red   = sbitval;
--                pngInfoP->sig_bit.green = sbitval;
--                pngInfoP->sig_bit.blue  = sbitval;
-+            (void)memset(&sbit, 0, sizeof(sbit));
-+            if (png_get_color_type(pngP, pngInfoP) & PNG_COLOR_MASK_COLOR) {
-+                sbit.red   = sbitval;
-+                sbit.green = sbitval;
-+                sbit.blue  = sbitval;
-             } else
--                pngInfoP->sig_bit.gray = sbitval;
-+                sbit.gray = sbitval;
-             
-             if (verbose)
-                 pm_message("Writing sBIT chunk with bits = %d", sbitval);
-+
-+            if (png_get_color_type(pngP, pngInfoP) & PNG_COLOR_MASK_ALPHA) {
-+                sbit.alpha =
-+                    pm_maxvaltobits(MIN(alphaMaxval, pngMaxval));
-+                if (verbose)
-+                    pm_message("  alpha bits = %d", sbit.alpha);
-+            }
-+            png_set_sBIT(pngP, pngInfoP, &sbit);
-         }
--        if (pngInfoP->color_type & PNG_COLOR_MASK_ALPHA) {
--            pngInfoP->sig_bit.alpha =
--                pm_maxvaltobits(MIN(alphaMaxval, pngMaxval));
--            if (verbose)
--                pm_message("  alpha bits = %d", pngInfoP->sig_bit.alpha);
--        }
-     }
- }
- 
-@@ -2410,6 +2401,8 @@ convertpnm(struct cmdlineInfo const cmdline,
-   xelval maxmaxval;
-   gray ** alpha_mask;
- 
-+  int color_type;
-+
-   /* these guys are initialized to quiet compiler warnings: */
-   maxmaxval = 255;
-   alpha_mask = NULL;
-@@ -2595,43 +2588,42 @@ convertpnm(struct cmdlineInfo const cmdline,
-     pm_error ("setjmp returns error condition (2)");
-   }
- 
--  png_init_io (png_ptr, stdout);
--  info_ptr->width = cols;
--  info_ptr->height = rows;
--  info_ptr->bit_depth = depth;
--
-   if (colorMapped)
--    info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
--  else if (pnm_type == PPM_TYPE)
--    info_ptr->color_type = PNG_COLOR_TYPE_RGB;
--  else
--    info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
-+    color_type = PNG_COLOR_TYPE_PALETTE;
-+  else if (pnm_type == PPM_TYPE) {
-+    if (alpha)
-+      color_type = PNG_COLOR_TYPE_RGB_ALPHA;
-+    else
-+      color_type = PNG_COLOR_TYPE_RGB;
-+  } else {
-+    if (alpha)
-+      color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
-+    else
-+      color_type = PNG_COLOR_TYPE_GRAY;
-+  }
- 
--  if (alpha && info_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
--    info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
-+  png_set_IHDR(png_ptr, info_ptr, cols, rows, depth, color_type, 0, 0, 0);
-+  png_init_io (png_ptr, stdout);
- 
--  info_ptr->interlace_type = cmdline.interlace;
-+  if (cmdline.interlace)
-+    png_set_interlace_handling(png_ptr);
- 
--  doGamaChunk(cmdline, info_ptr);
-+  doGamaChunk(cmdline, png_ptr, info_ptr);
- 
--  doChrmChunk(cmdline, info_ptr);
-+  doChrmChunk(cmdline, png_ptr, info_ptr);
- 
--  doPhysChunk(cmdline, info_ptr);
-+  doPhysChunk(cmdline, png_ptr, info_ptr);
- 
--  if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
-+  if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {
- 
-     /* creating PNG palette  (PLTE and tRNS chunks) */
- 
-     createPngPalette(palette_pnm, palette_size, maxval,
-                      trans_pnm, trans_size, alpha_maxval, 
-                      palette, trans);
--    info_ptr->valid |= PNG_INFO_PLTE;
--    info_ptr->palette = palette;
--    info_ptr->num_palette = palette_size;
-+    png_set_PLTE(png_ptr, info_ptr, palette, palette_size);
-     if (trans_size > 0) {
--        info_ptr->valid |= PNG_INFO_tRNS;
--        info_ptr->trans = trans;
--        info_ptr->num_trans = trans_size;   /* omit opaque values */
-+        png_set_tRNS(png_ptr, info_ptr, trans, trans_size, NULL);
-     }
-     /* creating hIST chunk */
-     if (cmdline.hist) {
-@@ -2657,18 +2649,17 @@ convertpnm(struct cmdlineInfo const cmdline,
- 
-         ppm_freecolorhash(cht);
- 
--        info_ptr->valid |= PNG_INFO_hIST;
--        info_ptr->hist = histogram;
-+        png_set_hIST(png_ptr, info_ptr, histogram);
-         if (verbose)
-             pm_message("histogram created");
-     }
-   } else { /* color_type != PNG_COLOR_TYPE_PALETTE */
--    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
--        info_ptr->color_type == PNG_COLOR_TYPE_RGB) {
-+    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
-+        png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB) {
-         if (transparent > 0) {
--            info_ptr->valid |= PNG_INFO_tRNS;
--            info_ptr->trans_values = 
--                xelToPngColor_16(transcolor, maxval, png_maxval);
-+            png_color_16 trans_color = xelToPngColor_16(transcolor, maxval, 
png_maxval);
-+            png_set_tRNS(png_ptr, info_ptr, NULL, 0, &trans_color);
-+                
-         }
-     } else {
-         /* This is PNG_COLOR_MASK_ALPHA.  Transparency will be handled
-@@ -2676,43 +2667,49 @@ convertpnm(struct cmdlineInfo const cmdline,
-         */
-     }
-     if (verbose) {
--        if (info_ptr->valid && PNG_INFO_tRNS) 
-+        if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
-+            png_color_16p trans_color;
-+
-+            png_get_tRNS(png_ptr, info_ptr, NULL, NULL, &trans_color);
-             pm_message("Transparent color {gray, red, green, blue} = "
-                        "{%d, %d, %d, %d}",
--                       info_ptr->trans_values.gray,
--                       info_ptr->trans_values.red,
--                       info_ptr->trans_values.green,
--                       info_ptr->trans_values.blue);
--        else
-+                       trans_color->gray,
-+                       trans_color->red,
-+                       trans_color->green,
-+                       trans_color->blue);
-+        } else
-             pm_message("No transparent color");
-     }
-   }
- 
-   /* bKGD chunk */
-   if (cmdline.background) {
--      info_ptr->valid |= PNG_INFO_bKGD;
--      if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
--          info_ptr->background.index = background_index;
-+      if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {
-+          png_color_16 background;
-+
-+          (void)memset(&background, 0, sizeof(background));
-+          background.index = background_index;
-+          png_set_bKGD(png_ptr, info_ptr, &background);
-       } else {
--          info_ptr->background = 
--              xelToPngColor_16(backcolor, maxval, png_maxval);
-+          png_color_16 background = xelToPngColor_16(backcolor, maxval, 
png_maxval);
-+          png_set_bKGD(png_ptr, info_ptr, &background);
-           if (verbose)
-               pm_message("Writing bKGD chunk with background color "
-                          " {gray, red, green, blue} = {%d, %d, %d, %d}",
--                         info_ptr->background.gray, 
--                         info_ptr->background.red, 
--                         info_ptr->background.green, 
--                         info_ptr->background.blue ); 
-+                         background.gray, 
-+                         background.red, 
-+                         background.green, 
-+                         background.blue ); 
-       }
-   }
- 
--  doSbitChunk(info_ptr, png_maxval, maxval, alpha, alpha_maxval);
-+  doSbitChunk(png_ptr, info_ptr, png_maxval, maxval, alpha, alpha_maxval);
- 
-   /* tEXT and zTXT chunks */
-   if (cmdline.text || cmdline.ztxt)
--      pnmpng_read_text(info_ptr, tfp, !!cmdline.ztxt, cmdline.verbose);
-+      pnmpng_read_text(png_ptr, info_ptr, tfp, !!cmdline.ztxt, 
cmdline.verbose);
- 
--  doTimeChunk(cmdline, info_ptr);
-+  doTimeChunk(cmdline, png_ptr, info_ptr);
- 
-   if (cmdline.filterSet != 0)
-       png_set_filter(png_ptr, 0, cmdline.filterSet);
-@@ -2722,6 +2719,7 @@ convertpnm(struct cmdlineInfo const cmdline,
-   /* write the png-info struct */
-   png_write_info(png_ptr, info_ptr);
- 
-+#if 0
-   if (cmdline.text || cmdline.ztxt)
-       /* prevent from being written twice with png_write_end */
-       info_ptr->num_text = 0;
-@@ -2729,6 +2727,7 @@ convertpnm(struct cmdlineInfo const cmdline,
-   if (cmdline.modtime)
-       /* prevent from being written twice with png_write_end */
-       info_ptr->valid &= ~PNG_INFO_tIME;
-+#endif
- 
-   /* let libpng take care of, e.g., bit-depth conversions */
-   png_set_packing (png_ptr);
Index: patches/patch-converter_ppm_ppmtompeg_parallel_c
===================================================================
RCS file: patches/patch-converter_ppm_ppmtompeg_parallel_c
diff -N patches/patch-converter_ppm_ppmtompeg_parallel_c
--- patches/patch-converter_ppm_ppmtompeg_parallel_c    2 Jul 2010 02:54:59 
-0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-converter_ppm_ppmtompeg_parallel_c,v 1.1 2010/07/02 02:54:59 
naddy Exp $
---- converter/ppm/ppmtompeg/parallel.c.orig    Wed Jun 30 05:58:21 2010
-+++ converter/ppm/ppmtompeg/parallel.c Wed Jun 30 05:58:48 2010
-@@ -12,7 +12,7 @@
-  * HEADER FILES *
-  *==============*/
- 
--#define _XOPEN_SOURCE 500 /* Make sure stdio.h contains pclose() */
-+/*#define _XOPEN_SOURCE 500*/ /* Make sure stdio.h contains pclose() */
- /* _ALL_SOURCE is needed on AIX to make the C library include the 
-    socket services (e.g. define struct sockaddr) 
- 
Index: patches/patch-editor_ppmquantall
===================================================================
RCS file: patches/patch-editor_ppmquantall
diff -N patches/patch-editor_ppmquantall
--- patches/patch-editor_ppmquantall    3 Jan 2014 20:16:31 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,59 +0,0 @@
-$OpenBSD: patch-editor_ppmquantall,v 1.1 2014/01/03 20:16:31 naddy Exp $
-
-Convert from bash to sh.
-
---- editor/ppmquantall.orig    Tue Apr 28 03:43:45 2009
-+++ editor/ppmquantall Fri Jan  3 19:12:06 2014
-@@ -53,8 +53,6 @@ fi
- 
- newcolors=$1
- shift
--nfiles=$#
--files=($@)
- 
- # Extract the width and height of each of the images.
- # Here, we make the assumption that the width and height are on the
-@@ -62,14 +60,6 @@ files=($@)
- # To be robust, we need to use Pnmfile to get that information, or 
- # Put this program in C and use ppm_readppminit().
- 
--widths=()
--heights=()
--
--for i in ${files[@]}; do
--    widths=(${widths[*]} `grep -v '^#' $i | sed '1d; s/ .*//; 2q'`)
--    heights=(${heights[*]} `grep -v '^#' $i | sed '1d; s/.* //; 2q'`)
--done
--
- tempdir="${TMPDIR-/tmp}/ppmquantall.$$"
- mkdir $tempdir || { echo "Could not create temporary file. Exiting."; exit 1;}
- chmod 700 $tempdir
-@@ -78,7 +68,7 @@ trap 'rm -rf $tempdir' 0 1 3 15
- 
- all=$tempdir/pqa.all.$$
- 
--pnmcat -topbottom -jleft -white ${files[@]} | pnmquant $newcolors > $all
-+pnmcat -topbottom -jleft -white "$@" | pnmquant $newcolors > $all
- if [ $? != 0 ]; then
-     exit $?
- fi
-@@ -86,12 +76,15 @@ fi
- y=0
- i=0
- 
--while [ $i -lt $nfiles ]; do
--    pamcut -left 0 -top $y -width ${widths[$i]} -height ${heights[$i]} $all \
--        > ${files[$i]}$ext
-+for f in "$@"; do
-+    width=`grep -v '^#' "$f" | sed '1d; s/ .*//; 2q'`
-+    height=`grep -v '^#' "$f" | sed '1d; s/.* //; 2q'`
-+
-+    pamcut -left 0 -top $y -width $width -height $height $all \
-+        > "$f$ext"
-     if [ $? != 0 ]; then
-         exit $?
-     fi
--    y=$(($y + ${heights[$i]}))
-+    y=$(($y + $height))
-     i=$(($i + 1))
- done
Index: patches/patch-lib_Makefile
===================================================================
RCS file: /cvs/ports/graphics/netpbm/patches/patch-lib_Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 patch-lib_Makefile
--- patches/patch-lib_Makefile  2 Jul 2010 02:54:59 -0000       1.4
+++ patches/patch-lib_Makefile  26 Apr 2016 12:30:53 -0000
@@ -1,9 +1,9 @@
 $OpenBSD: patch-lib_Makefile,v 1.4 2010/07/02 02:54:59 naddy Exp $
---- lib/Makefile.orig  Wed Jun 30 02:15:15 2010
-+++ lib/Makefile       Wed Jun 30 02:22:04 2010
-@@ -42,6 +42,9 @@ endif
- # Library objects to be linked but not built by Makefile.common:
- LIBOBJECTS_X = util/shhopt.o util/nstring.o util/filename.o
+--- lib/Makefile.orig  Sat Sep 26 21:59:25 2015
++++ lib/Makefile       Mon Apr 25 19:43:02 2016
+@@ -51,6 +51,9 @@ LIBOBJECTS_X = \
+   util/token.o \
+   util/vasprintf.o \
  
 +SHLIBOBJECTS = $(patsubst %.o, %.lo, $(LIBOBJECTS))
 +SHLIBOBJECTS_X = $(patsubst %.o, %.lo, $(LIBOBJECTS_X))
@@ -11,18 +11,25 @@ $OpenBSD: patch-lib_Makefile,v 1.4 2010/
  MANUALS3 = libnetpbm
  MANUALS5 = pbm pgm ppm pnm pam
  
-@@ -80,6 +83,10 @@ extra_staticlib: $(EXTRA_STATICLIB)
+@@ -87,13 +90,16 @@ extra_staticlib: $(EXTRA_STATICLIB)
+ # type, but request a static library in addition.
+ #----------------------------------------------------------------------------
+ 
+-$(LIBOBJECTS): CFLAGS_TARGET=$(CFLAGS_SHLIB)
++$(SHLIBOBJECTS): CFLAGS_TARGET=$(CFLAGS_SHLIB)
+ 
+ libpbm3.o: CFLAGS_TARGET+=$(CFLAGS_SSE)
  
  $(LIBOBJECTS): %.o: %.c importinc
- # Note that the user may have configured -I options into CFLAGS.
-+      $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) \
-+        $(CFLAGS_PERSONAL) $(CADD) -o $@ $<
-+
+       $(CC) -c $(INCLUDES) $(CFLAGS_ALL) -o $@ $<
+ 
 +$(SHLIBOBJECTS): %.lo: %.c importinc
-       $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) $(CFLAGS_SHLIB) \
-         $(CFLAGS_PERSONAL) $(CADD) -o $@ $<
++      $(CC) -c $(INCLUDES) $(CFLAGS_ALL) -o $@ $<
++
+ MAJ = 11
+ MIN = $(NETPBM_MINOR_RELEASE)
  
-@@ -107,7 +114,7 @@ endif
+@@ -118,7 +124,7 @@ endif
  
  ifeq ($(NETPBMLIBTYPE),unixshared)
  # The libxxx.so link is needed to link the executables.
@@ -31,20 +38,18 @@ $OpenBSD: patch-lib_Makefile,v 1.4 2010/
        rm -f $@
        $(SYMLINK) $< $@
  # The $(SONAME) link is needed only to test the programs without
-@@ -116,9 +123,9 @@ libnetpbm.$(NETPBMLIBSUFFIX): $(SONAME)
+@@ -127,8 +133,8 @@ libnetpbm.$(NETPBMLIBSUFFIX): $(SONAME)
  $(SONAME): libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).$(MIN)
        rm -f $@
        $(SYMLINK) $< $@
 -libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).$(MIN): $(LIBOBJECTS) $(LIBOBJECTS_X)
 -      $(LD) $(LDSHLIB) -o $@ $(LIBOBJECTS) $(LIBOBJECTS_X) \
--          $(SHLIB_CLIB) -lm $(LADD)
 +libnetpbm.$(NETPBMLIBSUFFIX).$(LIBnetpbm_VERSION): $(SHLIBOBJECTS) 
$(SHLIBOBJECTS_X)
 +      $(LD) $(LDSHLIB) -o $@ $(SHLIBOBJECTS) $(SHLIBOBJECTS_X) \
-+        $(SHLIB_CLIB) $(LADD)
+           $(SHLIB_CLIB) -lm $(LADD)
  endif
  
- ifeq ($(NETPBMLIBTYPE),dll)
-@@ -193,7 +200,7 @@ standardppmdfont.c:standard.ppmdfont
+@@ -204,25 +210,21 @@ standardppmdfont.c: standard.ppmdfont
  compile.h:
        $(SRCDIR)/buildtools/stamp-date >$@ || rm $@
  
@@ -53,37 +58,35 @@ $OpenBSD: patch-lib_Makefile,v 1.4 2010/
        @if [ ! -d $(dir $@) ] ; then mkdir $(dir $@) ; fi
        $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
                SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) $(notdir $@) 
-@@ -205,13 +212,9 @@ libpm.o: compile.h
+ 
+-libpm.o: compile.h
++libpm.o libpm.lo: compile.h
+ 
+ # Install a shared library
+ #
  .PHONY: install.lib
  ifeq ($(NETPBMLIBTYPE),unixshared)
  # install a Unix-style shared library
 -install.lib: $(PKGDIR)/lib $(PKGDIR)/link
 -      cd $(PKGDIR)/lib ; rm -f libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).*
--      $(INSTALL) -c -m $(INSTALL_PERM_LIBD) \
++install.lib: $(PKGDIR)/lib
+       $(INSTALL) -c -m $(INSTALL_PERM_LIBD) \
 -        libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).$(MIN)  $(PKGDIR)/lib/
 -      cd $(PKGDIR)/lib/ ; \
 -          rm -f libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ); \
 -          $(SYMLINK) libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).$(MIN) $(SONAME)
-+install.lib: $(PKGDIR)/lib
-+      $(BSD_INSTALL_DATA) \
-+        libnetpbm.$(NETPBMLIBSUFFIX).$(LIBnetpbm_VERSION) $(PKGDIR)/lib/
++        libnetpbm.$(NETPBMLIBSUFFIX).$(LIBnetpbm_VERSION)  $(PKGDIR)/lib/
  endif
  ifeq ($(NETPBMLIBTYPE),dll)
  #install a Windows DLL shared library
-@@ -241,13 +244,13 @@ install.hdr: $(INTERFACE_HEADERS:%=%_installhdr)
- # directory when you compile your programs.
- 
- %_installhdr: $(PKGDIR)/include
--      $(INSTALL) -c -m $(INSTALL_PERM_HDR) \
-+      $(BSD_INSTALL_DATA) \
-         $(SRCDIR)/lib/$(@:%_installhdr=%) $(PKGDIR)/include/;
+@@ -258,9 +260,9 @@ $(INTERFACE_HEADERS:%=%_installhdr): $(PKGDIR)/include
+         $(SRCDIR)/lib/$(@:%_installhdr=%) $(PKGDIR)/include/netpbm/
  
  .PHONY: install.staticlib
 -install.staticlib: $(PKGDIR)/link
--      $(INSTALL) -c -m $(INSTALL_PERM_LIBS) libnetpbm.$(STATICLIBSUFFIX) \
--        $(PKGDIR)/link
 +install.staticlib: $(PKGDIR)/lib
-+      $(BSD_INSTALL_DATA) libnetpbm.$(STATICLIBSUFFIX) \
+       $(INSTALL) -c -m $(INSTALL_PERM_LIBS) libnetpbm.$(STATICLIBSUFFIX) \
+-        $(PKGDIR)/link
 +        $(PKGDIR)/lib
  
  # Install a shared library stub -- the ".so" file used at link time to
Index: patches/patch-lib_libpm_c
===================================================================
RCS file: patches/patch-lib_libpm_c
diff -N patches/patch-lib_libpm_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_libpm_c   26 Apr 2016 12:30:53 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- lib/libpm.c.orig   Mon Mar 30 01:07:03 2015
++++ lib/libpm.c        Tue Apr 26 10:59:12 2016
+@@ -785,7 +785,7 @@ pm_arg0toprogname(const char arg0[]) {
+ unsigned int
+ pm_randseed(void) {
+ 
+-    return time(NULL) ^ getpid();
++    return arc4random();
+ 
+ }
+ 
Index: patches/patch-lib_libsystem_c
===================================================================
RCS file: patches/patch-lib_libsystem_c
diff -N patches/patch-lib_libsystem_c
--- patches/patch-lib_libsystem_c       26 Mar 2011 15:43:18 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-lib_libsystem_c,v 1.2 2011/03/26 15:43:18 naddy Exp $
---- lib/libsystem.c.orig       Fri Mar 25 22:12:34 2011
-+++ lib/libsystem.c    Fri Mar 25 22:12:42 2011
-@@ -12,7 +12,7 @@
- 
-    Contributed to the public domain.
- 
=============================================================================*/
--#define _XOPEN_SOURCE
-+/*#define _XOPEN_SOURCE*/
- 
- #include <unistd.h>
- #include <stdlib.h>
Index: patches/patch-lib_util_Makefile
===================================================================
RCS file: /cvs/ports/graphics/netpbm/patches/patch-lib_util_Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 patch-lib_util_Makefile
--- patches/patch-lib_util_Makefile     2 Jul 2010 02:54:59 -0000       1.3
+++ patches/patch-lib_util_Makefile     26 Apr 2016 12:30:53 -0000
@@ -1,24 +1,26 @@
 $OpenBSD: patch-lib_util_Makefile,v 1.3 2010/07/02 02:54:59 naddy Exp $
---- lib/util/Makefile.orig     Wed Jun 30 02:26:13 2010
-+++ lib/util/Makefile  Wed Jun 30 02:27:31 2010
-@@ -12,14 +12,19 @@ INCLUDES = -I $(BUILDDIR) -I $(SRCDIR)/$(SUBDIR)/..
- # nstring is required for asprintf(), etc.  Also some systems don't have
- # snprintf(), e.g. Solaris 2.5.1.  2002.03.29.
- UTILOBJECTS = shhopt.o nstring.o filename.o
-+SHUTILOBJECTS = $(patsubst %.o, %.lo, $(UTILOBJECTS))
+--- lib/util/Makefile.orig     Sat Sep 26 21:59:25 2015
++++ lib/util/Makefile  Mon Apr 25 19:43:02 2016
+@@ -24,15 +24,20 @@ UTILOBJECTS = \
+   token.o \
+   vasprintf.o \
  
++SHUTILOBJECTS = $(patsubst %.o, %.lo, $(UTILOBJECTS))
++
  MERGE_OBJECTS =
  
+ include $(SRCDIR)/common.mk
+ 
 -all: $(UTILOBJECTS)
 +all: $(UTILOBJECTS) $(SHUTILOBJECTS)
  
- include $(SRCDIR)/Makefile.common
+-$(UTILOBJECTS): CFLAGS_TARGET=$(CFLAGS_SHLIB)
++$(SHUTILOBJECTS): CFLAGS_TARGET=$(CFLAGS_SHLIB)
  
  $(UTILOBJECTS):%.o:%.c importinc
-+      $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) \
-+        $(CFLAGS_PERSONAL) $(CADD) -o $@ $<
++      $(CC) -c $(INCLUDES) $(CFLAGS_ALL) -o $@ $<
 +
 +$(SHUTILOBJECTS):%.lo:%.c importinc
-       $(CC) -c $(INCLUDES) -DNDEBUG $(CFLAGS) $(CFLAGS_SHLIB) \
-         $(CFLAGS_PERSONAL) $(CADD) -o $@ $<
+       $(CC) -c $(INCLUDES) $(CFLAGS_ALL) -o $@ $<
  
+ testnstring: test.c nstring.h nstring.o
Index: patches/patch-pm_config_in_h
===================================================================
RCS file: patches/patch-pm_config_in_h
diff -N patches/patch-pm_config_in_h
--- patches/patch-pm_config_in_h        8 Oct 2015 11:48:39 -0000       1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-pm_config_in_h,v 1.3 2015/10/08 11:48:39 jasper Exp $
---- pm_config.in.h.orig        Wed Jun 30 02:05:34 2010
-+++ pm_config.in.h     Wed Jun 30 02:06:24 2010
-@@ -67,9 +67,9 @@
- #define RGB_DB2 "PBMplus_Dir:RGB.TXT"
- #define RGB_DB3 "PBMplus_Dir:RGB.TXT"
- #else
--#define RGB_DB1 "/usr/lib/X11/rgb.txt"
--#define RGB_DB2 "/usr/share/X11/rgb.txt"
--#define RGB_DB3 "/usr/X11R6/lib/X11/rgb.txt"
-+#define RGB_DB1 "${X11BASE}/share/X11/rgb.txt"
-+#define RGB_DB2 "${X11BASE}/share/X11/rgb.txt"
-+#define RGB_DB3 "${PREFIX}/share/netpbm/rgb.txt"
- #endif
- 
- /* CONFIGURE: This is the name of an environment variable that tells
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/graphics/netpbm/pkg/DESCR,v
retrieving revision 1.4
diff -u -p -r1.4 DESCR
--- pkg/DESCR   11 Jun 2006 18:22:06 -0000      1.4
+++ pkg/DESCR   26 Apr 2016 12:30:53 -0000
@@ -1,5 +1,9 @@
-Netpbm is a toolkit for conversion of images between a variety of
-different formats, as well as to allow a few basic image operations.
+Netpbm is a toolkit for manipulation of graphic images, including conversion
+of images between a variety of different formats. There are over 300 separate
+tools in the package including converters for about 100 graphics formats.
+Examples of the sort of image manipulation we're talking about are: shrinking
+an image by 10%; cutting the top half off of an image; making a mirror image;
+creating a sequence of images that fade from one image to another.
 
 There are no man pages.  Netpbm documentation is kept in HTML format.
 Refer to the home page.
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/graphics/netpbm/pkg/PLIST,v
retrieving revision 1.11
diff -u -p -r1.11 PLIST
--- pkg/PLIST   8 Jul 2015 20:48:57 -0000       1.11
+++ pkg/PLIST   26 Apr 2016 12:30:53 -0000
@@ -3,11 +3,13 @@
 bin/anytopnm
 @bin bin/asciitopgm
 @bin bin/atktopbm
+@bin bin/avstopam
 @bin bin/bioradtopgm
 @bin bin/bmptopnm
 bin/bmptoppm
 @bin bin/brushtopbm
 @bin bin/cameratopam
+@bin bin/cistopbm
 @bin bin/cmuwmtopbm
 @bin bin/ddbugtopbm
 @bin bin/escp2topbm
@@ -23,7 +25,7 @@ bin/gemtopbm
 @bin bin/hdifftopam
 @bin bin/hipstopgm
 @comment bin/hpcdtoppm
-@bin bin/icontopbm
+bin/icontopbm
 @bin bin/ilbmtoppm
 @bin bin/imgtoppm
 @bin bin/infotopam
@@ -42,9 +44,11 @@ bin/manweb
 @bin bin/palmtopnm
 @bin bin/pamaddnoise
 @bin bin/pamarith
+@bin bin/pambackground
 @bin bin/pambayer
 @bin bin/pamchannel
 @bin bin/pamcomp
+@bin bin/pamcrater
 @bin bin/pamcut
 @bin bin/pamdeinterlace
 @bin bin/pamdepth
@@ -53,7 +57,10 @@ bin/manweb
 @bin bin/pamedge
 @bin bin/pamendian
 @bin bin/pamenlarge
+@bin bin/pamexec
 @bin bin/pamfile
+@bin bin/pamfix
+bin/pamfixtrunc
 @bin bin/pamflip
 @bin bin/pamfunc
 @bin bin/pamgauss
@@ -61,15 +68,21 @@ bin/manweb
 @bin bin/pamlookup
 @bin bin/pammasksharpen
 @bin bin/pammixinterlace
+@bin bin/pammosaicknit
 @bin bin/pamoil
+@bin bin/pampaintspill
 @bin bin/pamperspective
 @bin bin/pampick
 @bin bin/pampop9
-@bin bin/pamrgbatopng
+@bin bin/pamrecolor
+bin/pamrgbatopng
+@bin bin/pamrubber
 @bin bin/pamscale
 @bin bin/pamseq
+@bin bin/pamshadedrelief
 @bin bin/pamsharpmap
 @bin bin/pamsharpness
+@bin bin/pamsistoaglyph
 @bin bin/pamslice
 @bin bin/pamsplit
 @bin bin/pamstack
@@ -80,23 +93,37 @@ bin/pamstretch-gen
 @bin bin/pamsummcol
 @bin bin/pamthreshold
 @bin bin/pamtilt
+@bin bin/pamtoavs
 @bin bin/pamtodjvurle
 @bin bin/pamtofits
+@bin bin/pamtogif
 @bin bin/pamtohdiff
 @bin bin/pamtohtmltbl
 @bin bin/pamtojpeg2k
+@bin bin/pamtompfont
+@bin bin/pamtooctaveimg
+@bin bin/pamtopam
+@bin bin/pamtopdbimg
 @bin bin/pamtopfm
+@bin bin/pamtopng
 @bin bin/pamtopnm
+@bin bin/pamtosrf
 @bin bin/pamtosvg
 @bin bin/pamtotga
 @bin bin/pamtotiff
 @bin bin/pamtouil
+@bin bin/pamtowinicon
 @bin bin/pamtoxvmini
+@bin bin/pamundice
+@bin bin/pamunlookup
+@bin bin/pamvalidate
+@bin bin/pamwipeout
 @bin bin/pamx
 @bin bin/pbmclean
 @bin bin/pbmlife
 @bin bin/pbmmake
 @bin bin/pbmmask
+@bin bin/pbmminkowski
 @bin bin/pbmpage
 @bin bin/pbmpscale
 @bin bin/pbmreduce
@@ -107,6 +134,7 @@ bin/pamstretch-gen
 @bin bin/pbmtoascii
 @bin bin/pbmtoatk
 @bin bin/pbmtobbnbg
+@bin bin/pbmtocis
 @bin bin/pbmtocmuwm
 @bin bin/pbmtodjvurle
 @bin bin/pbmtoepsi
@@ -116,7 +144,7 @@ bin/pamstretch-gen
 @bin bin/pbmtogem
 @bin bin/pbmtogo
 @bin bin/pbmtoibm23xx
-@bin bin/pbmtoicon
+bin/pbmtoicon
 @bin bin/pbmtolj
 @bin bin/pbmtoln03
 @bin bin/pbmtolps
@@ -133,8 +161,9 @@ bin/pamstretch-gen
 @bin bin/pbmtoppa
 @bin bin/pbmtopsg3
 @bin bin/pbmtoptx
+@bin bin/pbmtosunicon
 @bin bin/pbmtowbmp
-@bin bin/pbmtox10bm
+bin/pbmtox10bm
 @bin bin/pbmtoxbm
 @bin bin/pbmtoybm
 @bin bin/pbmtozinc
@@ -142,10 +171,11 @@ bin/pamstretch-gen
 @bin bin/pc1toppm
 bin/pcdovtoppm
 @bin bin/pcxtoppm
+@bin bin/pdbimgtopam
 @bin bin/pfmtopam
 @bin bin/pgmabel
 @bin bin/pgmbentley
-@bin bin/pgmcrater
+bin/pgmcrater
 @bin bin/pgmdeshadow
 bin/pgmedge
 @bin bin/pgmenhance
@@ -166,20 +196,23 @@ bin/pgmslice
 @bin bin/pgmtopbm
 @bin bin/pgmtopgm
 @bin bin/pgmtoppm
+@bin bin/pgmtosbig
+@bin bin/pgmtost4
 @bin bin/pi1toppm
 @bin bin/pi3topbm
 @bin bin/picttoppm
 @bin bin/pjtoppm
 @bin bin/pktopbm
-@bin bin/pngtopnm
+@bin bin/pngtopam
+bin/pngtopnm
 @bin bin/pnmalias
 bin/pnmarith
 @bin bin/pnmcat
 @bin bin/pnmcolormap
-@bin bin/pnmcomp
+bin/pnmcomp
 @bin bin/pnmconvol
 @bin bin/pnmcrop
-@bin bin/pnmcut
+bin/pnmcut
 bin/pnmdepth
 bin/pnmenlarge
 bin/pnmfile
@@ -191,6 +224,7 @@ bin/pnmflip
 bin/pnminterp
 @bin bin/pnminvert
 bin/pnmmargin
+@bin bin/pnmmercator
 @bin bin/pnmmontage
 @bin bin/pnmnlfilt
 bin/pnmnoraw
@@ -199,9 +233,10 @@ bin/pnmnoraw
 @bin bin/pnmpaste
 @bin bin/pnmpsnr
 bin/pnmquant
+bin/pnmquantall
 @bin bin/pnmremap
 @bin bin/pnmrotate
-@bin bin/pnmscale
+bin/pnmscale
 @bin bin/pnmscalefixed
 @bin bin/pnmshear
 @bin bin/pnmsmooth
@@ -259,7 +294,9 @@ bin/ppmshadow
 @bin bin/ppmshift
 @bin bin/ppmspread
 @bin bin/ppmtoacad
+@bin bin/ppmtoapplevol
 @bin bin/ppmtoarbtxt
+@bin bin/ppmtoascii
 @bin bin/ppmtobmp
 @bin bin/ppmtoeyuv
 @bin bin/ppmtogif
@@ -282,6 +319,7 @@ bin/ppmtomap
 @bin bin/ppmtopuzz
 @bin bin/ppmtorgb3
 @bin bin/ppmtosixel
+@bin bin/ppmtospu
 @bin bin/ppmtoterm
 bin/ppmtotga
 bin/ppmtouil
@@ -307,11 +345,15 @@ bin/ppmtouil
 @bin bin/spctoppm
 @bin bin/spottopgm
 @bin bin/sputoppm
+@bin bin/srftopam
+@bin bin/st4topgm
+@bin bin/sunicontopnm
 @bin bin/svgtopam
 @bin bin/tgatoppm
 @bin bin/thinkjettopbm
 @bin bin/tifftopnm
 @bin bin/wbmptopbm
+@bin bin/winicontopam
 @bin bin/winicontoppm
 @bin bin/xbmtopbm
 @bin bin/ximtoppm
@@ -321,25 +363,29 @@ bin/ppmtouil
 @bin bin/ybmtopbm
 @bin bin/yuvsplittoppm
 @bin bin/yuvtoppm
+@bin bin/yuy2topam
 @bin bin/zeisstopnm
-include/bitio.h
-include/colorname.h
-include/mallocvar.h
-include/nstring.h
-include/pam.h
-include/pammap.h
-include/pbm.h
-include/pbmfont.h
-include/pgm.h
-include/pm.h
-include/pm_config.h
-include/pm_gamma.h
-include/pm_system.h
-include/pnm.h
-include/ppm.h
-include/ppmcmap.h
-include/ppmfloyd.h
-include/shhopt.h
+include/netpbm/
+include/netpbm/colorname.h
+include/netpbm/mallocvar.h
+include/netpbm/pam.h
+include/netpbm/pamdraw.h
+include/netpbm/pammap.h
+include/netpbm/pbm.h
+include/netpbm/pbmfont.h
+include/netpbm/pgm.h
+include/netpbm/pm.h
+include/netpbm/pm_config.h
+include/netpbm/pm_gamma.h
+include/netpbm/pm_system.h
+include/netpbm/pnm.h
+include/netpbm/ppm.h
+include/netpbm/ppmcmap.h
+include/netpbm/ppmdfont.h
+include/netpbm/ppmdraw.h
+include/netpbm/ppmfloyd.h
+include/netpbm/runlength.h
+include/netpbm/shhopt.h
 lib/libnetpbm.a
 @lib lib/libnetpbm.so.${LIBnetpbm_VERSION}
 share/netpbm/
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to