SUMMARY="A file format and library for storing scientific data"
DESCRIPTION="HDF5 was designed and implemented to address the deficiencies \
of HDF4.x. It has a more powerful and flexible data model, supports files \
larger than 2 GB, and supports parallel I/O."
HOMEPAGE="https://www.hdfgroup.org/HDF5/"
COPYRIGHT="2011-2019 The HDF Group,
	The Board of Trustees of the University of Illinois."
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-$portVersion/src/hdf5-$portVersion.tar.gz"
CHECKSUM_SHA256="5f9a3ee85db4ea1d3b1fa9159352aebc2af72732fc2f58c96a3f0768dba0e9aa"
SOURCE_DIR="hdf5-$portVersion"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libhdf5Version="103.2.0"
libhdf5VersionCompat="$libhdf5Version compat >= ${libhdf5Version%%.*}"
libhdf5_cppVersion="103.2.0"
libhdf5_cppVersionCompat="$libhdf5_cppVersion compat >= ${libhdf5_cppVersion%%.*}"
libhdf5_fortranVersion="102.0.1"
libhdf5_fortranVersionCompat="$libhdf5_fortranVersion compat >= ${libhdf5_fortranVersion%%.*}"
libhdf5_hlVersion="100.1.3"
libhdf5_hlVersionCompat="$libhdf5_hlVersion compat >= ${libhdf5_hlVersion%%.*}"
libhdf5_hl_cppVersion="100.1.4"
libhdf5_hl_cppVersionCompat="$libhdf5_hl_cppVersion compat >= ${libhdf5_hl_cppVersion%%.*}"
libhdf5hl_fortranVersion="100.0.5"
libhdf5hl_fortranVersionCompat="$libhdf5hl_fortranVersion compat >= ${libhdf5hl_fortranVersion%%.*}"

PROVIDES="
	hdf5_103$secondaryArchSuffix = $portVersion
	lib:libhdf5$secondaryArchSuffix = $libhdf5VersionCompat
	lib:libhdf5_cpp$secondaryArchSuffix = $libhdf5_cppVersionCompat
	lib:libhdf5_fortran$secondaryArchSuffix = $libhdf5_fortranVersionCompat
	lib:libhdf5_hl$secondaryArchSuffix = $libhdf5_hlVersionCompat
	lib:libhdf5_hl_cpp$secondaryArchSuffix = $libhdf5_hl_cppVersionCompat
	lib:libhdf5hl_fortran$secondaryArchSuffix = $libhdf5hl_fortranVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgettextpo$secondaryArchSuffix
	lib:libgfortran$secondaryArchSuffix
	lib:libgomp$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgettextlib$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:g++$secondaryArchSuffix
	cmd:gettext$secondaryArchSuffix
	cmd:gfortran$secondaryArchSuffix
	cmd:grep
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -fi
	runConfigure ./configure \
		--enable-hl \
		--enable-build-mode=production \
		--enable-fortran \
		--enable-fortran2003 \
		--enable-cxx \
		--disable-sharedlib-rpath \
		--disable-threadsafe
	make $jobArgs
}

INSTALL()
{
	make install $jobArgs

	rm $libDir/lib*.la || true

	prepareInstalledDevelLibs \
		libhdf5 \
		libhdf5_cpp \
		libhdf5_fortran \
		libhdf5_hl \
		libhdf5_hl_cpp \
		libhdf5hl_fortran \
		libhdf5_hl_fortran

	fixPkgconfig

	rm -rf $developDir $binDir $prefix/share
}

TEST()
{
	make check
}
