SUMMARY="x264 h.264/AVC encoder"
DESCRIPTION="
x264 is a h.264/AVC encoder library.
"
HOMEPAGE="http://www.videolan.org/developers/x264.html"
COPYRIGHT="
	2003-2012 http://www.videolan.org/developers/x264.html
	"
LICENSE="GNU GPL v2"
SOURCE_URI="http://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20140308-2245.tar.bz2"
CHECKSUM_SHA256="b179cb1e1d4f51418d292011a7494d5b62145571c05c22007f28d8fd89d2ebbe"
REVISION="1"
ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PATCHES="x264-$portVersion.patchset"

PROVIDES="
	x264$secondaryArchSuffix = $portVersion compat >= 20140308
	cmd:x264$secondaryArchSuffix
	lib:libx264$secondaryArchSuffix = 142 compat >= 142
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:yasm >= 1.2.0
	"

SOURCE_DIR="x264-snapshot-20140308-2245"

BUILD()
{
	CFLAGS="-fPIC" runConfigure --omit-dirs \
		"manDir oldIncludeDir sbinDir localStateDir sharedStateDir sysconfDir infoDir dataDir dataRootDir libExecDir docDir" \
		--omit-buildspec ./configure --enable-pic --enable-shared \
		--extra-ldflags='-Wl,-Bsymbolic'
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libx264
	fixPkgconfig
	
	# devel package
	packageEntries devel \
		$developDir
}

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

PROVIDES_devel="
	x264${secondaryArchSuffix}_devel = $portVersion compat >= 20140308
	devel:libx264$secondaryArchSuffix = 142 compat >= 142
	"
REQUIRES_devel="
	x264$secondaryArchSuffix == $portVersion base
	"
