Skip to content
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
38 changes: 25 additions & 13 deletions pkgs/development/libraries/gdal/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
, useHDF ? (!useMinimalFeatures)
, useNetCDF ? (!useMinimalFeatures)
, useArmadillo ? (!useMinimalFeatures)
, useJava ? (!useMinimalFeatures)

, ant
, bison
, cmake
, gtest
Expand All @@ -36,6 +38,7 @@
, libgeotiff
, geos
, giflib
, jdk
, libheif
, dav1d
, libaom
Expand Down Expand Up @@ -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"
Expand All @@ -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 =
Expand Down Expand Up @@ -144,7 +151,8 @@ stdenv.mkDerivation (finalAttrs: {
openexr
xercesc
] ++ arrowDeps);
in [
in
[
c-blosc
brunsli
cfitsio
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 12 additions & 1 deletion pkgs/development/libraries/gdal/tests.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ runCommand, gdal }:
{ runCommand, gdal, jdk }:

let
inherit (gdal) pname version;
Expand Down Expand Up @@ -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
''