#!/usr/bin/env modbuild

pbuild::set_download_url "http://amas.web.psi.ch/Downloads/$P/$P-$V.tar.gz"
pbuild::add_to_group 'HDF5'
pbuild::install_docfiles 'AUTHORS' 'COPYING'

if [[ ${V_MAJOR} == 1 ]]; then
	pbuild::compile_in_sourcetree
fi

pbuild::pre_configure() {
	: ./autogen.sh
}

pbuild::configure() {
	if (( V_MAJOR >= 2 )); then
		: config_args+=" --enable-python"
	fi
	case "${COMPILER}" in
		"clang-macos" )
			:
			;;
		* )
			config_args+='--enable-fortran'
			;;
	esac

	"${SRC_DIR}"/configure \
		--prefix="${PREFIX}" \
		--enable-parallel \
		--enable-debug \
		--enable-shared \
		--with-hdf5=$HDF5_PREFIX \
		--with-pic \
		${config_args} \
		|| exit 1
}

pbuild::compile() {
	make -C src
	make -C tools 
}

pbuild::install() {
	make -C src install
	make -C tools install
}



