build fix
[LibreOffice.git] / external / nss / nss.patch
blobb3b932343d83196039cc6c782cc7af402d9cf537
1 --- a/nss.orig/nspr/pr/src/misc/prnetdb.c 2016-02-12 14:51:25.000000000 +0100
2 +++ b/nss/nspr/pr/src/misc/prnetdb.c 2016-03-04 19:23:00.462892600 +0100
3 @@ -438,7 +438,7 @@
4 char *buf = *bufp;
5 PRIntn buflen = *buflenp;
7 - if (align && ((long)buf & (align - 1))) {
8 + if (align && ((ptrdiff_t)buf & (align - 1))) {
9 PRIntn skip = align - ((ptrdiff_t)buf & (align - 1));
10 if (buflen < skip) {
11 return 0;
12 diff -ru a/nspr/configure b/nspr/configure
13 --- a/a/nspr/configure 2014-09-29 16:46:38.427423757 +0100
14 +++ b/b/nspr/configure 2014-09-29 16:47:42.984012225 +0100
15 @@ -7018,7 +7018,7 @@
16 PR_MD_CSRCS=linux.c
17 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
18 DSO_CFLAGS=-fPIC
19 - DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
20 + DSO_LDOPTS='-shared -Wl,-z,origin -Wl,-rpath,\$$ORIGIN -Wl,-soname -Wl,$(notdir $@)'
21 _OPTIMIZE_FLAGS=-O2
22 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
23 # combo is not yet good at debugging inlined
24 diff -ru a/nss/cmd/platlibs.mk b/nss/cmd/platlibs.mk
25 --- a/a/nss/cmd/platlibs.mk 2014-09-29 16:46:38.306422654 +0100
26 +++ b/b/nss/cmd/platlibs.mk 2014-09-29 16:47:42.987012253 +0100
27 @@ -10,17 +10,22 @@
29 ifeq ($(OS_ARCH), SunOS)
30 ifeq ($(USE_64), 1)
31 -EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
32 +#In OOo we would probable put the executables next to libs
33 +EXTRA_SHARED_LIBS += -R '$$ORIGIN'
34 else
35 -EXTRA_SHARED_LIBS += -R '$$ORIGIN/../lib:/usr/lib/mps/secv1:/usr/lib/mps'
36 +EXTRA_SHARED_LIBS += -R '$$ORIGIN'
37 endif
38 endif
40 +ifeq ($(OS_ARCH), FreeBSD)
41 +EXTRA_SHARED_LIBS += -Wl,-z,origin -Wl,-rpath,'$$ORIGIN'
42 +endif
44 ifeq ($(OS_ARCH), Linux)
45 ifeq ($(USE_64), 1)
46 -EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib64:/opt/sun/private/lib64:$$ORIGIN/../lib'
47 +EXTRA_SHARED_LIBS += -Wl,-z,origin -Wl,-rpath,'$$ORIGIN'
48 else
49 -EXTRA_SHARED_LIBS += -Wl,-rpath,'$$ORIGIN/../lib:/opt/sun/private/lib'
50 +EXTRA_SHARED_LIBS += -Wl,-z,origin -Wl,-rpath,'$$ORIGIN'
51 endif
52 endif
54 diff -ru nss.orig/nss/coreconf/arch.mk nss/nss/coreconf/arch.mk
55 --- a/nss.orig/nss/coreconf/arch.mk 2016-02-12 15:36:18.000000000 +0100
56 +++ b/nss/nss/coreconf/arch.mk 2016-02-23 20:48:31.595941079 +0100
57 @@ -280,11 +280,17 @@
58 OBJDIR_NAME_COMPILER = $(COMPILER_TAG)
59 endif
60 OBJDIR_NAME_BASE = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(OBJDIR_NAME_COMPILER)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG)
61 -OBJDIR_NAME = $(OBJDIR_NAME_BASE).OBJ
62 +# OBJDIR_NAME is used to build the directory containing the built objects, for
63 +# example mozilla/dist/Linux2.6_x86_glibc_PTH_DBG.OBJ
64 +# We need to deliver the contents of that folder into instdir. To make that
65 +# easier in the makefile we rename this directory to "out".
66 +#OBJDIR_NAME = $(OBJDIR_NAME_BASE).OBJ
67 +OBJDIR_NAME = out
70 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
71 -ifndef BUILD_OPT
72 +ifdef THIS_HAS_BEEN_DISABLED_TO_GET_out
75 # Define USE_DEBUG_RTL if you want to use the debug runtime library
76 # (RTL) in the debug build
77 diff -ru a/nss/coreconf/FreeBSD.mk b/nss/coreconf/FreeBSD.mk
78 --- a/a/nss/coreconf/FreeBSD.mk 2014-09-29 16:46:38.189421588 +0100
79 +++ b/b/nss/coreconf/FreeBSD.mk 2014-09-29 16:47:42.984012225 +0100
80 @@ -25,6 +25,7 @@
82 DSO_CFLAGS = -fPIC
83 DSO_LDOPTS = -shared -Wl,-soname -Wl,$(notdir $@)
84 +DSO_LDOPTS += -Wl,-z,origin '-Wl,-rpath,$$ORIGIN'
87 # The default implementation strategy for FreeBSD is pthreads.
88 diff -ru a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
89 --- a/a/nss/coreconf/Linux.mk 2014-09-29 16:46:38.189421588 +0100
90 +++ b/b/nss/coreconf/Linux.mk 2014-09-29 16:47:42.985012235 +0100
91 @@ -157,7 +160,7 @@
92 # against the libsanitizer runtime built into the main executable.
93 ZDEFS_FLAG = -Wl,-z,defs
94 ifneq ($(USE_ASAN),1)
95 -DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
96 +DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) -Wl,-z,origin '-Wl,-rpath,$$ORIGIN'
97 endif
98 LDFLAGS += $(ARCHFLAG)
100 @@ -189,8 +192,13 @@
101 endif
102 endif
104 +ifneq ($(SYSTEM_ZLIB),)
105 +# Currently (3.12.4) only the tools modutil and signtool are linked with libz
106 +# If USE_SYSTEM_ZLIB is not set then the tools link statically libzlib.a which
107 +# is also built in nss.
108 USE_SYSTEM_ZLIB = 1
109 ZLIB_LIBS = -lz
110 +endif
112 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
113 # dependencies in the same directory where it resides.
114 diff -ru a/nss/coreconf/rules.mk b/nss/coreconf/rules.mk
115 --- a/a/nss/coreconf/rules.mk 2014-09-29 16:46:38.188421578 +0100
116 +++ b/b/nss/coreconf/rules.mk 2014-09-29 16:47:42.986012244 +0100
117 @@ -261,7 +261,7 @@
118 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
119 $(AR) $(subst /,\\,$(OBJS))
120 else
121 - $(AR) $(OBJS)
122 + $(AR) cr $@ $(OBJS)
123 endif
124 $(RANLIB) $@
126 diff -ru a/nss/coreconf/SunOS5.mk b/nss/coreconf/SunOS5.mk
127 --- a/a/nss/coreconf/SunOS5.mk 2014-09-29 16:46:38.175421471 +0100
128 +++ b/b/nss/coreconf/SunOS5.mk 2014-09-29 16:47:42.985012235 +0100
129 @@ -48,8 +48,12 @@
130 # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
131 endif
132 else
133 - CC = cc
134 - CCC = CC
135 +# CC is taken from environment automatically.
136 +# CC = cc
137 +# Use CXX from environment.
138 +# CCC = CC
139 + CCC = $(CXX)
141 ASFLAGS += -Wa,-P
142 OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
143 ifndef BUILD_OPT
144 diff -ru a/nss/Makefile b/nss/Makefile
145 --- a/a/nss/Makefile 2014-09-29 16:46:38.171421425 +0100
146 +++ b/b/nss/Makefile 2014-09-29 16:47:42.987012253 +0100
147 @@ -1,3 +1,5 @@
148 +export AR
149 +export RANLIB
150 #! gmake
152 # This Source Code Form is subject to the terms of the Mozilla Public
153 @@ -91,10 +91,10 @@
154 NSPR_CONFIGURE_ENV = CC=gcc CXX=g++
155 endif
156 ifdef CC
157 -NSPR_CONFIGURE_ENV = CC=$(CC)
158 +NSPR_CONFIGURE_ENV = CC="$(CC) "
159 endif
160 ifdef CCC
161 -NSPR_CONFIGURE_ENV += CXX=$(CCC)
162 +NSPR_CONFIGURE_ENV += CXX="$(CCC) "
163 endif
164 # Remove -arch definitions. NSPR can't handle that.
165 NSPR_CONFIGURE_ENV := $(filter-out -arch x86_64,$(NSPR_CONFIGURE_ENV))
166 diff -ru nss.orig/nss/coreconf/Werror.mk nss/nss/coreconf/Werror.mk
167 --- a/nss.orig/nss/coreconf/Werror.mk 2016-02-12 15:36:18.000000000 +0100
168 +++ b/nss/nss/coreconf/Werror.mk 2016-02-23 23:58:15.119584046 +0100
169 @@ -94,7 +94,8 @@
170 endif #ndef NSS_ENABLE_WERROR
172 ifeq ($(NSS_ENABLE_WERROR),1)
173 - WARNING_CFLAGS += -Werror
174 +# We do not treat warnings as errors.
175 +# WARNING_CFLAGS += -Werror
176 else
177 # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
178 # Use this to disable use of that #pragma and the warnings it suppresses.