summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-04-17 12:40:12 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-04-17 12:40:12 -0500
commit8c065ddbe63955f0fc5384dcd01922c4527ab25b (patch)
treecd474e3398e209f374bb31cb3f9b2b0200c80ed2 /contrib
parent6ff9ec81c552b75dda64daa77847464386265ef2 (diff)
downloadlibpng-8c065ddbe63955f0fc5384dcd01922c4527ab25b.tar.gz
[devel] Revised contrib/pngminim/decoder to build and use pnglibconf.h
Diffstat (limited to 'contrib')
-rw-r--r--contrib/pngminim/decoder/makefile14
-rw-r--r--contrib/pngminim/decoder/pngusr.h4
-rwxr-xr-xcontrib/pngminim/encoder/gather.sh20
-rw-r--r--contrib/pngminim/encoder/makefile37
4 files changed, 66 insertions, 9 deletions
diff --git a/contrib/pngminim/decoder/makefile b/contrib/pngminim/decoder/makefile
index 356acdd5a..45ec4f26f 100644
--- a/contrib/pngminim/decoder/makefile
+++ b/contrib/pngminim/decoder/makefile
@@ -5,6 +5,8 @@
CC=gcc
LD=$(CC)
AWK=awk
+SED=sed
+CPP=cpp
RM=rm -f
@@ -39,6 +41,18 @@ pnglibconf.h: pnglibconf.mak pnglibconf.dfn
# used on demand to regenerate the standard header, CPPFLAGS should
# be empty - no non-standard defines
+
+.dfn.out:
+ rm -f $@ dfn.c dfn?.out
+ echo '#include "$<"' >dfn.c
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
+ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
+ $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
+ dfn1.out >dfn2.out
+ $(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
+ rm -f dfn.c dfn[12].out
+ mv dfn3.out $@
+
pnglibconf.dfn: pnglibconf.dfa options.awk
rm -f $@ dfn?.out
test -z "$(CPPFLAGS)"
diff --git a/contrib/pngminim/decoder/pngusr.h b/contrib/pngminim/decoder/pngusr.h
index 6e40d6498..ebda3f280 100644
--- a/contrib/pngminim/decoder/pngusr.h
+++ b/contrib/pngminim/decoder/pngusr.h
@@ -12,10 +12,6 @@
#ifndef MINRDPNGCONF_H
#define MINRDPNGCONF_H
-#ifdef NJET
- /* No 16-bit support beyond reading with strip_16 */
-#endif
-
#define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
diff --git a/contrib/pngminim/encoder/gather.sh b/contrib/pngminim/encoder/gather.sh
index d79cd2b85..2a6529a5a 100755
--- a/contrib/pngminim/encoder/gather.sh
+++ b/contrib/pngminim/encoder/gather.sh
@@ -1,9 +1,23 @@
+
+# Get the source for the pngminus application
cp ../../pngminus/pnm2png.c pnm2pngm.c
+
+# Get the libpng sources
cp ../../../*.h .
cp ../../../*.c .
+
+# Get the libpng scripts for building pnglibconf.h
+cp ../../../scripts/options.awk .
+cp ../../../scripts/pnglibconf.dfa .
+sed -e "s:scripts/::g" ../../../scripts/pnglibconf.mak > pnglibconf.mak
+#14+%
+# Remove libpng sources we won't use
rm example.c pngtest.c pngr*.c pngpread.c
-# Change the next 2 lines if zlib is somewhere else.
+
+# Get the zlib sources
+# Change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
-rm inf*.[ch]
-rm minigzip.c example.c gz*
+
+# Remove zlib sources we won't use
+rm minigzip.c example.c inf*.[ch] gz*
diff --git a/contrib/pngminim/encoder/makefile b/contrib/pngminim/encoder/makefile
index 0c7ccbf36..8c38c452c 100644
--- a/contrib/pngminim/encoder/makefile
+++ b/contrib/pngminim/encoder/makefile
@@ -1,13 +1,17 @@
+
# Makefile for PngMinus (pnm2pngm)
# Linux / Unix
#CC=cc
CC=gcc
LD=$(CC)
+AWK=awk
+SED=sed
+CPP=cpp
RM=rm -f
-CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
+CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
C=.c
O=.o
@@ -31,6 +35,35 @@ OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
all: pnm2pngm$(E)
+# see scripts/pnglibconf.mak for more options
+pnglibconf.h: pnglibconf.mak pnglibconf.dfn
+ make -f pnglibconf.mak pnglibconf.h
+
+# used on demand to regenerate the standard header, CPPFLAGS should
+# be empty - no non-standard defines
+
+.dfn.out:
+ rm -f $@ dfn.c dfn?.out
+ echo '#include "$<"' >dfn.c
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
+ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
+ $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
+ dfn1.out >dfn2.out
+ $(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
+ rm -f dfn.c dfn[12].out
+ mv dfn3.out $@
+
+pnglibconf.dfn: pnglibconf.dfa options.awk
+ rm -f $@ dfn?.out
+ test -z "$(CPPFLAGS)"
+ echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
+ $(AWK) -f options.awk pre=1 out=dfn1.out\
+ logunsupported=1 - pnglibconf.dfa 1>&2
+ $(AWK) -f options.awk pre=0 out=dfn2.out\
+ logunsupported=1 dfn1.out 1>&2
+ rm dfn1.out
+ mv dfn2.out $@
+
pnm2pngm$(E): $(OBJS)
$(LD) -o pnm2pngm$(E) $(OBJS)
strip pnm2pngm$(E)
@@ -40,4 +73,4 @@ clean:
$(RM) pnm2pngm$(E)
$(RM) $(OBJS)
-# End of makefile for pnm2pngm
+# End of makefile for pngm2pnm