SUMMARY="Open source command-line RTMP client"
DESCRIPTION="rtmpdump is an open-source command-line RTMP client intended \
to stream audio of video flash content."
HOMEPAGE="http://rtmpdump.mplayerhq.hu/"
COPYRIGHT="2009 Andrej Stepanchuk
	2009-2011 Howard Chu
	2010 2a665470ced7adb7156fcef47f8199a6371c117b8a79e399a2771e0b36384090
	2011 33ae1ce77301f4b4494faaa5f609f3c48b9dcf82
	"
LICENSE="GNU LGPL v2.1
	GNU GPL v2
	"
REVISION="1"
SOURCE_URI="git://git.ffmpeg.org/rtmpdump#a1900c3e152085406ecb87c1962c55ec9c6e4016"
PATCHES="rtmpdump-2.4_git.patch"

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"
else
    ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	rtmpdump$secondaryArchSuffix = $portVersion compat >= 2.4
	lib:librtmp$secondaryArchSuffix = 1 compat >= 1
	lib:librtmp.1$secondaryArchSuffix = 1 compat >= 1
	cmd:rtmpdump = $portVersion compat >= 2.4
	cmd:rtmpgw = $portVersion compat >= 2.4
	cmd:rtmpsrv = $portVersion compat >= 2.4
	cmd:rtmpsuck = $portVersion compat >= 2.4
	"
# commands are provided in /bin regardless
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	"

PROVIDES_devel="
	rtmpdump${secondaryArchSuffix}_devel = $portVersion compat >= 2.4
	devel:librtmp$secondaryArchSuffix = 1 compat >= 1
	devel:librtmp.1$secondaryArchSuffix = 1 compat >= 1
	"
REQUIRES_devel="
	rtmpdump$secondaryArchSuffix == $portVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:awk
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	make $jobArgs SYS=haiku \
		prefix=$prefix \
		bindir=$prefix/bin \
		sbindir=$prefix/bin \
		incdir=$includeDir \
		libdir=$libDir \
		mandir=$manDir
}

INSTALL()
{
	make $jobArgs SYS=haiku \
		prefix=$prefix \
		bindir=$prefix/bin \
		sbindir=$prefix/bin \
		incdir=$includeDir \
		libdir=$libDir \
		mandir=$manDir \
		install

	prepareInstalledDevelLibs \
		librtmp

	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir

}
