xref: /aoo42x/main/nss/nss.patch (revision a46cde23)
1diff -ur misc/nss-3.39/nspr/configure misc/build/nss-3.39/nspr/configure
2--- misc/nss-3.39/nspr/configure	2018-08-28 05:42:28.000000000 -0700
3+++ misc/build/nss-3.39/nspr/configure	2020-10-06 07:41:59.563345390 -0700
4@@ -7039,7 +7039,7 @@
5     PR_MD_CSRCS=linux.c
6     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
7     DSO_CFLAGS=-fPIC
8-    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
9+    DSO_LDOPTS='-shared -Wl,-rpath,\$$ORIGIN -Wl,-soname -Wl,$(notdir $@)'
10     _OPTIMIZE_FLAGS=-O2
11     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
12                                    # combo is not yet good at debugging inlined
13diff -ur misc/nss-3.39/nspr/pr/include/pratom.h misc/build/nss-3.39/nspr/pr/include/pratom.h
14--- misc/nss-3.39/nspr/pr/include/pratom.h	2018-08-28 05:42:28.000000000 -0700
15+++ misc/build/nss-3.39/nspr/pr/include/pratom.h	2020-10-06 07:41:59.563345390 -0700
16@@ -81,7 +81,9 @@
17 #if defined(_WIN32) && !defined(_WIN32_WCE) && \
18     (!defined(_MSC_VER) || (_MSC_VER >= 1310))
19
20+PR_END_EXTERN_C
21 #include <intrin.h>
22+PR_BEGIN_EXTERN_C
23
24 #ifdef _MSC_VER
25 #pragma intrinsic(_InterlockedIncrement)
26diff -ur misc/nss-3.39/nss/cmd/platlibs.mk misc/build/nss-3.39/nss/cmd/platlibs.mk
27--- misc/nss-3.39/nss/cmd/platlibs.mk	2018-08-31 05:55:53.000000000 -0700
28+++ misc/build/nss-3.39/nss/cmd/platlibs.mk	2020-10-06 07:41:59.567345437 -0700
29@@ -10,17 +10,18 @@
30
31 ifeq ($(OS_ARCH), SunOS)
32 ifeq ($(USE_64), 1)
33-EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
34+#In AOO we would probable put the executables next to libs
35+EXTRA_SHARED_LIBS += -R '$$ORIGIN'
36 else
37-EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1:/usr/lib/mps'
38+EXTRA_SHARED_LIBS += -R '$$ORIGIN'
39 endif
40 endif
41
42 ifeq ($(OS_ARCH), Linux)
43 ifeq ($(USE_64), 1)
44-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib64:/opt/sun/private/lib64:$$ORIGIN/../lib'
45+EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN'
46 else
47-EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib:/opt/sun/private/lib'
48+EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN'
49 endif
50 endif
51
52diff -ur misc/nss-3.39/nss/cmd/shlibsign/Makefile misc/build/nss-3.39/nss/cmd/shlibsign/Makefile
53--- misc/nss-3.39/nss/cmd/shlibsign/Makefile	2018-08-31 05:55:53.000000000 -0700
54+++ misc/build/nss-3.39/nss/cmd/shlibsign/Makefile	2020-10-06 07:41:59.567345437 -0700
55@@ -49,10 +49,15 @@
56 CHECKLIBS =
57 CHECKLOC =
58 else
59-CHECKLIBS = $(DIST)/lib/$(DLL_PREFIX)softokn3.$(DLL_SUFFIX)
60-CHECKLIBS += $(wildcard $(DIST)/lib/$(DLL_PREFIX)freebl*3.$(DLL_SUFFIX))
61+# Signing causes loading of some system library which in turn loads
62+# libsqlite3. Then it loads libsqulite3 from nss, which does not have the proper
63+# version. Therefore signing fails.
64+# We cannot build with the system sqlite3, because it is too old (SDK
65+# 10.4). Otherwise one could set NSS_USE_SYSTEM_SQLITE=1 and use the system lib.
66+#CHECKLIBS = $(DIST)/lib/$(DLL_PREFIX)softokn3.$(DLL_SUFFIX)
67+#CHECKLIBS += $(wildcard $(DIST)/lib/$(DLL_PREFIX)freebl*3.$(DLL_SUFFIX))
68 ifndef NSS_DISABLE_DBM
69-CHECKLIBS += $(DIST)/lib/$(DLL_PREFIX)nssdbm3.$(DLL_SUFFIX)
70+#CHECKLIBS += $(DIST)/lib/$(DLL_PREFIX)nssdbm3.$(DLL_SUFFIX)
71 endif
72 CHECKLOC = $(CHECKLIBS:.$(DLL_SUFFIX)=.chk)
73
74diff -ur misc/nss-3.39/nss/coreconf/Darwin.mk misc/build/nss-3.39/nss/coreconf/Darwin.mk
75--- misc/nss-3.39/nss/coreconf/Darwin.mk	2018-08-31 05:55:53.000000000 -0700
76+++ misc/build/nss-3.39/nss/coreconf/Darwin.mk	2020-10-06 07:51:49.590356560 -0700
77@@ -3,14 +3,15 @@
78 # License, v. 2.0. If a copy of the MPL was not distributed with this
79 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
80
81-CC     ?= gcc
82-CCC    ?= g++
83+# CC is taken from environment automatically.
84+#CC     ?= gcc
85+CCC    ?= $(CXX)
86 RANLIB ?= ranlib
87
88 include $(CORE_DEPTH)/coreconf/UNIX.mk
89-include $(CORE_DEPTH)/coreconf/Werror.mk
90+#include $(CORE_DEPTH)/coreconf/Werror.mk
91
92-DEFAULT_COMPILER = gcc
93+DEFAULT_COMPILER = cc
94
95 ifndef CPU_ARCH
96 # When cross-compiling, CPU_ARCH should already be defined as the target
97diff -ur misc/nss-3.39/nss/coreconf/FreeBSD.mk misc/build/nss-3.39/nss/coreconf/FreeBSD.mk
98--- misc/nss-3.39/nss/coreconf/FreeBSD.mk	2018-08-31 05:55:53.000000000 -0700
99+++ misc/build/nss-3.39/nss/coreconf/FreeBSD.mk	2020-10-06 07:41:59.567345437 -0700
100@@ -5,9 +5,8 @@
101
102 include $(CORE_DEPTH)/coreconf/UNIX.mk
103
104-DEFAULT_COMPILER	= gcc
105-CC			= gcc
106-CCC			= g++
107+DEFAULT_COMPILER	= $(CC)
108+CCC			= $(CXX)
109 RANLIB			= ranlib
110
111 CPU_ARCH		= $(OS_TEST)
112@@ -21,7 +20,7 @@
113 CPU_ARCH		= x86_64
114 endif
115
116-OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
117+OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_UNISTD_H -DHAVE_BSD_FLOCK
118
119 DSO_CFLAGS		= -fPIC
120 DSO_LDOPTS		= -shared -Wl,-soname -Wl,$(notdir $@)
121diff -ur misc/nss-3.39/nss/coreconf/Linux.mk misc/build/nss-3.39/nss/coreconf/Linux.mk
122--- misc/nss-3.39/nss/coreconf/Linux.mk	2018-08-31 05:55:53.000000000 -0700
123+++ misc/build/nss-3.39/nss/coreconf/Linux.mk	2020-10-06 07:41:59.567345437 -0700
124@@ -140,7 +140,7 @@
125 endif
126
127 DSO_CFLAGS		= -fPIC
128-DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections
129+DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections '-Wl,-rpath,$$ORIGIN'
130 # The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
131 # incorrectly reports undefined references in the libraries we link with, so
132 # we don't use -z defs there.
133@@ -177,8 +177,13 @@
134 endif
135 endif
136
137+ifeq ($(SYSTEM_ZLIB),YES)
138+# Currently (3.12.4) only the tools modutil and signtool are linked with libz
139+# If USE_SYSTEM_ZLIB is not set then the tools link statically libzlib.a which
140+# is also build in nss.
141 USE_SYSTEM_ZLIB = 1
142 ZLIB_LIBS = -lz
143+endif
144
145 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
146 # dependencies in the same directory where it resides.
147diff -ur misc/nss-3.39/nss/coreconf/rules.mk misc/build/nss-3.39/nss/coreconf/rules.mk
148--- misc/nss-3.39/nss/coreconf/rules.mk	2018-08-31 05:55:53.000000000 -0700
149+++ misc/build/nss-3.39/nss/coreconf/rules.mk	2020-10-06 07:41:59.567345437 -0700
150@@ -322,7 +322,12 @@
151 ifdef NS_USE_GCC
152 	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
153 else
154-	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
155+        #We remove stl from the paths to avoid that rc.exe finds the stlport of
156+        #OOo. stlport includes the system stl which will fail. By removing it,
157+        #rc will use the stl from the system if the path is in the INCLUDE
158+        #variable.
159+	INCLUDE="$(subst /stl,,$(INCLUDE))" $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
160+
161 endif
162 	@echo $(RES) finished
163 endif
164diff -ur misc/nss-3.39/nss/coreconf/SunOS5.mk misc/build/nss-3.39/nss/coreconf/SunOS5.mk
165--- misc/nss-3.39/nss/coreconf/SunOS5.mk	2018-08-31 05:55:53.000000000 -0700
166+++ misc/build/nss-3.39/nss/coreconf/SunOS5.mk	2020-10-06 07:41:59.567345437 -0700
167@@ -48,8 +48,12 @@
168 	    # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
169 	endif
170 else
171-	CC         = cc
172-	CCC        = CC
173+# CC is taken from environment automatically.
174+#	CC         = cc
175+# Use CXX from environment.
176+#	CCC        = CC
177+        CCC       = $(CXX)
178+
179 	ASFLAGS   += -Wa,-P
180 	OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
181 	ifndef BUILD_OPT
182diff -ur misc/nss-3.39/nss/lib/zlib/inflate.c misc/build/nss-3.39/nss/lib/zlib/inflate.c
183--- misc/nss-3.39/nss/lib/zlib/inflate.c	2018-08-31 05:55:53.000000000 -0700
184+++ misc/build/nss-3.39/nss/lib/zlib/inflate.c	2020-10-06 07:41:59.567345437 -0700
185@@ -1472,9 +1472,9 @@
186 {
187     struct inflate_state FAR *state;
188
189-    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
190+    if (strm == Z_NULL || strm->state == Z_NULL) return ~0UL << 16;
191     state = (struct inflate_state FAR *)strm->state;
192-    return ((long)(state->back) << 16) +
193+    return ((unsigned long)(state->back) << 16) +
194         (state->mode == COPY ? state->length :
195             (state->mode == MATCH ? state->was - state->length : 0));
196 }
197diff -ur misc/nss-3.39/nss/Makefile misc/build/nss-3.39/nss/Makefile
198--- misc/nss-3.39/nss/Makefile	2018-08-31 05:55:53.000000000 -0700
199+++ misc/build/nss-3.39/nss/Makefile	2020-10-06 07:41:59.567345437 -0700
200@@ -77,6 +77,9 @@
201 ifeq ($(OS_TARGET),WIN95)
202 NSPR_CONFIGURE_OPTS += --enable-win32-target=WIN95
203 endif
204+ifdef MACOS_SDK_DIR
205+NSPR_CONFIGURE_OPTS += --with-macos-sdk=$(MACOS_SDK_DIR)
206+endif
207 ifdef USE_DEBUG_RTL
208 NSPR_CONFIGURE_OPTS += --enable-debug-rtl
209 endif
210