[libpng10] Imported from libpng-1.0.14.tar

This commit is contained in:
Glenn Randers-Pehrson 2002-07-07 19:48:06 -05:00
parent 80b4f15ae3
commit 787081f75b
71 changed files with 2878 additions and 1162 deletions

View File

@ -1,49 +1,55 @@
Libpng 1.0.13 - April 15, 2002 Libpng 1.0.14 - July 8, 2002
This is a public release of libpng, intended for use in production codes. This is a public release of libpng, intended for use in production codes.
Changes since the last public release (1.2.1): Changes since the last public release (1.0.13):
Fixed a bug with reading the length of iCCP profiles (Larry Reeves). Changed ${PNGMAJ}.${PNGVER} bug to ${PNGVER} in makefile.sgi and makefile.sggcc
Revised makefile.linux, makefile.gcmmx, and others to generate Fixed VER -> PNGVER typo in makefile.macosx and added install-static to install
libpng.a, libpngNN.so, libpng.so.NN, and libpngNN/png.h Added install: target to makefile.32sunu and makefile.64sunu
Revised makefile.darwin to remove "-undefined suppress" option. Revised 15 makefiles to link libpng.a to libpngNN.a and the include libpng
Added checks for gamma and chromaticity values over 21474.83, which exceed subdirectory to libpngNN subdirectory without the full pathname.
the limit for PNG unsigned 32-bit integers when encoded. Moved generation of libpng.pc from "install" to "all" in 15 makefiles.
Revised calls to png_create_read_struct() and png_create_write_struct() Added install-man target to 15 makefiles (Dimitri Papadopolous-Orfanos).
for simpler debugging. Added $(DESTDIR) feature to 24 makefiles (Tim Mooney)
Revised png_zalloc() so zlib handles errors (uses PNG_FLAG_MALLOC_NULL_MEM_OK) Fixed bug with $prefix, should be $(prefix) in makefile.hpux.
Check chunk_length and idat_size for invalid (over PNG_MAX_UINT) lengths. Updated cygwin-specific portion of pngconf.h and revised makefile.cygwin
Check for invalid image dimensions in png_get_IHDR. Added a link from libpngNN.pc to libpng.pc in 15 makefiles.
Added install-shared and install-static targets to all makefiles that make Added links from include/libpngNN/*.h to include/*.h in 24 makefiles.
shared libraries. Revised makefile.darwin to make relative links without full pathname.
Always do gamma compensation when image is partially transparent. Added setjmp() at the end of png_create_*_struct_2() in case user forgets
Modified shared-library makefiles to install pkgconfig/libpngNN.pc. to put one in their application.
Export (with PNGAPI) png_zalloc, png_zfree, and png_handle_as_unknown Fixed bug in reporting number of channels in pngget.c, introduced in
Removed unused png_write_destroy_info prototype from png.h version 1.2.2
Eliminated incorrect use of width_mmx from pnggccrd.c in pixel_bytes == 8 case Added "libpng.pc" dependency to the "install-shared" target in 15 makefiles.
Stopped a double free of palette, hist, and trans when not using free_me. Remove old libpng.pc and libpngNN.pc before installing new ones.
Added makefile.32sunu for Sun Ultra 32 and makefile.64sunu for Sun Ultra 64. Revised 15 makefiles to build libpng-config and libpngNN-config from
Compute background.gray and background_1.gray even when color_type is RGB libpng-config-*.in.
in case image gets reduced to gray later (Jason Summers). Added "Win32 DLL VB" configuration to projects/msvc/libpng.dsp
Added PNG_1_0_X macro which can be used to build a 1.0.x-compatible library. Changed "error" and "message" in prototypes to "error_message" and
Added missing PNGAPI to several function definitions. "warning_message" to avoid namespace conflict.
Check for invalid bit_depth or color_type in png_get_IHDR(), and Restored png_zalloc and png_zfree to nonexported form as in libpng-1.2.1.
check for missing PLTE or IHDR in png_push_read_chunk() (Matthias Clasen). Removed description of png_set_mem_fn() from documentation.
Revised iTXt support to accept NULL for lang and lang_key. Revised projects/msvc/README.txt
Compute gamma for color components of background even when color_type is gray. Added libpng.pc and libpng-config to "all:" target in 16 makefiles.
Revised makefiles to put png.h and pngconf.h only in $prefix/include/libpngNN Fixed bug in 16 makefiles: $(DESTDIR)/$(LIBPATH) to $(DESTDIR)$(LIBPATH)
Revised makefiles to make symlink to libpng.so.NN in addition to libpngNN.so Added missing "\" before closing double quote in makefile.gcmmx.
Prevent png_zalloc() from trying to memset memory that it failed to acquire. Plugged various memory leaks; added png_malloc_warn() and png_set_text_2()
Add typecasts of PNG_MAX_UINT in pngset_cHRM_fixed() (Matt Holgate). functions.
Ensure that the right function (user or default) is used to free the Plugged memory leak of png_ptr->current_text (Matt Holgate).
png_struct after an error in png_create_read_struct_2(). Check for buffer overflow before reading CRC in pngpread.c (Warwick Allison)
Save the ebx register in pnggccrd.c (Sami Farin) Added -soname to the loader flags in makefile.dec, makefile.sgi, and
Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner). makefile.sggcc.
Updated makefiles to put headers in include/libpng and remove old include/*.h. Added "test-installed" targets to makefile.linux, makefile.gcmmx,
Revised description of png_set_filter() in libpng.3/libpng.txt. makefile.sgi, makefile.sggcc, makefile.32sunu, makefile.64sunu,
Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd makefile.beos, makefile.darwin, makefile.dec, makefile.macosx,
makefile.solaris, makefile.sco, makefile.cygwin, makefile.hpux,
makefile.hpgcc, and makefile.so9.
Plugged memory leak of row_buf in pngtest.c when there is a png_error().
Detect buffer overflow in pngpread.c when IDAT is corrupted with extra data.
Revised pnggccrd.c to be able to back out version 1.0.x via PNG_1_0_X macro.
Changed png_warning() to png_error() when width is too large to process.
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

83
CHANGES
View File

@ -1008,7 +1008,6 @@ version 1.2.1rc1 [November 24, 2001]
Updated various makefiles so "make clean" does not remove previous major Updated various makefiles so "make clean" does not remove previous major
version of the shared library. version of the shared library.
version 1.2.1rc2 [December 4, 2001] version 1.2.1rc2 [December 4, 2001]
Added a pop/push operation to pngvcrd.c, to preserve Eflag.
Always allocate 256-entry internal palette, hist, and trans arrays, to Always allocate 256-entry internal palette, hist, and trans arrays, to
avoid out-of-bounds memory reference caused by invalid PNG datastreams. avoid out-of-bounds memory reference caused by invalid PNG datastreams.
Added a check for prefix_length > data_length in iCCP chunk handler. Added a check for prefix_length > data_length in iCCP chunk handler.
@ -1065,9 +1064,91 @@ version 1.0.13rc1 [April 7, 2002]
Save the ebx register in pnggccrd.c (Sami Farin) Save the ebx register in pnggccrd.c (Sami Farin)
Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner). Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner).
Updated makefiles to put headers in include/libpng and remove old include/*.h. Updated makefiles to put headers in include/libpng and remove old include/*.h.
version 1.2.2 [April 15, 2002]
version 1.0.13 [April 15, 2002] version 1.0.13 [April 15, 2002]
Revised description of png_set_filter() in libpng.3/libpng.txt. Revised description of png_set_filter() in libpng.3/libpng.txt.
Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd
version 1.0.13patch01 [April 17, 2002]
version 1.2.2patch01 [April 17, 2002]
Changed ${PNGMAJ}.${PNGVER} bug to ${PNGVER} in makefile.sgi and makefile.sggcc
Fixed VER -> PNGVER typo in makefile.macosx and added install-static to install
Added install: target to makefile.32sunu and makefile.64sunu
version 1.0.13patch03 [April 18, 2002]
version 1.2.2patch03 [April 18, 2002]
Revised 15 makefiles to link libpng.a to libpngNN.a and the include libpng
subdirectory to libpngNN subdirectory without the full pathname.
Moved generation of libpng.pc from "install" to "all" in 15 makefiles.
version 1.2.3rc1 [April 28, 2002]
Added install-man target to 15 makefiles (Dimitri Papadopolous-Orfanos).
Added $(DESTDIR) feature to 24 makefiles (Tim Mooney)
Fixed bug with $prefix, should be $(prefix) in makefile.hpux.
Updated cygwin-specific portion of pngconf.h and revised makefile.cygwin
Added a link from libpngNN.pc to libpng.pc in 15 makefiles.
Added links from include/libpngNN/*.h to include/*.h in 24 makefiles.
Revised makefile.darwin to make relative links without full pathname.
Added setjmp() at the end of png_create_*_struct_2() in case user forgets
to put one in their application.
Restored png_zalloc() and png_zfree() prototypes to version 1.2.1 and
removed them from module definition files.
version 1.2.3rc2 [May 1, 2002]
Fixed bug in reporting number of channels in pngget.c and pngset.c,
that was introduced in version 1.2.2beta5.
Exported png_zalloc(), png_zfree(), png_default_read(), png_default_write(),
png_default_flush(), and png_push_fill_buffer() and included them in
module definition files.
Added "libpng.pc" dependency to the "install-shared" target in 15 makefiles.
version 1.2.3rc3 [May 1, 2002]
Revised prototype for png_default_flush()
Remove old libpng.pc and libpngNN.pc before installing new ones.
version 1.2.3rc4 [May 2, 2002]
Typos in *.def files (png_default_read|write -> png_default_read|write_data)
In makefiles, changed rm libpng.NN.pc to rm libpngNN.pc
Added libpng-config and libpngNN-config and modified makefiles to install them.
Changed $(MANPATH) to $(DESTDIR)$(MANPATH) in makefiles
Added "Win32 DLL VB" configuration to projects/msvc/libpng.dsp
version 1.2.3rc5 [May 11, 2002]
Changed "error" and "message" in prototypes to "error_message" and
"warning_message" to avoid namespace conflict.
Revised 15 makefiles to build libpng-config from libpng-config-*.in
Once more restored png_zalloc and png_zfree to regular nonexported form.
Restored png_default_read|write_data, png_default_flush, png_read_fill_buffer
to nonexported form, but with PNGAPI, and removed them from module def files.
version 1.2.3rc6 [May 14, 2002]
Removed "PNGAPI" from png_zalloc() and png_zfree() in png.c
Changed "Gz" to "Gd" in projects/msvc/libpng.dsp and zlib.dsp.
Removed leftover libpng-config "sed" script from four makefiles.
Revised libpng-config creating script in 16 makefiles.
version 1.2.3 [May 22, 2002]
Revised libpng-config target in makefile.cygwin.
Removed description of png_set_mem_fn() from documentation.
Revised makefile.freebsd.
Minor cosmetic changes to 15 makefiles, e.g., $(DI) = $(DESTDIR)/$(INCDIR).
Revised projects/msvc/README.txt
Changed -lpng to -lpngNN in LDFLAGS in several makefiles.
version 1.2.4beta1 [May 24, 2002]
Added libpng.pc and libpng-config to "all:" target in 16 makefiles.
Fixed bug in 16 makefiles: $(DESTDIR)/$(LIBPATH) to $(DESTDIR)$(LIBPATH)
Added missing "\" before closing double quote in makefile.gcmmx.
Plugged various memory leaks; added png_malloc_warn() and png_set_text_2()
functions.
version 1.2.4beta2 [June 25, 2002]
Plugged memory leak of png_ptr->current_text (Matt Holgate).
Check for buffer overflow before reading CRC in pngpread.c (Warwick Allison)
Added -soname to the loader flags in makefile.dec, makefile.sgi, and
makefile.sggcc.
Added "test-installed" target to makefile.linux, makefile.gcmmx,
makefile.sgi, and makefile.sggcc.
version 1.2.4beta3 [June 28, 2002]
Plugged memory leak of row_buf in pngtest.c when there is a png_error().
Detect buffer overflow in pngpread.c when IDAT is corrupted with extra data.
Added "test-installed" target to makefile.32sunu, makefile.64sunu,
makefile.beos, makefile.darwin, makefile.dec, makefile.macosx,
makefile.solaris, makefile.hpux, makefile.hpgcc, and makefile.so9.
version 1.2.4rc1 [July 2, 2002]
Added "test-installed" target to makefile.cygwin and makefile.sco.
Revised pnggccrd.c to be able to back out version 1.0.x via PNG_1_0_X macro.
version 1.0.14 [July 8, 2002]
Changed png_warning() to png_error() when width is too large to process.
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

18
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.13 - April 15, 2002 Installing libpng version 1.0.14 - July 8, 2002
Before installing libpng, you must first install zlib. zlib Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be can usually be found wherever you got libpng. zlib can be
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
version of zlib that's installed. version of zlib that's installed.
You can rename the directories that you downloaded (they You can rename the directories that you downloaded (they
might be called "libpng-1.0.13" or "lpng109" and "zlib-1.1.3" might be called "libpng-1.0.14" or "lpng109" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng". or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@ -64,8 +64,8 @@ The files that are presently available in the scripts directory
include include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng10.so.0.1.0.13) makefile.linux => Linux/ELF makefile (gcc, creates libpng10.so.0.1.0.14)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng10.so.0.1.0.13, makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng10.so.0.1.0.14,
uses assembler code tuned for Intel MMX platform) uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@ -75,19 +75,21 @@ include
makefile.cygwin => Cygwin/gcc makefile makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile makefile.darwin => Darwin makefile
makefile.dec => DEC Alpha UNIX makefile makefile.dec => DEC Alpha UNIX makefile
makefile.hpgcc => FreeBSD makefile
makefile.hpgcc => HPUX makefile using gcc makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.macosx => MACOS X Makefile makefile.macosx => MACOS X Makefile
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
makefile.ne0bsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng0.so
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng10.so.0.1.0.13) makefile.sggcc => Silicon Graphics (gcc, creates libpng10.so.0.1.0.14)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng10.so.0.1.0.13) makefile.solaris => Solaris 2.X makefile (gcc, creates libpng10.so.0.1.0.14)
makefile.so9 => Solaris 9 makefile (gcc, creates libpng10.so.0.1.0.13) makefile.so9 => Solaris 9 makefile (gcc, creates libpng10.so.0.1.0.14)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc

View File

@ -1,9 +1,11 @@
Known bugs in libpng version 1.0.13 Known bugs in libpng version 1.0.14
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when 1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
reading interlaced PNG files, when assembler code is enabled. reading interlaced PNG files, when assembler code is enabled but running
on a non-MMX i386 platform.
STATUS: Under investigation. The change to pnggccrd.c in libpng-1.2.1 STATUS: Under investigation. The change to pnggccrd.c in libpng-1.2.1
fixed a problem under FreeBSD but not the problem with NetBSD. fixed a problem under FreeBSD but not the problem with NetBSD, which
still fails as of libpng-1.2.2rc1.

View File

@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following If you modify libpng you may insert additional notices immediately following
this sentence. this sentence.
libpng versions 1.0.7, July 1, 2000, through 1.0.13, April 15, 2002, are libpng versions 1.0.7, July 1, 2000, through 1.0.14, July 8, 2002, are
Copyright (c) 2000-2002 Glenn Randers-Pehrson Copyright (c) 2000-2002 Glenn Randers-Pehrson
and are distributed according to the same disclaimer and license as libpng-1.0.6 and are distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors with the following individuals added to the list of Contributing Authors
@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
randeg@alum.rpi.edu randeg@alum.rpi.edu
April 15, 2002 July 8, 2002

16
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.13 - April 15, 2002 (shared library 2.1) README for libpng 1.0.14 - July 8, 2002 (shared library 2.1)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
@ -187,9 +187,9 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.13) (gcc, creates libpng10.so.0.1.0.14)
makefile.gcmmx => Linux/ELF makefile (gcc, creates makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng10.so.0.1.0.13, uses assembler code libpng10.so.0.1.0.14, uses assembler code
tuned for Intel MMX platform) tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@ -199,21 +199,23 @@ Files in this distribution:
makefile.cygwin => Cygwin/gcc makefile makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile makefile.darwin => Darwin makefile
makefile.dec => DEC Alpha UNIX makefile makefile.dec => DEC Alpha UNIX makefile
makefile.freebsd => FreeBSD makefile
makefile.hpgcc => HPUX makefile using gcc makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.macosx => MACOS X Makefile makefile.macosx => MACOS X Makefile
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
makefile.ne0bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng0.so
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng10.so.0.1.0.13) makefile.sggcc => Silicon Graphics (gcc, creates libpng10.so.0.1.0.14)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng10.so.0.1.0.13) (gcc, creates libpng10.so.0.1.0.14)
makefile.so9 => Solaris 9 makefile makefile.so9 => Solaris 9 makefile
(gcc, creates libpng10.so.0.1.0.13) (gcc, creates libpng10.so.0.1.0.14)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng: Y2K compliance in libpng:
========================= =========================
April 15, 2002 July 8, 2002
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.13 are Y2K compliant. It is my belief that earlier upward through 1.0.14 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer Libpng only has three year fields. One is a 2-byte unsigned integer

2
configure vendored
View File

@ -1,5 +1,5 @@
echo " echo "
There is no \"configure\" script for Libpng-1.0.13. Instead, please There is no \"configure\" script for Libpng-1.0.14. Instead, please
copy the appropriate makefile for your system from the \"scripts\" copy the appropriate makefile for your system from the \"scripts\"
directory. Read the INSTALL file for more details. directory. Read the INSTALL file for more details.
" "

View File

@ -169,11 +169,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL); &interlace_type, int_p_NULL, int_p_NULL);
/**** Set up the data transformations you want. Note that these are all /* Set up the data transformations you want. Note that these are all
**** optional. Only call them if you want/need them. Many of the * optional. Only call them if you want/need them. Many of the
**** transformations only work on specific types of images, and many * transformations only work on specific types of images, and many
**** are mutually exclusive. * are mutually exclusive.
****/ */
/* tell libpng to strip 16 bit/color files down to 8 bits/color */ /* tell libpng to strip 16 bit/color files down to 8 bits/color */
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);

