Merge pull request #26039 from knedlsepp/add-gdal-hdf4-support

gdal: Add hdf4 support
This commit is contained in:
Frederik Rietdijk 2017-07-01 10:38:36 +02:00 committed by GitHub
commit 9c05499de9
3 changed files with 88 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, composableDerivation, unzip, libjpeg, libtiff, zlib
, postgresql, mysql, libgeotiff, pythonPackages, proj, geos, openssl
, libpng, sqlite, libspatialite, poppler
, libpng, sqlite, libspatialite, poppler, hdf4
, libiconv
, netcdfSupport ? true, netcdf, hdf5 , curl
}:
@ -17,15 +17,20 @@ composableDerivation.composableDerivation {} (fixed: rec {
};
buildInputs = [ unzip libjpeg libtiff libpng proj openssl sqlite
libspatialite poppler ]
libspatialite poppler hdf4 ]
++ (with pythonPackages; [ python numpy wrapPython ])
++ stdenv.lib.optional stdenv.isDarwin libiconv
++ stdenv.lib.optionals netcdfSupport [ netcdf hdf5 curl ];
hardeningDisable = [ "format" ];
# Unset CC and CXX as they confuse libtool.
preConfigure = "unset CC CXX";
# - Unset CC and CXX as they confuse libtool.
# - teach gdal that libdf is the legacy name for libhdf
preConfigure = ''
unset CC CXX
substituteInPlace configure \
--replace "-lmfhdf -ldf" "-lmfhdf -lhdf"
'';
configureFlags = [
"--with-jpeg=${libjpeg.dev}"
@ -41,6 +46,7 @@ composableDerivation.composableDerivation {} (fixed: rec {
"--with-python" # optional
"--with-static-proj4=${proj}" # optional
"--with-geos=${geos}/bin/geos-config"# optional
"--with-hdf4=${hdf4.dev}" # optional
(if netcdfSupport then "--with-netcdf=${netcdf}" else "")
];

View File

@ -0,0 +1,76 @@
{ stdenv
, fetchurl
, cmake
, libjpeg
, szip
, zlib
}:
stdenv.mkDerivation rec {
name = "hdf-${version}";
version = "4.2.12";
src = fetchurl {
url = "https://support.hdfgroup.org/ftp/HDF/releases/HDF${version}/src/hdf-${version}.tar.bz2";
sha256 = "020jh563sjyxsgml8l809d2i1d4ms9shivwj3gbm7n0ilxbll8id";
};
buildInputs = [
cmake
libjpeg
szip
zlib
];
preConfigure = "export SZIP_INSTALL=${szip}";
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_TESTING=ON"
"-DHDF4_BUILD_TOOLS=ON"
"-DHDF4_BUILD_UTILS=ON"
"-DHDF4_BUILD_WITH_INSTALL_NAME=OFF"
"-DHDF4_ENABLE_JPEG_LIB_SUPPORT=ON"
"-DHDF4_ENABLE_NETCDF=OFF"
"-DHDF4_ENABLE_SZIP_ENCODING=ON"
"-DHDF4_ENABLE_SZIP_SUPPORT=ON"
"-DHDF4_ENABLE_Z_LIB_SUPPORT=ON"
"-DHDF4_BUILD_FORTRAN=OFF"
"-DJPEG_DIR=${libjpeg}"
];
doCheck = true;
preCheck = ''
export LD_LIBRARY_PATH=$(pwd)/bin
'' + stdenv.lib.optionalString (stdenv.isDarwin) ''
export DYLD_LIBRARY_PATH=$(pwd)/bin
'';
excludedTests = [
"MFHDF_TEST-hdftest"
"MFHDF_TEST-hdftest-shared"
"HDP-dumpsds-18"
"NC_TEST-nctest"
];
checkPhase = let excludedTestsRegex = if (excludedTests != [])
then "(" + (stdenv.lib.concatStringsSep "|" excludedTests) + ")"
else ""; in ''
runHook preCheck
ctest -E "${excludedTestsRegex}" --output-on-failure
runHook postCheck
'';
outputs = [ "bin" "dev" "out" ];
postInstall = ''
moveToOutput bin "$bin"
'';
meta = {
description = "Data model, library, and file format for storing and managing data";
homepage = https://support.hdfgroup.org/products/hdf4/;
maintainers = with stdenv.lib.maintainers; [ knedlsepp ];
platforms = stdenv.lib.platforms.unix;
};
}

View File

@ -2360,6 +2360,8 @@ with pkgs;
hddtemp = callPackage ../tools/misc/hddtemp { };
hdf4 = callPackage ../tools/misc/hdf4 { };
hdf5 = callPackage ../tools/misc/hdf5 {
gfortran = null;
szip = null;