From a419187458c4672dce257494666a65ac59ffd1b3 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 16 Feb 2021 23:24:14 +0100 Subject: [PATCH] hdf4, hdf5: add javaSupport flag --- pkgs/tools/misc/hdf4/default.nix | 17 +++++++++++++---- pkgs/tools/misc/hdf5/default.nix | 8 ++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/misc/hdf4/default.nix b/pkgs/tools/misc/hdf4/default.nix index d127bc25c3c6..5373c64d647c 100644 --- a/pkgs/tools/misc/hdf4/default.nix +++ b/pkgs/tools/misc/hdf4/default.nix @@ -4,11 +4,15 @@ , fixDarwinDylibNames , cmake , libjpeg +, uselibtirpc ? stdenv.isLinux , libtirpc , zlib , szip ? null +, javaSupport ? false +, jdk }: -let uselibtirpc = stdenv.isLinux; +let + javabase = "${jdk}/jre/lib/${jdk.architecture}"; in stdenv.mkDerivation rec { pname = "hdf"; @@ -52,9 +56,9 @@ stdenv.mkDerivation rec { libjpeg szip zlib - ] ++ lib.optionals uselibtirpc [ - libtirpc - ]; + ] + ++ lib.optional javaSupport jdk + ++ lib.optional uselibtirpc libtirpc; preConfigure = lib.optionalString uselibtirpc '' # Make tirpc discovery work with CMAKE_PREFIX_PATH @@ -75,6 +79,11 @@ stdenv.mkDerivation rec { "-DHDF4_ENABLE_Z_LIB_SUPPORT=ON" "-DHDF4_BUILD_FORTRAN=OFF" "-DJPEG_DIR=${libjpeg}" + ] ++ lib.optionals javaSupport [ + "-DHDF4_BUILD_JAVA=ON" + "-DJAVA_HOME=${jdk}" + "-DJAVA_AWT_LIBRARY=${javabase}/libawt.so" + "-DJAVA_JVM_LIBRARY=${javabase}/server/libjvm.so" ] ++ lib.optionals (szip != null) [ "-DHDF4_ENABLE_SZIP_ENCODING=ON" "-DHDF4_ENABLE_SZIP_SUPPORT=ON" diff --git a/pkgs/tools/misc/hdf5/default.nix b/pkgs/tools/misc/hdf5/default.nix index c6fd5cde599b..e97a6dbdd189 100644 --- a/pkgs/tools/misc/hdf5/default.nix +++ b/pkgs/tools/misc/hdf5/default.nix @@ -8,6 +8,8 @@ , mpiSupport ? false , mpi , enableShared ? !stdenv.hostPlatform.isStatic +, javaSupport ? false +, jdk }: # cpp and mpi options are mutually exclusive @@ -35,7 +37,8 @@ stdenv.mkDerivation rec { buildInputs = [] ++ optional (gfortran != null) gfortran - ++ optional (szip != null) szip; + ++ optional (szip != null) szip + ++ optional javaSupport jdk; propagatedBuildInputs = [] ++ optional (zlib != null) zlib @@ -46,7 +49,8 @@ stdenv.mkDerivation rec { ++ optional (gfortran != null) "--enable-fortran" ++ optional (szip != null) "--with-szlib=${szip}" ++ optionals mpiSupport ["--enable-parallel" "CC=${mpi}/bin/mpicc"] - ++ optional enableShared "--enable-shared"; + ++ optional enableShared "--enable-shared" + ++ optional javaSupport "--enable-java"; patches = [ ./bin-mv.patch