View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "April 15, 2002" .TH LIBPNG 3 "July 8, 2002"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.13 libpng \- Portable Network Graphics (PNG) Reference Library 1.0.14
.SH SYNOPSIS .SH SYNOPSIS
\fI\fB \fI\fB
@ -761,7 +761,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.13 - April 15, 2002 libpng version 1.0.14 - July 8, 2002
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998-2002 Glenn Randers-Pehrson Copyright (c) 1998-2002 Glenn Randers-Pehrson
@ -3062,18 +3062,16 @@ goes through callbacks that are user-settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function. these functions, call the appropriate png_set_*_fn() function.
Memory allocation is done through the functions png_malloc(), png_zalloc(), Memory allocation is done through the functions png_malloc()
and png_free(). These currently just call the standard C functions. If and png_free(). These currently just call the standard C functions. If
your pointers can't access more then 64K at a time, you will want to set your pointers can't access more then 64K at a time, you will want to set
MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
memory allocation on a platform will change between applications, these memory allocation on a platform will change between applications, these
functions must be modified in the library at compile time. If you prefer functions must be modified in the library at compile time. If you prefer
to use a different method of allocating and freeing data, you can use to use a different method of allocating and freeing data, you can use
png_create_read_struct_2() or png_create_write_struct_2() to register
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, your own functions as described above.
png_malloc_ptr malloc_fn, png_free_ptr free_fn) These functions also provide a void pointer that can be retrieved via
This function also provides a void pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr); mem_ptr=png_get_mem_ptr(png_ptr);
@ -3083,7 +3081,7 @@ Your replacement memory functions must have prototypes as follows:
png_size_t size); png_size_t size);
void free_fn(png_structp png_ptr, png_voidp ptr); void free_fn(png_structp png_ptr, png_voidp ptr);
Your malloc_fn() can return NULL in case of failure. The png_malloc() Your malloc_fn() should return NULL in case of failure. The png_malloc()
function will call png_error() if it receives a NULL from the system function will call png_error() if it receives a NULL from the system
memory allocator or from your replacement malloc_fn(). memory allocator or from your replacement malloc_fn().
@ -3109,9 +3107,9 @@ png_get_io_ptr(). For example:
The replacement I/O functions must have prototypes as follows: The replacement I/O functions must have prototypes as follows:
void user_read_data(png_structp png_ptr, void user_read_data(png_structp png_ptr,
png_bytep data, png_uint_32 length); png_bytep data, png_size_t length);
void user_write_data(png_structp png_ptr, void user_write_data(png_structp png_ptr,
png_bytep data, png_uint_32 length); png_bytep data, png_size_t length);
void user_flush_data(png_structp png_ptr); void user_flush_data(png_structp png_ptr);
Supplying NULL for the read, write, or flush functions sets them back Supplying NULL for the read, write, or flush functions sets them back
@ -3492,13 +3490,13 @@ application:
.SH VII. Y2K Compliance in libpng .SH VII. Y2K Compliance in libpng
April 15, 2002 July 8, 2002
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.13 are Y2K compliant. It is my belief that earlier upward through 1.0.14 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that
@ -3623,10 +3621,16 @@ the first widely used release:
1.2.1 3 10201 3.1.2.1 1.2.1 3 10201 3.1.2.1
1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
1.0.13beta1 10 10013 10.so.0.1.0.13beta1 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
1.2.2rc1 12 10202 12.so.0.1.2.2rc1
1.0.13rc1 10 10013 10.so.0.1.0.13rc1 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
1.2.2rc1 12 10202 12.so.0.1.2.2rc1
1.0.13 10 10013 10.so.0.1.0.13
1.2.2 12 10202 12.so.0.1.2.2 1.2.2 12 10202 12.so.0.1.2.2
1.0.13 10 10013 10.so.0.1.0.13rc1 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
1.2.3 12 10203 12.so.0.1.2.3
1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
1.2.4rc1 13 10204 12.so.0.1.2.4rc1
1.0.14 10 10014 10.so.0.1.0.14
1.2.4 13 10204 12.so.0.1.2.4
Henceforth the source version will match the shared-library minor Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be and patch numbers; the shared-library major version number will be
@ -3684,7 +3688,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.13 - April 15, 2002: Libpng version 1.0.14 - July 8, 2002:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@ -3701,7 +3705,7 @@ included in the libpng distribution, the latter shall prevail.)
If you modify libpng you may insert additional notices immediately following If you modify libpng you may insert additional notices immediately following
this sentence. this sentence.
libpng versions 1.0.7, July 1, 2000, through 1.0.13, April 15, 2002, are libpng versions 1.0.7, July 1, 2000, through 1.0.14, July 8, 2002, are
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.0.6 distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors with the following individuals added to the list of Contributing Authors
@ -3793,7 +3797,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
randeg@alum.rpi.edu randeg@alum.rpi.edu
April 15, 2002 July 8, 2002
.\" end of man page .\" end of man page

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.13 - April 15, 2002 libpng version 1.0.14 - July 8, 2002
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998-2002 Glenn Randers-Pehrson Copyright (c) 1998-2002 Glenn Randers-Pehrson
@ -2301,18 +2301,16 @@ goes through callbacks that are user-settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function. these functions, call the appropriate png_set_*_fn() function.
Memory allocation is done through the functions png_malloc(), png_zalloc(), Memory allocation is done through the functions png_malloc()
and png_free(). These currently just call the standard C functions. If and png_free(). These currently just call the standard C functions. If
your pointers can't access more then 64K at a time, you will want to set your pointers can't access more then 64K at a time, you will want to set
MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
memory allocation on a platform will change between applications, these memory allocation on a platform will change between applications, these
functions must be modified in the library at compile time. If you prefer functions must be modified in the library at compile time. If you prefer
to use a different method of allocating and freeing data, you can use to use a different method of allocating and freeing data, you can use
png_create_read_struct_2() or png_create_write_struct_2() to register
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, your own functions as described above.
png_malloc_ptr malloc_fn, png_free_ptr free_fn) These functions also provide a void pointer that can be retrieved via
This function also provides a void pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr); mem_ptr=png_get_mem_ptr(png_ptr);
@ -2322,7 +2320,7 @@ Your replacement memory functions must have prototypes as follows:
png_size_t size); png_size_t size);
void free_fn(png_structp png_ptr, png_voidp ptr); void free_fn(png_structp png_ptr, png_voidp ptr);
Your malloc_fn() can return NULL in case of failure. The png_malloc() Your malloc_fn() should return NULL in case of failure. The png_malloc()
function will call png_error() if it receives a NULL from the system function will call png_error() if it receives a NULL from the system
memory allocator or from your replacement malloc_fn(). memory allocator or from your replacement malloc_fn().
@ -2348,9 +2346,9 @@ png_get_io_ptr(). For example:
The replacement I/O functions must have prototypes as follows: The replacement I/O functions must have prototypes as follows:
void user_read_data(png_structp png_ptr, void user_read_data(png_structp png_ptr,
png_bytep data, png_uint_32 length); png_bytep data, png_size_t length);
void user_write_data(png_structp png_ptr, void user_write_data(png_structp png_ptr,
png_bytep data, png_uint_32 length); png_bytep data, png_size_t length);
void user_flush_data(png_structp png_ptr); void user_flush_data(png_structp png_ptr);
Supplying NULL for the read, write, or flush functions sets them back Supplying NULL for the read, write, or flush functions sets them back
@ -2731,13 +2729,13 @@ application:
VII. Y2K Compliance in libpng VII. Y2K Compliance in libpng
April 15, 2002 July 8, 2002
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.13 are Y2K compliant. It is my belief that earlier upward through 1.0.14 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "April 15, 2002" .TH LIBPNGPF 3 "July 8, 2002"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.13 libpng \- Portable Network Graphics (PNG) Reference Library 1.0.14
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "April 15, 2002" .TH PNG 5 "July 8, 2002"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION

22
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* libpng version 1.0.13 - April 15, 2002 * libpng version 1.0.14 - July 8, 2002
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -13,14 +13,14 @@
#include "png.h" #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_13 Your_png_h_is_not_version_1_0_13; typedef version_1_0_14 Your_png_h_is_not_version_1_0_14;
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. */ * string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */ /* png_libpng_ver was changed to a function in version 1.0.5c */
const char png_libpng_ver[18] = "1.0.13"; const char png_libpng_ver[18] = "1.0.14";
/* png_sig was changed to a function in version 1.0.5c */ /* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */ /* Place to hold the signature string for a PNG file. */
@ -135,7 +135,11 @@ png_check_sig(png_bytep sig, int num)
} }
/* Function to allocate memory for zlib and clear it to 0. */ /* Function to allocate memory for zlib and clear it to 0. */
#ifdef PNG_1_0_X
voidpf PNGAPI voidpf PNGAPI
#else
voidpf /* private */
#endif
png_zalloc(voidpf png_ptr, uInt items, uInt size) png_zalloc(voidpf png_ptr, uInt items, uInt size)
{ {
png_uint_32 num_bytes = (png_uint_32)items * size; png_uint_32 num_bytes = (png_uint_32)items * size;
@ -166,7 +170,11 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
} }
/* function to free memory for zlib */ /* function to free memory for zlib */
#ifdef PNG_1_0_X
void PNGAPI void PNGAPI
#else
void /* private */
#endif
png_zfree(voidpf png_ptr, voidpf ptr) png_zfree(voidpf png_ptr, voidpf ptr)
{ {
png_free((png_structp)png_ptr, (png_voidp)ptr); png_free((png_structp)png_ptr, (png_voidp)ptr);
@ -663,7 +671,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ((png_charp) "\n libpng version 1.0.13 - April 15, 2002\n\ return ((png_charp) "\n libpng version 1.0.14 - July 8, 2002\n\
Copyright (c) 1998-2002 Glenn Randers-Pehrson\n\ Copyright (c) 1998-2002 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
@ -681,8 +689,8 @@ png_get_libpng_ver(png_structp png_ptr)
{ {
/* Version of *.c files used when building libpng */ /* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return((png_charp) "1.0.13"); return((png_charp) "1.0.14");
return((png_charp) "1.0.13"); return((png_charp) "1.0.14");
} }
png_charp PNGAPI png_charp PNGAPI
@ -732,7 +740,7 @@ png_uint_32 PNGAPI
png_access_version_number(void) png_access_version_number(void)
{ {
/* Version of *.c files used when building libpng */ /* Version of *.c files used when building libpng */
return((png_uint_32) 10013L); return((png_uint_32) 10014L);
} }

126
png.h
View File

@ -1,7 +1,6 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.0.13 - April 15, 2002 * libpng version 1.0.14 - July 8, 2002
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -9,7 +8,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.13 - April 15, 2002: Glenn * libpng versions 0.97, January 1998, through 1.0.14 - July 8, 2002: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -83,10 +82,17 @@
* 1.2.1 3 10201 3.1.2.1 * 1.2.1 3 10201 3.1.2.1
* 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
* 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
* 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
* 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
* 1.2.2 12 10202 12.so.0.1.2.2 * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
* 1.0.13 10 10013 10.so.0.1.0.13 * 1.0.13 10 10013 10.so.0.1.0.13
* 1.2.2 12 10202 12.so.0.1.2.2
* 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
* 1.2.3 12 10203 12.so.0.1.2.3
* 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
* 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
* 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
* 1.0.14 10 10014 10.so.0.1.0.14
* 1.2.4 13 10204 12.so.0.1.2.4
* *
* Henceforth the source version will match the shared-library major * Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be * and minor numbers; the shared-library major version number will be
@ -116,8 +122,8 @@
* If you modify libpng you may insert additional notices immediately following * If you modify libpng you may insert additional notices immediately following
* this sentence. * this sentence.
* *
* libpng versions 1.0.7, July 1, 2000, through 1.0.13, April 15, 2002, are * libpng versions 1.0.7, July 1, 2000, through 1.0.14, July 8, 2002, are
* Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.0.6 * distributed according to the same disclaimer and license as libpng-1.0.6
* with the following individuals added to the list of Contributing Authors * with the following individuals added to the list of Contributing Authors
* *
@ -221,13 +227,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* April 15, 2002 * July 8, 2002
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.13 are Y2K compliant. It is my belief that earlier * upward through 1.0.14 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant. * versions were also Y2K compliant.
* *
* Libpng only has three year fields. One is a 2-byte unsigned integer * Libpng only has three year fields. One is a 2-byte unsigned integer
@ -283,7 +289,7 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.13" #define PNG_LIBPNG_VER_STRING "1.0.14"
#define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM% #define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
@ -291,7 +297,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 0 #define PNG_LIBPNG_VER_MINOR 0
#define PNG_LIBPNG_VER_RELEASE 13 #define PNG_LIBPNG_VER_RELEASE 14
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */ * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
@ -310,7 +316,7 @@
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
#define PNG_LIBPNG_VER 10013 /* 1.0.13 */ #define PNG_LIBPNG_VER 10014 /* 1.0.14 */
#ifndef PNG_VERSION_INFO_ONLY #ifndef PNG_VERSION_INFO_ONLY
@ -372,7 +378,7 @@ extern "C" {
*/ */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (const char) png_libpng_ver[18]; PNG_EXPORT_VAR (const char) png_libpng_ver[18];
/* need room for 99.99.99beta99z*/ /* need room for 99.99.99beta99z */
#else #else
#define png_libpng_ver png_get_header_ver(NULL) #define png_libpng_ver png_get_header_ver(NULL)
#endif #endif
@ -598,7 +604,7 @@ typedef struct png_info_struct
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
/* The following is informational only on read, and not used on writes. */ /* The following is informational only on read, and not used on writes. */
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4)*/ png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
png_byte pixel_depth; /* number of bits per pixel */ png_byte pixel_depth; /* number of bits per pixel */
png_byte spare_byte; /* to align the data, and for future use */ png_byte spare_byte; /* to align the data, and for future use */
png_byte signature[8]; /* magic bytes read by libpng from start of file */ png_byte signature[8]; /* magic bytes read by libpng from start of file */
@ -888,7 +894,7 @@ typedef png_info FAR * FAR * png_infopp;
#define PNG_KEYWORD_MAX_LENGTH 79 #define PNG_KEYWORD_MAX_LENGTH 79
/* Maximum number of entries in PLTE/sPLT/tRNS arrays */ /* Maximum number of entries in PLTE/sPLT/tRNS arrays */
#define PNG_MAX_PALETTE_LENGTH 256 #define PNG_MAX_PALETTE_LENGTH 256
/* These determine if an ancillary chunk's data has been successfully read /* These determine if an ancillary chunk's data has been successfully read
* from the PNG header, or if the application has filled in the corresponding * from the PNG header, or if the application has filled in the corresponding
@ -1007,7 +1013,7 @@ struct png_struct_def
png_voidp error_ptr; /* user supplied struct for error functions */ png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* function for writing output data */ png_rw_ptr write_data_fn; /* function for writing output data */
png_rw_ptr read_data_fn; /* function for reading input data */ png_rw_ptr read_data_fn; /* function for reading input data */
png_voidp io_ptr; /* ptr to application struct for I/O functions*/ png_voidp io_ptr; /* ptr to application struct for I/O functions */
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_user_transform_ptr read_user_transform_fn; /* user read transform */ png_user_transform_ptr read_user_transform_fn; /* user read transform */
@ -1257,15 +1263,25 @@ struct png_struct_def
png_free_ptr free_fn; /* function for freeing memory */ png_free_ptr free_fn; /* function for freeing memory */
#endif #endif
/* New member added in libpng-1.0.13 and 1.2.0 */
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
#if defined(PNG_READ_DITHER_SUPPORTED)
/* The following three members were added at version 1.0.14 and 1.2.4 */
png_bytep dither_sort; /* working sort array */
png_bytep index_to_palette; /* where the original index currently is */
/* in the palette */
png_bytep palette_to_index; /* which original index points to this */
/* palette color */
#endif
}; };
/* This prevents a compiler error in png.c if png.c and png.h are both at /* This prevents a compiler error in png.c if png.c and png.h are both at
version 1.0.13 version 1.0.14
*/ */
typedef png_structp version_1_0_13; typedef png_structp version_1_0_14;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@ -1349,6 +1365,7 @@ extern PNG_EXPORT(png_infop,png_create_info_struct)
/* Initialize the info structure (old interface - DEPRECATED) */ /* Initialize the info structure (old interface - DEPRECATED) */
extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
#undef png_info_init
#define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info)); #define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info));
extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
png_size_t png_info_struct_size)); png_size_t png_info_struct_size));
@ -1524,11 +1541,11 @@ extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
png_infop info_ptr)); png_infop info_ptr));
/* read a one or more rows of image data.*/ /* read one or more rows of image data. */
extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
/* read a row of data.*/ /* read a row of data. */
extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
png_bytep row, png_bytep row,
png_bytep display_row)); png_bytep display_row));
@ -1814,15 +1831,25 @@ extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
png_uint_32 size)); png_uint_32 size));
#if defined(PNG_1_0_X)
# define png_malloc_warn png_malloc
#else
/* Added at libpng version 1.2.4 */
extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
png_uint_32 size));
#endif
/* frees a pointer allocated by png_malloc() */ /* frees a pointer allocated by png_malloc() */
extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
#if defined(PNG_1_0_X)
/* Function to allocate memory for zlib. */ /* Function to allocate memory for zlib. */
extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
uInt size)); uInt size));
/* Function to free memory for zlib */ /* Function to free memory for zlib */
extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
#endif
/* Free data that was allocated internally */ /* Free data that was allocated internally */
extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
@ -1872,19 +1899,19 @@ extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
/* Fatal error in PNG image of libpng - can't continue */ /* Fatal error in PNG image of libpng - can't continue */
extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
png_const_charp error)); png_const_charp error_message));
/* The same, but the chunk name is prepended to the error string. */ /* The same, but the chunk name is prepended to the error string. */
extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
png_const_charp error)); png_const_charp error_message));
/* Non-fatal error in libpng. Can continue, but may have a problem. */ /* Non-fatal error in libpng. Can continue, but may have a problem. */
extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
png_const_charp message)); png_const_charp warning_message));
/* Non-fatal error in libpng, chunk name is prepended to message. */ /* Non-fatal error in libpng, chunk name is prepended to message. */
extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
png_const_charp message)); png_const_charp warning_message));
/* The png_set_<chunk> functions are for storing values in the png_info_struct. /* The png_set_<chunk> functions are for storing values in the png_info_struct.
* Similarly, the png_get_<chunk> calls are used to read values from the * Similarly, the png_get_<chunk> calls are used to read values from the
@ -2319,15 +2346,15 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
/* Added to version 1.2.0 */ /* Added to version 1.2.0 */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 #define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08
#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 #define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10
#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 #define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20
#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 #define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40
#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 #define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ #define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */
#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ #define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \ | PNG_ASM_FLAG_MMX_READ_INTERLACE \
@ -2394,7 +2421,7 @@ extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.13 - April 15, 2002 (header)\n" " libpng version 1.0.14 - July 8, 2002 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on /* With these routines we avoid an integer divide, which will be slower on
@ -2628,6 +2655,7 @@ PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
* (old interface - DEPRECATED - use png_create_read_struct instead). * (old interface - DEPRECATED - use png_create_read_struct instead).
*/ */
extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
#undef png_read_init
#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, sizeof(png_struct)); PNG_LIBPNG_VER_STRING, sizeof(png_struct));
extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
@ -2640,6 +2668,7 @@ extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
* (old interface - DEPRECATED - use png_create_write_struct instead). * (old interface - DEPRECATED - use png_create_write_struct instead).
*/ */
extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
#undef png_write_init
#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ #define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, sizeof(png_struct)); PNG_LIBPNG_VER_STRING, sizeof(png_struct));
extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
@ -2663,6 +2692,39 @@ PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
png_infop info_ptr)); png_infop info_ptr));
#ifndef PNG_1_0_X
/* Function to allocate memory for zlib. */
PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
/* Function to free memory for zlib */
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
/* Next four functions are used internally as callbacks. PNGAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
#endif
PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
#if !defined(PNG_NO_STDIO)
PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
#endif
#endif
#else /* PNG_1_0_X */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
#endif
#endif /* PNG_1_0_X */
/* Reset the CRC variable */ /* Reset the CRC variable */
PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
@ -2703,6 +2765,7 @@ PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
#endif #endif
/* Place a 32-bit number into a buffer in PNG byte order (big-endian). /* Place a 32-bit number into a buffer in PNG byte order (big-endian).
* The only currently known PNG chunks that use signed numbers are * The only currently known PNG chunks that use signed numbers are
* the ancillary extension chunks, oFFs and pCAL. * the ancillary extension chunks, oFFs and pCAL.
@ -2825,6 +2888,11 @@ PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
png_charp text)); png_charp text));
#endif #endif
#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */
PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
#if defined(PNG_WRITE_oFFs_SUPPORTED) #if defined(PNG_WRITE_oFFs_SUPPORTED)
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
png_int_32 x_offset, png_int_32 y_offset, int unit_type)); png_int_32 x_offset, png_int_32 y_offset, int unit_type));
@ -3146,8 +3214,6 @@ PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
png_uint_32 length)); png_uint_32 length));
PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t buffer_length)); png_bytep buffer, png_size_t buffer_length));

View File

