SUMMARY="Samplerate converter for audio"
DESCRIPTION=" Secret Rabbit Code (aka libsamplerate) is a Sample Rate Converter \
for audio. One example of where such a thing would be useful is converting \
audio from the CD sample rate of 44.1kHz to the 48kHz sample rate used by \
DAT players.

SRC is capable of arbitrary and time varying conversions, from downsampling \
by a factor of 256 to upsampling by the same factor. Arbitrary in this case \
means that the ratio of input and output sample rates can be an irrational \
number. The conversion ratio can also vary with time for speeding up and \
slowing down effects."
HOMEPAGE="http://www.mega-nerd.com/SRC/"
COPYRIGHT="2002-2011 Erik de Castro Lopo"
LICENSE="GNU GPL v2"
SOURCE_URI="http://www.mega-nerd.com/SRC/libsamplerate-$portVersion.tar.gz"
CHECKSUM_SHA256="93b54bdf46d5e6d2354b7034395fe329c222a966790de34520702bb9642f1c06"
REVISION="3"
ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
    # x86_gcc2 is fine as primary target architecture as long as we're building
    # for a different secondary architecture.
    ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
    ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PATCHES="libsamplerate-$portVersion.patchset"

PROVIDES="
	libsamplerate$secondaryArchSuffix = $portVersion compat >= 0
	cmd:sndfile_resample$secondaryArchSuffix
	lib:libsamplerate$secondaryArchSuffix = 15.12.0 compat >= 15
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libsamplerate${secondaryArchSuffix}_devel = $portVersion compat >= 0
	devel:libsamplerate$secondaryArchSuffix = 15.12.0 compat >= 15
	"
REQUIRES_devel="
	libsamplerate$secondaryArchSuffix == $portVersion base
	"

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

BUILD()
{
	autoreconf -fi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libsamplerate.la

	prepareInstalledDevelLibs libsamplerate
	fixPkgconfig

	# devel package
	packageEntries devel \
		$docDir \
		$developDir
}
