xref: /aoo4110/main/nss/nss.patch (revision b1cdbd2c)
1diff -ur misc/nss-3.25/nspr/config/rules.mk misc/build/nss-3.25/nspr/config/rules.mk
2--- misc/nss-3.25/nspr/config/rules.mk	2016-02-12 05:51:25.000000000 -0800
3+++ misc/build/nss-3.25/nspr/config/rules.mk	2016-07-14 23:47:54.492034000 -0700
4@@ -382,7 +382,12 @@
5 ifdef NS_USE_GCC
6 	$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
7 else
8-	$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
9+        #We remove stl from the paths to avoid that rc.exe finds the stl wrapper
10+        #of AOO. stlport includes the system stl which will fail. By removing it,
11+        #rc will use the stl from the system if the path is in the INCLUDE
12+        #variable.
13+	INCLUDE="$(subst /stl,,$(INCLUDE))" $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
14+
15 endif # GCC
16 	@echo $(RES) finished
17 endif
18diff -ur misc/nss-3.25/nspr/configure misc/build/nss-3.25/nspr/configure
19--- misc/nss-3.25/nspr/configure	2016-02-12 05:51:25.000000000 -0800
20+++ misc/build/nss-3.25/nspr/configure	2016-07-14 23:47:54.531323000 -0700
21@@ -6992,7 +6992,7 @@
22     PR_MD_CSRCS=linux.c
23     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
24     DSO_CFLAGS=-fPIC
25-    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
26+    DSO_LDOPTS='-shared -Wl,-rpath,\$$ORIGIN -Wl,-soname -Wl,$(notdir $@)'
27     _OPTIMIZE_FLAGS=-O2
28     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
29                                    # combo is not yet good at debugging inlined
30diff -ur misc/nss-3.25/nspr/pr/include/pratom.h misc/build/nss-3.25/nspr/pr/include/pratom.h
31--- misc/nss-3.25/nspr/pr/include/pratom.h	2016-02-12 05:51:25.000000000 -0800
32+++ misc/build/nss-3.25/nspr/pr/include/pratom.h	2016-07-14 23:47:54.538325000 -0700
33@@ -81,7 +81,9 @@
34 #if defined(_WIN32) && !defined(_WIN32_WCE) && \
35     (!defined(_MSC_VER) || (_MSC_VER >= 1310))
36
37+PR_END_EXTERN_C
38 #include <intrin.h>
39+PR_BEGIN_EXTERN_C
40
41 #ifdef _MSC_VER
42 #pragma intrinsic(_InterlockedIncrement)
43diff -ur misc/nss-3.25/nss/Makefile misc/build/nss-3.25/nss/Makefile
44--- misc/nss-3.25/nss/Makefile	2016-06-20 10:11:28.000000000 -0700
45+++ misc/build/nss-3.25/nss/Makefile	2016-07-14 23:47:54.544021000 -0700
46@@ -76,6 +76,9 @@
47 ifeq ($(OS_TARGET),WIN95)
48 NSPR_CONFIGURE_OPTS += --enable-win32-target=WIN95
49 endif
50+ifdef MACOS_SDK_DIR
51+NSPR_CONFIGURE_OPTS += --with-macos-sdk=$(MACOS_SDK_DIR)
52+endif
53 ifdef USE_DEBUG_RTL
54 NSPR_CONFIGURE_OPTS += --enable-debug-rtl
55 endif
56diff -ur misc/nss-3.25/nss/cmd/platlibs.mk misc/build/nss-3.25/nss/cmd/platlibs.mk
57--- misc/nss-3.25/nss/cmd/platlibs.mk	2016-06-20 10:11:28.000000000 -0700
58+++ misc/build/nss-3.25/nss/cmd/platlibs.mk	2016-07-14 23:47:54.549839000 -0700
59@@ -10,17 +10,18 @@
60
61 ifeq ($(OS_ARCH), SunOS)
62 ifeq ($(USE_64), 1)
63-EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
64+#In AOO we would probable put the executables next to libs
65+EXTRA_SHARED_LIBS += -R '$$ORIGIN'
66 else
67-EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1:/usr/lib/mps'
68+EXTRA_SHARED_LIBS += -R '$$ORIGIN'
69 endif
70 endif
71
72 ifeq ($(OS_ARCH), Linux)
73 ifeq ($(USE_64), 1)
74-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib64:/opt/sun/private/lib64:$$ORIGIN/../lib'
75+EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN'
76 else
77-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib:/opt/sun/private/lib'
78+EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN'
79 endif
80 endif
81
82diff -ur misc/nss-3.25/nss/cmd/shlibsign/Makefile misc/build/nss-3.25/nss/cmd/shlibsign/Makefile
83--- misc/nss-3.25/nss/cmd/shlibsign/Makefile	2016-06-20 10:11:28.000000000 -0700
84+++ misc/build/nss-3.25/nss/cmd/shlibsign/Makefile	2016-07-14 23:47:54.554784000 -0700
85@@ -49,10 +49,15 @@
86 CHECKLIBS =
87 CHECKLOC =
88 else
89-CHECKLIBS = $(DIST)/lib/$(DLL_PREFIX)softokn3.$(DLL_SUFFIX)
90-CHECKLIBS += $(wildcard $(DIST)/lib/$(DLL_PREFIX)freebl*3.$(DLL_SUFFIX))
91+# Signing causes loading of some system library which in turn loads
92+# libsqlite3. Then it loads libsqulite3 from nss, which does not have the proper
93+# version. Therefore signing fails.
94+# We cannot build with the system sqlite3, because it is too old (SDK
95+# 10.4). Otherwise one could set NSS_USE_SYSTEM_SQLITE=1 and use the system lib.
96+#CHECKLIBS = $(DIST)/lib/$(DLL_PREFIX)softokn3.$(DLL_SUFFIX)
97+#CHECKLIBS += $(wildcard $(DIST)/lib/$(DLL_PREFIX)freebl*3.$(DLL_SUFFIX))
98 ifndef NSS_DISABLE_DBM
99-CHECKLIBS += $(DIST)/lib/$(DLL_PREFIX)nssdbm3.$(DLL_SUFFIX)
100+#CHECKLIBS += $(DIST)/lib/$(DLL_PREFIX)nssdbm3.$(DLL_SUFFIX)
101 endif
102 CHECKLOC = $(CHECKLIBS:.$(DLL_SUFFIX)=.chk)
103
104diff -ur misc/nss-3.25/nss/coreconf/Darwin.mk misc/build/nss-3.25/nss/coreconf/Darwin.mk
105--- misc/nss-3.25/nss/coreconf/Darwin.mk	2016-06-20 10:11:28.000000000 -0700
106+++ misc/build/nss-3.25/nss/coreconf/Darwin.mk	2016-07-14 23:47:54.560325000 -0700
107@@ -4,12 +4,14 @@
108 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
109
110 include $(CORE_DEPTH)/coreconf/UNIX.mk
111-include $(CORE_DEPTH)/coreconf/Werror.mk
112+#include $(CORE_DEPTH)/coreconf/Werror.mk
113
114-DEFAULT_COMPILER = gcc
115+DEFAULT_COMPILER = cc
116+
117+# CC is taken from environment automatically.
118+#CC		= cc
119+CCC		= $(CXX) -stdlib=libc++ -std=c++11
120
121-CC		= gcc
122-CCC		= g++
123 RANLIB		= ranlib
124
125 ifndef CPU_ARCH
126diff -ur misc/nss-3.25/nss/coreconf/FreeBSD.mk misc/build/nss-3.25/nss/coreconf/FreeBSD.mk
127--- misc/nss-3.25/nss/coreconf/FreeBSD.mk	2016-06-20 10:11:28.000000000 -0700
128+++ misc/build/nss-3.25/nss/coreconf/FreeBSD.mk	2016-07-14 23:47:54.564724000 -0700
129@@ -5,9 +5,8 @@
130
131 include $(CORE_DEPTH)/coreconf/UNIX.mk
132
133-DEFAULT_COMPILER	= gcc
134-CC			= gcc
135-CCC			= g++
136+DEFAULT_COMPILER	= $(CC)
137+CCC			= $(CXX)
138 RANLIB			= ranlib
139
140 CPU_ARCH		= $(OS_TEST)
141@@ -21,7 +20,7 @@
142 CPU_ARCH		= x86_64
143 endif
144
145-OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
146+OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_UNISTD_H -DHAVE_BSD_FLOCK
147
148 DSO_CFLAGS		= -fPIC
149 DSO_LDOPTS		= -shared -Wl,-soname -Wl,$(notdir $@)
150diff -ur misc/nss-3.25/nss/coreconf/Linux.mk misc/build/nss-3.25/nss/coreconf/Linux.mk
151--- misc/nss-3.25/nss/coreconf/Linux.mk	2016-06-20 10:11:28.000000000 -0700
152+++ misc/build/nss-3.25/nss/coreconf/Linux.mk	2016-07-14 23:47:54.569918000 -0700
153@@ -16,8 +16,11 @@
154 	IMPL_STRATEGY = _PTH
155 endif
156
157-CC			= gcc
158-CCC			= g++
159+# CC is taken from environment automatically.
160+#CC			= gcc
161+# Use CCC from environment.
162+#CCC			= g++
163+CCC		= $(CXX)
164 RANLIB			= ranlib
165
166 DEFAULT_COMPILER = gcc
167@@ -139,7 +142,7 @@
168 OS_PTHREAD = -lpthread
169 endif
170
171-OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR
172+OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR -DHAVE_UNISTD_H
173 OS_LIBS			= $(OS_PTHREAD) -ldl -lc
174
175 ifdef USE_PTHREADS
176@@ -149,7 +152,7 @@
177 ARCH			= linux
178
179 DSO_CFLAGS		= -fPIC
180-DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections
181+DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections '-Wl,-rpath,$$ORIGIN'
182 # The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
183 # incorrectly reports undefined references in the libraries we link with, so
184 # we don't use -z defs there.
185@@ -189,8 +192,13 @@
186 endif
187 endif
188
189+ifeq ($(SYSTEM_ZLIB),YES)
190+# Currently (3.12.4) only the tools modutil and signtool are linked with libz
191+# If USE_SYSTEM_ZLIB is not set then the tools link statically libzlib.a which
192+# is also build in nss.
193 USE_SYSTEM_ZLIB = 1
194 ZLIB_LIBS = -lz
195+endif
196
197 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
198 # dependencies in the same directory where it resides.
199diff -ur misc/nss-3.25/nss/coreconf/SunOS5.mk misc/build/nss-3.25/nss/coreconf/SunOS5.mk
200--- misc/nss-3.25/nss/coreconf/SunOS5.mk	2016-06-20 10:11:28.000000000 -0700
201+++ misc/build/nss-3.25/nss/coreconf/SunOS5.mk	2016-07-14 23:47:54.575211000 -0700
202@@ -48,8 +48,12 @@
203 	    # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
204 	endif
205 else
206-	CC         = cc
207-	CCC        = CC
208+# CC is taken from environment automatically.
209+#	CC         = cc
210+# Use CXX from environment.
211+#	CCC        = CC
212+        CCC       = $(CXX)
213+
214 	ASFLAGS   += -Wa,-P
215 	OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
216 	ifndef BUILD_OPT
217diff -ur misc/nss-3.25/nss/coreconf/arch.mk misc/build/nss-3.25/nss/coreconf/arch.mk
218--- misc/nss-3.25/nss/coreconf/arch.mk	2016-06-20 10:11:28.000000000 -0700
219+++ misc/build/nss-3.25/nss/coreconf/arch.mk	2016-07-14 23:47:54.579901000 -0700
220@@ -294,7 +294,12 @@
221 ifdef CROSS_COMPILE
222 OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
223 else
224-OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
225+# OBJDIR_NAME is used to build the directory containing the built objects, for
226+# example mozilla/dist/Linux2.6_x86_glibc_PTH_DBG.OBJ
227+# We need to deliver the contents of that folder into the solver. To make that easier
228+# in the makefile we rename this directory to "out".
229+#OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
230+OBJDIR_NAME = out
231 endif
232
233
234diff -ur misc/nss-3.25/nss/coreconf/rules.mk misc/build/nss-3.25/nss/coreconf/rules.mk
235--- misc/nss-3.25/nss/coreconf/rules.mk	2016-06-20 10:11:28.000000000 -0700
236+++ misc/build/nss-3.25/nss/coreconf/rules.mk	2016-07-14 23:47:54.586736000 -0700
237@@ -322,7 +322,12 @@
238 ifdef NS_USE_GCC
239 	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
240 else
241-	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
242+        #We remove stl from the paths to avoid that rc.exe finds the stlport of
243+        #OOo. stlport includes the system stl which will fail. By removing it,
244+        #rc will use the stl from the system if the path is in the INCLUDE
245+        #variable.
246+	INCLUDE="$(subst /stl,,$(INCLUDE))" $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
247+
248 endif
249 	@echo $(RES) finished
250 endif
251diff -ur misc/nss-3.25/nss/lib/zlib/inflate.c misc/build/nss-3.25/nss/lib/zlib/inflate.c
252--- misc/nss-3.25/nss/lib/zlib/inflate.c	2016-06-20 10:11:28.000000000 -0700
253+++ misc/build/nss-3.25/nss/lib/zlib/inflate.c	2016-07-14 23:47:54.598199000 -0700
254@@ -1472,9 +1472,9 @@
255 {
256     struct inflate_state FAR *state;
257
258-    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
259+    if (strm == Z_NULL || strm->state == Z_NULL) return ~0UL << 16;
260     state = (struct inflate_state FAR *)strm->state;
261-    return ((long)(state->back) << 16) +
262+    return ((unsigned long)(state->back) << 16) +
263         (state->mode == COPY ? state->length :
264             (state->mode == MATCH ? state->was - state->length : 0));
265 }
266diff -ur misc/nss-3.25/nss/external_tests/common/gtest.mk misc/build/nss-3.25/nss/external_tests/common/gtest.mk
267--- misc/nss-3.25/nss/external_tests/common/gtest.mk		2017-10-09 14:16:48.000000000 -0400
268+++ misc/build/nss-3.25/nss/external_tests/common/gtest.mk	2017-10-09 14:17:55.000000000 -0400
269@@ -16,6 +16,9 @@
270 # platform.
271 ifeq (-Werror,$(filter -Werror -Wsign-compare,$(WARNING_CFLAGS)))
272 WARNING_CFLAGS += -Wsign-compare
273+ifeq (Darwin,$(OS_ARCH))
274+    WARNING_CFLAGS += -Wno-error=deprecated -Wno-error=c++11-extensions
275+endif
276 endif
277 WARNING_CFLAGS := $(filter-out -w44018,$(WARNING_CFLAGS))
278
279@@ -32,5 +35,9 @@
280     # Needed because we include files from a subdirectory
281     MAKE_OBJDIR = $(INSTALL) -D $(dir $@)
282 else
283-    CXXFLAGS += -std=c++0x
284+    ifeq (Darwin,$(OS_ARCH))
285+        CXXFLAGS += -stdlib=libc++ -std=c++11
286+    else
287+        CXXFLAGS += -std=c++0x
288+    endif
289 endif
290