SUMMARY="A library to adjust the sound tempo, pitch and playback rate"
DESCRIPTION="SoundTouch is an open-source audio processing library for \
changing the tempo, pitch and playback rates of audio streams or audio files. \
The library additionally supports estimating stable beats-per-minute rates for \
audio tracks.

- Tempo (time stretch): Changes the sound to play at faster or slower tempo \
than originally without affecting the sound pitch.
- Pitch (key) : Changes the sound pitch or key while keeping the original \
tempo (speed).
Playback Rate : Changes both tempo and pitch together as if a vinyl disc was \
played at different RPM rate."
HOMEPAGE="http://www.surina.net/soundtouch"
LICENSE="GNU LGPL v2.1"
REVISION="1"

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"
fi
SECONDARY_ARCHITECTURES="x86"

SOURCE_URI="http://www.surina.net/soundtouch/soundtouch-$portVersion.tar.gz"
CHECKSUM_SHA256="3d4161d74ca25c5a98c69dbb8ea10fd2be409ba1a3a0bf81db407c4c261f166b"
COPYRIGHT="2001-2014 Olli Parviainen"
SOURCE_DIR="soundtouch"
PATCHES="libsoundtouch-$portVersion.patchset"

PROVIDES="
	libsoundtouch$secondaryArchSuffix = $portVersion compat >= 1
	cmd:soundstretch$secondaryArchSuffix
	lib:libSoundTouch$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
PROVIDES_devel="
	libsoundtouch${secondaryArchSuffix}_devel = $portVersion compat >= 1
	devel:libSoundTouch$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	libsoundtouch$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
	"

BUILD()
{
	mkdir -p config/m4
	autoreconf -fi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
	
	prepareInstalledDevelLibs libSoundTouch
	fixPkgconfig
	
	rm -Rf $prefix/doc

	# devel package
	packageEntries devel \
		$developDir
}
