Update libpng to version 1.6.3
(cherry picked from commit ca2bf81b02c99afa2e76b3b2c6eb232c239221e0)
Change-Id: I313493fa630be9812e503ae24820b2923ed717f3
diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin
index 5b53046..814fef5 100644
--- a/scripts/makefile.darwin
+++ b/scripts/makefile.darwin
@@ -1,5 +1,5 @@
# makefile for libpng on Darwin / Mac OS X
-# Copyright (C) 2002, 2004, 2006, 2008 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2004, 2006, 2008, 2010-2011 Glenn Randers-Pehrson
# Copyright (C) 2001 Christoph Pfisterer
# derived from makefile.linux:
# Copyright (C) 1998, 1999 Greg Roelofs
@@ -9,29 +9,24 @@
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-# where "make install" puts libpng.a, libpng12.dylib, png.h and pngconf.h
+# where "make install" puts libpng.a, libpng16.dylib, png.h, pngconf.h,
+# and pnglibconf.h
prefix=/usr/local
exec_prefix=$(prefix)
# Where the zlib library and include files are located
-#ZLIBLIB=/usr/local/lib
-#ZLIBINC=/usr/local/include
-ZLIBLIB=../zlib
-ZLIBINC=../zlib
+ZLIBLIB=/usr/lib
+ZLIBINC=/usr/include
# Library name:
-LIBNAME = libpng12
-PNGMAJ = 12
-PNGMIN = 1.2.46
-PNGVER = $(PNGMAJ).$(PNGMIN)
+LIBNAME = libpng16
+PNGMAJ = 16
# Shared library names:
LIBSO=$(LIBNAME).dylib
LIBSOMAJ=$(LIBNAME).$(PNGMAJ).dylib
-LIBSOVER=$(LIBNAME).$(PNGVER).dylib
+LIBSOREL=$(LIBNAME).$(PNGMAJ).$(RELEASE).dylib
OLDSO=libpng.dylib
-OLDSOMAJ=libpng.3.dylib
-OLDSOVER=libpng.3.$(PNGMIN).dylib
# Utilities:
CC=cc
@@ -40,10 +35,11 @@
LN_SF=ln -sf
RANLIB=ranlib
RM_F=/bin/rm -f
+ARCH=-arch ppc -arch i386 -arch x86_64
-# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE
-CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops
-LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz
+# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops
+CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops $(ARCH)
+LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz $(ARCH)
INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib
@@ -78,6 +74,10 @@
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
+# see scripts/pnglibconf.mak for more options
+pnglibconf.h: scripts/pnglibconf.h.prebuilt
+ cp scripts/pnglibconf.h.prebuilt $@
+
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)
$(RANLIB) $@
@@ -87,35 +87,25 @@
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
- -e s!-lpng12!-lpng12\ -lz! > libpng.pc
+ -e s!-lpng16!-lpng16\ -lz! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \
- echo libs=\"-lpng12 -lz\"; \
+ echo libs=\"-lpng16 -lz\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBSO): $(LIBSOMAJ)
$(LN_SF) $(LIBSOMAJ) $(LIBSO)
-$(LIBSOMAJ): $(LIBSOVER)
- $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
-
-$(LIBSOVER): $(OBJSDLL)
+$(LIBSOMAJ): $(OBJSDLL)
$(CC) -dynamiclib \
-install_name $(LIBPATH)/$(LIBSOMAJ) \
- -current_version 0 -compatibility_version 0 \
- -o $(LIBSOVER) \
- $(OBJSDLL) -L$(ZLIBLIB) -lz
-
-$(OLDSOVER): $(OBJSDLL)
- $(CC) -dynamiclib \
- -install_name $(LIBPATH)/$(OLDSOMAJ) \
- -current_version 3 -compatibility_version 3 \
- -o $(OLDSOVER) \
+ -current_version 16 -compatibility_version 16 \
+ $(ARCH) -o $(LIBSOMAJ) \
$(OBJSDLL) -L$(ZLIBLIB) -lz
pngtest: pngtest.o $(LIBSO)
@@ -124,12 +114,12 @@
test: pngtest
./pngtest
-install-headers: png.h pngconf.h
+install-headers: png.h pngconf.h pnglibconf.h
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
- cp png.h pngconf.h $(DI)/$(LIBNAME)
- chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
- -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+ cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
+ chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
+ -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
-@$(RM_F) $(DI)/libpng
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
@@ -141,24 +131,16 @@
-@$(RM_F) $(DL)/libpng.a
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
-install-shared: install-headers $(LIBSO) libpng.pc \
- $(OLDSOVER)
+install-shared: install-headers $(LIBSOMAJ) libpng.pc
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
- -@$(RM_F) $(DL)/$(LIBNAME).$(PNGVER)*.dylib
- -@$(RM_F) $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
-@$(RM_F) $(DL)/$(LIBSO)
+ -@$(RM_F) $(DL)/$(LIBSOMAJ)
-@$(RM_F) $(DL)/$(OLDSO)
- -@$(RM_F) $(DL)/$(OLDSOMAJ)
- -@$(RM_F) $(DL)/libpng.3.$(PNGMIN)*.dylib
- cp $(LIBSOVER) $(DL)
- cp $(OLDSOVER) $(DL)
- chmod 755 $(DL)/$(LIBSOVER)
- chmod 755 $(DL)/$(OLDSOVER)
+ cp $(LIBSOMAJ) $(DL)
+ chmod 755 $(DL)/$(LIBSOMAJ)
(cd $(DL); \
- $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
- $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
- $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
- $(LN_SF) $(LIBSOMAJ) $(LIBSO))
+ $(LN_SF) $(LIBSOREL) $(LIBSO); \
+ $(LN_SF) $(LIBSO) $(OLDSO))
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
@@ -209,8 +191,7 @@
clean:
$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
- $(OLDSOVER) \
- libpng.pc $(LIBNAME).*dylib pngtesti
+ libpng.pc $(LIBNAME).*dylib pngtesti pnglibconf.h
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
@@ -218,20 +199,20 @@
# DO NOT DELETE THIS LINE -- make depend depends on it.
-png.o png.pic.o: png.h pngconf.h
-pngerror.o pngerror.pic.o: png.h pngconf.h
-pngrio.o pngrio.pic.o: png.h pngconf.h
-pngwio.o pngwio.pic.o: png.h pngconf.h
-pngmem.o pngmem.pic.o: png.h pngconf.h
-pngset.o pngset.pic.o: png.h pngconf.h
-pngget.o pngget.pic.o: png.h pngconf.h
-pngread.o pngread.pic.o: png.h pngconf.h
-pngrtran.o pngrtran.pic.o: png.h pngconf.h
-pngrutil.o pngrutil.pic.o: png.h pngconf.h
-pngtrans.o pngtrans.pic.o: png.h pngconf.h
-pngwrite.o pngwrite.pic.o: png.h pngconf.h
-pngwtran.o pngwtran.pic.o: png.h pngconf.h
-pngwutil.o pngwutil.pic.o: png.h pngconf.h
-pngpread.o pngpread.pic.o: png.h pngconf.h
+png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
+pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngtest.o: png.h pngconf.h
+pngtest.o: png.h pngconf.h pnglibconf.h