Bug 275744: Use either system zlib or nss/lib/zlib. Unset NSS_ENABLE_ZLIB
authorwtc%google.com
Thu, 04 Feb 2010 19:09:08 +0000
changeset 9541 bce3aa63c58be9dd24015cf9ce42567ec758e591
parent 9538 981bd2eebe2f65a6f86cf24c0a12ba975c9ee135 (current diff)
parent 9540 7fb62ba52b745bf08df10feda2965ba9085f0f45 (diff)
child 9543 bfa523055b5239b4f30533dd8d6cb2c7ca1c3a11
push idunknown
push userunknown
push dateunknown
bugs275744
Bug 275744: Use either system zlib or nss/lib/zlib. Unset NSS_ENABLE_ZLIB when building (make NSS_ENABLE_ZLIB=) to turn off TLS deflate compression. r=rrelyea. Modified Files: Makefile config.mk
security/nss/lib/ssl/Makefile
security/nss/lib/ssl/config.mk
--- a/security/nss/lib/ssl/Makefile
+++ b/security/nss/lib/ssl/Makefile
@@ -66,21 +66,16 @@ DEFINES += -DIN_LIBSSL
 else
 ifeq ($(OS_TARGET),OS2)
 CSRCS	+= os2_err.c
 else
 CSRCS	+= unix_err.c
 endif
 endif
 
-ifdef USE_SYSTEM_ZLIB
-DEFINES += -DNSS_ENABLE_ZLIB
-EXTRA_LIBS += $(ZLIB_LIBS)
-endif
-
 #######################################################################
 # (5) Execute "global" rules. (OPTIONAL)                              #
 #######################################################################
 
 include $(CORE_DEPTH)/coreconf/rules.mk
 
 #######################################################################
 # (6) Execute "component" rules. (OPTIONAL)                           #
--- a/security/nss/lib/ssl/config.mk
+++ b/security/nss/lib/ssl/config.mk
@@ -38,17 +38,16 @@
 ifdef NISCC_TEST
 DEFINES += -DNISCC_TEST
 endif
 
 ifdef NSS_SURVIVE_DOUBLE_BYPASS_FAILURE
 DEFINES += -DNSS_SURVIVE_DOUBLE_BYPASS_FAILURE
 endif
 
-# $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS)
 CRYPTOLIB=$(SOFTOKEN_LIB_DIR)/$(LIB_PREFIX)freebl.$(LIB_SUFFIX)
 
 EXTRA_LIBS += \
 	$(CRYPTOLIB) \
 	$(NULL)
 
 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
 
@@ -77,17 +76,16 @@ EXTRA_SHARED_LIBS += \
 	$(NSPR_LIB_DIR)/$(NSPR31_LIB_PREFIX)plc4.lib \
 	$(NSPR_LIB_DIR)/$(NSPR31_LIB_PREFIX)plds4.lib \
 	$(NSPR_LIB_DIR)/$(NSPR31_LIB_PREFIX)nspr4.lib \
 	$(NULL)
 endif # NS_USE_GCC
 
 else
 
-# $(PROGRAM) has NO explicit dependencies on $(EXTRA_SHARED_LIBS)
 # $(EXTRA_SHARED_LIBS) come before $(OS_LIBS), except on AIX.
 EXTRA_SHARED_LIBS += \
 	-L$(DIST)/lib \
 	-lnss3 \
 	-L$(NSSUTIL_LIB_DIR) \
 	-lnssutil3 \
 	-L$(NSPR_LIB_DIR) \
 	-lplc4 \
@@ -95,8 +93,28 @@ EXTRA_SHARED_LIBS += \
 	-lnspr4 \
 	$(NULL)
 
 ifeq ($(OS_ARCH), BeOS)
 EXTRA_SHARED_LIBS += -lbe
 endif
 
 endif
+
+# Mozilla's mozilla/modules/zlib/src/zconf.h adds the MOZ_Z_ prefix to zlib
+# exported symbols, which causes problem when NSS is built as part of Mozilla.
+# So we add a NSS_ENABLE_ZLIB variable to allow Mozilla to turn this off.
+NSS_ENABLE_ZLIB = 1
+ifdef NSS_ENABLE_ZLIB
+
+DEFINES += -DNSS_ENABLE_ZLIB
+
+# If a platform has a system zlib, set USE_SYSTEM_ZLIB to 1 and
+# ZLIB_LIBS to the linker command-line arguments for the system zlib
+# (for example, -lz) in the platform's config file in coreconf.
+ifdef USE_SYSTEM_ZLIB
+OS_LIBS += $(ZLIB_LIBS)
+else
+ZLIB_LIBS = $(DIST)/lib/$(LIB_PREFIX)zlib.$(LIB_SUFFIX)
+EXTRA_LIBS += $(ZLIB_LIBS)
+endif
+
+endif