@ -1,6 +1,6 @@
/* pngasmrd.h - assembler version of utilities to read a PNG file /* pngasmrd.h - assembler version of utilities to read a PNG file
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 2002 Glenn Randers-Pehrson * Copyright (c) 2002 Glenn Randers-Pehrson
* *

View File

@ -1,6 +1,6 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -80,12 +80,12 @@
* (no define) -- building static library, or building an * (no define) -- building static library, or building an
* application and linking to the static lib * application and linking to the static lib
* 'Cygwin' defines/defaults: * 'Cygwin' defines/defaults:
* PNG_BUILD_DLL -- building the dll * PNG_BUILD_DLL -- (ignored) building the dll
* (no define) -- building an application, linking to the dll * (no define) -- (ignored) building an application, linking to the dll
* PNG_STATIC -- building the static lib, or building an application * PNG_STATIC -- (ignored) building the static lib, or building an
* that links to the static lib. * application that links to the static lib.
* ALL_STATIC -- building various static libs, or building an application * ALL_STATIC -- (ignored) building various static libs, or building an
* that links to the static libs. * application that links to the static libs.
* Thus, * Thus,
* a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
* this bit of #ifdefs will define the 'correct' config variables based on * this bit of #ifdefs will define the 'correct' config variables based on
@ -96,7 +96,15 @@
* ALL_STATIC (since we can't #undef something outside our namespace) * ALL_STATIC (since we can't #undef something outside our namespace)
* PNG_BUILD_DLL * PNG_BUILD_DLL
* PNG_STATIC * PNG_STATIC
* (nothing) == PNG_USE_DLL * (nothing) == PNG_USE_DLL
*
* CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
* of auto-import in binutils, we no longer need to worry about
* __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
* we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
* to __declspec() stuff. However, we DO need to worry about
* PNG_BUILD_DLL and PNG_STATIC because those change some defaults
* such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
*/ */
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
# if defined(ALL_STATIC) # if defined(ALL_STATIC)
@ -1151,10 +1159,23 @@ typedef z_stream FAR * png_zstreamp;
# endif # endif
#endif #endif
#if defined(__CYGWIN__)
# undef PNGAPI
# define PNGAPI __cdecl
# undef PNG_IMPEXP
# define PNG_IMPEXP
#endif
/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
* you may get warnings regarding the linkage of png_zalloc and png_zfree.
* Don't ignore those warnings; you must also reset the default calling
* convention in your compiler to match your PNGAPI, and you must build
* zlib and your applications the same way you build libpng.
*/
#ifndef PNGAPI #ifndef PNGAPI
#if defined(__MINGW32__) || defined(__CYGWIN__) && !defined(PNG_MODULEDEF) #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
# ifndef PNG_NO_MODULEDEF # ifndef PNG_NO_MODULEDEF
# define PNG_NO_MODULEDEF # define PNG_NO_MODULEDEF
# endif # endif
@ -1166,8 +1187,7 @@ typedef z_stream FAR * png_zstreamp;
#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
(( defined(_Windows) || defined(_WINDOWS) || \ (( defined(_Windows) || defined(_WINDOWS) || \
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \ defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
) && !defined(__CYGWIN__))
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
# define PNGAPI __cdecl # define PNGAPI __cdecl
@ -1194,8 +1214,8 @@ typedef z_stream FAR * png_zstreamp;
# if defined(PNG_BUILD_DLL) # if defined(PNG_BUILD_DLL)
# define PNG_IMPEXP __export # define PNG_IMPEXP __export
# else # else
# define PNG_IMPEXP /*__import*/ /* doesn't exist AFAIK in # define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
VC++*/ VC++ */
# endif /* Exists in Borland C++ for # endif /* Exists in Borland C++ for
C++ classes (== huge) */ C++ classes (== huge) */
# endif # endif
@ -1210,12 +1230,6 @@ typedef z_stream FAR * png_zstreamp;
# endif # endif
# endif /* PNG_IMPEXP */ # endif /* PNG_IMPEXP */
#else /* !(DLL || non-cygwin WINDOWS) */ #else /* !(DLL || non-cygwin WINDOWS) */
# if defined(__CYGWIN__) && !defined(PNG_DLL)
# if !defined(PNG_IMPEXP)
# define PNG_IMPEXP
# endif
# define PNGAPI __cdecl
# else
# if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__) # if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System # define PNGAPI _System
# define PNG_IMPEXP # define PNG_IMPEXP
@ -1226,7 +1240,6 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_IMPEXP # define PNG_IMPEXP
# endif # endif
# endif # endif
# endif
#endif #endif
#endif #endif

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -18,10 +18,10 @@
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr, png_default_error PNGARG((png_structp png_ptr,
png_const_charp message)); png_const_charp error_message));
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr, png_default_warning PNGARG((png_structp png_ptr,
png_const_charp message)); png_const_charp warning_message));
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
* should not be changed. If there is a need to handle errors differently, * should not be changed. If there is a need to handle errors differently,
@ -29,28 +29,28 @@ png_default_warning PNGARG((png_structp png_ptr,
* to replace the error function at run-time. * to replace the error function at run-time.
*/ */
void PNGAPI void PNGAPI
png_error(png_structp png_ptr, png_const_charp message) png_error(png_structp png_ptr, png_const_charp error_message)
{ {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16]; char msg[16];
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{ {
int offset = 0; int offset = 0;
if (*message == '#') if (*error_message == '#')
{ {
for (offset=1; offset<15; offset++) for (offset=1; offset<15; offset++)
if (*(message+offset) == ' ') if (*(error_message+offset) == ' ')
break; break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ {
int i; int i;
for (i=0; i<offset-1; i++) for (i=0; i<offset-1; i++)
msg[i]=message[i+1]; msg[i]=error_message[i+1];
msg[i]='\0'; msg[i]='\0';
message=msg; error_message=msg;
} }
else else
message+=offset; error_message+=offset;
} }
else else
{ {
@ -58,17 +58,17 @@ png_error(png_structp png_ptr, png_const_charp message)
{ {
msg[0]='0'; msg[0]='0';
msg[1]='\0'; msg[1]='\0';
message=msg; error_message=msg;
} }
} }
} }
#endif #endif
if (png_ptr->error_fn != NULL) if (png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, message); (*(png_ptr->error_fn))(png_ptr, error_message);
/* if the following returns or doesn't exist, use the default function, /* if the following returns or doesn't exist, use the default function,
which will not return */ which will not return */
png_default_error(png_ptr, message); png_default_error(png_ptr, error_message);
} }
/* This function is called whenever there is a non-fatal error. This function /* This function is called whenever there is a non-fatal error. This function
@ -77,24 +77,25 @@ png_error(png_structp png_ptr, png_const_charp message)
* png_set_error_fn() to replace the warning function at run-time. * png_set_error_fn() to replace the warning function at run-time.
*/ */
void PNGAPI void PNGAPI
png_warning(png_structp png_ptr, png_const_charp message) png_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
int offset = 0; int offset = 0;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif #endif
{ {
if (*message == '#') if (*warning_message == '#')
{ {
for (offset=1; offset<15; offset++) for (offset=1; offset<15; offset++)
if (*(message+offset) == ' ') if (*(warning_message+offset) == ' ')
break; break;
} }
} }
if (png_ptr->warning_fn != NULL) if (png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, (png_const_charp)(message+offset)); (*(png_ptr->warning_fn))(png_ptr,
(png_const_charp)(warning_message+offset));
else else
png_default_warning(png_ptr, (png_const_charp)(message+offset)); png_default_warning(png_ptr, (png_const_charp)(warning_message+offset));
} }
/* These utilities are used internally to build an error message that relates /* These utilities are used internally to build an error message that relates
@ -110,7 +111,7 @@ static PNG_CONST char png_digit[16] = {
static void /* PRIVATE */ static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
message) error_message)
{ {
int iout = 0, iin = 0; int iout = 0, iin = 0;
@ -130,30 +131,30 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
} }
} }
if (message == NULL) if (error_message == NULL)
buffer[iout] = 0; buffer[iout] = 0;
else else
{ {
buffer[iout++] = ':'; buffer[iout++] = ':';
buffer[iout++] = ' '; buffer[iout++] = ' ';
png_memcpy(buffer+iout, message, 64); png_memcpy(buffer+iout, error_message, 64);
buffer[iout+63] = 0; buffer[iout+63] = 0;
} }
} }
void PNGAPI void PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp message) png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{ {
char msg[18+64]; char msg[18+64];
png_format_buffer(png_ptr, msg, message); png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg); png_error(png_ptr, msg);
} }
void PNGAPI void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp message) png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
char msg[18+64]; char msg[18+64];
png_format_buffer(png_ptr, msg, message); png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
@ -163,33 +164,34 @@ png_chunk_warning(png_structp png_ptr, png_const_charp message)
* error function pointer in png_set_error_fn(). * error function pointer in png_set_error_fn().
*/ */
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error(png_structp png_ptr, png_const_charp message) png_default_error(png_structp png_ptr, png_const_charp error_message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifndef PNG_NO_CONSOLE_IO
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*message == '#') if (*error_message == '#')
{ {
int offset; int offset;
char error_number[16]; char error_number[16];
for (offset=0; offset<15; offset++) for (offset=0; offset<15; offset++)
{ {
error_number[offset] = *(message+offset+1); error_number[offset] = *(error_message+offset+1);
if (*(message+offset) == ' ') if (*(error_message+offset) == ' ')
break; break;
} }
if((offset > 1) && (offset < 15)) if((offset > 1) && (offset < 15))
{ {
error_number[offset-1]='\0'; error_number[offset-1]='\0';
fprintf(stderr, "libpng error no. %s: %s\n", error_number, message+offset); fprintf(stderr, "libpng error no. %s: %s\n", error_number,
error_message+offset);
} }
else else
fprintf(stderr, "libpng error: %s, offset=%d\n", message,offset); fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset);
} }
else else
#endif #endif
fprintf(stderr, "libpng error: %s\n", message); fprintf(stderr, "libpng error: %s\n", error_message);
#else #else
if (message) if (error_message)
/* make compiler happy */ ; /* make compiler happy */ ;
#endif #endif
@ -216,34 +218,34 @@ png_default_error(png_structp png_ptr, png_const_charp message)
* not used, but it is passed in case it may be useful. * not used, but it is passed in case it may be useful.
*/ */
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning(png_structp png_ptr, png_const_charp message) png_default_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifndef PNG_NO_CONSOLE_IO
# ifdef PNG_ERROR_NUMBERS_SUPPORTED # ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*message == '#') if (*warning_message == '#')
{ {
int offset; int offset;
char warning_number[16]; char warning_number[16];
for (offset=0; offset<15; offset++) for (offset=0; offset<15; offset++)
{ {
warning_number[offset]=*(message+offset+1); warning_number[offset]=*(warning_message+offset+1);
if (*(message+offset) == ' ') if (*(warning_message+offset) == ' ')
break; break;
} }
if((offset > 1) && (offset < 15)) if((offset > 1) && (offset < 15))
{ {
warning_number[offset-1]='\0'; warning_number[offset-1]='\0';
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
message+offset); warning_message+offset);
} }
else else
fprintf(stderr, "libpng warning: %s\n", message); fprintf(stderr, "libpng warning: %s\n", warning_message);
} }
else else
# endif # endif
fprintf(stderr, "libpng warning: %s\n", message); fprintf(stderr, "libpng warning: %s\n", warning_message);
#else #else
if (message) if (warning_message)
/* appease compiler */ ; /* appease compiler */ ;
#endif #endif
if (png_ptr) if (png_ptr)

View File

