SUMMARY="A patent-free, Open Source/Free Software DSP library"
DESCRIPTION="Speex is an open-source/free software  patent-free audio \
compression format designed for speech. The Speex project aims to lower the \
barrier of entry for voice applications by providing a free alternative to \
expensive proprietary speech codecs. Moreover, Speex is well-adapted to \
internet applications and provides useful features that are not present in \
most other codecs.
Finally, Speex is part of the GNU project and is available under the revised \
BSD license."
HOMEPAGE="https://www.speex.org/"
COPYRIGHT="2002-2009 Xiph.org Foundation
	2002-2008 Jean-Marc Valin
	2005-2007 Analog Devices Inc.
	2005-2008 Commonwealth Scientific and Industrial Research Organisation (CSIRO)
	1993, 2002, 2006 David Rowe
	2003 EpicGames
	1992-1994 Jutta Degener, Carsten Bormann"
LICENSE="Speex"
REVISION="1"
SOURCE_URI="https://downloads.xiph.org/releases/speex/speexdsp-${portVersion/\~/}.tar.gz"
CHECKSUM_SHA256="682042fc6f9bee6294ec453f470dadc26c6ff29b9c9e9ad2ffc1f4312fd64771"
SOURCE_DIR="speexdsp-${portVersion/\~/}"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

libVersion="1.5.1"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	speexdsp$secondaryArchSuffix = $portVersion
	lib:libspeexdsp$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	speexdsp${secondaryArchSuffix}_devel = $portVersion
	devel:libspeexdsp$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	speexdsp$secondaryArchSuffix == $portVersion base
	"

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

defineDebugInfoPackage speexdsp$secondaryArchSuffix \
	"$libDir"/libspeexdsp.so.$libVersion

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

INSTALL()
{
	make install

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

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf "$docDir"
	fi

	prepareInstalledDevelLib libspeexdsp
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}

TEST()
{
	make check
}
