7110151: Use underlying platform's zlib library for Java zlib support
Make SYSTEM_ZLIB more flexible by using ZLIB_{CFLAGS,LIBS} and building on more than just MACOSX. Reviewed-by: sherman, alanb
This commit is contained in:
parent
4f5a96bc8b
commit
1ec7522737
@ -77,8 +77,8 @@ ifeq ($(STANDALONE),true)
|
||||
OTHER_CXXFLAGS += $(ZINCLUDE)
|
||||
LDDFLAGS += $(ZIPOBJS)
|
||||
else
|
||||
LDDFLAGS += -lz
|
||||
OTHER_CXXFLAGS += -DSYSTEM_ZLIB
|
||||
LDDFLAGS += $(ZLIB_LIBS)
|
||||
OTHER_CXXFLAGS += $(ZLIB_CFLAGS) -DSYSTEM_ZLIB
|
||||
endif
|
||||
else
|
||||
OTHER_CXXFLAGS += -DNO_ZLIB -DUNPACK_JNI
|
||||
|
@ -91,7 +91,7 @@ ifeq ($(PLATFORM), macosx)
|
||||
LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a
|
||||
|
||||
ifeq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_LDLIBS += -lz
|
||||
OTHER_LDLIBS += $(ZLIB_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -129,6 +129,11 @@ endif
|
||||
BUILD_HEADLESS = true
|
||||
LIBM=-lm
|
||||
|
||||
# Set ZLIB_LIBS if not already set
|
||||
ifeq ("$(ZLIB_LIBS)", "")
|
||||
ZLIB_LIBS=-lz
|
||||
endif
|
||||
|
||||
# GCC29_COMPILER_PATH: is the path to where the gcc 2.9 compiler is installed
|
||||
# NOTE: Must end with / so that it could be empty, allowing PATH usage.
|
||||
ifdef ALT_GCC29_COMPILER_PATH
|
||||
|
@ -143,6 +143,11 @@ else
|
||||
_CUPS_HEADERS_PATH=$(PACKAGE_PATH)/include
|
||||
endif
|
||||
|
||||
# Set ZLIB_LIBS if not already set
|
||||
ifeq ("$(ZLIB_LIBS)", "")
|
||||
ZLIB_LIBS=-lz
|
||||
endif
|
||||
|
||||
# Import JDK images allow for partial builds, components not built are
|
||||
# imported (or copied from) these import areas when needed.
|
||||
|
||||
|
@ -140,6 +140,11 @@ BUILD_HEADLESS = true
|
||||
|
||||
_CUPS_HEADERS_PATH=/opt/sfw/cups/include
|
||||
|
||||
# Set ZLIB_LIBS if not already set
|
||||
ifeq ("$(ZLIB_LIBS)", "")
|
||||
ZLIB_LIBS=-lz
|
||||
endif
|
||||
|
||||
# Import JDK images allow for partial builds, components not built are
|
||||
# imported (or copied from) these import areas when needed.
|
||||
|
||||
|
@ -46,6 +46,8 @@ include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
ifneq ($(SYSTEM_ZLIB),true)
|
||||
ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
|
||||
else # SYSTEM_ZLIB
|
||||
OTHER_CFLAGS += $(ZLIB_CFLAGS)
|
||||
endif #SYSTEM_ZLIB
|
||||
LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
|
||||
|
||||
@ -162,7 +164,7 @@ OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC)
|
||||
ifneq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_INCLUDES += -I$(ZIP_SRC)
|
||||
else # !SYSTEM_ZLIB
|
||||
LDLIBS += -lz
|
||||
LDLIBS += $(ZLIB_LIBS)
|
||||
endif # SYSTEM_ZLIB
|
||||
|
||||
#
|
||||
|
@ -56,6 +56,10 @@ ifneq ($(PLATFORM), windows)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_CFLAGS += $(ZLIB_CFLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# Library to compile.
|
||||
#
|
||||
@ -90,7 +94,7 @@ endif
|
||||
# Link to JVM library for JVM_Zip* functions
|
||||
#
|
||||
ifeq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_LDLIBS = -lz
|
||||
OTHER_LDLIBS = $(ZLIB_LIBS)
|
||||
else
|
||||
OTHER_LDLIBS = $(JVMLIB)
|
||||
endif
|
||||
|
@ -378,3 +378,22 @@ if [ "${ZERO_BUILD}" = true ] ; then
|
||||
export LLVM_LIBS
|
||||
fi
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -126,7 +126,8 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg
|
||||
ifneq ($(SYSTEM_ZLIB),true)
|
||||
CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
|
||||
else
|
||||
OTHER_LDLIBS += -lz
|
||||
OTHER_CFLAGS += $(ZLIB_CFLAGS)
|
||||
OTHER_LDLIBS += $(ZLIB_LIBS)
|
||||
endif
|
||||
|
||||
# Shun the less than portable MMX assembly code in pnggccrd.c,
|
||||
|
@ -93,7 +93,7 @@ extern int assert_failed(const char*);
|
||||
// bytes and byte arrays
|
||||
|
||||
typedef unsigned int uint;
|
||||
#if !defined(MACOSX) || (defined(MACOSX) && defined(NO_ZLIB))
|
||||
#if defined(NO_ZLIB)
|
||||
#ifdef _LP64
|
||||
typedef unsigned int uLong; // Historical zlib, should be 32-bit.
|
||||
#else
|
||||
|
@ -29,8 +29,8 @@
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni_util.h"
|
||||
#include "zlib.h"
|
||||
#include "jlong.h"
|
||||
#include <zlib.h>
|
||||
|
||||
#include "java_util_zip_Adler32.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni_util.h"
|
||||
#include "zlib.h"
|
||||
#include <zlib.h>
|
||||
|
||||
#include "java_util_zip_CRC32.h"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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) \
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "io_util.h"
|
||||
#include "io_util_md.h"
|
||||
#include "zip_util.h"
|
||||
#include "zlib.h"
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef _ALLBSD_SOURCE
|
||||
#define off64_t off_t
|
||||
|
Loading…
x
Reference in New Issue
Block a user