@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code. * for Intel's performance analysis of the MMX vs. non-MMX code.
* *
* libpng version 1.0.13 - April 15, 2002 * libpng version 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, Intel Corporation
@ -338,7 +338,7 @@ static unsigned long long _const6 = 0x00000000000000FFLL;
static png_uint_32 _FullLength; static png_uint_32 _FullLength;
static png_uint_32 _MMXLength; static png_uint_32 _MMXLength;
static int _dif; static int _dif;
static int _patemp; // temp variables for Paeth routine static int _patemp; // temp variables for Paeth routine
static int _pbtemp; static int _pbtemp;
static int _pctemp; static int _pctemp;
#endif #endif
@ -386,9 +386,9 @@ static int _mmx_supported = 2;
#if defined(PNG_HAVE_ASSEMBLER_COMBINE_ROW) #if defined(PNG_HAVE_ASSEMBLER_COMBINE_ROW)
#define BPP2 2 #define BPP2 2
#define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */ #define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */
#define BPP4 4 #define BPP4 4
#define BPP6 6 /* (defined only to help avoid cut-and-paste errors) */ #define BPP6 6 /* (defined only to help avoid cut-and-paste errors) */
#define BPP8 8 #define BPP8 8
/* Combines the row recently read in with the previous row. /* Combines the row recently read in with the previous row.
@ -1504,8 +1504,10 @@ png_do_read_interlace(png_structp png_ptr)
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if (_mmx_supported == 2) { if (_mmx_supported == 2) {
#if !defined(PNG_1_0_X)
/* this should have happened in png_init_mmx_flags() already */ /* this should have happened in png_init_mmx_flags() already */
png_warning(png_ptr, "asm_flags may not have been initialized"); png_warning(png_ptr, "asm_flags may not have been initialized");
#endif
png_mmx_support(); png_mmx_support();
} }
#endif #endif
@ -4825,7 +4827,7 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
} }
break; break;
default: // bpp greater than 8 bytes GRR BOGUS default: // bpp greater than 8 bytes GRR BOGUS
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl _dif, %%edx \n\t" "movl _dif, %%edx \n\t"
@ -5135,11 +5137,11 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if !defined(PNG_1_0_X) #if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) && if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
#else
if (
#endif
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
if (_mmx_supported)
#endif
{ {
png_read_filter_row_mmx_sub(row_info, row); png_read_filter_row_mmx_sub(row_info, row);
} }
@ -5164,11 +5166,11 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
#if !defined(PNG_1_0_X) #if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) && if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
#else
if (
#endif
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
if (_mmx_supported)
#endif
{ {
png_read_filter_row_mmx_up(row_info, row, prev_row); png_read_filter_row_mmx_up(row_info, row, prev_row);
} }
@ -5192,11 +5194,11 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if !defined(PNG_1_0_X) #if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) && if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
#else
if (
#endif
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
if (_mmx_supported)
#endif
{ {
png_read_filter_row_mmx_avg(row_info, row, prev_row); png_read_filter_row_mmx_avg(row_info, row, prev_row);
} }
@ -5230,11 +5232,11 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if !defined(PNG_1_0_X) #if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) && if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
#else
if (
#endif
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
if (_mmx_supported)
#endif
{ {
png_read_filter_row_mmx_paeth(row_info, row, prev_row); png_read_filter_row_mmx_paeth(row_info, row, prev_row);
} }

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -560,7 +560,9 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
*interlace_type = info_ptr->interlace_type; *interlace_type = info_ptr->interlace_type;
/* check for potential overflow of rowbytes */ /* check for potential overflow of rowbytes */
if (*color_type & PNG_COLOR_MASK_COLOR) if (*color_type == PNG_COLOR_TYPE_PALETTE)
channels = 1;
else if (*color_type & PNG_COLOR_MASK_COLOR)
channels = 3; channels = 3;
else else
channels = 1; channels = 1;
@ -572,9 +574,9 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
png_error(png_ptr, "Invalid image width"); png_error(png_ptr, "Invalid image width");
if (height == 0 || *height > PNG_MAX_UINT) if (height == 0 || *height > PNG_MAX_UINT)
png_error(png_ptr, "Invalid image height"); png_error(png_ptr, "Invalid image height");
if ((*width > PNG_MAX_UINT/rowbytes_per_pixel)) if (*width > PNG_MAX_UINT/rowbytes_per_pixel - 64)
{ {
png_warning(png_ptr, png_error(png_ptr,
"Width too large for libpng to process image data."); "Width too large for libpng to process image data.");
} }
return (1); return (1);
@ -835,7 +837,7 @@ png_get_compression_buffer_size(png_structp png_ptr)
#ifndef PNG_1_0_X #ifndef PNG_1_0_X
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED #ifdef PNG_ASSEMBLER_CODE_SUPPORTED
/* this function was added to libpng 1.2.0 and should exist by default*/ /* this function was added to libpng 1.2.0 and should exist by default */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_asm_flags (png_structp png_ptr) png_get_asm_flags (png_structp png_ptr)
{ {

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -110,12 +110,12 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* result, we would be truncating potentially larger memory requests * result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems. * (which should cause a fatal error) and introducing major problems.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_malloc(png_structp png_ptr, png_uint_32 size)
{ {
#ifndef PNG_USER_MEM_SUPPORTED
png_voidp ret; png_voidp ret;
#endif
if (png_ptr == NULL || size == 0) if (png_ptr == NULL || size == 0)
return (NULL); return (NULL);
@ -306,7 +306,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
/* Allocate memory for a png_struct or a png_info. The malloc and /* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably.*/ to improve performance noticably. */
png_voidp /* PRIVATE */ png_voidp /* PRIVATE */
png_create_struct(int type) png_create_struct(int type)
{ {
@ -316,7 +316,7 @@ png_create_struct(int type)
/* Allocate memory for a png_struct or a png_info. The malloc and /* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably.*/ to improve performance noticably. */
png_voidp /* PRIVATE */ png_voidp /* PRIVATE */
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
{ {
@ -399,7 +399,6 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
} }
} }
/* Allocate memory. For reasonable files, size should never exceed /* Allocate memory. For reasonable files, size should never exceed
64K. However, zlib may allocate more then 64K if you don't tell 64K. However, zlib may allocate more then 64K if you don't tell
it not to. See zconf.h and png.h for more information. zlib does it not to. See zconf.h and png.h for more information. zlib does
@ -410,13 +409,14 @@ png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_malloc(png_structp png_ptr, png_uint_32 size)
{ {
png_voidp ret; png_voidp ret;
if (png_ptr == NULL || size == 0) if (png_ptr == NULL || size == 0)
return (NULL); return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(png_ptr->malloc_fn != NULL) if(png_ptr->malloc_fn != NULL)
{ {
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size)); ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory!"); png_error(png_ptr, "Out of Memory!");
return (ret); return (ret);
@ -424,6 +424,7 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
else else
return (png_malloc_default(png_ptr, size)); return (png_malloc_default(png_ptr, size));
} }
png_voidp PNGAPI png_voidp PNGAPI
png_malloc_default(png_structp png_ptr, png_uint_32 size) png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
@ -493,6 +494,26 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
#endif /* Not Borland DOS special memory handler */ #endif /* Not Borland DOS special memory handler */
#if defined(PNG_1_0_X)
# define png_malloc_warn png_malloc
#else
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
* function will issue a png_warning and return NULL instead of issuing a
* png_error, if it fails to allocate the requested memory.
*/
png_voidp PNGAPI
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
{
png_voidp ptr;
png_uint_32 save_flags=png_ptr->flags;
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
png_ptr->flags=save_flags;
return(ptr);
}
#endif
png_voidp PNGAPI png_voidp PNGAPI
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2, png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
png_uint_32 length) png_uint_32 length)

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -221,7 +221,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
} }
else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4))
@ -231,7 +230,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
} }
else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
@ -243,7 +241,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before IDAT"); png_error(png_ptr, "Missing IHDR before IDAT");
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
!(png_ptr->mode & PNG_HAVE_PLTE)) !(png_ptr->mode & PNG_HAVE_PLTE))
png_error(png_ptr, "Missing PLTE before IDAT"); png_error(png_ptr, "Missing PLTE before IDAT");
if (png_ptr->mode & PNG_HAVE_IDAT) if (png_ptr->mode & PNG_HAVE_IDAT)
@ -270,8 +268,8 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
png_ptr->process_mode = PNG_READ_DONE_MODE; png_ptr->process_mode = PNG_READ_DONE_MODE;
png_push_have_end(png_ptr, info_ptr); png_push_have_end(png_ptr, info_ptr);
} }
@ -283,7 +281,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -295,7 +292,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -307,7 +303,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -319,7 +314,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -331,7 +325,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -343,7 +336,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -355,7 +347,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -367,7 +358,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -379,7 +369,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -391,7 +380,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -403,7 +391,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -415,7 +402,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -427,7 +413,6 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@ -439,30 +424,49 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4))
{ {
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
{
png_push_save_buffer(png_ptr);
return;
}
png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4))
{ {
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
{
png_push_save_buffer(png_ptr);
return;
}
png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4))
{ {
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
{
png_push_save_buffer(png_ptr);
return;
}
png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
else else
{ {
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
{
png_push_save_buffer(png_ptr);
return;
}
png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
} }
@ -524,7 +528,7 @@ png_push_crc_finish(png_structp png_ptr)
} }
} }
void /* PRIVATE */ void PNGAPI
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
{ {
png_bytep ptr; png_bytep ptr;
@ -742,6 +746,13 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
} }
if (!(png_ptr->zstream.avail_out)) if (!(png_ptr->zstream.avail_out))
{ {
if ((
#if defined(PNG_READ_INTERLACING_SUPPORTED)
png_ptr->interlaced && png_ptr->pass > 6) ||
(!png_ptr->interlaced &&
#endif
png_ptr->row_number == png_ptr->num_rows-1))
png_error(png_ptr, "Too much data in IDAT chunks");
png_push_process_row(png_ptr); png_push_process_row(png_ptr);
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes;
png_ptr->zstream.next_out = png_ptr->row_buf; png_ptr->zstream.next_out = png_ptr->row_buf;
@ -802,13 +813,13 @@ png_push_process_row(png_structp png_ptr)
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
} }
if (png_ptr->pass == 4 && png_ptr->height <= 4) if (png_ptr->pass == 4 && png_ptr->height <= 4)
{ {
for (i = 0; i < 2 && png_ptr->pass == 4; i++) for (i = 0; i < 2 && png_ptr->pass == 4; i++)
{ {
png_push_have_row(png_ptr, png_bytep_NULL); png_push_have_row(png_ptr, png_bytep_NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
} }
if (png_ptr->pass == 6 && png_ptr->height <= 4) if (png_ptr->pass == 6 && png_ptr->height <= 4)
{ {
@ -1051,6 +1062,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
png_textp text_ptr; png_textp text_ptr;
png_charp text; png_charp text;
png_charp key; png_charp key;
int ret;
if (png_ptr->buffer_size < 4) if (png_ptr->buffer_size < 4)
{ {
@ -1066,7 +1078,6 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
#endif #endif
key = png_ptr->current_text; key = png_ptr->current_text;
png_ptr->current_text = 0;
for (text = key; *text; text++) for (text = key; *text; text++)
/* empty loop */ ; /* empty loop */ ;
@ -1083,10 +1094,14 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
#endif #endif
text_ptr->text = text; text_ptr->text = text;
png_set_text(png_ptr, info_ptr, text_ptr, 1); ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_free(png_ptr, key); png_free(png_ptr, key);
png_free(png_ptr, text_ptr); png_free(png_ptr, text_ptr);
png_ptr->current_text = NULL;
if (ret)
png_warning(png_ptr, "Insufficient memory to store text chunk.");
} }
} }
#endif #endif
@ -1157,7 +1172,6 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
png_push_crc_finish(png_ptr); png_push_crc_finish(png_ptr);
key = png_ptr->current_text; key = png_ptr->current_text;
png_ptr->current_text = 0;
for (text = key; *text; text++) for (text = key; *text; text++)
/* empty loop */ ; /* empty loop */ ;
@ -1165,6 +1179,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
/* zTXt can't have zero text */ /* zTXt can't have zero text */
if (text == key + png_ptr->current_text_size) if (text == key + png_ptr->current_text_size)
{ {
png_ptr->current_text = NULL;
png_free(png_ptr, key); png_free(png_ptr, key);
return; return;
} }
@ -1173,6 +1188,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
if (*text != PNG_TEXT_COMPRESSION_zTXt) /* check compression byte */ if (*text != PNG_TEXT_COMPRESSION_zTXt) /* check compression byte */
{ {
png_ptr->current_text = NULL;
png_free(png_ptr, key); png_free(png_ptr, key);
return; return;
} }
@ -1197,6 +1213,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
{ {
inflateReset(&png_ptr->zstream); inflateReset(&png_ptr->zstream);
png_ptr->zstream.avail_in = 0; png_ptr->zstream.avail_in = 0;
png_ptr->current_text = NULL;
png_free(png_ptr, key); png_free(png_ptr, key);
png_free(png_ptr, text); png_free(png_ptr, text);
return; return;
@ -1250,11 +1267,13 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
if (ret != Z_STREAM_END) if (ret != Z_STREAM_END)
{ {
png_ptr->current_text = NULL;
png_free(png_ptr, key); png_free(png_ptr, key);
png_free(png_ptr, text); png_free(png_ptr, text);
return; return;
} }
png_ptr->current_text = NULL;
png_free(png_ptr, key); png_free(png_ptr, key);
key = text; key = text;
text += key_size; text += key_size;
@ -1268,10 +1287,13 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
#endif #endif
text_ptr->text = text; text_ptr->text = text;
png_set_text(png_ptr, info_ptr, text_ptr, 1); ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_free(png_ptr, key); png_free(png_ptr, key);
png_free(png_ptr, text_ptr); png_free(png_ptr, text_ptr);
if (ret)
png_warning(png_ptr, "Insufficient memory to store text chunk.");
} }
} }
#endif #endif
@ -1332,6 +1354,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
png_charp lang; png_charp lang;
png_charp lang_key; png_charp lang_key;
png_charp text; png_charp text;
int ret;
if (png_ptr->buffer_size < 4) if (png_ptr->buffer_size < 4)
{ {
@ -1347,7 +1370,6 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
#endif #endif
key = png_ptr->current_text; key = png_ptr->current_text;
png_ptr->current_text = 0;
for (lang = key; *lang; lang++) for (lang = key; *lang; lang++)
/* empty loop */ ; /* empty loop */ ;
@ -1377,9 +1399,13 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
text_ptr->text_length = 0; text_ptr->text_length = 0;
text_ptr->itxt_length = png_strlen(text); text_ptr->itxt_length = png_strlen(text);
png_set_text(png_ptr, info_ptr, text_ptr, 1); ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_ptr->current_text = NULL;
png_free(png_ptr, text_ptr); png_free(png_ptr, text_ptr);
if (ret)
png_warning(png_ptr, "Insufficient memory to store iTXt chunk.");
} }
} }
#endif #endif
@ -1497,7 +1523,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
png_ptr->row_fn = row_fn; png_ptr->row_fn = row_fn;
png_ptr->end_fn = end_fn; png_ptr->end_fn = end_fn;
png_set_read_fn(png_ptr, progressive_ptr, (png_rw_ptr)png_push_fill_buffer); png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
} }
png_voidp PNGAPI png_voidp PNGAPI

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -70,8 +70,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_ptr->zbuf=NULL; png_ptr->zbuf=NULL;
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr, png_destroy_struct_2((png_voidp)png_ptr,
(png_free_ptr)free_fn, (png_free_ptr)free_fn, (png_voidp)mem_ptr);
(png_voidp)mem_ptr);
#else #else
png_destroy_struct((png_voidp)png_ptr); png_destroy_struct((png_voidp)png_ptr);
#endif #endif
@ -148,6 +147,19 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL); png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
#ifdef PNG_SETJMP_SUPPORTED
/* Applications that neglect to set up their own setjmp() and then encounter
a png_error() will longjmp here. Since the jmpbuf is then meaningless we
abort instead of returning. */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
PNG_ABORT();
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
#else
if (setjmp(png_ptr->jmpbuf))
PNG_ABORT();
#endif
#endif
return (png_ptr); return (png_ptr);
} }
@ -162,7 +174,6 @@ png_read_init(png_structp png_ptr)
png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0); png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
} }
#undef png_read_init_2
void PNGAPI void PNGAPI
png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_size_t png_struct_size, png_size_t png_info_size) png_size_t png_struct_size, png_size_t png_info_size)
@ -289,7 +300,6 @@ void PNGAPI
png_read_info(png_structp png_ptr, png_infop info_ptr) png_read_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_read_info\n"); png_debug(1, "in png_read_info\n");
/* save jump buffer and error functions */
/* If we haven't checked all of the PNG signature bytes, do so now. */ /* If we haven't checked all of the PNG signature bytes, do so now. */
if (png_ptr->sig_bytes < 8) if (png_ptr->sig_bytes < 8)
{ {
@ -503,7 +513,6 @@ void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr) png_read_update_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_read_update_info\n"); png_debug(1, "in png_read_update_info\n");
/* save jump buffer and error functions */
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
else else
@ -521,7 +530,6 @@ void PNGAPI
png_start_read_image(png_structp png_ptr) png_start_read_image(png_structp png_ptr)
{ {
png_debug(1, "in png_start_read_image\n"); png_debug(1, "in png_start_read_image\n");
/* save jump buffer and error functions */
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
} }
@ -537,7 +545,6 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
int ret; int ret;
png_debug2(1, "in png_read_row (row %lu, pass %d)\n", png_debug2(1, "in png_read_row (row %lu, pass %d)\n",
png_ptr->row_number, png_ptr->pass); png_ptr->row_number, png_ptr->pass);
/* save jump buffer and error functions */
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
if (png_ptr->row_number == 0 && png_ptr->pass == 0) if (png_ptr->row_number == 0 && png_ptr->pass == 0)
@ -782,7 +789,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
* not called png_set_interlace_handling(), the display_row buffer will * not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it. * be ignored, so pass NULL to it.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.13 * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.14
*/ */
void PNGAPI void PNGAPI
@ -794,7 +801,6 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
png_bytepp dp; png_bytepp dp;
png_debug(1, "in png_read_rows\n"); png_debug(1, "in png_read_rows\n");
/* save jump buffer and error functions */
rp = row; rp = row;
dp = display_row; dp = display_row;
if (rp != NULL && dp != NULL) if (rp != NULL && dp != NULL)
@ -831,7 +837,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
* only call this function once. If you desire to have an image for * only call this function once. If you desire to have an image for
* each pass of a interlaced image, use png_read_rows() instead. * each pass of a interlaced image, use png_read_rows() instead.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.13 * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.14
*/ */
void PNGAPI void PNGAPI
png_read_image(png_structp png_ptr, png_bytepp image) png_read_image(png_structp png_ptr, png_bytepp image)
@ -841,7 +847,6 @@ png_read_image(png_structp png_ptr, png_bytepp image)
png_bytepp rp; png_bytepp rp;
png_debug(1, "in png_read_image\n"); png_debug(1, "in png_read_image\n");
/* save jump buffer and error functions */
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
pass = png_set_interlace_handling(png_ptr); pass = png_set_interlace_handling(png_ptr);
@ -878,7 +883,6 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
png_uint_32 length; png_uint_32 length;
png_debug(1, "in png_read_end\n"); png_debug(1, "in png_read_end\n");
/* save jump buffer and error functions */
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
do do
@ -1068,7 +1072,6 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
#endif #endif
png_debug(1, "in png_destroy_read_struct\n"); png_debug(1, "in png_destroy_read_struct\n");
/* save jump buffer and error functions */
if (png_ptr_ptr != NULL) if (png_ptr_ptr != NULL)
png_ptr = *png_ptr_ptr; png_ptr = *png_ptr_ptr;
@ -1141,7 +1144,6 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
#endif #endif
png_debug(1, "in png_read_destroy\n"); png_debug(1, "in png_read_destroy\n");
/* save jump buffer and error functions */
if (info_ptr != NULL) if (info_ptr != NULL)
png_info_destroy(png_ptr, info_ptr); png_info_destroy(png_ptr, info_ptr);
@ -1237,6 +1239,12 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->save_buffer); png_free(png_ptr, png_ptr->save_buffer);
#endif #endif
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
#ifdef PNG_TEXT_SUPPORTED
png_free(png_ptr, png_ptr->current_text);
#endif /* PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
/* Save the important info out of the png_struct, in case it is /* Save the important info out of the png_struct, in case it is
* being used again. * being used again.
*/ */

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -39,7 +39,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
read_data function and use it at run time with png_set_read_fn(), rather read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */ than changing the library. */
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
static void /* PRIVATE */ void PNGAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_size_t check; png_size_t check;
@ -140,7 +140,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
if (read_data_fn != NULL) if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn; png_ptr->read_data_fn = read_data_fn;
else else
png_ptr->read_data_fn = (png_rw_ptr)png_default_read_data; png_ptr->read_data_fn = png_default_read_data;
#else #else
png_ptr->read_data_fn = read_data_fn; png_ptr->read_data_fn = read_data_fn;
#endif #endif

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -167,15 +167,14 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
Perhaps not the best solution, but good enough. */ Perhaps not the best solution, but good enough. */
int i; int i;
png_bytep sort;
/* initialize an array to sort colors */ /* initialize an array to sort colors */
sort = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr,
* sizeof (png_byte))); (png_uint_32)(num_palette * sizeof (png_byte)));
/* initialize the sort array */ /* initialize the dither_sort array */
for (i = 0; i < num_palette; i++) for (i = 0; i < num_palette; i++)
sort[i] = (png_byte)i; png_ptr->dither_sort[i] = (png_byte)i;
/* Find the least used palette entries by starting a /* Find the least used palette entries by starting a
bubble sort, and running it until we have sorted bubble sort, and running it until we have sorted
@ -191,13 +190,14 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
done = 1; done = 1;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
{ {
if (histogram[sort[j]] < histogram[sort[j + 1]]) if (histogram[png_ptr->dither_sort[j]]
< histogram[png_ptr->dither_sort[j + 1]])
{ {
png_byte t; png_byte t;
t = sort[j]; t = png_ptr->dither_sort[j];
sort[j] = sort[j + 1]; png_ptr->dither_sort[j] = png_ptr->dither_sort[j + 1];
sort[j + 1] = t; png_ptr->dither_sort[j + 1] = t;
done = 0; done = 0;
} }
} }
@ -214,11 +214,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
move the others */ move the others */
for (i = 0; i < maximum_colors; i++) for (i = 0; i < maximum_colors; i++)
{ {
if ((int)sort[i] >= maximum_colors) if ((int)png_ptr->dither_sort[i] >= maximum_colors)
{ {
do do
j--; j--;
while ((int)sort[j] >= maximum_colors); while ((int)png_ptr->dither_sort[j] >= maximum_colors);
palette[i] = palette[j]; palette[i] = palette[j];
} }
} }
@ -232,13 +232,13 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
for (i = 0; i < maximum_colors; i++) for (i = 0; i < maximum_colors; i++)
{ {
/* only move the colors we need to */ /* only move the colors we need to */
if ((int)sort[i] >= maximum_colors) if ((int)png_ptr->dither_sort[i] >= maximum_colors)
{ {
png_color tmp_color; png_color tmp_color;
do do
j--; j--;
while ((int)sort[j] >= maximum_colors); while ((int)png_ptr->dither_sort[j] >= maximum_colors);
tmp_color = palette[j]; tmp_color = palette[j];
palette[j] = palette[i]; palette[j] = palette[i];
@ -276,7 +276,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
} }
} }
} }
png_free(png_ptr, sort); png_free(png_ptr, png_ptr->dither_sort);
png_ptr->dither_sort=NULL;
} }
else else
{ {
@ -291,23 +292,22 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
int i; int i;
int max_d; int max_d;
int num_new_palette; int num_new_palette;
png_dsortp t;
png_dsortpp hash; png_dsortpp hash;
png_bytep index_to_palette;
/* where the original index currently is in the palette */ t=NULL;
png_bytep palette_to_index;
/* which original index points to this palette color */
/* initialize palette index arrays */ /* initialize palette index arrays */
index_to_palette = (png_bytep)png_malloc(png_ptr, png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(num_palette * sizeof (png_byte))); (png_uint_32)(num_palette * sizeof (png_byte)));
palette_to_index = (png_bytep)png_malloc(png_ptr, png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(num_palette * sizeof (png_byte))); (png_uint_32)(num_palette * sizeof (png_byte)));
/* initialize the sort array */ /* initialize the sort array */
for (i = 0; i < num_palette; i++) for (i = 0; i < num_palette; i++)
{ {
index_to_palette[i] = (png_byte)i; png_ptr->index_to_palette[i] = (png_byte)i;
palette_to_index[i] = (png_byte)i; png_ptr->palette_to_index[i] = (png_byte)i;
} }
hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 * hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
@ -342,18 +342,22 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
if (d <= max_d) if (d <= max_d)
{ {
png_dsortp t;
t = (png_dsortp)png_malloc(png_ptr, (png_uint_32)(sizeof t = (png_dsortp)png_malloc_warn(png_ptr,
(png_dsort))); (png_uint_32)(sizeof(png_dsort)));
if (t == NULL)
break;
t->next = hash[d]; t->next = hash[d];
t->left = (png_byte)i; t->left = (png_byte)i;
t->right = (png_byte)j; t->right = (png_byte)j;
hash[d] = t; hash[d] = t;
} }
} }
if (t == NULL)
break;
} }
if (t != NULL)
for (i = 0; i <= max_d; i++) for (i = 0; i <= max_d; i++)
{ {
if (hash[i] != NULL) if (hash[i] != NULL)
@ -362,8 +366,10 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
for (p = hash[i]; p; p = p->next) for (p = hash[i]; p; p = p->next)
{ {
if ((int)index_to_palette[p->left] < num_new_palette && if ((int)png_ptr->index_to_palette[p->left]
(int)index_to_palette[p->right] < num_new_palette) < num_new_palette &&
(int)png_ptr->index_to_palette[p->right]
< num_new_palette)
{ {
int j, next_j; int j, next_j;
@ -379,7 +385,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
} }
num_new_palette--; num_new_palette--;
palette[index_to_palette[j]] = palette[num_new_palette]; palette[png_ptr->index_to_palette[j]]
= palette[num_new_palette];
if (!full_dither) if (!full_dither)
{ {
int k; int k;
@ -387,23 +394,23 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
for (k = 0; k < num_palette; k++) for (k = 0; k < num_palette; k++)
{ {
if (png_ptr->dither_index[k] == if (png_ptr->dither_index[k] ==
index_to_palette[j]) png_ptr->index_to_palette[j])
png_ptr->dither_index[k] = png_ptr->dither_index[k] =
index_to_palette[next_j]; png_ptr->index_to_palette[next_j];
if ((int)png_ptr->dither_index[k] == if ((int)png_ptr->dither_index[k] ==
num_new_palette) num_new_palette)
png_ptr->dither_index[k] = png_ptr->dither_index[k] =
index_to_palette[j]; png_ptr->index_to_palette[j];
} }
} }
index_to_palette[palette_to_index[num_new_palette]] = png_ptr->index_to_palette[png_ptr->palette_to_index
index_to_palette[j]; [num_new_palette]] = png_ptr->index_to_palette[j];
palette_to_index[index_to_palette[j]] = png_ptr->palette_to_index[png_ptr->index_to_palette[j]]
palette_to_index[num_new_palette]; = png_ptr->palette_to_index[num_new_palette];
index_to_palette[j] = (png_byte)num_new_palette; png_ptr->index_to_palette[j] = (png_byte)num_new_palette;
palette_to_index[num_new_palette] = (png_byte)j; png_ptr->palette_to_index[num_new_palette] = (png_byte)j;
} }
if (num_new_palette <= maximum_colors) if (num_new_palette <= maximum_colors)
break; break;
@ -420,8 +427,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
png_dsortp p = hash[i]; png_dsortp p = hash[i];
while (p) while (p)
{ {
png_dsortp t;
t = p->next; t = p->next;
png_free(png_ptr, p); png_free(png_ptr, p);
p = t; p = t;
@ -432,8 +437,10 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
max_d += 96; max_d += 96;
} }
png_free(png_ptr, hash); png_free(png_ptr, hash);
png_free(png_ptr, palette_to_index); png_free(png_ptr, png_ptr->palette_to_index);
png_free(png_ptr, index_to_palette); png_free(png_ptr, png_ptr->index_to_palette);
png_ptr->palette_to_index=NULL;
png_ptr->index_to_palette=NULL;
} }
num_palette = maximum_colors; num_palette = maximum_colors;
} }
@ -872,7 +879,7 @@ png_init_read_transformations(png_structp png_ptr)
} }
} }
} }
/* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN)*/ /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
else else
/* color_type != PNG_COLOR_TYPE_PALETTE */ /* color_type != PNG_COLOR_TYPE_PALETTE */
{ {

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -200,7 +200,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
if (text == NULL) if (text == NULL)
{ {
text_size = prefix_size + sizeof(msg) + 1; text_size = prefix_size + sizeof(msg) + 1;
text = (png_charp)png_malloc(png_ptr, text_size); text = (png_charp)png_malloc_warn(png_ptr, text_size);
if (text == NULL)
{
png_free(png_ptr,chunkdata);
png_error(png_ptr,"Not enough memory to decompress chunk");
}
png_memcpy(text, chunkdata, prefix_size); png_memcpy(text, chunkdata, prefix_size);
} }
@ -218,7 +223,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
{ {
text_size = prefix_size + text_size = prefix_size +
png_ptr->zbuf_size - png_ptr->zstream.avail_out; png_ptr->zbuf_size - png_ptr->zstream.avail_out;
text = (png_charp)png_malloc(png_ptr, text_size + 1); text = (png_charp)png_malloc_warn(png_ptr, text_size + 1);
if (text == NULL)
{
png_free(png_ptr,chunkdata);
png_error(png_ptr,"Not enough memory to decompress chunk.");
}
png_memcpy(text + prefix_size, png_ptr->zbuf, png_memcpy(text + prefix_size, png_ptr->zbuf,
text_size - prefix_size); text_size - prefix_size);
png_memcpy(text, chunkdata, prefix_size); png_memcpy(text, chunkdata, prefix_size);
@ -229,8 +239,15 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp tmp; png_charp tmp;
tmp = text; tmp = text;
text = (png_charp)png_malloc(png_ptr, (png_uint_32)(text_size + text = (png_charp)png_malloc_warn(png_ptr,
(png_uint_32)(text_size +
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1)); png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
if (text == NULL)
{
png_free(png_ptr, tmp);
png_free(png_ptr, chunkdata);
png_error(png_ptr,"Not enough memory to decompress chunk..");
}
png_memcpy(text, tmp, text_size); png_memcpy(text, tmp, text_size);
png_free(png_ptr, tmp); png_free(png_ptr, tmp);
png_memcpy(text + text_size, png_ptr->zbuf, png_memcpy(text + text_size, png_ptr->zbuf,
@ -269,7 +286,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
text_size=prefix_size; text_size=prefix_size;
if (text == NULL) if (text == NULL)
{ {
text = (png_charp)png_malloc(png_ptr, text_size+1); text = (png_charp)png_malloc_warn(png_ptr, text_size+1);
if (text == NULL)
{
png_free(png_ptr, chunkdata);
png_error(png_ptr,"Not enough memory for text.");
}
png_memcpy(text, chunkdata, prefix_size); png_memcpy(text, chunkdata, prefix_size);
} }
*(text + text_size) = 0x00; *(text + text_size) = 0x00;
@ -1193,7 +1215,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void /* PRIVATE */ void /* PRIVATE */
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_byte readbuf[PNG_MAX_PALETTE_LENGTH]; png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
png_debug(1, "in png_handle_tRNS\n"); png_debug(1, "in png_handle_tRNS\n");
@ -1376,7 +1398,7 @@ void /* PRIVATE */
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
int num, i; int num, i;
png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH]; png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
png_debug(1, "in png_handle_hIST\n"); png_debug(1, "in png_handle_hIST\n");
@ -1542,7 +1564,12 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n", png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n",
length + 1); length + 1);
purpose = (png_charp)png_malloc(png_ptr, length + 1); purpose = (png_charp)png_malloc_warn(png_ptr, length + 1);
if (purpose == NULL)
{
png_warning(png_ptr, "No memory for pCAL purpose.");
return;
}
slength = (png_size_t)length; slength = (png_size_t)length;
png_crc_read(png_ptr, (png_bytep)purpose, slength); png_crc_read(png_ptr, (png_bytep)purpose, slength);
@ -1597,8 +1624,14 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Empty loop to move past the units string. */ ; /* Empty loop to move past the units string. */ ;
png_debug(3, "Allocating pCAL parameters array\n"); png_debug(3, "Allocating pCAL parameters array\n");
params = (png_charpp)png_malloc(png_ptr, (png_uint_32)(nparams params = (png_charpp)png_malloc_warn(png_ptr, (png_uint_32)(nparams
*sizeof(png_charp))) ; *sizeof(png_charp))) ;
if (params == NULL)
{
png_free(png_ptr, purpose);
png_warning(png_ptr, "No memory for pCAL params.");
return;
}
/* Get pointers to the start of each parameter string. */ /* Get pointers to the start of each parameter string. */
for (i = 0; i < (int)nparams; i++) for (i = 0; i < (int)nparams; i++)
@ -1662,7 +1695,12 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n", png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n",
length + 1); length + 1);
buffer = (png_charp)png_malloc(png_ptr, length + 1); buffer = (png_charp)png_malloc_warn(png_ptr, length + 1);
if (buffer == NULL)
{
png_warning(png_ptr, "Out of memory while processing sCAL chunk");
return;
}
slength = (png_size_t)length; slength = (png_size_t)length;
png_crc_read(png_ptr, (png_bytep)buffer, slength); png_crc_read(png_ptr, (png_bytep)buffer, slength);
@ -1685,7 +1723,12 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
swidth = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1); swidth = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1);
if (swidth == NULL)
{
png_warning(png_ptr, "Out of memory while processing sCAL chunk width");
return;
}
png_memcpy(swidth, ep, (png_size_t)png_strlen(ep)); png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
#endif #endif
#endif #endif
@ -1703,7 +1746,12 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
sheight = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1); sheight = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1);
if (swidth == NULL)
{
png_warning(png_ptr, "Out of memory while processing sCAL chunk height");
return;
}
png_memcpy(sheight, ep, (png_size_t)png_strlen(ep)); png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
#endif #endif
#endif #endif
@ -1793,6 +1841,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_charp text; png_charp text;
png_uint_32 skip = 0; png_uint_32 skip = 0;
png_size_t slength; png_size_t slength;
int ret;
png_debug(1, "in png_handle_tEXt\n"); png_debug(1, "in png_handle_tEXt\n");
@ -1811,7 +1860,12 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
#endif #endif
key = (png_charp)png_malloc(png_ptr, length + 1); key = (png_charp)png_malloc_warn(png_ptr, length + 1);
if (key == NULL)
{
png_warning(png_ptr, "No memory to process text chunk.");
return;
}
slength = (png_size_t)length; slength = (png_size_t)length;
png_crc_read(png_ptr, (png_bytep)key, slength); png_crc_read(png_ptr, (png_bytep)key, slength);
@ -1829,7 +1883,13 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (text != key + slength) if (text != key + slength)
text++; text++;
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text)); text_ptr = (png_textp)png_malloc_warn(png_ptr, (png_uint_32)sizeof(png_text));
if (text_ptr == NULL)
{
png_warning(png_ptr, "Not enough memory to process text chunk.");
png_free(png_ptr, key);
return;
}
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr->key = key; text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED #ifdef PNG_iTXt_SUPPORTED
@ -1840,10 +1900,12 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
text_ptr->text = text; text_ptr->text = text;
text_ptr->text_length = png_strlen(text); text_ptr->text_length = png_strlen(text);
png_set_text(png_ptr, info_ptr, text_ptr, 1); ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_free(png_ptr, key); png_free(png_ptr, key);
png_free(png_ptr, text_ptr); png_free(png_ptr, text_ptr);
if (ret)
png_warning(png_ptr, "Insufficient memory to process text chunk.");
} }
#endif #endif
@ -1856,6 +1918,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_charp chunkdata; png_charp chunkdata;
png_charp text; png_charp text;
int comp_type; int comp_type;
int ret;
png_size_t slength, prefix_len, data_len; png_size_t slength, prefix_len, data_len;
png_debug(1, "in png_handle_zTXt\n"); png_debug(1, "in png_handle_zTXt\n");
@ -1876,8 +1939,13 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
#endif #endif
chunkdata = (png_charp)png_malloc(png_ptr, length + 1); chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
slength = (png_size_t)length; if (chunkdata == NULL)
{
png_warning(png_ptr,"Out of memory processing zTXt chunk.");
return;
}
slength = (png_size_t)length;
png_crc_read(png_ptr, (png_bytep)chunkdata, slength); png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
if (png_crc_finish(png_ptr, 0)) if (png_crc_finish(png_ptr, 0))
{ {
@ -1911,7 +1979,13 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata, chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata,
(png_size_t)length, prefix_len, &data_len); (png_size_t)length, prefix_len, &data_len);
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text)); text_ptr = (png_textp)png_malloc_warn(png_ptr, (png_uint_32)sizeof(png_text));
if (text_ptr == NULL)
{
png_warning(png_ptr,"Not enough memory to process zTXt chunk.");
png_free(png_ptr, chunkdata);
return;
}
text_ptr->compression = comp_type; text_ptr->compression = comp_type;
text_ptr->key = chunkdata; text_ptr->key = chunkdata;
#ifdef PNG_iTXt_SUPPORTED #ifdef PNG_iTXt_SUPPORTED
@ -1922,10 +1996,12 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
text_ptr->text = chunkdata + prefix_len; text_ptr->text = chunkdata + prefix_len;
text_ptr->text_length = data_len; text_ptr->text_length = data_len;
png_set_text(png_ptr, info_ptr, text_ptr, 1); ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_free(png_ptr, text_ptr); png_free(png_ptr, text_ptr);
png_free(png_ptr, chunkdata); png_free(png_ptr, chunkdata);
if (ret)
png_error(png_ptr, "Insufficient memory to store zTXt chunk.");
} }
#endif #endif
@ -1939,6 +2015,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_charp key, lang, text, lang_key; png_charp key, lang, text, lang_key;
int comp_flag; int comp_flag;
int comp_type = 0; int comp_type = 0;
int ret;
png_size_t slength, prefix_len, data_len; png_size_t slength, prefix_len, data_len;
png_debug(1, "in png_handle_iTXt\n"); png_debug(1, "in png_handle_iTXt\n");
@ -1960,7 +2037,12 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
#endif #endif
chunkdata = (png_charp)png_malloc(png_ptr, length + 1); chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
if (chunkdata == NULL)
{
png_warning(png_ptr, "No memory to process iTXt chunk.");
return;
}
slength = (png_size_t)length; slength = (png_size_t)length;
png_crc_read(png_ptr, (png_bytep)chunkdata, slength); png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
if (png_crc_finish(png_ptr, 0)) if (png_crc_finish(png_ptr, 0))
@ -2006,7 +2088,13 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
(size_t)length, prefix_len, &data_len); (size_t)length, prefix_len, &data_len);
else else
data_len=png_strlen(chunkdata + prefix_len); data_len=png_strlen(chunkdata + prefix_len);
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text)); text_ptr = (png_textp)png_malloc_warn(png_ptr, (png_uint_32)sizeof(png_text));
if (text_ptr == NULL)
{
png_warning(png_ptr,"Not enough memory to process iTXt chunk.");
png_free(png_ptr, chunkdata);
return;
}
text_ptr->compression = (int)comp_flag + 1; text_ptr->compression = (int)comp_flag + 1;
text_ptr->lang_key = chunkdata+(lang_key-key); text_ptr->lang_key = chunkdata+(lang_key-key);
text_ptr->lang = chunkdata+(lang-key); text_ptr->lang = chunkdata+(lang-key);
@ -2015,10 +2103,12 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
text_ptr->key = chunkdata; text_ptr->key = chunkdata;
text_ptr->text = chunkdata + prefix_len; text_ptr->text = chunkdata + prefix_len;
png_set_text(png_ptr, info_ptr, text_ptr, 1); ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_free(png_ptr, text_ptr); png_free(png_ptr, text_ptr);
png_free(png_ptr, chunkdata); png_free(png_ptr, chunkdata);
if (ret)
png_error(png_ptr, "Insufficient memory to store iTXt chunk.");
} }
#endif #endif
@ -2084,7 +2174,10 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (!(png_ptr->chunk_name[0] & 0x20)) if (!(png_ptr->chunk_name[0] & 0x20))
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
HANDLE_CHUNK_ALWAYS) HANDLE_CHUNK_ALWAYS)
{
png_free(png_ptr, chunk.data);
png_chunk_error(png_ptr, "unknown critical chunk"); png_chunk_error(png_ptr, "unknown critical chunk");
}
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1); png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
} }
} }

