1Nix outputs put the `name' in each store path like
2/nix/store/...-<name>. This was confusing the Postgres make script
3because it thought its data directory already had postgresql in its
4directory. This lead to Postgres installing all of its fils in
5$out/share. To fix this, we just look for postgres or psql in the part
6after the / using make's notdir.
7
8---
9--- a/src/Makefile.global.in
10+++ b/src/Makefile.global.in
11@@ -102,15 +102,15 @@ datarootdir := @datarootdir@
12 bindir := @bindir@
13
14 datadir := @datadir@
15-ifeq "$(findstring pgsql, $(datadir))" ""
16-ifeq "$(findstring postgres, $(datadir))" ""
17+ifeq "$(findstring pgsql, $(notdir $(datadir)))" ""
18+ifeq "$(findstring postgres, $(notdir $(datadir)))" ""
19 override datadir := $(datadir)/postgresql
20 endif
21 endif
22
23 sysconfdir := @sysconfdir@
24-ifeq "$(findstring pgsql, $(sysconfdir))" ""
25-ifeq "$(findstring postgres, $(sysconfdir))" ""
26+ifeq "$(findstring pgsql, $(notdir $(sysconfdir)))" ""
27+ifeq "$(findstring postgres, $(notdir $(sysconfdir)))" ""
28 override sysconfdir := $(sysconfdir)/postgresql
29 endif
30 endif
31@@ -136,8 +136,8 @@ endif
32 mandir := @mandir@
33
34 docdir := @docdir@
35-ifeq "$(findstring pgsql, $(docdir))" ""
36-ifeq "$(findstring postgres, $(docdir))" ""
37+ifeq "$(findstring pgsql, $(notdir $(docdir)))" ""
38+ifeq "$(findstring postgres, $(notdir $(docdir)))" ""
39 override docdir := $(docdir)/postgresql
40 endif
41 endif