summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorLancelot SIX <lsix@lancelotsix.com>2016-08-19 09:06:40 +0200
committerLancelot SIX <lsix@lancelotsix.com>2016-09-02 11:51:21 +0200
commit5b8072fff6afe5a455d06b8b8f37a6d7e0519986 (patch)
tree9a4bf5397bbff921b78261cb347357f81801032b /pkgs/servers
parentf976fa40a238e9bf78fd1a875dbd2f23318acf6a (diff)
downloadnixlib-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar
nixlib-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.gz
nixlib-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.bz2
nixlib-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.lz
nixlib-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.xz
nixlib-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.zst
nixlib-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.zip
postgresql: Fix use with extensions
Fixes #15512 and #16032

With the multi output, postgresql cannot find at runtime what is its
basedir when looking for libdir and pkglibdir. This commit fixes that.
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/sql/postgresql/default.nix1
-rw-r--r--pkgs/servers/sql/postgresql/specify_pkglibdir_at_runtime.patch29
2 files changed, 30 insertions, 0 deletions
diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix
index b58ca5f44b9c..c0e97dab8125 100644
--- a/pkgs/servers/sql/postgresql/default.nix
+++ b/pkgs/servers/sql/postgresql/default.nix
@@ -33,6 +33,7 @@ let
       [ (if lib.versionAtLeast version "9.4" then ./disable-resolve_symlinks-94.patch else ./disable-resolve_symlinks.patch)
         ./less-is-more.patch
         ./hardcode-pgxs-path.patch
+        ./specify_pkglibdir_at_runtime.patch
       ];
 
     installTargets = [ "install-world" ];
diff --git a/pkgs/servers/sql/postgresql/specify_pkglibdir_at_runtime.patch b/pkgs/servers/sql/postgresql/specify_pkglibdir_at_runtime.patch
new file mode 100644
index 000000000000..fe95d2ee99f0
--- /dev/null
+++ b/pkgs/servers/sql/postgresql/specify_pkglibdir_at_runtime.patch
@@ -0,0 +1,29 @@
+diff -ur postgresql-9.5.3-orig/src/port/path.c postgresql-9.5.3/src/port/path.c
+--- postgresql-9.5.3-orig/src/port/path.c	2016-05-09 22:50:23.000000000 +0200
++++ postgresql-9.5.3/src/port/path.c	2016-08-29 22:44:10.507377613 +0200
+@@ -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);
+ }
+ 
+ /*