112
pngset.c
View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -200,7 +200,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
void PNGAPI void PNGAPI
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
{ {
int i; int i;
png_debug1(1, "in %s storage function\n", "hIST"); png_debug1(1, "in %s storage function\n", "hIST");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
@ -216,8 +216,13 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
#endif #endif
/* Changed from info->num_palette to 256 in version 1.2.1 */ /* Changed from info->num_palette to 256 in version 1.2.1 */
png_ptr->hist = (png_uint_16p)png_malloc(png_ptr, png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
(png_uint_32)(256 * sizeof (png_uint_16))); (png_uint_32)(256 * sizeof (png_uint_16)));
if (png_ptr->hist == NULL)
{
png_warning(png_ptr, "Insufficient memory for hIST chunk data.");
return;
}
for (i = 0; i < info_ptr->num_palette; i++) for (i = 0; i < info_ptr->num_palette; i++)
png_ptr->hist[i] = hist[i]; png_ptr->hist[i] = hist[i];
@ -305,7 +310,9 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
info_ptr->compression_type = (png_byte)compression_type; info_ptr->compression_type = (png_byte)compression_type;
info_ptr->filter_type = (png_byte)filter_type; info_ptr->filter_type = (png_byte)filter_type;
info_ptr->interlace_type = (png_byte)interlace_type; info_ptr->interlace_type = (png_byte)interlace_type;
if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
info_ptr->channels = 1;
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
info_ptr->channels = 3; info_ptr->channels = 3;
else else
info_ptr->channels = 1; info_ptr->channels = 1;
@ -315,7 +322,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
/* check for overflow */ /* check for overflow */
rowbytes_per_pixel = (info_ptr->pixel_depth + 7) >> 3; rowbytes_per_pixel = (info_ptr->pixel_depth + 7) >> 3;
if (( width > PNG_MAX_UINT/rowbytes_per_pixel)) if ( width > PNG_MAX_UINT/rowbytes_per_pixel - 64)
{ {
png_warning(png_ptr, png_warning(png_ptr,
"Width too large to process image data; rowbytes will overflow."); "Width too large to process image data; rowbytes will overflow.");
@ -356,7 +363,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
length = png_strlen(purpose) + 1; length = png_strlen(purpose) + 1;
png_debug1(3, "allocating purpose for info (%lu bytes)\n", length); png_debug1(3, "allocating purpose for info (%lu bytes)\n", length);
info_ptr->pcal_purpose = (png_charp)png_malloc(png_ptr, length); info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_purpose == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL purpose.");
return;
}
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length); png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
png_debug(3, "storing X0, X1, type, and nparams in info\n"); png_debug(3, "storing X0, X1, type, and nparams in info\n");
@ -367,11 +379,21 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
length = png_strlen(units) + 1; length = png_strlen(units) + 1;
png_debug1(3, "allocating units for info (%lu bytes)\n", length); png_debug1(3, "allocating units for info (%lu bytes)\n", length);
info_ptr->pcal_units = (png_charp)png_malloc(png_ptr, length); info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_units == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL units.");
return;
}
png_memcpy(info_ptr->pcal_units, units, (png_size_t)length); png_memcpy(info_ptr->pcal_units, units, (png_size_t)length);
info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr, info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr,
(png_uint_32)((nparams + 1) * sizeof(png_charp))); (png_uint_32)((nparams + 1) * sizeof(png_charp)));
if (info_ptr->pcal_params == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL params.");
return;
}
info_ptr->pcal_params[nparams] = NULL; info_ptr->pcal_params[nparams] = NULL;
@ -379,7 +401,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
{ {
length = png_strlen(params[i]) + 1; length = png_strlen(params[i]) + 1;
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length); png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length);
info_ptr->pcal_params[i] = (png_charp)png_malloc(png_ptr, length); info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_params[i] == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL parameter.");
return;
}
png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length); png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);
} }
@ -625,6 +652,16 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
void PNGAPI void PNGAPI
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text) int num_text)
{
int ret;
ret=png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
if (ret)
png_error(png_ptr, "Insufficient memory to store text");
}
int /* PRIVATE */
png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text)
{ {
int i; int i;
@ -632,7 +669,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
"text" : (png_const_charp)png_ptr->chunk_name)); "text" : (png_const_charp)png_ptr->chunk_name));
if (png_ptr == NULL || info_ptr == NULL || num_text == 0) if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
return; return(0);
/* Make sure we have enough space in the "text" array in info_struct /* Make sure we have enough space in the "text" array in info_struct
* to hold all of the incoming text_ptr objects. * to hold all of the incoming text_ptr objects.
@ -647,8 +684,13 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
old_max = info_ptr->max_text; old_max = info_ptr->max_text;
info_ptr->max_text = info_ptr->num_text + num_text + 8; info_ptr->max_text = info_ptr->num_text + num_text + 8;
old_text = info_ptr->text; old_text = info_ptr->text;
info_ptr->text = (png_textp)png_malloc(png_ptr, info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
(png_uint_32)(info_ptr->max_text * sizeof (png_text))); (png_uint_32)(info_ptr->max_text * sizeof (png_text)));
if (info_ptr->text == NULL)
{
png_free(png_ptr, old_text);
return(1);
}
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max * png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
sizeof(png_text))); sizeof(png_text)));
png_free(png_ptr, old_text); png_free(png_ptr, old_text);
@ -657,8 +699,10 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
{ {
info_ptr->max_text = num_text + 8; info_ptr->max_text = num_text + 8;
info_ptr->num_text = 0; info_ptr->num_text = 0;
info_ptr->text = (png_textp)png_malloc(png_ptr, info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
(png_uint_32)(info_ptr->max_text * sizeof (png_text))); (png_uint_32)(info_ptr->max_text * sizeof (png_text)));
if (info_ptr->text == NULL)
return(1);
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_TEXT; info_ptr->free_me |= PNG_FREE_TEXT;
#endif #endif
@ -718,8 +762,10 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
textp->compression = text_ptr[i].compression; textp->compression = text_ptr[i].compression;
} }
textp->key = (png_charp)png_malloc(png_ptr, textp->key = (png_charp)png_malloc_warn(png_ptr,
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4)); (png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
if (textp->key == NULL)
return(1);
png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n", png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n",
(png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4), (png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key); (int)textp->key);
@ -770,6 +816,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr->num_text++; info_ptr->num_text++;
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
} }
return(0);
} }
#endif #endif
@ -799,10 +846,10 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
if (trans != NULL) if (trans != NULL)
{ {
/* /*
* It may not actually be necessary to set png_ptr->trans here; * It may not actually be necessary to set png_ptr->trans here;
* we do it for backward compatibility with the way the png_handle_tRNS * we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation. * function used to do the allocation.
*/ */
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
#endif #endif
@ -837,8 +884,13 @@ png_set_sPLT(png_structp png_ptr,
png_sPLT_tp np; png_sPLT_tp np;
int i; int i;
np = (png_sPLT_tp)png_malloc(png_ptr, np = (png_sPLT_tp)png_malloc_warn(png_ptr,
(info_ptr->splt_palettes_num + nentries) * sizeof(png_sPLT_t)); (info_ptr->splt_palettes_num + nentries) * sizeof(png_sPLT_t));
if (np == NULL)
{
png_warning(png_ptr, "No memory for sPLT palettes.");
return;
}
png_memcpy(np, info_ptr->splt_palettes, png_memcpy(np, info_ptr->splt_palettes,
info_ptr->splt_palettes_num * sizeof(png_sPLT_t)); info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
@ -881,9 +933,14 @@ png_set_unknown_chunks(png_structp png_ptr,
if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0) if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0)
return; return;
np = (png_unknown_chunkp)png_malloc(png_ptr, np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
(info_ptr->unknown_chunks_num + num_unknowns) * (info_ptr->unknown_chunks_num + num_unknowns) *
sizeof(png_unknown_chunk)); sizeof(png_unknown_chunk));
if (np == NULL)
{
png_warning(png_ptr, "Out of memory while processing unknown chunk.");
return;
}
png_memcpy(np, info_ptr->unknown_chunks, png_memcpy(np, info_ptr->unknown_chunks,
info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk)); info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
@ -897,11 +954,16 @@ png_set_unknown_chunks(png_structp png_ptr,
png_strcpy((png_charp)to->name, (png_charp)from->name); png_strcpy((png_charp)to->name, (png_charp)from->name);
to->data = (png_bytep)png_malloc(png_ptr, from->size); to->data = (png_bytep)png_malloc(png_ptr, from->size);
png_memcpy(to->data, from->data, from->size); if (to->data == NULL)
to->size = from->size; png_warning(png_ptr, "Out of memory while processing unknown chunk.");
else
{
png_memcpy(to->data, from->data, from->size);
to->size = from->size;
/* note our location in the read or write sequence */ /* note our location in the read or write sequence */
to->location = (png_byte)(png_ptr->mode & 0xff); to->location = (png_byte)(png_ptr->mode & 0xff);
}
} }
info_ptr->unknown_chunks = np; info_ptr->unknown_chunks = np;
@ -1079,8 +1141,8 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
* so first zero them out of the master copy, then logical-OR in the * so first zero them out of the master copy, then logical-OR in the
* allowed subset that was requested */ * allowed subset that was requested */
png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */ png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */
png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */ png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */
} }
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -64,7 +64,7 @@
#endif #endif
#if !PNG_DEBUG #if !PNG_DEBUG
# define SINGLE_ROWBUF_ALLOC /* makes buffer overruns easier to nail */ # define SINGLE_ROWBUF_ALLOC /* makes buffer overruns easier to nail */
#endif #endif
/* Turn on CPU timing /* Turn on CPU timing
@ -117,7 +117,13 @@ static int status_dots_requested=0;
static int status_dots=1; static int status_dots=1;
void void
#ifdef PNG_1_0_X
PNGAPI
#endif
read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
#ifdef PNG_1_0_X
PNGAPI
#endif
void void
read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
{ {
@ -137,8 +143,14 @@ read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
fprintf(stdout, "r"); fprintf(stdout, "r");
} }
#ifdef PNG_1_0_X
PNGAPI
#endif
void void
write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
#ifdef PNG_1_0_X
PNGAPI
#endif
void void
write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
{ {
@ -153,8 +165,14 @@ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
5 in case illegal filter values are present.) */ 5 in case illegal filter values are present.) */
static png_uint_32 filters_used[256]; static png_uint_32 filters_used[256];
void void
#ifdef PNG_1_0_X
PNGAPI
#endif
count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data); count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data);
void void
#ifdef PNG_1_0_X
PNGAPI
#endif
count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data) count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
{ {
if(png_ptr != NULL && row_info != NULL) if(png_ptr != NULL && row_info != NULL)
@ -169,8 +187,14 @@ count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
static png_uint_32 zero_samples; static png_uint_32 zero_samples;
void void
#ifdef PNG_1_0_X
PNGAPI
#endif
count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data); count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data);
void void
#ifdef PNG_1_0_X
PNGAPI
#endif
count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
{ {
png_bytep dp = data; png_bytep dp = data;
@ -663,6 +687,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
{ {
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
if (row_buf)
png_free(read_ptr, row_buf);
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_info_struct(write_ptr, &write_end_info_ptr);
@ -1512,4 +1538,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_13 your_png_h_is_not_version_1_0_13; typedef version_1_0_14 your_png_h_is_not_version_1_0_14;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -2,7 +2,7 @@
* *
* For Intel x86 CPU and Microsoft Visual C++ compiler * For Intel x86 CPU and Microsoft Visual C++ compiler
* *
* libpng version 1.0.13 - April 15, 2002 * libpng version 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, Intel Corporation

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -40,7 +40,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
write_data function and use it at run time with png_set_write_fn(), rather write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */ than changing the library. */
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
static void /* PRIVATE */ void PNGAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_uint_32 check;
@ -63,7 +63,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024 #define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b) #define MIN(a,b) (a <= b ? a : b)
static void /* PRIVATE */ void PNGAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_uint_32 check;
@ -126,7 +126,7 @@ png_flush(png_structp png_ptr)
} }
#if !defined(PNG_NO_STDIO) #if !defined(PNG_NO_STDIO)
static void /* PRIVATE */ void PNGAPI
png_default_flush(png_structp png_ptr) png_default_flush(png_structp png_ptr)
{ {
#if !defined(_WIN32_WCE) #if !defined(_WIN32_WCE)
@ -171,7 +171,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
if (write_data_fn != NULL) if (write_data_fn != NULL)
png_ptr->write_data_fn = write_data_fn; png_ptr->write_data_fn = write_data_fn;
else else
png_ptr->write_data_fn = (png_rw_ptr)png_default_write_data; png_ptr->write_data_fn = png_default_write_data;
#else #else
png_ptr->write_data_fn = write_data_fn; png_ptr->write_data_fn = write_data_fn;
#endif #endif
@ -181,7 +181,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
if (output_flush_fn != NULL) if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn; png_ptr->output_flush_fn = output_flush_fn;
else else
png_ptr->output_flush_fn = (png_flush_ptr)png_default_flush; png_ptr->output_flush_fn = png_default_flush;
#else #else
png_ptr->output_flush_fn = output_flush_fn; png_ptr->output_flush_fn = output_flush_fn;
#endif #endif

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -530,7 +530,20 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
1, png_doublep_NULL, png_doublep_NULL); 1, png_doublep_NULL, png_doublep_NULL);
#endif #endif
return ((png_structp)png_ptr); #ifdef PNG_SETJMP_SUPPORTED
/* Applications that neglect to set up their own setjmp() and then encounter
a png_error() will longjmp here. Since the jmpbuf is then meaningless we
abort instead of returning. */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
PNG_ABORT();
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
#else
if (setjmp(png_ptr->jmpbuf))
PNG_ABORT();
#endif
#endif
return (png_ptr);
} }
/* Initialize png_ptr structure, and allocate any memory needed */ /* Initialize png_ptr structure, and allocate any memory needed */
@ -542,7 +555,6 @@ png_write_init(png_structp png_ptr)
png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0); png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
} }
#undef png_write_init_2
void PNGAPI void PNGAPI
png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_size_t png_struct_size, png_size_t png_info_size) png_size_t png_struct_size, png_size_t png_info_size)

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* libpng 1.0.13 - April 15, 2002 * libpng 1.0.14 - July 8, 2002
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,5 +1,5 @@
Microsoft Developer Studio Build File, Format Version 6.00 for Microsoft Developer Studio Build File, Format Version 6.00 for
libpng 1.0.13 (April 15, 2002) and zlib libpng 1.0.14 (July 8, 2002) and zlib
Copyright (C) 2000 Simon-Pierre Cadieux Copyright (C) 2000 Simon-Pierre Cadieux
For conditions of distribution and use, see copyright notice in png.h For conditions of distribution and use, see copyright notice in png.h

