mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Updated contrib/pngminim project to work with the new pnglibconf.h
This commit is contained in:
@@ -1,23 +1,15 @@
|
|||||||
|
test -n "${PNGSRC}" || PNGSRC=../../..
|
||||||
# Get the source for the pngminus application
|
cp ${PNGSRC}/contrib/pngminus/png2pnm.c pngm2pnm.c
|
||||||
cp ../../pngminus/png2pnm.c pngm2pnm.c
|
cp "${PNGSRC}"/*.h .
|
||||||
|
cp "${PNGSRC}"/*.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 pngpread.c pngw*.c
|
rm example.c pngtest.c pngpread.c pngw*.c
|
||||||
|
rm -f pnglibconf.h
|
||||||
# Get the zlib sources
|
test -d scripts || mkdir scripts
|
||||||
# Change the following 2 lines if zlib is somewhere else
|
cp "${PNGSRC}"/scripts/pnglibconf.mak scripts
|
||||||
cp ../../../../zlib/*.h .
|
cp "${PNGSRC}"/scripts/pnglibconf.dfa scripts
|
||||||
cp ../../../../zlib/*.c .
|
cp "${PNGSRC}"/scripts/options.awk scripts
|
||||||
|
# change the following if zlib is somewhere else
|
||||||
# Remove zlib sources we won't use
|
test -n "${ZLIBSRC}" || ZLIBSRC="${PNGSRC}"/../zlib
|
||||||
|
cp "${ZLIBSRC}"/*.h .
|
||||||
|
cp "${ZLIBSRC}"/*.c .
|
||||||
rm minigzip.c example.c compress.c deflate.c gz*
|
rm minigzip.c example.c compress.c deflate.c gz*
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
#CC=cc
|
#CC=cc
|
||||||
CC=gcc
|
CC=gcc
|
||||||
LD=$(CC)
|
LD=$(CC)
|
||||||
AWK=awk
|
|
||||||
SED=sed
|
|
||||||
CPP=cpp
|
|
||||||
|
|
||||||
RM=rm -f
|
RM=rm -f
|
||||||
|
|
||||||
@@ -28,50 +25,33 @@ OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
|||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
.c$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngusr.h zlib.h
|
# note: dependencies do not work on implicit rule lines
|
||||||
|
.c$(O):
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
|
|
||||||
all: pngm2pnm$(E)
|
all: pngm2pnm$(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 $@
|
|
||||||
|
|
||||||
|
|
||||||
pngm2pnm$(E): $(OBJS)
|
pngm2pnm$(E): $(OBJS)
|
||||||
$(LD) -o pngm2pnm$(E) $(OBJS)
|
$(LD) -o pngm2pnm$(E) $(OBJS)
|
||||||
strip pngm2pnm$(E)
|
strip pngm2pnm$(E)
|
||||||
|
|
||||||
|
pnglibconf.h: scripts/pnglibconf.mak scripts/pnglibconf.dfa \
|
||||||
|
scripts/options.awk pngusr.h
|
||||||
|
|
||||||
|
rm -f pnglibconf.h
|
||||||
|
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f scripts/pnglibconf.mak\
|
||||||
|
CPPFLAGS=-DPNG_USER_CONFIG $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f scripts/pnglibconf.mak clean
|
||||||
$(RM) pngm2pnm$(O)
|
$(RM) pngm2pnm$(O)
|
||||||
$(RM) pngm2pnm$(E)
|
$(RM) pngm2pnm$(E)
|
||||||
$(RM) $(OBJS)
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
$(OBJS): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h\
|
||||||
|
pnginfo.h pngdebug.h zlib.h
|
||||||
|
|
||||||
# End of makefile for pngm2pnm
|
# End of makefile for pngm2pnm
|
||||||
|
|||||||
@@ -12,12 +12,15 @@
|
|||||||
#ifndef MINRDPNGCONF_H
|
#ifndef MINRDPNGCONF_H
|
||||||
#define MINRDPNGCONF_H
|
#define MINRDPNGCONF_H
|
||||||
|
|
||||||
|
#ifdef NJET
|
||||||
|
/* No 16-bit support beyond reading with strip_16 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PNG_USER_PRIVATEBUILD "PNG minimal build"
|
||||||
|
#define PNG_USER_DLLFNAME_POSTFIX "MN"
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
#define PNG_NO_WARNINGS
|
||||||
#define png_warning(s1,s2) ""
|
|
||||||
#define png_chunk_warning(s1,s2) ""
|
|
||||||
#define PNG_NO_ERROR_TEXT
|
#define PNG_NO_ERROR_TEXT
|
||||||
#define png_error(s1,s2) png_err(s1)
|
|
||||||
#define png_chunk_error(s1,s2) png_err(s1)
|
|
||||||
|
|
||||||
#define PNG_NO_READ_GAMMA
|
#define PNG_NO_READ_GAMMA
|
||||||
#define PNG_NO_READ_BACKGROUND
|
#define PNG_NO_READ_BACKGROUND
|
||||||
|
|||||||
@@ -1,23 +1,17 @@
|
|||||||
|
test -n "${PNGSRC}" || PNGSRC=../../..
|
||||||
# Get the source for the pngminus application
|
cp ${PNGSRC}/contrib/pngminus/pnm2png.c pnm2pngm.c
|
||||||
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
cp "${PNGSRC}"/*.h .
|
||||||
|
cp "${PNGSRC}"/*.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
|
rm example.c pngtest.c pngr*.c pngpread.c
|
||||||
|
rm -f pnglibconf.h
|
||||||
|
test -d scripts || mkdir scripts
|
||||||
|
cp "${PNGSRC}"/scripts/pnglibconf.mak scripts
|
||||||
|
cp "${PNGSRC}"/scripts/pnglibconf.dfa scripts
|
||||||
|
cp "${PNGSRC}"/scripts/options.awk scripts
|
||||||
|
# change the following if zlib is somewhere else
|
||||||
|
test -n "${ZLIBSRC}" || ZLIBSRC="${PNGSRC}"/../zlib
|
||||||
|
cp "${ZLIBSRC}"/*.h .
|
||||||
|
cp "${ZLIBSRC}"/*.c .
|
||||||
|
rm inf*.[ch]
|
||||||
|
rm minigzip.c example.c gz*
|
||||||
|
|
||||||
# Get the zlib sources
|
|
||||||
# Change the following 2 lines if zlib is somewhere else
|
|
||||||
cp ../../../../zlib/*.h .
|
|
||||||
cp ../../../../zlib/*.c .
|
|
||||||
|
|
||||||
# Remove zlib sources we won't use
|
|
||||||
rm minigzip.c example.c inf*.[ch] gz*
|
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
|
|
||||||
# Makefile for PngMinus (pnm2pngm)
|
# Makefile for PngMinus (pnm2pngm)
|
||||||
# Linux / Unix
|
# Linux / Unix
|
||||||
|
|
||||||
#CC=cc
|
#CC=cc
|
||||||
CC=gcc
|
CC=gcc
|
||||||
LD=$(CC)
|
LD=$(CC)
|
||||||
AWK=awk
|
|
||||||
SED=sed
|
|
||||||
CPP=cpp
|
|
||||||
|
|
||||||
RM=rm -f
|
RM=rm -f
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
||||||
|
|
||||||
C=.c
|
C=.c
|
||||||
O=.o
|
O=.o
|
||||||
@@ -28,49 +24,27 @@ OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
|||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
.c$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngusr.h zlib.h
|
.c$(O):
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
|
|
||||||
all: pnm2pngm$(E)
|
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)
|
pnm2pngm$(E): $(OBJS)
|
||||||
$(LD) -o pnm2pngm$(E) $(OBJS)
|
$(LD) -o pnm2pngm$(E) $(OBJS)
|
||||||
strip pnm2pngm$(E)
|
strip pnm2pngm$(E)
|
||||||
|
|
||||||
|
pnglibconf.h: scripts/pnglibconf.mak scripts/pnglibconf.dfa scripts/options.awk pngusr.h
|
||||||
|
rm -f pnglibconf.h
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f scripts/pnglibconf.mak CPPFLAGS=-DPNG_USER_CONFIG $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f scripts/pnglibconf.mak clean
|
||||||
$(RM) pnm2pngm$(O)
|
$(RM) pnm2pngm$(O)
|
||||||
$(RM) pnm2pngm$(E)
|
$(RM) pnm2pngm$(E)
|
||||||
$(RM) $(OBJS)
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
# End of makefile for pngm2pnm
|
$(OBJS): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngusr.h zlib.h
|
||||||
|
|
||||||
|
# End of makefile for pnm2pngm
|
||||||
|
|||||||
@@ -12,14 +12,13 @@
|
|||||||
#ifndef MINWRPNGCONF_H
|
#ifndef MINWRPNGCONF_H
|
||||||
#define MINWRPNGCONF_H
|
#define MINWRPNGCONF_H
|
||||||
|
|
||||||
|
#define PNG_USER_PRIVATEBUILD "PNG minimal build"
|
||||||
|
#define PNG_USER_DLLFNAME_POSTFIX "MN"
|
||||||
|
|
||||||
#define PNG_NO_READ_SUPPORTED
|
#define PNG_NO_READ_SUPPORTED
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
#define PNG_NO_WARNINGS
|
||||||
#define png_warning(s1,s2) ""
|
|
||||||
#define png_chunk_warning(s1,s2) ""
|
|
||||||
#define PNG_NO_ERROR_TEXT
|
#define PNG_NO_ERROR_TEXT
|
||||||
#define png_error(s1,s2) png_err(s1)
|
|
||||||
#define png_chunk_error(s1,s2) png_err(s1)
|
|
||||||
|
|
||||||
#define PNG_NO_WRITE_BACKGROUND
|
#define PNG_NO_WRITE_BACKGROUND
|
||||||
#define PNG_NO_WRITE_GAMMA
|
#define PNG_NO_WRITE_GAMMA
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
|
test -n "${PNGSRC}" || PNGSRC=../../..
|
||||||
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
|
cp "${PNGSRC}"/contrib/gregbook/rpng2-x.c .
|
||||||
cp ../../../*.h .
|
cp "${PNGSRC}"/contrib/gregbook/readpng2.[ch] .
|
||||||
cp ../../../*.c .
|
cp "${PNGSRC}"/contrib/gregbook/COPYING .
|
||||||
|
cp "${PNGSRC}"/contrib/gregbook/LICENSE .
|
||||||
|
cp "${PNGSRC}"/*.h .
|
||||||
|
cp "${PNGSRC}"/*.c .
|
||||||
rm example.c pngtest.c pngw*.c
|
rm example.c pngtest.c pngw*.c
|
||||||
# change the following 2 lines if zlib is somewhere else
|
rm -f pnglibconf.h
|
||||||
cp ../../../../zlib/*.h .
|
test -d scripts || mkdir scripts
|
||||||
cp ../../../../zlib/*.c .
|
cp "${PNGSRC}"/scripts/pnglibconf.mak scripts
|
||||||
|
cp "${PNGSRC}"/scripts/pnglibconf.dfa scripts
|
||||||
|
cp "${PNGSRC}"/scripts/options.awk scripts
|
||||||
|
# change the following if zlib is somewhere else
|
||||||
|
test -n "${ZLIBSRC}" || ZLIBSRC="${PNGSRC}"/../zlib
|
||||||
|
cp "${ZLIBSRC}"/*.h .
|
||||||
|
cp "${ZLIBSRC}"/*.c .
|
||||||
rm minigzip.c example.c compress.c deflate.c gz*
|
rm minigzip.c example.c compress.c deflate.c gz*
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
|||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
.c$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h readpng2.h pngusr.h zlib.h
|
.c$(O):
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
@@ -52,9 +52,16 @@ rpng2-x$(E): $(OBJS)
|
|||||||
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
|
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
|
||||||
strip rpng2-x$(E)
|
strip rpng2-x$(E)
|
||||||
|
|
||||||
|
pnglibconf.h: scripts/pnglibconf.mak scripts/pnglibconf.dfa scripts/options.awk pngusr.h
|
||||||
|
rm -f pnglibconf.h
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f scripts/pnglibconf.mak CPPFLAGS=-DPNG_USER_CONFIG $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f scripts/pnglibconf.mak clean
|
||||||
$(RM) rpng2-x$(O)
|
$(RM) rpng2-x$(O)
|
||||||
$(RM) rpng2-x$(E)
|
$(RM) rpng2-x$(E)
|
||||||
$(RM) $(OBJS)
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
$(OBJS): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h readpng2.h pngusr.h zlib.h
|
||||||
|
|
||||||
# End of makefile for rpng2-x
|
# End of makefile for rpng2-x
|
||||||
|
|||||||
@@ -12,12 +12,11 @@
|
|||||||
#ifndef MINPRDPNGCONF_H
|
#ifndef MINPRDPNGCONF_H
|
||||||
#define MINPRDPNGCONF_H
|
#define MINPRDPNGCONF_H
|
||||||
|
|
||||||
|
#define PNG_USER_PRIVATEBUILD "PNG minimal build"
|
||||||
|
#define PNG_USER_DLLFNAME_POSTFIX "MN"
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
#define PNG_NO_WARNINGS
|
||||||
#define png_warning(s1,s2) ""
|
|
||||||
#define png_chunk_warning(s1,s2) ""
|
|
||||||
#define PNG_NO_ERROR_TEXT
|
#define PNG_NO_ERROR_TEXT
|
||||||
#define png_error(s1,s2) png_err(s1)
|
|
||||||
#define png_chunk_error(s1,s2) png_err(s1)
|
|
||||||
|
|
||||||
#define PNG_NO_READ_QUANTIZE
|
#define PNG_NO_READ_QUANTIZE
|
||||||
#define PNG_NO_READ_INVERT
|
#define PNG_NO_READ_INVERT
|
||||||
|
|||||||
Reference in New Issue
Block a user