ref: 5fcdee38fa1b440f6fe4e18b3ddd71e033c0fb52
parent: 3ad0af209812d2c2f0a7c5735b0cdd0e176efc38
author: Chris Liddell <chris.liddell@artifex.com>
date: Fri Oct 31 08:39:45 EDT 2014
Fix and improve bit-rotted jbig2dec/libpng build on Windows The Windows jbig2dec build incorporating libpng had bit-rotted, credit to Ray for identifying the problems there. In addition, I've added provision for specifying the libpng and zlib source paths on the nmake command line, and automatic inclusion of libpng if the path appears valid. No cluster differences.
--- a/jbig2_image_png.c
+++ b/jbig2_image_png.c
@@ -26,6 +26,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <png.h>
+#include <pngstruct.h>
+#define CVT_PTR(ptr) (ptr)
#include "jbig2.h"
#include "jbig2_priv.h"
--- a/msvc.mak
+++ b/msvc.mak
@@ -2,20 +2,34 @@
# under Microsoft Visual C++
#
# To compile zlib.dll:
-# Get zlib >= 1.1.4, unzip and rename to zlib,
-# cd zlib, copy nt\zlib.dnt zlib.dnt, then nmake -f nt\makefile.nt
+# Get zlib >= 1.2.7, unzip and rename to zlib,
+# cd zlib, then nmake -f win32\Makefile.msc
# To compile libpng.lib:
-# Get libpng >= 1.2.5, unzip then rename to libpng,
+# Get libpng >= 1.6.0, unzip then rename to libpng,
# cd libpng, nmake -f scripts\makefile.vcwin32
+!ifndef LIBPNGDIR
LIBPNGDIR=../libpng
+!endif
+
+!ifndef ZLIBDIR
ZLIBDIR=../zlib
+!endif
+
# define iff you're linking to libpng
-# LIBPNG_CFLAGS=-DHAVE_LIBPNG -I$(LIBPNGDIR) -I$(ZLIBDIR)
-# LIBPNG_LDFLAGS=$(LIBPNGDIR)/libpng.lib $(ZLIBDIR)/zlib.lib /link /NODEFAULTLIB:LIBCMT
+!if exist("$(ZLIBDIR)") && exist("$(LIBPNGDIR)") && exist ("$(LIBPNGDIR)/pnglibconf.h")
+LIBPNG_CFLAGS=-DHAVE_LIBPNG -I$(LIBPNGDIR) -I$(ZLIBDIR)
+LIBPNG_LDFLAGS=$(LIBPNGDIR)/libpng.lib $(ZLIBDIR)/zlib.lib /link /NODEFAULTLIB:LIBCMT
+
+JBIG2_IMAGE_PNG_OBJ=jbig2_image_png$(OBJ)
+!else
LIBPNG_CFLAGS=
LIBPNG_LDFLAGS=
+JBIG2_IMAGE_PNG_OBJ=
+!endif
+
+
EXE=.exe
OBJ=.obj
NUL=
@@ -29,20 +43,10 @@
OBJS=getopt$(OBJ) getopt1$(OBJ) jbig2$(OBJ) jbig2_arith$(OBJ) \
jbig2_arith_iaid$(OBJ) jbig2_arith_int$(OBJ) jbig2_huffman$(OBJ) \
jbig2_generic$(OBJ) jbig2_refinement$(OBJ) jbig2_halftone$(OBJ)\
- jbig2_image$(OBJ) jbig2_image_pbm$(OBJ)\
+ jbig2_image$(OBJ) jbig2_image_pbm$(OBJ) $(JBIG2_IMAGE_PNG_OBJ) \
jbig2_segment$(OBJ) jbig2_symbol_dict$(OBJ) jbig2_text$(OBJ) \
jbig2_mmr$(OBJ) jbig2_page$(OBJ) jbig2_metadata$(OBJ) \
jbig2dec$(OBJ) sha1$(OBJ)
-
-# libpng - if you link to libpng, uncomment these lines.
-#
-#OBJS=getopt$(OBJ) getopt1$(OBJ) jbig2$(OBJ) jbig2_arith$(OBJ) \
-# jbig2_arith_iaid$(OBJ) jbig2_arith_int$(OBJ) jbig2_huffman$(OBJ) \
-# jbig2_generic$(OBJ) jbig2_refinement$(OBJ) jbig2_halftone$(OBJ)\
-# jbig2_image$(OBJ) jbig2_image_pbm$(OBJ) jbig2_image_png$(OBJ) \
-# jbig2_segment$(OBJ) jbig2_symbol_dict$(OBJ) jbig2_text$(OBJ) \
-# jbig2_mmr$(OBJ) jbig2_page$(OBJ) jbig2_metadata$(OBJ) \
-# jbig2dec$(OBJ) sha1$(OBJ)
HDRS=getopt.h jbig2.h jbig2_arith.h jbig2_arith_iaid.h jbig2_arith_int.h \
jbig2_generic.h jbig2_huffman.h jbig2_hufftab.h jbig2_image.h \