summary refs log tree commit diff
path: root/pkgs/development/libraries/nss/nix_secload_fixup.patch
blob: 89c82f1b87d488a6e560ec6d5faa86280142fc55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
diff -ru -x '*~' nss-3.15.1-orig/nss/cmd/shlibsign/shlibsign.c nss-3.15.1/nss/cmd/shlibsign/shlibsign.c
--- nss-3.15.1-orig/nss/cmd/shlibsign/shlibsign.c	2013-08-07 16:03:40.013256377 +0200
+++ nss-3.15.1/nss/cmd/shlibsign/shlibsign.c	2013-08-07 16:04:21.128410153 +0200
@@ -853,7 +853,7 @@
     assert(libname != NULL);
     lib = PR_LoadLibrary(libname);
     if (!lib)
-        lib = PR_LoadLibrary("/usr/lib/nss/libsoftokn3.so");
+        lib = PR_LoadLibrary(NIX_NSS_LIBDIR"libsoftokn3.so");
     assert(lib != NULL);
     PR_FreeLibraryName(libname);
 
diff -ru -x '*~' nss-3.15.1-orig/nss/coreconf/config.mk nss-3.15.1/nss/coreconf/config.mk
--- nss-3.15.1-orig/nss/coreconf/config.mk	2013-06-27 19:58:08.000000000 +0200
+++ nss-3.15.1/nss/coreconf/config.mk	2013-08-07 16:11:27.364608802 +0200
@@ -181,3 +181,6 @@
 
 # Build with NO_NSPR_10_SUPPORT to avoid using obsolete NSPR features
 DEFINES += -DNO_NSPR_10_SUPPORT
+
+# Nix specific stuff.
+DEFINES += -DNIX_NSS_LIBDIR=\"$(out)/lib/\"
diff -ru -x '*~' nss-3.15.1-orig/nss/lib/util/secload.c nss-3.15.1/nss/lib/util/secload.c
--- nss-3.15.1-orig/nss/lib/util/secload.c	2013-08-07 16:03:40.014256381 +0200
+++ nss-3.15.1/nss/lib/util/secload.c	2013-08-07 16:05:02.453563064 +0200
@@ -70,9 +70,9 @@
     /* Remove the trailing filename from referencePath and add the new one */
     c = strrchr(referencePath, PR_GetDirectorySeparator());
     if (!c) { /* referencePath doesn't contain a / means that dladdr gave us argv[0]
-               * and program was called from $PATH. Hack to get libs from /usr/lib */
-        referencePath = "/usr/lib/";
-        c = &referencePath[8]; /* last / */
+               * and program was called from $PATH. Hack to get libs from NIX_NSS_LIBDIR */
+        referencePath = NIX_NSS_LIBDIR;
+        c = &referencePath[sizeof(NIX_NSS_LIBDIR) - 1]; /* last / */
     }
     if (c) {
         size_t referencePathSize = 1 + c - referencePath;
@@ -90,8 +90,7 @@
                 (strncmp(fullName + referencePathSize - 4, "bin", 3) == 0)) {
                 memcpy(fullName + referencePathSize -4, "lib", 3);
             }
-            strcpy(fullName + referencePathSize, "nss/");
-            strcpy(fullName + referencePathSize + 4, name);
+            strcpy(fullName + referencePathSize, name);
             dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL
 #ifdef PR_LD_ALT_SEARCH_PATH
             /* allow library's dependencies to be found in the same directory