SUMMARY="SoX Resampler library"
DESCRIPTION="SoXR is a high-quality audio resampling library. It handles \
the conversion of audio to different sample rates (most commonly 44100, \
48000, and 96000 Hz). It is one-dimensional and high-quality.
"
HOMEPAGE="https://sourceforge.net/p/soxr/wiki/Home/"
SOURCE_URI="http://downloads.sourceforge.net/project/soxr/soxr-${portVersion}-Source.tar.xz"
CHECKSUM_SHA256="dcc16868d1a157079316f84233afcc2b52dd0bd541dd8439dc25bceb306faac2"
REVISION="1"

LICENSE="GNU LGPL v2.1"
COPYRIGHT="2007-2013 Rob Sykes <robs@users.sourceforge.net>"

ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	soxr${secondaryArchSuffix} = $portVersion
	lib:libsoxr$secondaryArchSuffix = 0.1.0 compat >= 0
	lib:libsoxr_lsr$secondaryArchSuffix = 0.1.9 compat >= 0
	"

REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	"

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

SOURCE_DIR="soxr-${portVersion}-Source"

PATCHES="soxr-${portVersion}.patchset"

BUILD()
{
	if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
		visibilityArgs="-DVISIBILITY_HIDDEN=OFF"
	fi
	cmake . \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DBUILD_TESTS=OFF \
		-DBIN_INSTALL_DIR=$binDir \
		-DLIB_INSTALL_DIR=$libDir \
		-DINCLUDE_INSTALL_DIR=$includeDir \
		-DDOC_INSTALL_DIR=$docDir \
		$visibilityArgs
	make $jobArgs
}

INSTALL()
{
	make install

	# prepare develop/lib
	prepareInstalledDevelLibs libsoxr libsoxr-lsr
	fixPkgconfig

	packageEntries devel \
		$developDir
}

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	soxr${secondaryArchSuffix}_devel = $portVersion
	devel:libsoxr$secondaryArchSuffix = 0.1.0 compat >= 0
	devel:libsoxr_lsr$secondaryArchSuffix = 0.1.9 compat >= 0
	"
REQUIRES_devel="
	soxr$secondaryArchSuffix == $portVersion base
	"
