about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gdal
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
committerAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
commita5e1520e4538e29ecfbd4b168306f890566d7bfd (patch)
tree28099c268b5d4b1e33c2b29f0714c45f0b961382 /nixpkgs/pkgs/development/libraries/gdal
parent822f7c15c04567fbdc27020e862ea2b70cfbf8eb (diff)
parent3560d1c8269d0091b9aae10731b5e85274b7bbc1 (diff)
downloadnixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.gz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.bz2
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.lz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.xz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.zst
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gdal')
-rw-r--r--nixpkgs/pkgs/development/libraries/gdal/default.nix38
-rw-r--r--nixpkgs/pkgs/development/libraries/gdal/tests.nix13
2 files changed, 37 insertions, 14 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gdal/default.nix b/nixpkgs/pkgs/development/libraries/gdal/default.nix
index 6f0e06213626..fd1aaf9c2e92 100644
--- a/nixpkgs/pkgs/development/libraries/gdal/default.nix
+++ b/nixpkgs/pkgs/development/libraries/gdal/default.nix
@@ -14,7 +14,9 @@
 , useHDF ? (!useMinimalFeatures)
 , useNetCDF ? (!useMinimalFeatures)
 , useArmadillo ? (!useMinimalFeatures)
+, useJava ? (!useMinimalFeatures)
 
+, ant
 , bison
 , cmake
 , gtest
@@ -36,6 +38,7 @@
 , libgeotiff
 , geos
 , giflib
+, jdk
 , libheif
 , dav1d
 , libaom
@@ -94,7 +97,7 @@ stdenv.mkDerivation (finalAttrs: {
     python3.pkgs.setuptools
     python3.pkgs.wrapPython
     swig
-  ];
+  ] ++ lib.optionals useJava [ ant jdk ];
 
   cmakeFlags = [
     "-DGDAL_USE_INTERNAL_LIBS=OFF"
@@ -110,6 +113,10 @@ stdenv.mkDerivation (finalAttrs: {
     "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
   ] ++ lib.optionals (!useTiledb) [
     "-DGDAL_USE_TILEDB=OFF"
+  ] ++ lib.optionals (!useJava) [
+    # This is not strictly needed as the Java bindings wouldn't build anyway if
+    # ant/jdk were not available.
+    "-DBUILD_JAVA_BINDINGS=OFF"
   ];
 
   buildInputs =
@@ -144,7 +151,8 @@ stdenv.mkDerivation (finalAttrs: {
         openexr
         xercesc
       ] ++ arrowDeps);
-    in [
+    in
+    [
       c-blosc
       brunsli
       cfitsio
@@ -178,20 +186,24 @@ stdenv.mkDerivation (finalAttrs: {
       python3
       python3.pkgs.numpy
     ] ++ tileDbDeps
-      ++ libHeifDeps
-      ++ libJxlDeps
-      ++ mysqlDeps
-      ++ postgresDeps
-      ++ popplerDeps
-      ++ arrowDeps
-      ++ hdfDeps
-      ++ netCdfDeps
-      ++ armadilloDeps
-      ++ darwinDeps
-      ++ nonDarwinDeps;
+    ++ libHeifDeps
+    ++ libJxlDeps
+    ++ mysqlDeps
+    ++ postgresDeps
+    ++ popplerDeps
+    ++ arrowDeps
+    ++ hdfDeps
+    ++ netCdfDeps
+    ++ armadilloDeps
+    ++ darwinDeps
+    ++ nonDarwinDeps;
 
   postInstall = ''
     wrapPythonPrograms
+  '' + lib.optionalString useJava ''
+    cd $out/lib
+    ln -s ./jni/libgdalalljni${stdenv.hostPlatform.extensions.sharedLibrary}
+    cd -
   '';
 
   enableParallelBuilding = true;
diff --git a/nixpkgs/pkgs/development/libraries/gdal/tests.nix b/nixpkgs/pkgs/development/libraries/gdal/tests.nix
index b89bbd51ab20..87fbff2d5fa5 100644
--- a/nixpkgs/pkgs/development/libraries/gdal/tests.nix
+++ b/nixpkgs/pkgs/development/libraries/gdal/tests.nix
@@ -1,4 +1,4 @@
-{ runCommand, gdal }:
+{ runCommand, gdal, jdk }:
 
 let
   inherit (gdal) pname version;
@@ -40,5 +40,16 @@ runCommand "${pname}-tests" { meta.timeout = 60; }
 
     ${gdal}/bin/gdalinfo ./test.tif
 
+    # test java bindings
+    cat <<EOF > main.java
+    import org.gdal.gdal.gdal;
+    class Main {
+      public static void main(String[] args) {
+      gdal.AllRegister();
+      }
+    }
+    EOF
+    ${jdk}/bin/java -Djava.library.path=${gdal}/lib/ -cp ${gdal}/share/java/gdal-${version}.jar main.java
+
     touch $out
   ''