SUMMARY="GNU Scientific Library"
DESCRIPTION="This is GSL, the GNU Scientific Library, a collection of \
numerical routines for scientific computing."
HOMEPAGE="https://www.gnu.org/software/gsl/"
COPYRIGHT="1996-2007, 2009, 2010 Gerard Jungman
	1996-2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2013 Brian Gough
	1996-2000, 2007, 2010 Jim Davies
	2002, 2004, 2009 Ivo Alxneit
	2002 Gert Van den Eynde
	1996-2000, 2007, 2013 Patrick Alken
	2002, 2003, 2009 Lowell Johnson
	1996, 1997, 1998, 1999, 2000, 2001, 2007 Thomas Walter
	1996, 1997, 1998, 1999, 2000 Mark Galassi
	1996, 1997, 1998, 1999, 2000, 2007 Reid Priedhorsky
	1996, 1997, 1998, 1999, 2000, 2007, 2010 James Theiler
	2002 Atakan Gurkan
	2003 Heiko Bauke
	2001, 2003, 2007 Carlo Perassi
	2003 Olaf Lenz
	2002 Gavin E. Crooks
	2000, 2001, 2004 David Morrison
	2005 Jochen Voss
	2006 Charles Karney
	2004, 2006 Giulio Bottazzi
	2007 O. Teytaud
	1996, 1997, 1998, 1999, 2000, 2006-2009, 2013 Patrick Alken
	2009 Marc JOURDAIN
	2007 Frank Reininghaus
	2001 DAN, HO-JIN
	2001, 2002 Nicolas Darnis
	2004, 2008, 2009, 2010 Tuomo Keskitalo
	2008, 2009, 2011 Rhys Ulerich
	2000 Simone Piccardi
	2001 Szymon Jaroszewicz
	1996, 1997, 1998, 1999, 2000 Fabrice Rossi
	1996, 1997, 1998, 1999, 2000, 2009 Michael Booth
	2007 James Howse
	1996, 1997, 1998, 1999, 2000, 2002, 2004, 2007 David Necas
	2004 Joerg Wensch
	2007-2008 Pavel Holoborodko
	2010 Pedro Gonnet
	1996, 1997, 1998, 1999, 2000 Tim Mooney
	2001 Jason Beegan
	2001 Henry Sobotka
	1996, 1997, 1998, 1999, 2000, 2007 John Fisher
	2000 Vladimir Kushnir
	2006 Erik Schnetter
	2001 Rodney Sparapani
	2002 Achim Gaedke
	1996, 1997, 1998, 1999, 2000, 2007 Jorma Olavi Ttinen
	2002-2004 Jason H. Stover"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://ftpmirror.gnu.org/gsl/gsl-$portVersion.tar.gz
	https://ftp.gnu.org/gnu/gsl/gsl-$portVersion.tar.gz"
CHECKSUM_SHA256="b782339fc7a38fe17689cb39966c4d821236c28018b6593ddb6fd59ee40786a8"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

libgslVersion="25.0.0"
libgslcblasVersion="0.0.0"
libgslVersionCompat="$libgslVersion compat >= ${libgslVersion%%.*}"
libgslcblasVersionCompat="$libgslcblasVersion compat >= ${libgslcblasVersion%%.*}"

PROVIDES="
	gsl$secondaryArchSuffix = $portVersion compat >= 1
	cmd:gsl_histogram$commandSuffix = $portVersion
	cmd:gsl_randist$commandSuffix = $portVersion
	lib:libgsl$secondaryArchSuffix = $libgslVersionCompat
	lib:libgslcblas$secondaryArchSuffix = $libgslcblasVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	gsl${secondaryArchSuffix}_devel = $portVersion compat >= 1
	cmd:gsl_config$secondaryArchSuffix
	devel:libgsl$secondaryArchSuffix = $libgslVersionCompat
	devel:libgslcblas$secondaryArchSuffix = $libgslcblasVersionCompat
	"
REQUIRES_devel="
	gsl$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

TEST_REQUIRES="
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage gsl$secondaryArchSuffix \
	"$commandBinDir"/gsl-histogram \
	"$commandBinDir"/gsl-randist \
	"$libDir"/libgsl.so.$libgslVersion \
	"$libDir"/libgslcblas.so.$libgslcblasVersion \

BUILD()
{
	autoreconf -fi
	runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir"
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/libgsl*.la

	prepareInstalledDevelLibs libgsl libgslcblas
	fixPkgconfig

	if [ -n "$secondaryArchSuffix" -a -z "$commandSuffix" ]; then
		mkdir -p "$binDir"
		mv "$commandBinDir"/gsl-config "$binDir"
	fi

	# devel package
	packageEntries devel \
		$binDir/gsl-config \
		$developDir \
		$manDir/man1/gsl-config.1 \
		$manDir/man3 \
		$dataDir/aclocal

	if [ -n "$secondaryArchSuffix" -a -z "$commandSuffix" ]; then
		rmdir "$binDir"
	fi
}

TEST()
{
	make check
}
