SUMMARY="Library for encoding .opus audio files and live streams"
DESCRIPTION="Opus is a totally open, royalty-free, highly versatile audio \
codec. Opus is unmatched for interactive speech and music transmission over \
the Internet, but is also intended for storage and streaming applications. \
It is standardized by the Internet Engineering Task Force (IETF) as RFC 6716 \
which incorporated technology from Skype's SILK codec and Xiph.Org's CELT \
codec.

The libopusenc libraries provide a high-level API for encoding .opus files. \
libopusenc depends only on libopus."
HOMEPAGE="https://opus-codec.org/"
COPYRIGHT="1994-2013 Xiph.Org Foundation and contributors
	2017-2018 Jean-Marc Valin
	2018 Mark Harris
	2018 Tristan Matthews
	2018 Andrew Allen
	2017 Ralph Giles"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://downloads.xiph.org/releases/opus/libopusenc-$portVersion.tar.gz"
CHECKSUM_SHA256="8298db61a8d3d63e41c1a80705baa8ce9ff3f50452ea7ec1c19a564fe106cbb9"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

libVersion="0.4.2"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
portVersionCompat="$portVersion compat >= 0"

PROVIDES="
	libopusenc$secondaryArchSuffix = $portVersionCompat
	lib:libopusenc$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libopus$secondaryArchSuffix
	"

PROVIDES_devel="
	libopusenc${secondaryArchSuffix}_devel = $portVersionCompat
	devel:libopusenc$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libopusenc$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libopus$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	"

defineDebugInfoPackage libopusenc$secondaryArchSuffix \
	"$libDir"/libopusenc.so.$libVersion \

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

INSTALL()
{
	make install

	# remove libtool library file
	rm -f "$libDir"/libopusenc.la

	prepareInstalledDevelLibs libopusenc
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}
