xref: /aoo41x/main/nss/nss.patch (revision 94670cb6)
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/FreeBSD.mk misc/build/nss-3.39/nss/coreconf/FreeBSD.mk
75--- misc/nss-3.39/nss/coreconf/FreeBSD.mk	2018-08-31 05:55:53.000000000 -0700
76+++ misc/build/nss-3.39/nss/coreconf/FreeBSD.mk	2020-10-06 07:41:59.567345437 -0700
77@@ -5,9 +5,8 @@
78
79 include $(CORE_DEPTH)/coreconf/UNIX.mk
80
81-DEFAULT_COMPILER	= gcc
82-CC			= gcc
83-CCC			= g++
84+DEFAULT_COMPILER	= $(CC)
85+CCC			= $(CXX)
86 RANLIB			= ranlib
87
88 CPU_ARCH		= $(OS_TEST)
89@@ -21,7 +20,7 @@
90 CPU_ARCH		= x86_64
91 endif
92
93-OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
94+OS_CFLAGS		= $(DSO_CFLAGS) -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_UNISTD_H -DHAVE_BSD_FLOCK
95
96 DSO_CFLAGS		= -fPIC
97 DSO_LDOPTS		= -shared -Wl,-soname -Wl,$(notdir $@)
98diff -ur misc/nss-3.39/nss/coreconf/Linux.mk misc/build/nss-3.39/nss/coreconf/Linux.mk
99--- misc/nss-3.39/nss/coreconf/Linux.mk	2018-08-31 05:55:53.000000000 -0700
100+++ misc/build/nss-3.39/nss/coreconf/Linux.mk	2020-10-06 07:41:59.567345437 -0700
101@@ -140,7 +140,7 @@
102 endif
103
104 DSO_CFLAGS		= -fPIC
105-DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections
106+DSO_LDOPTS		= -shared $(ARCHFLAG) -Wl,--gc-sections '-Wl,-rpath,$$ORIGIN'
107 # The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
108 # incorrectly reports undefined references in the libraries we link with, so
109 # we don't use -z defs there.
110@@ -177,8 +177,13 @@
111 endif
112 endif
113
114+ifeq ($(SYSTEM_ZLIB),YES)
115+# Currently (3.12.4) only the tools modutil and signtool are linked with libz
116+# If USE_SYSTEM_ZLIB is not set then the tools link statically libzlib.a which
117+# is also build in nss.
118 USE_SYSTEM_ZLIB = 1
119 ZLIB_LIBS = -lz
120+endif
121
122 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
123 # dependencies in the same directory where it resides.
124diff -ur misc/nss-3.39/nss/coreconf/rules.mk misc/build/nss-3.39/nss/coreconf/rules.mk
125--- misc/nss-3.39/nss/coreconf/rules.mk	2018-08-31 05:55:53.000000000 -0700
126+++ misc/build/nss-3.39/nss/coreconf/rules.mk	2020-10-06 07:41:59.567345437 -0700
127@@ -322,7 +322,12 @@
128 ifdef NS_USE_GCC
129 	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
130 else
131-	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
132+        #We remove stl from the paths to avoid that rc.exe finds the stlport of
133+        #OOo. stlport includes the system stl which will fail. By removing it,
134+        #rc will use the stl from the system if the path is in the INCLUDE
135+        #variable.
136+	INCLUDE="$(subst /stl,,$(INCLUDE))" $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
137+
138 endif
139 	@echo $(RES) finished
140 endif
141diff -ur misc/nss-3.39/nss/coreconf/SunOS5.mk misc/build/nss-3.39/nss/coreconf/SunOS5.mk
142--- misc/nss-3.39/nss/coreconf/SunOS5.mk	2018-08-31 05:55:53.000000000 -0700
143+++ misc/build/nss-3.39/nss/coreconf/SunOS5.mk	2020-10-06 07:41:59.567345437 -0700
144@@ -48,8 +48,12 @@
145 	    # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
146 	endif
147 else
148-	CC         = cc
149-	CCC        = CC
150+# CC is taken from environment automatically.
151+#	CC         = cc
152+# Use CXX from environment.
153+#	CCC        = CC
154+        CCC       = $(CXX)
155+
156 	ASFLAGS   += -Wa,-P
157 	OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
158 	ifndef BUILD_OPT
159diff -ur misc/nss-3.39/nss/lib/zlib/inflate.c misc/build/nss-3.39/nss/lib/zlib/inflate.c
160--- misc/nss-3.39/nss/lib/zlib/inflate.c	2018-08-31 05:55:53.000000000 -0700
161+++ misc/build/nss-3.39/nss/lib/zlib/inflate.c	2020-10-06 07:41:59.567345437 -0700
162@@ -1472,9 +1472,9 @@
163 {
164     struct inflate_state FAR *state;
165
166-    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
167+    if (strm == Z_NULL || strm->state == Z_NULL) return ~0UL << 16;
168     state = (struct inflate_state FAR *)strm->state;
169-    return ((long)(state->back) << 16) +
170+    return ((unsigned long)(state->back) << 16) +
171         (state->mode == COPY ? state->length :
172             (state->mode == MATCH ? state->was - state->length : 0));
173 }
174diff -ur misc/nss-3.39/nss/Makefile misc/build/nss-3.39/nss/Makefile
175--- misc/nss-3.39/nss/Makefile	2018-08-31 05:55:53.000000000 -0700
176+++ misc/build/nss-3.39/nss/Makefile	2020-10-06 07:41:59.567345437 -0700
177@@ -77,6 +77,9 @@
178 ifeq ($(OS_TARGET),WIN95)
179 NSPR_CONFIGURE_OPTS += --enable-win32-target=WIN95
180 endif
181+ifdef MACOS_SDK_DIR
182+NSPR_CONFIGURE_OPTS += --with-macos-sdk=$(MACOS_SDK_DIR)
183+endif
184 ifdef USE_DEBUG_RTL
185 NSPR_CONFIGURE_OPTS += --enable-debug-rtl
186 endif
187