@@ -14,10 +14,39 @@ stdenv.mkDerivation rec {
14
14
hash = "sha256-QC77AnPGpPQGEWi6JtJdiNsB2su5+aV2pKg5ImR2B0k=" ;
15
15
} ;
16
16
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
+
17
46
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
21
50
'' ;
22
51
23
52
meta = with lib ; {
0 commit comments