# Template file for 'arpack-ng'
pkgname=arpack-ng
version=3.8.0
revision=1
build_style=gnu-configure
hostmakedepends="automake libtool gcc-fortran pkg-config"
makedepends="eigen"
short_desc="Collection of Fortran77 subroutines"
maintainer="Diogo Leal <diogo@diogoleal.com>"
license="BSD-3-Clause"
homepage="https://github.com/opencollab/arpack-ng"
changelog="https://raw.githubusercontent.com/opencollab/arpack-ng/master/CHANGES"
distfiles="https://github.com/opencollab/arpack-ng/archive/${version}.tar.gz"
checksum=ada5aeb3878874383307239c9235b716a8a170c6d096a6625bfd529844df003d

# As of 2021-01-03 arpack-ng is only used by octave which includes openblas as
# its BLAS implementation. So if openblas is available for XBPS_TARGET_MACHINE,
# use it and if not fall back to regular blas.
case "$XBPS_TARGET_MACHINE" in
	# List of supported architectures copied from openblas.
	armv[67]*|aarch64*|i686*|x86_64*|ppc*)
		makedepends+=" openblas-devel"
		configure_args=" --with-blas=openblas --with-lapack=openblas"
		;;
	*)
		makedepends+=" blas-devel lapack-devel"
		;;
esac

pre_configure() {
	./bootstrap
}

post_install() {
	vlicense COPYING
}

arpack-ng-devel_package() {
	short_desc+=" - development files"
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/lib/cmake
		vmove usr/lib/pkgconfig
		vmove usr/include/arpack
		vmove "usr/lib/*.so"
	}
}
