5 NSPR_CONFIGURE_ENV = CC=gcc CXX=g++
7 -# Make sure to remove -arch arguments. NSPR can't handle that.
8 -remove_arch = $(filter-out __REMOVEME%,$(subst $(NULL) -arch , __REMOVEME,$(1)))
10 -NSPR_CONFIGURE_ENV = CC="$(call remove_arch,$(CC))"
11 +NSPR_CONFIGURE_ENV = CC="$(CC)"
14 -NSPR_CONFIGURE_ENV += CXX="$(call remove_arch,$(CCC))"
15 +NSPR_CONFIGURE_ENV += CXX="$(CCC)"
21 build_nspr: $(NSPR_CONFIG_STATUS)
22 $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
23 - $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/pr/tests
25 install_nspr: build_nspr
26 $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install
27 --- a/a/nss/lib/ckfw/builtins/manifest.mn
28 +++ a/a/nss/lib/ckfw/builtins/manifest.mn
38 --- a/a/nss/lib/nss/nssinit.c
39 +++ a/a/nss/lib/nss/nssinit.c
41 const char *secmodprefix,
42 char **retoldpath, char **retnewpath)
44 +#ifndef NSS_STATIC_PKCS11
45 char *path, *oldpath = NULL, *lastsep;
46 int len, path_len, secmod_len, dll_len;
50 *retoldpath = oldpath;
54 + *retnewpath = PORT_Strdup("NSSCKBI");
59 --- a/a/nss/lib/pk11wrap/pk11load.c
60 +++ a/a/nss/lib/pk11wrap/pk11load.c
63 * load a new module into our address space and initialize it.
65 +extern CK_RV NSSCKBI_C_GetFunctionList();
68 secmod_LoadPKCS11Module(SECMODModule *mod, SECMODModule **oldModule)
71 /* load the library. If this succeeds, then we have to remember to
72 * unload the library if anything goes wrong from here on out...
74 +#ifndef NSS_STATIC_PKCS11 // With NSS_STATIC_PKCS11, the only module wodule we load here is nssckbi
76 if (nssUTF8_Length(mod->dllName, NULL)) {
77 wchar_t *dllNameWide = _NSSUTIL_UTF8ToWide(mod->dllName);
79 mod->moduleDBFunc = (void *)
80 PR_FindSymbol(library, "NSS_ReturnModuleSpecData");
83 + if (strcmp(mod->dllName, "NSSCKBI") == 0)
84 + fentry = NSSCKBI_C_GetFunctionList;
87 if (mod->moduleDBFunc == NULL)
88 mod->isModuleDB = PR_FALSE;
89 if ((ientry == NULL) && (fentry == NULL)) {
93 mod->functionList = NULL;
94 +#ifndef NSS_STATIC_PKCS11
95 disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD");
96 if (library && !disableUnload) {
97 PR_UnloadLibrary(library);
103 --- a/a/nss/lib/ckfw/nssck.api
104 +++ a/a/nss/lib/ckfw/nssck.api
105 @@ -1842,7 +1842,11 @@
107 /* This one is always present */
109 +#ifndef NSS_STATIC_PKCS11
112 +NSSCKBI_C_GetFunctionList
115 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
117 --- a/a/nss/lib/freebl/loader.c
118 +++ a/a/nss/lib/freebl/loader.c
123 +#ifndef NSS_STATIC_FREEBL
125 const char *name = getLibName();
129 PRFuncPtr address = PR_FindFunctionSymbol(handle, "FREEBL_GetVector");
131 - FREEBLGetVectorFn *getVector = (FREEBLGetVectorFn *)address;
133 + FREEBLGetVectorFn *getVector = FREEBL_GetVector;
135 const FREEBLVector *dsoVector = getVector();
137 unsigned short dsoVersion = dsoVector->version;
138 unsigned short myVersion = FREEBL_VERSION;
139 if (MSB(dsoVersion) == MSB(myVersion) &&
140 LSB(dsoVersion) >= LSB(myVersion) &&
141 dsoVector->length >= sizeof(FREEBLVector)) {
143 +#ifndef NSS_STATIC_FREEBL
147 + libraryName = "self";
154 +#ifndef NSS_STATIC_FREEBL
158 PRStatus status = PR_UnloadLibrary(blLib);
159 PORT_Assert(PR_SUCCESS == status);
163 PR_UnloadLibrary(blLib);
170 static const PRCallOnceType pristineCallOnce;
175 +#ifndef NSS_STATIC_FREEBL
176 /* This function is not thread-safe, but doesn't need to be, because it is
177 * only called from functions that are also defined as not thread-safe,
178 * namely C_Finalize in softoken, and the SSL bypass shutdown callback called
180 PR_UnloadLibrary(blLib);
185 loadFreeBLOnce = pristineCallOnce;
187 --- a/a/nspr/build/autoconf/config.sub 2017-09-07 15:29:45.031246453 +0200
188 +++ a/a/nspr/build/autoconf/config.sub 2017-09-07 15:32:13.087235423 +0200
193 +if test $1 = "arm64-apple-darwin"; then echo $1; exit; fi
194 +if test $1 = "aarch64-apple-darwin"; then echo $1; exit; fi
196 # Split fields of configuration type
197 # shellcheck disable=SC2162
198 IFS="-" read field1 field2 field3 field4 <<EOF
199 --- a/a/nspr/config/autoconf.mk.in
200 +++ a/a/nspr/config/autoconf.mk.in
204 AR_FLAGS = @AR_FLAGS@
210 --- a/a/nspr/configure
211 +++ a/a/nspr/configure
212 @@ -2507,7 +2507,7 @@
213 OBJDIR='$(OBJDIR_NAME)'
216 -NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall'
217 +NSINSTALL=${NSINSTALL?'$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall'}
218 NOSUCHFILE=/no-such-file
219 LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
220 LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)'
221 @@ -5571,7 +5571,7 @@
225 -MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
226 +MKSHLIB='touch $@; echo'
230 @@ -6485,7 +6485,7 @@
232 DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @__________________________________________________OOO/$@ -headerpad_max_install_names'
234 - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
239 --- a/a/nss/coreconf/ruleset.mk
240 +++ a/a/nss/coreconf/ruleset.mk
246 + MKPROG = touch $@; echo
250 --- a/a/nss/coreconf/Darwin.mk
251 +++ a/a/nss/coreconf/Darwin.mk
253 DSO_LDOPTS += --coverage
256 -MKSHLIB = $(CC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS)
257 +MKSHLIB = touch $@; echo
260 MKSHLIB += -exported_symbols_list $(MAPFILE)
261 --- a/a/nss/coreconf/UNIX.mk
262 +++ a/a/nss/coreconf/UNIX.mk
266 NSINSTALL_DIR = $(BUILD_TREE)/nss
268 NSINSTALL = $(BUILD_TREE)/nss/nsinstall
271 NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
273 NSINSTALL = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall
277 ####################################################################
278 --- a/a/nspr/pr/include/md/_darwin.h
279 +++ a/a/nspr/pr/include/md/_darwin.h
281 #define _PR_SI_ARCHITECTURE "ppc"
282 #elif defined(__arm__)
283 #define _PR_SI_ARCHITECTURE "arm"
284 +#elif defined(__arm64__)
285 +#define _PR_SI_ARCHITECTURE "arm64"
286 #elif defined(__aarch64__)
287 #define _PR_SI_ARCHITECTURE "aarch64"
289 --- a/a/nss/cmd/shlibsign/sign.sh
290 +++ a/a/nss/cmd/shlibsign/sign.sh
292 # This Source Code Form is subject to the terms of the Mozilla Public
293 # License, v. 2.0. If a copy of the MPL was not distributed with this
294 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
296 +# Pointless to sign anything for iOS as we don't build any real shared libraries
300 # 1: full path to DIST/OBJDIR (parent dir of "lib")