nixpkgs/pkgs/development/libraries/nss/nix_secload_fixup.patch
2013-08-07 17:12:33 +02:00

48 lines
2.4 KiB
Diff

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