Mercurial > hg > release > icedtea7-forest-2.0 > jdk
changeset 4525:3a2014eddd87
Support building using system zlib (USE_SYSTEM_ZLIB, ZLIB_CFLAGS, ZLIB_LIBS).
author | andrew |
---|---|
date | Wed, 03 Aug 2011 21:50:51 +0100 |
parents | e46d527097f1 |
children | ad240835fa9c |
files | make/com/sun/java/pack/Makefile make/common/Program.gmk make/java/jli/Makefile make/java/zip/FILES_c.gmk make/java/zip/Makefile make/jdk_generic_profile.sh make/sun/splashscreen/FILES_c.gmk make/sun/splashscreen/Makefile src/share/native/com/sun/java/util/jar/pack/defines.h src/share/native/java/util/zip/Adler32.c src/share/native/java/util/zip/CRC32.c src/share/native/java/util/zip/Deflater.c src/share/native/java/util/zip/Inflater.c src/share/native/java/util/zip/zip_util.c |
diffstat | 14 files changed, 99 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/make/com/sun/java/pack/Makefile Wed Aug 03 00:33:07 2011 +0100 +++ b/make/com/sun/java/pack/Makefile Wed Aug 03 21:50:51 2011 +0100 @@ -72,9 +72,14 @@ $(ZIPOBJDIR)/inftrees.$(OBJECT_SUFFIX) \ $(ZIPOBJDIR)/inffast.$(OBJECT_SUFFIX) - ZINCLUDE=-I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) - OTHER_CXXFLAGS += $(ZINCLUDE) - LDDFLAGS += $(ZIPOBJS) + ifdef USE_SYSTEM_ZLIB + OTHER_CXXFLAGS += $(ZLIB_CFLAGS) -DUSE_SYSTEM_ZLIB=1 + LDDFLAGS += $(ZLIB_LIBS) + else + ZINCLUDE=-I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) + OTHER_CXXFLAGS += $(ZINCLUDE) + LDDFLAGS += $(ZIPOBJS) + endif else OTHER_CXXFLAGS += -DNO_ZLIB -DUNPACK_JNI OTHER_LDLIBS += $(JVMLIB)
--- a/make/common/Program.gmk Wed Aug 03 00:33:07 2011 +0100 +++ b/make/common/Program.gmk Wed Aug 03 21:50:51 2011 +0100 @@ -91,6 +91,9 @@ endif endif ifeq ($(PLATFORM), linux) + ifdef USE_SYSTEM_ZLIB + LDFLAGS += $(ZLIB_LIBS) + endif LDFLAGS += $(LDFLAG_Z_ORIGIN) LDFLAGS += -Wl,--allow-shlib-undefined LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)/jli @@ -247,7 +250,9 @@ endif OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)/bin -I$(LAUNCHER_PLATFORM_SRC)/bin -OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 +ifndef USE_SYSTEM_ZLIB + OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 +endif OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"' VERSION_DEFINES += -DFULL_VERSION='"$(FULL_VERSION)"'
--- a/make/java/jli/Makefile Wed Aug 03 00:33:07 2011 +0100 +++ b/make/java/jli/Makefile Wed Aug 03 21:50:51 2011 +0100 @@ -44,7 +44,9 @@ include $(BUILDDIR)/common/Defs.gmk -ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +ifndef USE_SYSTEM_ZLIB + ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +endif LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin @@ -69,13 +71,17 @@ parse_manifest.c \ version_comp.c \ wildcard.c \ - jli_util.c \ + jli_util.c + +ifndef USE_SYSTEM_ZLIB +FILES_c += \ inflate.c \ inftrees.c \ inffast.c \ zadler32.c \ zcrc32.c \ zutil.c +endif ifneq ($(PLATFORM), windows) FILES_c += ergo.c @@ -106,6 +112,9 @@ # last library otherwise it could cause compatibility issues # by pulling in SUNW_private symbols from libc LDLIBS = -ldl -lc +ifdef USE_SYSTEM_ZLIB + LDLIBS += $(ZLIB_LIBS) +endif ifeq ($(USE_PTHREADS),true) LDLIBS += -lpthread endif # USE_PTHREADS @@ -129,7 +138,9 @@ OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC) OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC) -OTHER_INCLUDES += -I$(ZIP_SRC) +ifndef USE_SYSTEM_ZLIB + OTHER_INCLUDES += -I$(ZIP_SRC) +endif # # Library to compile.
--- a/make/java/zip/FILES_c.gmk Wed Aug 03 00:33:07 2011 +0100 +++ b/make/java/zip/FILES_c.gmk Wed Aug 03 21:50:51 2011 +0100 @@ -29,7 +29,10 @@ Deflater.c \ Inflater.c \ ZipFile.c \ - zip_util.c \ + zip_util.c + +ifndef USE_SYSTEM_ZLIB +FILES_c += \ compress.c \ deflate.c \ gzio.c \ @@ -42,3 +45,4 @@ zadler32.c \ zcrc32.c \ zutil.c +endif
--- a/make/java/zip/Makefile Wed Aug 03 00:33:07 2011 +0100 +++ b/make/java/zip/Makefile Wed Aug 03 21:50:51 2011 +0100 @@ -74,16 +74,23 @@ CPPFLAGS += -UDEBUG endif -CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +ifndef USE_SYSTEM_ZLIB + CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +endif CPPFLAGS += -I$(SHARE_SRC)/native/java/io CPPFLAGS += -I$(PLATFORM_SRC)/native/java/io # # Add to ambient vpath so we pick up the library files # -vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/zlib-$(ZLIB_VERSION) +ifndef USE_SYSTEM_ZLIB + vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/zlib-$(ZLIB_VERSION) +endif # # Link to JVM library for JVM_Zip* functions # OTHER_LDLIBS = $(JVMLIB) +ifdef USE_SYSTEM_ZLIB + OTHER_LDLIBS += $(ZLIB_LIBS) +endif
--- a/make/jdk_generic_profile.sh Wed Aug 03 00:33:07 2011 +0100 +++ b/make/jdk_generic_profile.sh Wed Aug 03 21:50:51 2011 +0100 @@ -393,10 +393,29 @@ fi fi if [ "${LCMS_LIBS}" = "" ] ; then - LIBFFI_LIBS="-llcms2" + LCMS_LIBS="-llcms2" fi export LCMS_CFLAGS export LCMS_LIBS +# Export variables for system zlib +# ZLIB_CFLAGS and ZLIB_LIBS tell the compiler how to compile and +# link against zlib +pkgconfig=$(which pkg-config 2>/dev/null) +if [ -x "${pkgconfig}" ] ; then + if [ "${ZLIB_CFLAGS}" = "" ] ; then + ZLIB_CFLAGS=$("${pkgconfig}" --cflags zlib) + fi + if [ "${ZLIB_LIBS}" = "" ] ; then + ZLIB_LIBS=$("${pkgconfig}" --libs zlib) + fi +fi +if [ "${ZLIB_LIBS}" = "" ] ; then + ZLIB_LIBS="-lz" +fi +export ZLIB_CFLAGS +export ZLIB_LIBS + # IcedTea defaults; use system libraries export USE_SYSTEM_LCMS=true +export USE_SYSTEM_ZLIB=true
--- a/make/sun/splashscreen/FILES_c.gmk Wed Aug 03 00:33:07 2011 +0100 +++ b/make/sun/splashscreen/FILES_c.gmk Wed Aug 03 21:50:51 2011 +0100 @@ -49,18 +49,6 @@ dgif_lib.c \ gif_err.c \ gifalloc.c \ - compress.c \ - deflate.c \ - gzio.c \ - infback.c \ - inffast.c \ - inflate.c \ - inftrees.c \ - trees.c \ - uncompr.c \ - zadler32.c \ - zcrc32.c \ - zutil.c \ jcomapi.c \ jdapimin.c \ jdapistd.c \ @@ -106,3 +94,18 @@ jfdctfst.c \ jfdctint.c +ifndef USE_SYSTEM_ZLIB +FILES_c += \ + compress.c \ + deflate.c \ + gzio.c \ + infback.c \ + inffast.c \ + inflate.c \ + inftrees.c \ + trees.c \ + uncompr.c \ + zadler32.c \ + zcrc32.c \ + zutil.c +endif
--- a/make/sun/splashscreen/Makefile Wed Aug 03 00:33:07 2011 +0100 +++ b/make/sun/splashscreen/Makefile Wed Aug 03 21:50:51 2011 +0100 @@ -65,6 +65,9 @@ CFLAGS += -DWITH_X11 CPPFLAGS += -I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include/X11/extensions OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 -lXext $(LIBM) -lpthread + ifdef USE_SYSTEM_ZLIB + OTHER_LDLIBS += $(ZLIB_LIBS) + endif else # PLATFORM CFLAGS += -DWITH_WIN32 OTHER_LDLIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib /DELAYLOAD:user32.dll @@ -77,13 +80,18 @@ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/splashscreen vpath %.c $(SHARE_SRC)/native/$(PKGDIR) vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/giflib -vpath %.c $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +ifndef USE_SYSTEM_ZLIB + vpath %.c $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +endif vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/libpng vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/image/jpeg vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen -I$(SHARE_SRC)/native/$(PKGDIR)/splashscreen -CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg +ifndef USE_SYSTEM_ZLIB + CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION) +endif # Shun the less than portable MMX assembly code in pnggccrd.c, # and use alternative implementations in C.
--- a/src/share/native/com/sun/java/util/jar/pack/defines.h Wed Aug 03 00:33:07 2011 +0100 +++ b/src/share/native/com/sun/java/util/jar/pack/defines.h Wed Aug 03 21:50:51 2011 +0100 @@ -89,10 +89,14 @@ // bytes and byte arrays typedef unsigned int uint; -#ifdef _LP64 -typedef unsigned int uLong; // Historical zlib, should be 32-bit. +#ifdef USE_SYSTEM_ZLIB + #include <zlib.h> #else -typedef unsigned long uLong; + #ifdef _LP64 + typedef unsigned int uLong; // Historical zlib, should be 32-bit. + #else + typedef unsigned long uLong; + #endif #endif #ifdef _MSC_VER typedef LONGLONG jlong;
--- a/src/share/native/java/util/zip/Adler32.c Wed Aug 03 00:33:07 2011 +0100 +++ b/src/share/native/java/util/zip/Adler32.c Wed Aug 03 21:50:51 2011 +0100 @@ -29,7 +29,7 @@ #include "jni.h" #include "jni_util.h" -#include "zlib.h" +#include <zlib.h> #include "java_util_zip_Adler32.h"
--- a/src/share/native/java/util/zip/CRC32.c Wed Aug 03 00:33:07 2011 +0100 +++ b/src/share/native/java/util/zip/CRC32.c Wed Aug 03 21:50:51 2011 +0100 @@ -29,7 +29,7 @@ #include "jni.h" #include "jni_util.h" -#include "zlib.h" +#include <zlib.h> #include "java_util_zip_CRC32.h"
--- a/src/share/native/java/util/zip/Deflater.c Wed Aug 03 00:33:07 2011 +0100 +++ b/src/share/native/java/util/zip/Deflater.c Wed Aug 03 21:50:51 2011 +0100 @@ -32,7 +32,7 @@ #include "jlong.h" #include "jni.h" #include "jni_util.h" -#include "zlib.h" +#include <zlib.h> #include "java_util_zip_Deflater.h"
--- a/src/share/native/java/util/zip/Inflater.c Wed Aug 03 00:33:07 2011 +0100 +++ b/src/share/native/java/util/zip/Inflater.c Wed Aug 03 21:50:51 2011 +0100 @@ -35,7 +35,7 @@ #include "jni.h" #include "jvm.h" #include "jni_util.h" -#include "zlib.h" +#include <zlib.h> #include "java_util_zip_Inflater.h" #define ThrowDataFormatException(env, msg) \
--- a/src/share/native/java/util/zip/zip_util.c Wed Aug 03 00:33:07 2011 +0100 +++ b/src/share/native/java/util/zip/zip_util.c Wed Aug 03 21:50:51 2011 +0100 @@ -44,7 +44,7 @@ #include "io_util.h" #include "io_util_md.h" #include "zip_util.h" -#include "zlib.h" +#include <zlib.h> /* USE_MMAP means mmap the CEN & ENDHDR part of the zip file. */ #ifdef USE_MMAP