View File

@ -6,7 +6,7 @@ LIBRARY
DESCRIPTION "PNG image compression library for Windows" DESCRIPTION "PNG image compression library for Windows"
EXPORTS EXPORTS
;Version 1.0.13 ;Version 1.0.14
png_build_grayscale_palette @1 png_build_grayscale_palette @1
png_check_sig @2 png_check_sig @2
png_chunk_error @3 png_chunk_error @3

View File

@ -1,6 +1,6 @@
A set of project files is available for Netware. Get A set of project files is available for Netware. Get
libpng-1.0.13-project-netware.zip from a libpng distribution libpng-1.0.14-project-netware.zip from a libpng distribution
site such as http://libpng.sourceforge.net site such as http://libpng.sourceforge.net
Put the zip file in this directory (projects) and then run Put the zip file in this directory (projects) and then run
"unzip -a libpng-1.0.13-project-netware.zip" "unzip -a libpng-1.0.14-project-netware.zip"

View File

@ -1,6 +1,6 @@
A set of project files is available for WinCE. Get A set of project files is available for WinCE. Get
libpng-1.0.13-project-wince.zip from a libpng distribution libpng-1.0.14-project-wince.zip from a libpng distribution
site such as http://libpng.sourceforge.net site such as http://libpng.sourceforge.net
Put the zip file in this directory (projects) and then run Put the zip file in this directory (projects) and then run
"unzip -a libpng-1.0.13-project-wince.zip" "unzip -a libpng-1.0.14-project-wince.zip"

70
scripts/libpng-config-body.in Executable file
View File

@ -0,0 +1,70 @@
usage()
{
cat <<EOF
Usage: libpng-config [OPTION] ...
Known values for OPTION are:
--prefix print libpng prefix
--libs print library linking information
--cflags print compiler flags
--cppflags print pre-processor flags
--ldflags print loader flags
--rpath print path to shared library
--help display this help and exit
--version output version information
EOF
exit $1
}
if test $# -eq 0; then
usage 1
fi
while test $# -gt 0; do
case "$1" in
--prefix)
echo ${prefix}
;;
--version)
echo ${version}
exit 0
;;
--help)
usage 0
;;
--cflags)
echo ${cflags}
;;
--cppflags)
echo ${cppflags}
;;
--libs)
echo ${libs}
;;
--rpath)
echo ${rpath}
;;
--ldflags)
echo ${ldflags}
;;
*)
usage
exit 1
;;
esac
shift
done
exit 0

18
scripts/libpng-config-head.in Executable file
View File

@ -0,0 +1,18 @@
#! /bin/sh
# libpng-config
# provides configuration info for libpng.
# Copyright (C) 2002 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h
# Modeled after libxml-config.
version=1.0.14
prefix=""
cppflags=""
cflags=""
ldflags=""
libs=""
rpath=""

View File

@ -6,6 +6,6 @@ includedir=${exec_prefix}/include
Name: libpng10 Name: libpng10
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.0.13 Version: 1.0.14
Libs: -L${libdir} -lpng10 Libs: -L${libdir} -lpng10 -lz -lm
Cflags: -I${includedir}/libpng10 Cflags: -I${includedir}/libpng10

View File

