# Contributor: graysky <graysky AT archlinux dot us>

# set this to a null to omit the docs and licenses
_installdocs=yes

pkgname=('linpack')
pkgver=11.2.1.009
_pkgvershort=11.2.1
_number=4942
pkgrel=2
arch=('i386' 'x86_64')
pkgdesc='Benchmark based on linear algebra excellent app for stress testing.'
license=('custom')
url="http://software.intel.com/en-us/articles/intel-math-kernel-library-linpack-download"
source=("http://registrationcenter.intel.com/irc_nas/3914/l_lpk_p_11.1.2.005.tgz"
'linpack.conf' 'runme.template')
install=readme.install
backup=(etc/linpack.conf)
sha256sums=('00c804e7b8cb31b4d94055b1889df4ab820e077dda0d3767af29f6af9f3c99b2'
            'd7e31c8c7e2648c8fa3c4838d98dfc39b8fadf0f74bdaa4ca52cd38277ec8254'
            '8c880adeee3de6c0e6005e210cea0e01b471219c590e25e824298a25ab0eef31')

build() {
	[[ -z "$CARCH" ]] && echo "Cannot determine architecture of this system!" && exit 1
	[[ "$CARCH" = "x86_64" ]] && bit=64 || bit=32
	export bit
	
	# setup based on detected arch
	sed -e "s/@TARGET_BIT@/$bit/g" <runme.template >linpack_runme_xeon$bit
}

package_linpack() {
	_path="$srcdir/linpack_11.1.2/benchmarks/linpack"

	#	config files
	install -Dm755 "$_path/runme_xeon$bit" "$pkgdir/lkp/benchmarks/linpack/runme_xeon$bit"
	
	# bins
	install -Dm755 "$_path/xlinpack_xeon$bit" "$pkgdir/lkp/benchmarks/linpack/xlinpack_xeon$bit"
	install -Dm644 "$_path/xhelp.lpk" "$pkgdir/usr/share/doc/${pkgname}/xhelp.lpk"
}
