# Template file for 'libvpx'
pkgname=libvpx
version=1.2.0
revision=2
wrksrc="${pkgname}-v${version}"
hostmakedepends="which perl yasm"
short_desc="The VP8 Codec"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.webmproject.org"
license="BSD"
distfiles="http://webm.googlecode.com/files/${pkgname}-v${version}.tar.bz2"
checksum=5ef0c650b2daa62085eb8105a7a4273f3e987db53c5ec97fd51d1b6511e5aa06

do_configure() {
	export LD="$CC" AS=

	if [ "$CROSS_BUILD" ]; then
		sed -e "s,generic-gnu,$XBPS_CROSS_TRIPLET," -i configure
		_cross="--target=$XBPS_CROSS_TRIPLET"
	fi
	CFLAGS+=" -fPIC"

	./configure --enable-vp8 --enable-runtime-cpu-detect --enable-shared \
		--enable-postproc --enable-pic --disable-install-docs \
		--disable-install-srcs --as=yasm ${_cross}
}

do_build() {
	make ${makejobs}
}

do_install() {
	make DIST_DIR=${DESTDIR}/usr install

	vinstall LICENSE 644 usr/share/licenses/${pkgname}
}

libvpx-tools_package() {
	short_desc+=" - tools"
	pkg_install() {
		vmove usr/bin
	}
}

libvpx-devel_package() {
	depends="libvpx>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}
