about summary refs log tree commit diff
path: root/pkgs/tools/misc/hdf4
diff options
context:
space:
mode:
authorPhillip Seeber <phillip.seeber@uni-jena.de>2023-05-10 11:45:34 +0200
committerPhillip Seeber <phillip.seeber@uni-jena.de>2023-05-10 11:45:45 +0200
commit4a33d3980cb769e2c75deef77b03e72a06bc26fe (patch)
tree1a936db4b6889cd452757d38b220b6fd197c9a8c /pkgs/tools/misc/hdf4
parent9cc20733c063fec11d44e5a43402816248fb61fb (diff)
hdf4: enable fortran and netcdf support
hdf4: fortran disabled by default


hdf4: fix formatting


hdf4: optional netcdf support


hdf4: disable fortran by default

Diffstat (limited to 'pkgs/tools/misc/hdf4')
-rw-r--r--pkgs/tools/misc/hdf4/default.nix16
1 files changed, 12 insertions, 4 deletions
diff --git a/pkgs/tools/misc/hdf4/default.nix b/pkgs/tools/misc/hdf4/default.nix
index 3bde0466cdbad..b6577a17bb195 100644
--- a/pkgs/tools/misc/hdf4/default.nix
+++ b/pkgs/tools/misc/hdf4/default.nix
@@ -12,6 +12,9 @@
 , szip
 , javaSupport ? false
 , jdk
+, fortranSupport ? false
+, gfortran
+, netcdfSupport ? false
 }:
 stdenv.mkDerivation rec {
   pname = "hdf";
@@ -50,7 +53,7 @@ stdenv.mkDerivation rec {
     cmake
   ] ++ lib.optionals stdenv.isDarwin [
     fixDarwinDylibNames
-  ];
+  ] ++ lib.optional fortranSupport gfortran;
 
   buildInputs = [
     libjpeg
@@ -75,9 +78,8 @@ stdenv.mkDerivation rec {
     "-DHDF4_BUILD_UTILS=ON"
     "-DHDF4_BUILD_WITH_INSTALL_NAME=OFF"
     "-DHDF4_ENABLE_JPEG_LIB_SUPPORT=ON"
-    "-DHDF4_ENABLE_NETCDF=OFF"
+    "-DHDF4_ENABLE_NETCDF=${if netcdfSupport then "ON" else "OFF"}"
     "-DHDF4_ENABLE_Z_LIB_SUPPORT=ON"
-    "-DHDF4_BUILD_FORTRAN=OFF"
     "-DJPEG_DIR=${libjpeg}"
   ] ++ lib.optionals javaSupport [
     "-DHDF4_BUILD_JAVA=ON"
@@ -85,7 +87,13 @@ stdenv.mkDerivation rec {
   ] ++ lib.optionals szipSupport [
     "-DHDF4_ENABLE_SZIP_ENCODING=ON"
     "-DHDF4_ENABLE_SZIP_SUPPORT=ON"
-  ];
+  ] ++ (if fortranSupport
+  then [
+    "-DHDF4_BUILD_FORTRAN=ON"
+    "-DCMAKE_Fortran_FLAGS=-fallow-argument-mismatch"
+  ]
+  else [ "-DHDF4_BUILD_FORTRAN=OFF" ]
+  );
 
   doCheck = true;