@ -1,4 +1,4 @@
# makefile for libpng on Solaris 2.x with gcc # makefile for libpng on Solaris 2.x with cc
# Contributed by William L. Sebok, based on makefile.linux # Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 2002 Glenn Randers-Pehrson # Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs # Copyright (C) 1998 Greg Roelofs
@ -33,11 +33,28 @@ RANLIB=echo
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -50,12 +67,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
all: libpng.a $(LIBNAME).so pngtest all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"-xtarget=ultra\"; \
echo ldflags=\"-xtarget=ultra -L$(LIBPATH) -R$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -85,42 +115,78 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm $(INCPATH)/libpng -@/bin/rm $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/libpng10.pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/libpng10.pc
chmod 644 $(DL)/pkgconfig/libpng10.pc
(cd $(DL)/pkgconfig; ln -f -s libpng10.pc libpng.pc)
install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/libpng10-config
cp libpng-config $(DB)/libpng10-config
chmod 755 $(DB)/libpng10-config
(cd $(DB); ln -sf libpng10-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs` \
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)*
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -1,4 +1,4 @@
# makefile for libpng on Solaris 2.x with gcc # makefile for libpng on Solaris 2.x with cc
# Contributed by William L. Sebok, based on makefile.linux # Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 2002 Glenn Randers-Pehrson # Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs # Copyright (C) 1998 Greg Roelofs
@ -33,11 +33,28 @@ RANLIB=echo
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -50,12 +67,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
all: libpng.a $(LIBNAME).so pngtest all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"-xtarget=ultra -xarch=v9\"; \
echo ldflags=\"-xtarget=ultra -xarch=v9 -L$(LIBPATH) -R$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -85,42 +115,78 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm $(INCPATH)/libpng -@/bin/rm $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs` \
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)*
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -1,7 +1,8 @@
# makefile for libpng using gcc (generic, static library) # makefile for libpng using gcc (generic, static library)
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 2000 Cosmin Truta # Copyright (C) 2000 Cosmin Truta
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# Location of the zlib library and include files # Location of the zlib library and include files
@ -15,16 +16,27 @@ AR = ar rcs
RANLIB = ranlib RANLIB = ranlib
RM = rm -f RM = rm -f
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DI=$(DESTDIR)/$(INCPATH)
DL=$(DESTDIR)/$(LIBPATH)
CDEBUG = -g -DPNG_DEBUG=5 CDEBUG = -g -DPNG_DEBUG=5
LDDEBUG = LDDEBUG =
CRELEASE = -O2 CRELEASE = -O2
@ -56,14 +68,16 @@ pngtest$(E): pngtest$(O) libpng$(A)
$(LD) -o $@ pngtest$(O) $(LDFLAGS) $(LD) -o $@ pngtest$(O) $(LDFLAGS)
install: libpng.a install: libpng.a
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/libpng ]; then mkdir $(INCPATH)/libpng; fi -@if [ ! -d $(DI)/libpng ]; then mkdir $(DI)/libpng; fi
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@rm $(INCPATH)/png.h -@rm $(DI)/png.h
-@rm $(INCPATH)/pngconf.h -@rm $(DI)/pngconf.h
cp png.h pngconf.h $(INCPATH)/libpng cp png.h pngconf.h $(DI)/libpng
chmod 644 $(INCPATH)/libpng/png.h $(INCPATH)/libpng/pngconf.h chmod 644 $(DI)/libpng/png.h \
cp libpng.a $(LIBPATH) $(DI)/libpng/pngconf.h
(cd $(DI); ln -f -s libpng/* .)
cp libpng.a $(DL)
clean: clean:
/bin/rm -f *.o libpng.a pngtest pngout.png /bin/rm -f *.o libpng.a pngtest pngout.png

View File

@ -1,4 +1,5 @@
# makefile for libpng # makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# modified for LC56/ATARI assumes libz.lib is in same dir and uses default # modified for LC56/ATARI assumes libz.lib is in same dir and uses default
@ -10,6 +11,18 @@ LDFLAGS=-lpng -lz -lm
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\ OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\ $(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
@ -25,12 +38,14 @@ pngtest.ttp: pngtest.o $(LBR)
$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o $(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
install: libpng.a install: libpng.a
-@mkdir $(prefix)/include -@mkdir $(DESTDIR)$(INCPATH)
-@mkdir $(prefix)/include/libpng -@mkdir $(DESTDIR)$(INCPATH)/libpng
-@mkdir $(prefix)/lib -@mkdir $(DESTDIR)$(LIBPATH)
-@rm -f $(prefix)/include/png.h -@rm -f $(DESTDIR)$(INCPATH)/png.h
-@rm -f $(prefix)/include/pngconf.h -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
cp png.h $(prefix)/include/libpng cp png.h $(DESTDIR)$(INCPATH)/libpng
cp pngconf.h $(prefix)/include/libpng cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
chmod 644 $(prefix)/include/libpng/png.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
chmod 644 $(prefix)/include/libpng/pngconf.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
ln -f -s $(LIBNAME)/* .)

View File

@ -11,10 +11,8 @@ CC=gcc
ZLIBLIB=/usr/local/lib ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include ZLIBINC=/usr/local/include
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
ALIGN= ALIGN=
@ -39,6 +37,24 @@ RANLIB=ranlib
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
LIBNAME=libpng10 LIBNAME=libpng10
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
@ -49,12 +65,25 @@ OBJSDLL = $(OBJS)
.SUFFIXES: .c .o .SUFFIXES: .c .o
all: libpng.a $(LIBNAME).so pngtest all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"\"; \
echo ldflags=\"-Wl,-soname=$(LIBNAME).so.$(PNGMAJ)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
cp $(LIBNAME).so* /boot/home/config/lib cp $(LIBNAME).so* /boot/home/config/lib
@ -74,45 +103,76 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) $(CFLAGS) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
pngtest pngout.png $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@ -1,15 +1,39 @@
# makefile for cygwin on x86 # makefile for cygwin on x86
# builds both dll (with import lib) and static lib versions # Builds both dll (with import lib) and static lib versions
# of the library, and builds two copies of pngtest: one # of the library, and builds two copies of pngtest: one
# statically linked and one dynamically linked. # statically linked and one dynamically linked.
# #
# Copyright (C) 2002 Soren Anderson, Charles Wilson, and Glenn Randers-Pehrson
# based on makefile for linux-elf w/mmx by: # based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000 Greg Roelofs # Copyright (C) 1998-2000 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# This makefile intends to support building outside the src directory
# if desired. When invoking it, specify an argument to SRCDIR on the
# command line that points to the top of the directory where your source
# is located.
ifdef SRCDIR
VPATH = $(SRCDIR)
else
SRCDIR = .
endif
# Override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
# To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to # To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to
# $CFLAGS, and include pnggccrd.o in $OBJS, below. # $CFLAGS, and include pnggccrd.o in $OBJS, below, and in the dependency
# list at the bottom of this makefile.
CC=gcc CC=gcc
ifdef MINGW ifdef MINGW
@ -17,12 +41,15 @@ MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
endif endif
# where "make install" puts libpng.a, libpng.so*, png.h, and pngconf.h # Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
ifndef prefix
prefix=/usr prefix=/usr
$(warning You haven't specified a 'prefix=' location. Defaulting to "/usr")
endif
# Where the zlib library and include files are located # Where the zlib library and include files are located
ZLIBLIB=${prefix}/lib ZLIBLIB= /usr/lib
ZLIBINC=${prefix}/include ZLIBINC=
#ZLIBLIB=../zlib #ZLIBLIB=../zlib
#ZLIBINC=../zlib #ZLIBINC=../zlib
@ -34,15 +61,25 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
#CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \ ### if you use the asm, add pnggccrd.o to the OBJS list
# -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5 ###
CFLAGS=$(MINGW_CCFLAGS) -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \ ### if you don't need thread safety, but want the asm accel
-fomit-frame-pointer #CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD \
# $(addprefix -I,$(ZLIBINC)) -Wall -O3 $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### if you need thread safety and want (minimal) asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_USE_PNGGCCRD $(addprefix -I,$(ZLIBINC)) \
# -Wall -O3 $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### Normal (non-asm) compilation
CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
-Wall -O3 $(ALIGN) -funroll-loops \
-fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
#PNGDLL = $10 PNGDLL = 10
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGMIN_BASE = 1.0.13
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(PNGDLL).dll SHAREDLIB=cygpng$(PNGDLL).dll
@ -52,19 +89,28 @@ SHAREDDEF=libpng.def
LIBS=$(SHAREDLIB) $(STATLIB) LIBS=$(SHAREDLIB) $(STATLIB)
EXE=.exe EXE=.exe
LDFLAGS=-L. $(MINGW_LDFLAGS) -L$(ZLIBLIB) -lpng -lz LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
LDSFLAGS=-shared -L. $(MINGW_LDFLAGS) -Wl,--enable-auto-image-base LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS) -Wl,--export-all)
LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(SHAREDDEF) LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
MKDIR=/bin/mkdir -pv
RANLIB=ranlib RANLIB=ranlib
#RANLIB=echo #RANLIB=echo
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
BINPATH=$(prefix)/bin BINPATH=$(prefix)/bin
MANPATH=$(prefix)/man MANPATH=$(prefix)/man
MAN3PATH=$(MANPATH)/man3 MAN3PATH=$(MANPATH)/man3
DOCPATH=$(prefix)/doc/libpng-$(PNGMIN_BASE) MAN5PATH=$(MANPATH)/man5
# cosmetic: shortened strings:
S =$(SRCDIR)
D =$(DESTDIR)
DB =$(D)$(BINPATH)
DI =$(D)$(INCPATH)
DL =$(D)$(LIBPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -72,37 +118,60 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
OBJSDLL = $(OBJS:.o=.pic.o) OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o .SUFFIXES: .c .o .pic.o
%.o : %.c %.o : %.c
$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
%.pic.o : CFLAGS += -DPNG_BUILD_DLL
%.pic.o : %.c %.pic.o : %.c
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
all: all-static all-shared all: all-static all-shared libpng.pc libpng-config libpng.pc libpng-config
# Make this to verify that "make [...] install" will do what you want.
buildsetup-tell:
@echo VPATH is set to: \"$(VPATH)\"
@echo prefix is set to: \"$(prefix)\"
@echo -e INCPATH,LIBPATH, etc. are set to:'\n' \
$(addprefix $(D),$(INCPATH)'\n' $(LIBPATH)'\n' $(BINPATH)'\n' \
$(MANPATH)'\n' $(MAN3PATH)'\n' $(MAN5PATH)'\n')'\n'
libpng.pc: scripts/libpng.pc.in
@echo -e Making pkg-config file for this libpng installation..'\n' \
using PREFIX=\"$(prefix)\"'\n'
cat $(S)/scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
sed -e s/-lm// > libpng.pc
libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
@echo -e Making $(LIBNAME) libpng-config file for this libpng \
installation..'\n' using PREFIX=\"$(prefix)\"'\n'
( cat $(S)/scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"\"; \
echo ldflags=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng$(PNGMAJ) -lz\"; \
cat $(S)/scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
static: all-static static: all-static
shared: all-shared shared: all-shared
all-static: $(STATLIB) pngtest-stat$(EXE) all-static: $(STATLIB) pngtest-stat$(EXE)
all-shared: $(SHAREDLIB) pngtest$(EXE) all-shared: $(SHAREDLIB) pngtest$(EXE)
pnggccrd.o: png.h pngconf.h pnggccrd.o: pnggccrd.c png.h pngconf.h
@echo "" @echo ""
@echo ' You can ignore the single "control reaches end of non-void function"' @echo ' You can ignore the "control reaches end of non-void function"'
@echo ' warning and multiple "<variable> defined but not used" warnings:' @echo ' warning and "<variable> defined but not used" warnings:'
@echo "" @echo ""
$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $*.c $(CC) -c $(CFLAGS) -o $@ $<
pnggccrd.pic.o: png.h pngconf.h pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
@echo "" @echo ""
@echo ' You can ignore the single "control reaches end of non-void function"' @echo ' You can ignore the "control reaches end of non-void function"'
@echo ' warning and multiple "<variable> defined but not used" warnings:' @echo ' warning and "<variable> defined but not used" warnings:'
@echo "" @echo ""
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ pnggccrd.c $(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
$(STATLIB): $(OBJS) $(STATLIB): $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
@ -113,7 +182,7 @@ $(SHAREDDEF): projects/msvc/png32ms.def
sed -e 's/\([^;]*\);/;/' > $@ sed -e 's/\([^;]*\);/;/' > $@
$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF) $(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
$(CC) $(LDSFLAGS) -o $@ $(LDEXTRA) $(OBJSDLL) -L. -L$(ZLIBLIB) -lz $(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
pngtest$(EXE): pngtest.pic.o $(SHAREDLIB) pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
@ -125,51 +194,93 @@ pngtest.pic.o: pngtest.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
pngtest.o: pngtest.c pngtest.o: pngtest.c
$(CC) $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
test: test-static test-shared test: test-static test-shared
test-static: pngtest-stat$(EXE) test-static: pngtest-stat$(EXE)
./pngtest-stat ./pngtest-stat $(S)/pngtest.png
test-shared: pngtest$(EXE) test-shared: pngtest$(EXE)
./pngtest ./pngtest $(S)/pngtest.png
install: install-static install-shared install-static: $(STATLIB) install-headers install-man
-@if [ ! -d $(DL) ]; then $(MKDIR) $(DL); fi
install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
-@rm -f $(DL)/$(STATLIB)
(cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
install-static: $(STATLIB) install-headers install-docs install-man install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
-@if [ ! -d $(LIBPATH) ]; then mkdir -p $(LIBPATH); fi -@if [ ! -d $(DL) ]; then $(MKDIR) $(DL); fi
install -m 755 $(STATLIB) $(LIBPATH) -@if [ ! -d $(DB) ]; then $(MKDIR) $(DB); fi
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR) $(DL)/pkgconfig; fi
install-shared: $(SHAREDLIB) install-headers install-docs install-man -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-@if [ ! -d $(LIBPATH) ]; then mkdir -p $(LIBPATH); fi -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
-@if [ ! -d $(BINPATH) ]; then mkdir -p $(BINPATH); fi install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
install -m 755 $(IMPLIB) $(LIBPATH) -@rm -f $(DL)/$(IMPLIB)
install -s -m 755 $(SHAREDLIB) $(BINPATH) (cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
install -s -m 755 $(SHAREDLIB) $(DB)
install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install-headers: install-headers:
-@if [ ! -d $(INCPATH)]; then mkdir -p $(INCPATH); fi -@if [ ! -d $(DI) ]; then $(MKDIR) $(DI); fi
-@if [ ! -d $(INCPATH)/libpng ]; then mkdir -p $(INCPATH)/libpng; fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR) $(DI)/$(LIBNAME); fi
-@rm -f ${INCPATH)/png.h -@rm -f $(DI)/png.h
-@rm -f ${INCPATH)/pngconf.h -@rm -f $(DI)/pngconf.h
install -m 644 png.h pngconf.h $(INCPATH) install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
-@rm -f $(DI)/libpng
install-docs: (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
-@if [ ! -d $(DOCPATH) ]; then mkdir -p $(DOCPATH); fi
install -m 644 $(DOCS) $(DOCPATH)
install-man: install-man:
-@if [ ! -d $(MAN3PATH) ]; then mkdir -p $(MAN3PATH); fi -@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR) $(D)$(MAN3PATH); fi
install -m 644 libpngpf.3 libpng.3 $(MAN3PATH) -@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR) $(D)$(MAN5PATH); fi
install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
# Run this to verify that a future `configure' run will pick up the settings
# you want.
test-config-install: SHELL=/bin/bash
test-config-install: $(DB)/libpng-config
@echo -e Testing libpng-config functions...'\n'
@ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
do \
printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
"$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
gytiu=$$(( $$gytiu + 1 )); \
done
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) $(CFLAGS) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) \
-o pngtesti$(EXE) `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti$(EXE) pngtest.png
clean: clean:
/bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \ /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
libpng-config libpng.pc pngtesti$(EXE)
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:
chmod a-w *.[ch35] $(DOCS) scripts/* chmod a-w *.[ch35] $(DOCS) scripts/*
.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h png.c png.o png.pic.o: png.h pngconf.h png.c
@ -190,3 +301,6 @@ pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
pngtest.o: png.h pngconf.h pngtest.c pngtest.o: png.h pngconf.h pngtest.c
pngtest-stat.o: png.h pngconf.h pngtest.c pngtest-stat.o: png.h pngconf.h pngtest.c

View File

@ -17,20 +17,35 @@ ZLIBINC=../zlib
CC=cc CC=cc
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz
#RANLIB=echo #RANLIB=echo
RANLIB=ranlib RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -43,12 +58,26 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -fno-common -o $@ $*.c $(CC) -c $(CFLAGS) -fno-common -o $@ $*.c
all: libpng.a $(LIBNAME).dylib pngtest all: libpng.a $(LIBNAME).dylib pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
sed -e s/-lm// > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"\"; \
echo ldflags=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib
ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib
@ -57,7 +86,7 @@ $(LIBNAME).$(PNGMAJ).dylib: $(LIBNAME).$(PNGVER).dylib
$(LIBNAME).$(PNGVER).dylib: $(OBJSDLL) $(LIBNAME).$(PNGVER).dylib: $(OBJSDLL)
$(CC) -dynamiclib \ $(CC) -dynamiclib \
-install_name $(LIBPATH)/$(LIBNAME).$(PNGMAJ).dylib \ -install_name $(DL)/$(LIBNAME).$(PNGMAJ).dylib \
-current_version $(PNGMIN) -compatibility_version $(PNGMIN) \ -current_version $(PNGMIN) -compatibility_version $(PNGMIN) \
-o $(LIBNAME).$(PNGVER).dylib \ -o $(LIBNAME).$(PNGVER).dylib \
$(OBJSDLL) -L$(ZLIBLIB) -lz $(OBJSDLL) -L$(ZLIBLIB) -lz
@ -69,45 +98,77 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).dylib install-shared: install-headers $(LIBNAME).dylib libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.dylib -@/bin/rm -f $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).dylib -@/bin/rm -f $(DL)/$(LIBNAME).dylib
-@/bin/rm -f $(LIBPATH)/libpng.dylib -@/bin/rm -f $(DL)/libpng.dylib
-@/bin/rm -f $(LIBPATH)/libpng.2.dylib -@/bin/rm -f $(DL)/libpng.3.dylib
-@/bin/rm -f $(LIBPATH)/libpng.2.*.dylib -@/bin/rm -f $(DL)/libpng.3.*.dylib
cp $(LIBNAME).$(PNGVER).dylib $(LIBPATH) cp $(LIBNAME).$(PNGVER).dylib $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).$(PNGVER).dylib chmod 755 $(DL)/$(LIBNAME).$(PNGVER).dylib
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).$(PNGVER).dylib libpng.dylib; \ ln -sf $(LIBNAME).$(PNGVER).dylib libpng.dylib; \
ln -sf $(LIBNAME).$(PNGVER).dylib libpng.2.dylib; \ ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.dylib; \
ln -sf $(LIBNAME).$(PNGVER).dylib libpng.2.$(PNGMIN).dylib; \ ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.$(PNGMIN).dylib; \
ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \ ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib) ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) $(CFLAGS) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
rm -f *.o libpng.a $(LIBNAME).*dylib pngtest pngout.png rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
$(LIBNAME).*dylib pngtesti
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -1,5 +1,5 @@
# makefile for libpng on DEC Alpha Unix # makefile for libpng on DEC Alpha Unix
# Copyright (C) 2000 Glenn Randers-Pehrson # Copyright (C) 2000-2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@ -7,6 +7,23 @@
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
# Where the zlib library and include files are located # Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib #ZLIBLIB=/usr/local/lib
@ -14,10 +31,8 @@ LIBPATH=$(prefix)/lib
ZLIBLIB=../zlib ZLIBLIB=../zlib
ZLIBINC=../zlib ZLIBINC=../zlib
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
@ -32,12 +47,25 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
all: $(LIBNAME).so libpng.a pngtest all: $(LIBNAME).so libpng.a pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"-std\"; \
echo ldflags=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -45,7 +73,8 @@ $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
$(LIBNAME).so.$(PNGVER): $(OBJS) $(LIBNAME).so.$(PNGVER): $(OBJS)
$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) -lz -lm $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB)
-soname $(LIBNAME).so.$(PNGMAJ) -lz -lm
pngtest: pngtest.o libpng.a pngtest: pngtest.o libpng.a
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
@ -54,44 +83,78 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) -std -w1 -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) -R$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)*
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@ -1,10 +1,13 @@
# DJGPP (DOS gcc) makefile for libpng # DJGPP (DOS gcc) makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a and png.h # where make install will put libpng.a and png.h
#prefix=/usr/local #prefix=/usr/local
prefix=. prefix=.
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
CC=gcc CC=gcc
CFLAGS=-I../zlib -O CFLAGS=-I../zlib -O

View File

@ -1,93 +1,48 @@
# makefile for libpng under FreeBSD # makefile for libpng under FreeBSD
# Copyright (C) 2002 Glenn Randers-Pehrson and Andrey A. Chernov # Copyright (C) 2002 Glenn Randers-Pehrson and Andrey A. Chernov
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a and png.h PREFIX?= /usr/local
prefix=/usr/local SHLIB_VER?= 5
PNGMAJ= 5 LIB= png
.if (${OBJFORMAT} == "elf") SHLIB_MAJOR= ${SHLIB_VER}
PNGVER= $(PNGMAJ) SHLIB_MINOR= 0
.else NOPROFILE= YES
PNGMIN= 0 NOOBJ= YES
PNGVER= $(PNGMAJ).$(PNGMIN)
.endif # where make install puts libpng.a and png.h
DESTDIR= ${PREFIX}
LIBDIR= /lib
INCS= png.h pngconf.h
INCSDIR= /include/libpng
INCDIR= ${INCSDIR} # for 4.x bsd.lib.mk
MAN= libpng.3 libpngpf.3 png.5
MANDIR= /man/man
SYMLINKS= libpng/png.h ${INCSDIR}/../png.h \
libpng/pngconf.h ${INCSDIR}/../pngconf.h
LDADD+= -lm -lz
DPADD+= ${LIBM} ${LIBZ}
CFLAGS+= -I. -DPNG_USE_PNGGCCRD CFLAGS+= -I. -DPNG_USE_PNGGCCRD
.if (${MACHINE_ARCH} != "i386") .if (${MACHINE_ARCH} != "i386")
CFLAGS+= -DPNG_NO_ASSEMBLER_CODE CFLAGS+= -DPNG_NO_ASSEMBLER_CODE
.endif .endif
LDFLAGS+=-L. -lpng -lz -lm -static
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.o pngmem.o pngerror.o pngpread.o pnggccrd.o pngwtran.c pngmem.c pngerror.c pngpread.c pnggccrd.c
.SUFFIXES: .c .so .o
.c.so:
${CC} ${CFLAGS} -fPIC -DPIC -o $@ -c $<
all: libpng.a libpng.so.${PNGVER} pngtest
libpng.a: $(OBJS)
ar rc $@ $(OBJS)
$(RANLIB) $@
libpng.so.${PNGVER}: $(OBJS:S/o$/so/g)
.if (${OBJFORMAT} == "elf")
${CC} -shared -Wl,-x,-soname,$@ -o $@ $(OBJS:S/o$/so/g) -lz -lm
.else
${CC} -shared -Wl,-x -o $@ $(OBJS:S/o$/so/g) -lz -lm
.endif
pngtest: pngtest.o libpng.a pngtest: pngtest.o libpng.a
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) ${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -lpng -lz -lm
CLEANFILES= pngtest pngtest.o pngout.png
test: pngtest test: pngtest
./pngtest ./pngtest
install: libpng.a libpng.so.${PNGVER}
-@mkdir $(prefix)/include/libpng
${INSTALL} -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} \
png.h pngconf.h $(prefix)/include/libpng
ln -sf libpng/png.h $(prefix)/include/png.h
ln -sf libpng/pngconf.h $(prefix)/include/pngconf.h
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
libpng.a libpng.so.${PNGVER} $(prefix)/lib
$(RANLIB) $(prefix)/lib/libpng.a
ln -sf libpng.so.${PNGVER} $(prefix)/lib/libpng.so
/sbin/ldconfig -R
${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
libpng.3 libpngpf.3 $(prefix)/man/man3
${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
png.5 $(prefix)/man/man5
clean:
rm -f *.o libpng.a libpng.so libpng.so.${PNGVER} pngtest pngout.png
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:
chmod a-w *.[ch35] $(DOCS) scripts/* chmod a-w *.[ch35] $(DOCS) scripts/*
# DO NOT DELETE THIS LINE -- make depend depends on it. .include <bsd.lib.mk>
png.o: png.h pngconf.h
pngerror.o: png.h pngconf.h
pngrio.o: png.h pngconf.h
pngwio.o: png.h pngconf.h
pngmem.o: png.h pngconf.h
pngset.o: png.h pngconf.h
pngget.o: png.h pngconf.h
pngread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h
pnggccrd.o: png.h pngconf.h

View File

@ -15,16 +15,17 @@
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
CC=gcc CC=gcc
# where "make install" puts libpng.a, libpng10/libpng10.so*, # where "make install" puts libpng10.a, libpng10.so*,
# $(LIBNAME)/png.h and $(LIBNAME)/pngconf.h # libpng10/png.h and libpng10/pngconf.h
# Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
# Where the zlib library and include files are located # Where the zlib library and include files are located.
#ZLIBLIB=/usr/local/lib #ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include #ZLIBINC=/usr/local/include
ZLIBLIB=../zlib ZLIBLIB=../zlib
@ -62,6 +63,23 @@ RANLIB=ranlib
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -74,7 +92,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
all: libpng.a $(LIBNAME).so pngtest pngtest-static all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
libpng.a: $(OBJS)
ar rc $@ $(OBJS)
$(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_THREAD_UNSAFE_OK \
-DPNG_USE_PNGGCCRD\"; \
echo cflags=\"\"; \
echo ldflags=\"-L$(LIBPATH) -Wl,-rpath,$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
pnggccrd.o: pnggccrd.c png.h pngconf.h pnggccrd.o: pnggccrd.c png.h pngconf.h
$(CC) -c $(CFLAGS) -o $@ $*.c $(CC) -c $(CFLAGS) -o $@ $*.c
@ -82,10 +118,6 @@ pnggccrd.o: pnggccrd.c png.h pngconf.h
pnggccrd.pic.o: pnggccrd.c png.h pngconf.h pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
$(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c $(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
$(LIBNAME).a: $(OBJS)
ar rc $@ $(OBJS)
$(RANLIB) $@
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -93,18 +125,19 @@ $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
$(LIBNAME).so.$(PNGVER): $(OBJSDLL) $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \ $(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc -o $(LIBNAME).so.$(PNGVER) \
$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
pngtest: pngtest.o $(LIBNAME).so pngtest: pngtest.o $(LIBNAME).so
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
pngtest-static: pngtest.o $(LIBNAME).a pngtest-static: pngtest.o libpng.a
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A) $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
test: pngtest pngtest-static test: pngtest pngtest-static
@echo "" @echo ""
@echo " Running pngtest dynamically linked with libpng10.so:" @echo " Running pngtest dynamically linked with $(LIBNAME).so:"
@echo "" @echo ""
./pngtest ./pngtest
@echo "" @echo ""
@ -113,45 +146,76 @@ test: pngtest pngtest-static
./pngtest-static ./pngtest-static
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
pngtest pngout.png $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -26,21 +26,36 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm
RANLIB=ranlib RANLIB=ranlib
#RANLIB=echo #RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -53,12 +68,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
all: libpng.a $(LIBNAME).sl pngtest all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"\"; \
echo ldflags=\"\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
ln -f -s $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl ln -f -s $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
@ -77,41 +105,79 @@ test: pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).sl.$(PNGVER) install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).sl -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)* $(DL)/$(LIBNAME).sl
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).sl.$(PNGVER) $(LIBPATH) cp $(LIBNAME).sl.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).sl.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2; \ ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3; \
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2.$(PNGMIN); \ ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3.$(PNGMIN); \
ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \ ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl) ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir \
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc $(DL)/pkgconfig; fi
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean:
/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)*
clean: clean:
/bin/rm -f *.o libpng.a $(SHAREDLIB).sl $(SHAREDLIB).sl.$(PNGMAJ)* \ /bin/rm -f *.o libpng.a $(SHAREDLIB).sl $(SHAREDLIB).sl.$(PNGMAJ)* \

View File

@ -16,17 +16,32 @@ LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
RANLIB=ranlib RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
# where make install puts libpng.a, libpng10.sl, and png.h # where make install puts libpng.a, libpng10.sl, and png.h
prefix=/opt/libpng prefix=/opt/libpng
LIBPATH=$prefix/lib INCPATH=$(prefix)/include
INCPATH=$prefix/include LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -39,12 +54,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) +z -o $@ $*.c $(CC) -c $(CFLAGS) +z -o $@ $*.c
all: libpng.a $(LIBNAME).sl pngtest all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"-Ae +DA1.1 +DS2.0"; \
echo ldflags=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
@ -63,45 +91,78 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).sl.$(PNGVER) install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).sl -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)* $(DL)/$(LIBNAME).sl
-@/bin/rm -f $(LIBPATH)/libpng.sl -@/bin/rm -f $(DL)/libpng.sl
-@/bin/rm -f $(LIBPATH)/libpng.sl.2 -@/bin/rm -f $(DL)/libpng.sl.3
-@/bin/rm -f $(LIBPATH)/libpng.sl.2.* -@/bin/rm -f $(DL)/libpng.sl.3.*
cp $(LIBNAME).sl.$(PNGVER) $(LIBPATH) cp $(LIBNAME).sl.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).sl.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl; \ ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl; \
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2; \ ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3; \
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2.$(PNGMIN); \ ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3.$(PNGMIN); \
ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \ ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl) ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) $(CCFLAGS) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \ /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
pngtest pngout.png libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)*
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -1,4 +1,5 @@
# makefile for libpng # makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@ -9,6 +10,18 @@
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
CC=cc CC=cc
CFLAGS=-I../zlib -O CFLAGS=-I../zlib -O
@ -46,17 +59,18 @@ test: pngtest
./pngtest ./pngtest
install: libpng.a install: libpng.a
-@mkdir $(prefix)/include -@mkdir $(DESTDIR)$(INCPATH)
-@mkdir $(prefix)/include/libpng -@mkdir $(DESTDIR)$(INCPATH)/libpng
-@mkdir $(prefix)/lib -@mkdir $(DESTDIR)$(LIBPATH)
-@rm -f $(prefix)/include/png.h -@rm -f $(DESTDIR)$(INCPATH)/png.h
-@rm -f $(prefix)/include/pngconf.h -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
cp png.h $(prefix)/include/libpng cp png.h $(DESTDIR)$(INCPATH)/libpng
cp pngconf.h $(prefix)/include/libpng cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
chmod 644 $(prefix)/include/libpng/png.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
chmod 644 $(prefix)/include/libpng/pngconf.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
cp libpng.a $(prefix)/lib (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
chmod 644 $(prefix)/lib/libpng.a cp libpng.a $(DESTDIR)$(LIBPATH)
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
clean: clean:
rm -f *.o libpng.a pngtest pngout.png ansi2knr rm -f *.o libpng.a pngtest pngout.png ansi2knr

View File

@ -5,16 +5,17 @@
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
CC=gcc CC=gcc
# where "make install" puts libpng.a, libpng10/libpng10.so*, # where "make install" puts libpng10.a, libpng10.so*,
# libpng10/png.h and libpng10/pngconf.h # libpng10/png.h and libpng10/pngconf.h
# Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
# Where the zlib library and include files are located # Where the zlib library and include files are located.
#ZLIBLIB=/usr/local/lib #ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include #ZLIBINC=/usr/local/include
ZLIBLIB=../zlib ZLIBLIB=../zlib
@ -41,6 +42,23 @@ RANLIB=ranlib
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -53,12 +71,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
all: libpng.a $(LIBNAME).so pngtest all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"\"; \
echo ldflags=\"-L$(LIBPATH) -Wl,-rpath,$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -73,12 +104,12 @@ $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
pngtest: pngtest.o $(LIBNAME).so pngtest: pngtest.o $(LIBNAME).so
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
pngtest-static: pngtest.o $(LIBNAME).a pngtest-static: pngtest.o libpng.a
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A) $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
test: pngtest pngtest-static test: pngtest pngtest-static
@echo "" @echo ""
@echo " Running pngtest dynamically linked with libpng10.so:" @echo " Running pngtest dynamically linked with $(LIBNAME).so:"
@echo "" @echo ""
./pngtest ./pngtest
@echo "" @echo ""
@ -87,46 +118,76 @@ test: pngtest pngtest-static
./pngtest-static ./pngtest-static
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNMAJ)* \ /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
pngtest pngout.png $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -15,17 +15,37 @@ ZLIBLIB=../zlib
ZLIBINC=../zlib ZLIBINC=../zlib
CC=cc CC=cc
CFLAGS=-fno-common -I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
LDSHARED=cc -lz -dynamiclib -compatibility_version $(VER) -current_version $(VER)
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
VER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
CFLAGS=-fno-common -I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
LDSHARED=cc -lz -dynamiclib -compatibility_version $(PNGVER) \
-current_version $(PNGVER)
LIBNAME=libpng10 LIBNAME=libpng10
SHAREDLIB_POSTFIX=dylib SHAREDLIB_POSTFIX=dylib
LIBPATH=$(prefix)/lib
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
#RANLIB=echo #RANLIB=echo
RANLIB=ranlib RANLIB=ranlib
@ -34,15 +54,29 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
all: libpng.a pngtest shared all: libpng.a pngtest shared libpng.pc libpng-config
shared: $(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX) shared: $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \
sed -e s/-lm// > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"\"; \
echo ldflags=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
$(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX): $(OBJS) $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX): $(OBJS)
$(LDSHARED) -o $@ $(OBJS) $(LDSHARED) -o $@ $(OBJS)
pngtest: pngtest.o libpng.a pngtest: pngtest.o libpng.a
@ -51,53 +85,84 @@ pngtest: pngtest.o libpng.a
test: pngtest test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) install-shared: install-headers $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.$(SHAREDLIB_POSTFIX) -@/bin/rm -f \
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(SHAREDLIB_POSTFIX) $(DL)/$(LIBNAME).$(PNGMAJ)*.$(SHAREDLIB_POSTFIX)
-@/bin/rm -f $(DL)/$(LIBNAME).$(SHAREDLIB_POSTFIX)
-@/bin/rm -f libpng.$(SHARED_POSTFIX) -@/bin/rm -f libpng.$(SHARED_POSTFIX)
-@/bin/rm -f libpng.2.$(SHARED_POSTFIX) -@/bin/rm -f libpng.3.$(SHARED_POSTFIX)
-@/bin/rm -f libpng.2.*.$(SHARED_POSTFIX) -@/bin/rm -f libpng.3.*.$(SHARED_POSTFIX)
cp $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) $(LIBPATH) cp $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) chmod 755 $(DL)/$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
(cd $(LIBPATH); \ (cd $(DL); \
ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ] ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
libpng.$(SHARED_POSTFIX); \ libpng.$(SHARED_POSTFIX); \
ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ] ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
libpng.2.$(SHARED_POSTFIX); \ libpng.3.$(SHARED_POSTFIX); \
ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ] ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
libpng.2.$(PNGMIN).$(SHARED_POSTFIX); \ libpng.3.$(PNGMIN).$(SHARED_POSTFIX); \
ln -sf $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \ ln -f -s $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
$(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX); \ $(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX); \
ln -sf $(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX) \ ln -f -s $(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX) \
$(LIBNAME).$(SHAREDLIB_POSTFIX)) $(LIBNAME).$(SHAREDLIB_POSTFIX))
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
install: install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) $(CFLAGS) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
rm -f *.o libpng.a pngtest pngout.png \ rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
$(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX) \ $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
$(LIBNAME).$(SHAREDLIB_POSTFIX) $(LIBNAME).$(SHAREDLIB_POSTFIX)
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO

View File

@ -1,9 +1,22 @@
# makefile for libpng # makefile for libpng
# Copyright (C) Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
CC=cc CC=cc
CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips
@ -30,17 +43,18 @@ test: pngtest
./pngtest ./pngtest
install: libpng.a install: libpng.a
-@mkdir $(prefix)/include -@mkdir $(DESTDIR)$(INCPATH)
-@mkdir $(prefix)/include/libpng -@mkdir $(DESTDIR)$(INCPATH)/libpng
-@mkdir $(prefix)/lib -@mkdir $(DESTDIR)$(LIBPATH)
-@rm -f $(prefix)/include/png.h -@rm -f $(DESTDIR)$(INCPATH)/png.h
-@rm -f $(prefix)/include/pngconf.h -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
cp png.h $(prefix)/include/libpng cp png.h $(DESTDIR)$(INCPATH)/libpng
cp pngconf.h $(prefix)/include/libpng cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
chmod 644 $(prefix)/include/libpng/png.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
chmod 644 $(prefix)/include/libpng/pngconf.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
cp libpng.a $(prefix)/lib (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
chmod 644 $(prefix)/lib/libpng.a cp libpng.a $(DESTDIR)$(LIBPATH)
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
clean: clean:
rm -f *.o libpng.a pngtest pngout.png rm -f *.o libpng.a pngtest pngout.png

44
scripts/makefile.ne10bsd Normal file
View File

@ -0,0 +1,44 @@
# makefile for libpng for NetBSD for the standard
# make obj && make depend && make && make test
# make includes && make install
# Copyright (C) 2002 Patrick R.L. Welche
# For conditions of distribution and use, see copyright notice in png.h
# You should also run makefile.netbsd
LOCALBASE?=/usr/local
LIBDIR= ${LOCALBASE}/lib
MANDIR= ${LOCALBASE}/man
INCSDIR=${LOCALBASE}/include/libpng10
LIB= png10
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.0.14
SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c
INCS= png.h pngconf.h
MAN= libpng.3 libpngpf.3 png.5
CPPFLAGS+=-I${.CURDIR} -DPNG_USE_PNGGCCRD
# something like this for mmx assembler, but it core dumps for me at the moment
# .if ${MACHINE_ARCH} == "i386"
# CPPFLAGS+=-DPNG_THREAD_UNSAFE_OK
# MKLINT= no
# .else
CPPFLAGS+=-DPNG_NO_ASSEMBLER_CODE
# .endif
CLEANFILES+=pngtest.o pngtest
pngtest.o: pngtest.c
${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET}
pngtest: pngtest.o libpng.a
${CC} ${LDFLAGS} ${.ALLSRC} -o${.TARGET} -lz -lm
test: pngtest
cd ${.CURDIR} && ${.OBJDIR}/pngtest
.include <bsd.lib.mk>

View File

@ -13,7 +13,7 @@ INCSDIR=${LOCALBASE}/include/libpng10
LIB= png10 LIB= png10
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.0.13 SHLIB_MINOR= 1.0.14
SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@ -13,7 +13,7 @@ INCSDIR=${LOCALBASE}/include/libpng
LIB= png LIB= png
SHLIB_MAJOR= 2 SHLIB_MAJOR= 2
SHLIB_MINOR= 1.0.13 SHLIB_MINOR= 1.0.14
SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@ -7,7 +7,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.0.13 SHLIB_MINOR= 1.0.14
LIB= png LIB= png
SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \ SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
@ -64,6 +64,8 @@ afterinstall:
@rmdir ${DESTDIR}${LIBDIR}/debug 2>/dev/null || true @rmdir ${DESTDIR}${LIBDIR}/debug 2>/dev/null || true
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \ ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
-m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include/libpng -m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include/libpng
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
-m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \ ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
-m ${NONBINMODE} ${DOCS} ${DESTDIR}${PREFIX}/share/doc/png -m ${NONBINMODE} ${DOCS} ${DESTDIR}${PREFIX}/share/doc/png

View File

@ -1,6 +1,7 @@
# makefile for SCO OSr5 ELF and Unixware 7 with Native cc # makefile for SCO OSr5 ELF and Unixware 7 with Native cc
# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx # Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app # force ELF build dynamic linking, SONAME setting in lib and RPATH in app
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs # Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@ -17,20 +18,35 @@ ZLIBLIB=../zlib
ZLIBINC=../zlib ZLIBINC=../zlib
CFLAGS= -dy -belf -I$(ZLIBINC) -O3 CFLAGS= -dy -belf -I$(ZLIBINC) -O3
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm
#RANLIB=ranlib #RANLIB=ranlib
RANLIB=echo RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
INCPATH=$(prefix)/include/libpng INCPATH=$(prefix)/include/libpng
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -43,12 +59,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
all: libpng.a $(LIBNAME).so pngtest all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"-belf\"; \
echo ldflags=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -65,45 +94,80 @@ pngtest: pngtest.o $(LIBNAME).so
test: pngtest test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
-@/bin/rm -f $(INCPATH)/png.h -@/bin/rm -f $(DI)/png.h
-@/bin/rm -f $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/pngconf.h
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) $(CFLAGS) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean:
/bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
install: install-static install-shared
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png

View File

@ -1,101 +1,184 @@
# makefile for libpng, SGI IRIX with gcc # makefile for libpng.a and libpng10.so, SGI IRIX with 'cc'
# Copyright (C) 2002 Glenn Randers-Pehrson # Copyright (C) 2001-2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a and png.h # Where make install puts libpng.a, libpng10.so, and libpng10/png.h
# Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
# Where the zlib library and include files are located # Where the zlib library and include files are located
ZLIBLIB=/usr/local/lib32 #ZLIBLIB=/usr/local/lib32
ZLIBINC=/usr/local/include #ZLIBINC=/usr/local/include
#ZLIBLIB=../zlib #ZLIBLIB=/usr/local/lib
#ZLIBINC=../zlib #ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib
LIBNAME=libpng10
PNGMAJ = 0
PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN)
CC=gcc
# ABI can be blank to use default for your system, -32, -o32, -n32, or -64 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
# See "man abi". zlib must be built with the same ABI. # See "man abi". zlib must be built with the same ABI.
ABI= ABI=
CC=gcc
WARNMORE= # -g -DPNG_DEBUG=5 WARNMORE= # -g -DPNG_DEBUG=5
CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=CC $(ABI) -shared LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
PNGMAJ = 0
PNGMIN = 1.0.13
PNGVER = $(PNGMAJ).$(PNGMIN)
# See "man dso" for info about shared objects # See "man dso" for info about shared objects
LIBS=libpng10.so.$(PNGMAJ).$(PNGVER)
LIBNAME=libpng10
LIBPATH=$(prefix)/lib32
RANLIB=echo RANLIB=echo
#RANLIB=ranlib #RANLIB=ranlib
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
#LIBPATH=$(prefix)/lib32
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
all: libpng.a $(LIBNAME).so.$(PNGVER) pngtest all: libpng.a pngtest shared libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
shared: $(LIBNAME).so.$(PNGVER)
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > \
libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
-DPNG_NO_ASSEMBLER_CODE\"; \
echo cflags=\"$(ABI)\"; \
echo ldflags=\"-L$(LIBPATH)\"; \
echo rpath=\"$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
$(LIBNAME).so.$(PNGVER): $(OBJS) $(LIBNAME).so.$(PNGVER): $(OBJS)
$(LDSHARED) -o $@ $(OBJS) $(LDSHARED) -o $@ $(OBJS)
rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ) rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
ln -s $@ $(LIBNAME).so
ln -s $@ $(LIBNAME).so.$(PNGMAJ)
pngtest: pngtest.o libpng.a pngtest: pngtest.o libpng.a
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
test: pngtest test: pngtest
echo
echo Testing local static library.
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) -rpath $(ZLIBLIB):`$(BINPATH)/libpng10-config --rpath` \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
echo
echo Testing installed dynamic shared library.
./pngtesti pngtest.png
clean: clean:
rm -f *.o libpng.a pngtest pngout.png rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* so_locations
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
chmod a-w *.[ch35] $(DOCS) scripts/*
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
@ -115,4 +198,5 @@ pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pnggccrd.o: png.h pngconf.h

View File

@ -3,7 +3,14 @@
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a, libpng10.so and libpng10/png.h LIBNAME=libpng10
PNGMAJ = 0
PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN)
# Where make install puts libpng.a, libpng10.so, and libpng10/png.h
# Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
# Where the zlib library and include files are located # Where the zlib library and include files are located
@ -26,13 +33,8 @@ WARNMORE=-fullwarn
CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng10 -lz -lm
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=cc $(ABI) -shared LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
# See "man dso" for info about shared objects # See "man dso" for info about shared objects
LIBNAME=libpng10
PNGMAJ = 0
PNGMIN = 1.0.13
PNGVER = $(PNGMAJ).$(PNGMIN)
RANLIB=echo RANLIB=echo
#RANLIB=ranlib #RANLIB=ranlib
@ -40,71 +42,141 @@ RANLIB=echo
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
#LIBPATH=$(prefix)/lib32 #LIBPATH=$(prefix)/lib32
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
all: libpng.a pngtest shared all: libpng.a pngtest shared libpng.pc libpng-config
shared: $(LIBNAME).so.$(PNGMAJ).$(PNGVER)
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
shared: $(LIBNAME).so.$(PNGVER)
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
-DPNG_NO_ASSEMBLER_CODE\"; \
echo cflags=\"$(ABI)\"; \
echo ldflags=\"-L$(LIBPATH) -rpath $(LIBPATH) \"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
$(LIBNAME).so.$(PNGVER): $(OBJS) $(LIBNAME).so.$(PNGVER): $(OBJS)
$(LDSHARED) -o $@ $(OBJS) $(LDSHARED) -o $@ $(OBJS)
rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ) rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
ln -s $@ $(LIBNAME).so
ln -s $@ $(LIBNAME).so.$(PNGMAJ)
pngtest: pngtest.o libpng.a pngtest: pngtest.o libpng.a
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
test: pngtest test: pngtest
echo
echo Testing local static library.
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-L$(ZLIBLIB) -rpath $(ZLIBLIB) \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs`
./pngtesti pngtest.png
clean: clean:
rm -f *.o libpng.a pngtest pngout.png $(LIBNAME).so \ rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
$(LIBNAME).so.$(PNGMAJ)* $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* so_locations
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -1,6 +1,7 @@
# makefile for libpng on Solaris 9 (beta) with Forte cc # makefile for libpng on Solaris 9 (beta) with Forte cc
# Updated by Chad Schrock for Solaris 9 # Updated by Chad Schrock for Solaris 9
# Contributed by William L. Sebok, based on makefile.linux # Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1998-2001 Greg Roelofs # Copyright (C) 1998-2001 Greg Roelofs
# Copyright (C) 1996-1997 Andreas Dilger # Copyright (C) 1996-1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@ -27,20 +28,35 @@ ZLIBINC=/usr/include
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
#CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 #CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5
CFLAGS=-I$(ZLIBINC) -O3 CFLAGS=-I$(ZLIBINC) -O3
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm
#RANLIB=ranlib #RANLIB=ranlib
RANLIB=echo RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -53,12 +69,25 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
all: libpng.a $(LIBNAME).so pngtest all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cflags=\"\"; \
echo ldflags=\"-L$(LIBPATH) -R$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -88,45 +117,78 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs` \
-L$(ZLIBLIB) -R$(ZLIBLIB)
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
pngtest pngout.png libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)*
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -24,20 +24,35 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) -Wall -O3 \ CFLAGS=-I$(ZLIBINC) -Wall -O3 \
# $(WARNMORE) -g -DPNG_DEBUG=5 # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm
#RANLIB=ranlib #RANLIB=ranlib
RANLIB=echo RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
# have to change it.
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.13 PNGMIN = 1.0.14
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@ -50,12 +65,26 @@ OBJSDLL = $(OBJS:.o=.pic.o)
.c.pic.o: .c.pic.o:
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
all: libpng.a $(LIBNAME).so pngtest all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
-DPNG_NO_ASSEMBLER_CODE\"; \
echo cflags=\"$(ABI)\"; \
echo ldflags=\"-L$(LIBPATH) -R$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
@ -85,45 +114,78 @@ test: pngtest
./pngtest ./pngtest
install-headers: png.h pngconf.h install-headers: png.h pngconf.h
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(INCPATH)/$(LIBNAME) cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-@/bin/rm -f $(INCPATH)/libpng -@/bin/rm -f $(DI)/libpng
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
install-static: install-headers libpng.a install-static: install-headers libpng.a
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(LIBPATH)/$(LIBNAME).a cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(LIBPATH)/$(LIBNAME).a chmod 644 $(DL)/$(LIBNAME).a
-@/bin/rm -f $(LIBPATH)/libpng.a -@/bin/rm -f $(DL)/libpng.a
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBNAME).so.$(PNGVER) install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
-@/bin/rm -f $(LIBPATH)/libpng.so -@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(LIBPATH)/libpng.so.2 -@/bin/rm -f $(DL)/libpng.so.2
-@/bin/rm -f $(LIBPATH)/libpng.so.2.* -@/bin/rm -f $(DL)/libpng.so.2.*
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) cp $(LIBNAME).so.$(PNGVER) $(DL)
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
(cd $(LIBPATH); \ (cd $(DL); \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \ ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \ ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)) ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
install: install-static install-shared install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-@/bin/rm -f $(DM)/man3/libpng.3
-@/bin/rm -f $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-@/bin/rm -f $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/libpng10-config --cppflags --cflags` pngtest.c \
-o pngtesti `$(BINPATH)/libpng10-config --ldflags --libs` \
-L$(ZLIBLIB) -R$(ZLIBLIB)
./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
pngtest pngout.png libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)*
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -1,9 +1,22 @@
# makefile for libpng # makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
# Where the zlib library and include files are located # Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib #ZLIBLIB=/usr/local/lib
@ -35,17 +48,18 @@ test: pngtest
./pngtest ./pngtest
install: libpng.a install: libpng.a
-@mkdir $(prefix)/include -@mkdir $(DESTDIR)$(INCPATH)
-@mkdir $(prefix)/include/libpng -@mkdir $(DESTDIR)$(INCPATH)/libpng
-@mkdir $(prefix)/lib -@mkdir $(DESTDIR)$(LIBPATH)
-@rm -f $(prefix)/include/png.h -@rm -f $(DESTDIR)$(INCPATH)/png.h
-@rm -f $(prefix)/include/pngconf.h -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
cp png.h $(prefix)/include/libpng cp png.h $(DESTDIR)$(INCPATH)/libpng
cp pngconf.h $(prefix)/include/libpng cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
chmod 644 $(prefix)/include/libpng/png.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
chmod 644 $(prefix)/include/libpng/pngconf.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
cp libpng.a $(prefix)/lib (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
chmod 644 $(prefix)/lib/libpng.a cp libpng.a $(DESTDIR)$(LIBPATH)
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
clean: clean:
rm -f *.o libpng.a pngtest pngout.png rm -f *.o libpng.a pngtest pngout.png

View File

@ -1,9 +1,22 @@
# makefile for libpng # makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
# Where the zlib library and include files are located # Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib #ZLIBLIB=/usr/local/lib
@ -39,17 +52,18 @@ test: pngtest
./pngtest ./pngtest
install: libpng.a install: libpng.a
-@mkdir $(prefix)/include -@mkdir $(DESTDIR)$(INCPATH)
-@mkdir $(prefix)/include/libpng -@mkdir $(DESTDIR)$(INCPATH)/libpng
-@mkdir $(prefix)/lib -@mkdir $(DESTDIR)$(LIBPATH)
-@rm -f $(prefix)/include/png.h -@rm -f $(DESTDIR)$(INCPATH)/png.h
-@rm -f $(prefix)/include/pngconf.h -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
cp png.h $(prefix)/include/libpng cp png.h $(DESTDIR)$(INCPATH)/libpng
cp pngconf.h $(prefix)/include/libpng cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
chmod 644 $(prefix)/include/libpng/png.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
chmod 644 $(prefix)/include/libpng/pngconf.h chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
cp libpng.a $(prefix)/lib (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
chmod 644 $(prefix)/lib/libpng.a cp libpng.a $(DESTDIR)$(LIBPATH)
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
clean: clean:
rm -f *.o libpng.a pngtest pngout.png rm -f *.o libpng.a pngtest pngout.png

View File

@ -7,8 +7,8 @@ unit pngdef;
interface interface
const const
PNG_LIBPNG_VER_STRING = '1.0.13'; PNG_LIBPNG_VER_STRING = '1.0.14';
PNG_LIBPNG_VER = 10013; PNG_LIBPNG_VER = 10014;
type type
png_uint_32 = Cardinal; png_uint_32 = Cardinal;

View File

@ -2,7 +2,7 @@
; PNG.LIB module definition file for OS/2 ; PNG.LIB module definition file for OS/2
;---------------------------------------- ;----------------------------------------
; Version 1.0.13 ; Version 1.0.14
LIBRARY PNG LIBRARY PNG
DESCRIPTION "PNG image compression library for OS/2" DESCRIPTION "PNG image compression library for OS/2"
@ -185,22 +185,27 @@ EXPORTS
png_set_invalid png_set_invalid
; Added at version 1.2.0: ; Added at version 1.2.0:
; png_mmx_support png_mmx_support
; png_permit_empty_plte png_permit_empty_plte
; png_permit_mng_features png_permit_mng_features
; png_get_mmx_flagmask png_get_mmx_flagmask
; png_get_asm_flagmask png_get_asm_flagmask
; png_get_asm_flags png_get_asm_flags
; png_get_mmx_bitdepth_threshold png_get_mmx_bitdepth_threshold
; png_get_mmx_rowbytes_threshold png_get_mmx_rowbytes_threshold
; png_set_asm_flags png_set_asm_flags
; png_init_mmx_flags png_init_mmx_flags
; Added at version 1.2.2: ; Added at version 1.2.2:
png_zalloc
png_zfree
png_handle_as_unknown png_handle_as_unknown
; Added at version 1.2.2 and deleted from 1.2.3:
; png_zalloc
; png_zfree
; Added at version 1.2.4
png_malloc_warn
; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS ; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
png_libpng_ver png_libpng_ver
png_pass_start png_pass_start