SUMMARY="WebM VP8 video codec library"
DESCRIPTION="
The WebM VP8 SDK allows you to integrate your applications with the VP8 video \
codec, a high quality, royalty free, open source codec deployed on millions of \
computers and devices worldwide.
This distribution of the WebM VP8 Codec SDK includes the following support:
* WebM VP8 Encoder
* WebM VP8 Decoder
"
HOMEPAGE="http://www.webmproject.org"
LICENSE="BSD (3-clause)"
COPYRIGHT="2009-2012 Google Inc.,
           The Mozilla Foundation and
           The Xiph.Org Foundation"
SRC_URI="http://webm.googlecode.com/files/libvpx-v1.0.0.tar.bz2"
CHECKSUM_SHA256="07cedb0a19a44e6d81d75f52eea864f59ef10c6c725cb860431bec6641eafe21"
REVISION="2"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PATCHES="libvpx-1.0.0.patchset"

PROVIDES="
	libvpx$secondaryArchSuffix = $portVersion
	lib:libvpx$secondaryArchSuffix = $portVersion compat >= 1
	"
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:vp8_scalable_patterns = $portVersion
		cmd:vpxdec = $portVersion compat >= 1
		cmd:vpxenc = $portVersion compat >= 1
		"
fi

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	"
BUILD_REQUIRES="
	"
	# Note: The build system also looks for libvorbis and SDL, but that seems
	# to be needed only for building the sample player, which we don't need.
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:awk
	cmd:make
	cmd:perl
	cmd:yasm
	"

SOURCE_DIR="libvpx-v1.0.0"

BUILD()
{
	# not an auto tools configure
	./configure \
		--prefix="$prefix" \
		--libdir="$libDir" \
		--as=yasm \
		--enable-pic \
		--enable-shared \
		--enable-vp8
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libvpx
	fixPkgconfig

	mkdir -p $includeDir
	mv $prefix/include/* $includeDir
	rmdir $prefix/include

	# devel package
	packageEntries devel \
		$developDir

	# Remove stuff we don't need in the secondary architecture base package.
	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $prefix/bin
	fi
}

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

PROVIDES_devel="
	libvpx${secondaryArchSuffix}_devel = $portVersion
	devel:libvpx$secondaryArchSuffix = $portVersion compat >= 1
	"
REQUIRES_devel="
	libvpx$secondaryArchSuffix == $portVersion
	"
