xref: /aoo41x/main/nss/nss.patch (revision e32eb42e)
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@@ -6,10 +6,12 @@
108 include $(CORE_DEPTH)/coreconf/UNIX.mk
109 include $(CORE_DEPTH)/coreconf/Werror.mk
110
111-DEFAULT_COMPILER = gcc
112+DEFAULT_COMPILER = cc
113+
114+# CC is taken from environment automatically.
115+#CC		= cc
116+CCC		= $(CXX)
117
118-CC		= gcc
119-CCC		= g++
120 RANLIB		= ranlib
121
122 ifndef CPU_ARCH
123diff -ur misc/nss-3.25/nss/coreconf/FreeBSD.mk misc/build/nss-3.25/nss/coreconf/FreeBSD.mk
124--- misc/nss-3.25/nss/coreconf/FreeBSD.mk	2016-06-20 10:11:28.000000000 -0700
125+++ misc/build/nss-3.25/nss/coreconf/FreeBSD.mk	2016-07-14 23:47:54.564724000 -0700
126@@ -5,9 +5,8 @@
127
128 include $(CORE_DEPTH)/coreconf/UNIX.mk
129
130-DEFAULT_COMPILER	= gcc
131-CC			= gcc
132-CCC			= g++
133+DEFAULT_COMPILER	= $(CC)
134+CCC			= $(CXX)
135 RANLIB			= ranlib
136
137 CPU_ARCH		= $(OS_TEST)
138@@ -21,7 +20,7 @@
139 CPU_ARCH		= x86_64
140 endif
141
142-OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
143+OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_UNISTD_H -DHAVE_BSD_FLOCK
144
145 DSO_CFLAGS		= -fPIC
146 DSO_LDOPTS		= -shared -Wl,-soname -Wl,$(notdir $@)
147diff -ur misc/nss-3.25/nss/coreconf/Linux.mk misc/build/nss-3.25/nss/coreconf/Linux.mk
148--- misc/nss-3.25/nss/coreconf/Linux.mk	2016-06-20 10:11:28.000000000 -0700
149+++ misc/build/nss-3.25/nss/coreconf/Linux.mk	2016-07-14 23:47:54.569918000 -0700
150@@ -16,8 +16,11 @@
151 	IMPL_STRATEGY = _PTH
152 endif
153
154-CC			= gcc
155-CCC			= g++
156+# CC is taken from environment automatically.
157+#CC			= gcc
158+# Use CCC from environment.
159+#CCC			= g++
160+CCC		= $(CXX)
161 RANLIB			= ranlib
162
163 DEFAULT_COMPILER = gcc
164@@ -139,7 +142,7 @@
165 OS_PTHREAD = -lpthread
166 endif
167
168-OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR
169+OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR -DHAVE_UNISTD_H
170 OS_LIBS			= $(OS_PTHREAD) -ldl -lc
171
172 ifdef USE_PTHREADS
173@@ -149,7 +152,7 @@
174 ARCH			= linux
175
176 DSO_CFLAGS		= -fPIC
177-DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections
178+DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections '-Wl,-rpath,$$ORIGIN'
179 # The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
180 # incorrectly reports undefined references in the libraries we link with, so
181 # we don't use -z defs there.
182@@ -189,8 +192,13 @@
183 endif
184 endif
185
186+ifeq ($(SYSTEM_ZLIB),YES)
187+# Currently (3.12.4) only the tools modutil and signtool are linked with libz
188+# If USE_SYSTEM_ZLIB is not set then the tools link statically libzlib.a which
189+# is also build in nss.
190 USE_SYSTEM_ZLIB = 1
191 ZLIB_LIBS = -lz
192+endif
193
194 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
195 # dependencies in the same directory where it resides.
196diff -ur misc/nss-3.25/nss/coreconf/SunOS5.mk misc/build/nss-3.25/nss/coreconf/SunOS5.mk
197--- misc/nss-3.25/nss/coreconf/SunOS5.mk	2016-06-20 10:11:28.000000000 -0700
198+++ misc/build/nss-3.25/nss/coreconf/SunOS5.mk	2016-07-14 23:47:54.575211000 -0700
199@@ -48,8 +48,12 @@
200 	    # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
201 	endif
202 else
203-	CC         = cc
204-	CCC        = CC
205+# CC is taken from environment automatically.
206+#	CC         = cc
207+# Use CXX from environment.
208+#	CCC        = CC
209+        CCC       = $(CXX)
210+
211 	ASFLAGS   += -Wa,-P
212 	OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
213 	ifndef BUILD_OPT
214diff -ur misc/nss-3.25/nss/coreconf/arch.mk misc/build/nss-3.25/nss/coreconf/arch.mk
215--- misc/nss-3.25/nss/coreconf/arch.mk	2016-06-20 10:11:28.000000000 -0700
216+++ misc/build/nss-3.25/nss/coreconf/arch.mk	2016-07-14 23:47:54.579901000 -0700
217@@ -294,7 +294,12 @@
218 ifdef CROSS_COMPILE
219 OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
220 else
221-OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
222+# OBJDIR_NAME is used to build the directory containing the built objects, for
223+# example mozilla/dist/Linux2.6_x86_glibc_PTH_DBG.OBJ
224+# We need to deliver the contents of that folder into the solver. To make that easier
225+# in the makefile we rename this directory to "out".
226+#OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
227+OBJDIR_NAME = out
228 endif
229
230
231diff -ur misc/nss-3.25/nss/coreconf/rules.mk misc/build/nss-3.25/nss/coreconf/rules.mk
232--- misc/nss-3.25/nss/coreconf/rules.mk	2016-06-20 10:11:28.000000000 -0700
233+++ misc/build/nss-3.25/nss/coreconf/rules.mk	2016-07-14 23:47:54.586736000 -0700
234@@ -322,7 +322,12 @@
235 ifdef NS_USE_GCC
236 	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
237 else
238-	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
239+        #We remove stl from the paths to avoid that rc.exe finds the stlport of
240+        #OOo. stlport includes the system stl which will fail. By removing it,
241+        #rc will use the stl from the system if the path is in the INCLUDE
242+        #variable.
243+	INCLUDE="$(subst /stl,,$(INCLUDE))" $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
244+
245 endif
246 	@echo $(RES) finished
247 endif
248diff -ur misc/nss-3.25/nss/lib/zlib/inflate.c misc/build/nss-3.25/nss/lib/zlib/inflate.c
249--- misc/nss-3.25/nss/lib/zlib/inflate.c	2016-06-20 10:11:28.000000000 -0700
250+++ misc/build/nss-3.25/nss/lib/zlib/inflate.c	2016-07-14 23:47:54.598199000 -0700
251@@ -1472,9 +1472,9 @@
252 {
253     struct inflate_state FAR *state;
254
255-    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
256+    if (strm == Z_NULL || strm->state == Z_NULL) return ~0UL << 16;
257     state = (struct inflate_state FAR *)strm->state;
258-    return ((long)(state->back) << 16) +
259+    return ((unsigned long)(state->back) << 16) +
260         (state->mode == COPY ? state->length :
261             (state->mode == MATCH ? state->was - state->length : 0));
262 }
263