Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sam/postgis tiger fix #1413

Merged
merged 9 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.0.1.020-orioledb"
postgres15: "15.8.1.030"
postgresorioledb-17: "17.0.1.021-orioledb"
postgres15: "15.8.1.031"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
39 changes: 18 additions & 21 deletions nix/ext/postgis.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ perl pkg-config ];
dontDisableStatic = true;

# postgis config directory assumes /include /lib from the same root for json-c library
env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";

env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";

preConfigure = ''
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
configureFlags="--datadir=$out/share/postgresql --datarootdir=$out/share/postgresql --bindir=$out/bin --docdir=$doc/share/doc/${pname} --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev} --disable-extension-upgrades-install --with-sfcgal"

makeFlags="PERL=${perl}/bin/perl datadir=$out/share/postgresql pkglibdir=$out/lib bindir=$out/bin docdir=$doc/share/doc/${pname}"
'';

postConfigure = ''
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
Expand All @@ -54,28 +54,25 @@ stdenv.mkDerivation rec {
" \
"raster/scripts/python/Makefile";
mkdir -p $out/bin

# postgis' build system assumes it is being installed to the same place as postgresql, and looks
# for the postgres binary relative to $PREFIX. We gently support this system using an illusion.
ln -s ${postgresql}/bin/postgres $out/bin/postgres
'';

# create aliases for all commands adding version information
postInstall = ''
# Teardown the illusory postgres used for building; see postConfigure.
rm $out/bin/postgres

for prog in $out/bin/*; do # */
ln -s $prog $prog-${version}
done

for file in $out/share/postgresql/extension/postgis_topology*--${version}.sql; do
sed -i "/SELECT topology.AddToSearchPath('topology');/i SELECT topology.AddToSearchPath('extensions');" "$file"
done

mkdir -p $doc/share/doc/postgis
mv doc/* $doc/share/doc/postgis/
'';
postInstall = ''
rm $out/bin/postgres
for prog in $out/bin/*; do # */
ln -s $prog $prog-${version}
done
# Add function definition and usage to tiger geocoder files
for file in $out/share/postgresql/extension/postgis_tiger_geocoder*--${version}.sql; do
sed -i "/SELECT postgis_extension_AddToSearchPath('tiger');/a SELECT postgis_extension_AddToSearchPath('extensions');" "$file"
done
# Original topology patching
for file in $out/share/postgresql/extension/postgis_topology*--${version}.sql; do
sed -i "/SELECT topology.AddToSearchPath('topology');/i SELECT topology.AddToSearchPath('extensions');" "$file"
done
mkdir -p $doc/share/doc/postgis
mv doc/* $doc/share/doc/postgis/
'';

passthru.tests.postgis = nixosTests.postgis;

Expand Down
Loading