3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
Sebastián Bernardo Galkin 2016-05-14 17:37:10 -07:00 committed by Joachim Fasting
parent 577d999ea6
commit edaecb41db
No known key found for this signature in database
GPG key ID: 4330820E1E04DCF4
3 changed files with 28 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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);