Skip to content

Commit 05ee8f3

Browse files
committed
feat: pgrouting 15/16 on all supported platforms
1 parent 9f84e85 commit 05ee8f3

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@
593593
# The list of exported 'checks' that are run with every run of 'nix
594594
# flake check'. This is run in the CI system, as well.
595595
checks = {
596-
#psql_15 = makeCheckHarness basePackages.psql_15.bin;
596+
psql_15 = makeCheckHarness basePackages.psql_15.bin;
597597
psql_16 = makeCheckHarness basePackages.psql_16.bin;
598598
#psql_orioledb_16 = makeCheckHarness basePackages.psql_orioledb_16.bin;
599599
};

nix/ext/pgrouting.nix

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,39 @@ stdenv.mkDerivation rec {
1414
hash = "sha256-QC77AnPGpPQGEWi6JtJdiNsB2su5+aV2pKg5ImR2B0k=";
1515
};
1616

17+
#disable compile time warnings for incompatible pointer types only on macos and pg16
18+
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16")
19+
"-Wno-error=int-conversion -Wno-error=incompatible-pointer-types";
20+
21+
cmakeFlags = [
22+
"-DPOSTGRESQL_VERSION=${postgresql.version}"
23+
] ++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") [
24+
"-DCMAKE_MACOSX_RPATH=ON"
25+
"-DCMAKE_SHARED_MODULE_SUFFIX=.dylib"
26+
"-DCMAKE_SHARED_LIBRARY_SUFFIX=.dylib"
27+
];
28+
29+
preConfigure = lib.optionalString (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") ''
30+
export DLSUFFIX=.dylib
31+
export CMAKE_SHARED_LIBRARY_SUFFIX=.dylib
32+
export CMAKE_SHARED_MODULE_SUFFIX=.dylib
33+
export MACOSX_RPATH=ON
34+
'';
35+
36+
postBuild = lib.optionalString (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") ''
37+
shopt -s nullglob
38+
for file in lib/libpgrouting-*.so; do
39+
if [ -f "$file" ]; then
40+
mv "$file" "''${file%.so}.dylib"
41+
fi
42+
done
43+
shopt -u nullglob
44+
'';
45+
1746
installPhase = ''
18-
install -D lib/*{dylib,so} -t $out/lib
19-
install -D sql/pgrouting--${version}.sql -t $out/share/postgresql/extension
20-
install -D sql/common/pgrouting.control -t $out/share/postgresql/extension
47+
install -D lib/*{dylib,so} -t $out/lib
48+
install -D sql/pgrouting--*.sql -t $out/share/postgresql/extension
49+
install -D sql/common/pgrouting.control -t $out/share/postgresql/extension
2150
'';
2251

2352
meta = with lib; {

0 commit comments

Comments
 (0)