hdf4, hdf5: add javaSupport flag

This commit is contained in:
Astro 2021-02-16 23:24:14 +01:00
parent d1ca6bd23e
commit a419187458
2 changed files with 19 additions and 6 deletions

View file

@ -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"

View file

@ -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