summaryrefslogtreecommitdiff
path: root/sci-physics/rivet/files/rivet-4.1.0-lib64.patch
blob: ef929985df3467ad198719ee934fddb0dc316571 (plain)
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
diff --git c/src/Tools/binreloc.c w/src/Tools/binreloc.c
index 0e11d570e..937e0d250 100644
--- c/src/Tools/binreloc.c
+++ w/src/Tools/binreloc.c
@@ -28,7 +28,19 @@
 extern "C" {
 #endif /* __cplusplus */
 
-
+const char *br_get_lib_suffix(const char *libdir) {
+    size_t len = strlen(libdir);
+    
+    // reverse skip trailing slashes
+    while (len > 0 && libdir[len - 1] == '/') {
+        len--;
+    }
+    // reverse skip over last dir (i.e. lib or lib64)
+    while ( len > 0 && libdir[len - 1] != '/' ) {
+	len--;
+    }
+    return strstr(libdir + len, "lib64") ? "lib64" : "lib";
+}
 
 /** @internal
  * Find the canonical filename of the executable. Returns the filename
@@ -603,7 +615,7 @@ br_find_lib_dir (const char *default_lib_dir)
 			return (char *) NULL;
 	}
 
-	dir = br_build_path (prefix, "lib");
+	dir = br_build_path (prefix, br_get_lib_suffix(default_lib_dir));
 	free (prefix);
 	return dir;
 }