From 24a2a22af66b5869672480ebc3af5a14957f88c0 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Sun, 13 Jul 2025 12:40:19 +0200 Subject: [PATCH] postgresqlPackages.postgis: fix cross-compilation --- pkgs/servers/sql/postgresql/ext/postgis.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pkgs/servers/sql/postgresql/ext/postgis.nix b/pkgs/servers/sql/postgresql/ext/postgis.nix index 09c547075135..541ddbcf0484 100644 --- a/pkgs/servers/sql/postgresql/ext/postgis.nix +++ b/pkgs/servers/sql/postgresql/ext/postgis.nix @@ -91,12 +91,19 @@ postgresqlBuildExtension (finalAttrs: { ./autogen.sh ''; - configureFlags = [ - "--with-pgconfig=${postgresql.pg_config}/bin/pg_config" - "--with-gdalconfig=${gdal}/bin/gdal-config" - "--with-jsondir=${json_c.dev}" - "--disable-extension-upgrades-install" - ] ++ lib.optional withSfcgal "--with-sfcgal=${sfcgal}/bin/sfcgal-config"; + configureFlags = + let + isCross = stdenv.hostPlatform.config != stdenv.buildPlatform.config; + in + [ + (lib.enableFeature false "extension-upgrades-install") + (lib.withFeatureAs true "pgconfig" "${postgresql.pg_config}/bin/pg_config") + (lib.withFeatureAs true "gdalconfig" "${gdal}/bin/gdal-config") + (lib.withFeatureAs true "jsondir" (lib.getDev json_c)) + (lib.withFeatureAs true "xml2config" (lib.getExe' (lib.getDev libxml2) "xml2-config")) + (lib.withFeatureAs withSfcgal "sfcgal" "${sfcgal}/bin/sfcgal-config") + (lib.withFeature (!isCross) "json") # configure: error: cannot check for file existence when cross compiling + ]; makeFlags = [ "PERL=${perl}/bin/perl"