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