postgis: fix build after output splits

Fixes #15236

Two changes were needed:

- pg_config from postgresql package wasn't reporting the correct location for
the pgxs extension system, after the output split
- json_c is now split in dev and out outputs, postgis configure doesn't find the
library location properly

Closes #15470
wip/yesman
Sebastián Bernardo Galkin 8 years ago committed by Joachim Fasting
parent 577d999ea6
commit edaecb41db
No known key found for this signature in database
GPG Key ID: 4330820E1E04DCF4
  1. 4
      pkgs/development/libraries/postgis/default.nix
  2. 7
      pkgs/servers/sql/postgresql/default.nix
  3. 17
      pkgs/servers/sql/postgresql/hardcode-pgxs-path.patch

@ -89,6 +89,10 @@ in rec {
sha256 = "02gsi1cm63kf0r7881444lrkzdjqhhpz9a5zav3al0q24nq01r8g";
sql_srcs = ["postgis.sql" "spatial_ref_sys.sql"];
builtInputs = [gdal json_c pkgconfig];
# postgis config directory assumes /include /lib from the same root for json-c library
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
dontDisableStatic = true;
preConfigure = ''
sed -i 's@/usr/bin/file@${file}/bin/file@' configure

@ -32,12 +32,19 @@ let
patches =
[ (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
];
installTargets = [ "install-world" ];
LC_ALL = "C";
postConfigure =
''
# Hardcode the path to pgxs so pg_config returns the path in $out
substituteInPlace "src/bin/pg_config/pg_config.c" --replace HARDCODED_PGXS_PATH $out/lib
'';
postInstall =
''
moveToOutput "lib/pgxs" "$out" # looks strange, but not deleting it

@ -0,0 +1,17 @@
--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -220,11 +220,13 @@ show_sysconfdir(bool all)
static void
show_pgxs(bool all)
{
- char path[MAXPGPATH];
+ char path[MAXPGPATH] = "HARDCODED_PGXS_PATH";
if (all)
printf("PGXS = ");
+ /* commented out to be able to point to nix $out path
get_pkglib_path(mypath, path);
+ */
strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
cleanup_path(path);
printf("%s\n", path);
Loading…
Cancel
Save