about summary refs log tree commit diff
path: root/pkgs/servers/sql/postgresql/patches/specify_pkglibdir_at_runtime.patch
blob: b94fc9efcbff8fd5e70ef4dffa43574db06443cc (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
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -714,7 +714,11 @@
 void
 get_lib_path(const char *my_exec_path, char *ret_path)
 {
-	make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
+	char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
+	if(nix_pglibdir == NULL)
+		make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
+	else
+		make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
 }
 
 /*
@@ -723,7 +727,11 @@
 void
 get_pkglib_path(const char *my_exec_path, char *ret_path)
 {
-	make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
+	char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
+	if(nix_pglibdir == NULL)
+		make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
+	else
+		make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
 }
 
 /*