SUMMARY="Samplerate converter for audio"
DESCRIPTION="Secret Rabbit Code (aka libsamplerate) is a samplerate \
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://libsndfile.github.io/libsamplerate/"
COPYRIGHT="2002-2021 Erik de Castro Lopo"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/libsndfile/libsamplerate/releases/download/$portVersion/libsamplerate-$portVersion.tar.xz"
CHECKSUM_SHA256="3258da280511d24b49d6b08615bbe824d0cacc9842b0e4caf11c52cf2b043893"

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

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

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	cmake $cmakeDirArgs \
		  -DCMAKE_BUILD_TYPE='Release' \
		  -DBUILD_SHARED_LIBS=TRUE \
		  .
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libsamplerate
	fixPkgconfig

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

TEST()
{
	make test
}
