SUMMARY="C++ libraries for multimedia streaming"
DESCRIPTION="live555 forms a set of C++ libraries for multimedia streaming \
using open standard protocols. The library can be used to build streaming \
applications using various audio and video codecs."
HOMEPAGE="http://www.live555.com/liveMedia/"
COPYRIGHT="Live Networks, Inc."
LICENSE="GNU LGPL v2.1"
REVISION="5"
SOURCE_URI="https://github.com/xanview/live555/archive/eda27a2d0fbf8ad25d7222f48154f62d72932962.tar.gz"
CHECKSUM_SHA256="bca897eb4d48957ed030ea3ffe42c0fd2d01b105d3ce8f61b5fbb79e1f3e1529"
SOURCE_DIR="live555-eda27a2d0fbf8ad25d7222f48154f62d72932962"
PATCHES="live555-2016.01.29.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	live555$secondaryArchSuffix = $portVersion
	cmd:live555MediaServer
	cmd:live555ProxyServer
	cmd:MPEG2TransportStreamIndexer
	cmd:openRTSP
	cmd:playSIP
	cmd:registerRTSPStream
	cmd:sapWatch
	cmd:testAMRAudioStreamer
	cmd:testDVVideoStreamer
	cmd:testH264VideoStreamer
	cmd:testH264VideoToTransportStream
	cmd:testH265VideoStreamer
	cmd:testH265VideoToTransportStream
	cmd:testMKVStreamer
	cmd:testMP3Receiver
	cmd:testMP3Streamer
	cmd:testMPEG1or2AudioVideoStreamer
	cmd:testMPEG1or2ProgramToTransportStream
	cmd:testMPEG1or2Splitter
	cmd:testMPEG1or2VideoReceiver
	cmd:testMPEG1or2VideoStreamer
	cmd:testMPEG2TransportReceiver
	cmd:testMPEG2TransportStreamer
	cmd:testMPEG2TransportStreamTrickPlay
	cmd:testMPEG4VideoStreamer
	cmd:testOggStreamer
	cmd:testOnDemandRTSPServer
	cmd:testRelay
	cmd:testReplicator
	cmd:testRTSPClient
	cmd:testWAVAudioStreamer
	cmd:vobStreamer
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	live555${secondaryArchSuffix}_devel = $portVersion
	devel:libBasicUsageEnvironment = $portVersion
	devel:libgroupsock = $portVersion
	devel:libliveMedia = $portVersion
	devel:libUsageEnvironment = $portVersion
	devel:live555$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	live555$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:ar
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	./genMakefiles haiku
	make $jobArgs
}

INSTALL()
{
	make install PREFIX=$prefix INSTALLDIR=$prefix/bin LIBDIR=$developLibDir \
		MANDIR=$manDir/man1 BINDIR=$binDir DESTDIR=${DESTDIR}

	mkdir -p $includeDir

	# fixes hardcoded paths in makefile
	mv $prefix/include/* $includeDir
	rm $prefix/include -r

	# No need to call prepareInstalledDevelLibs

	mkdir -p $developLibDir/pkgconfig
	cat > $developLibDir/pkgconfig/live555.pc << EOF
prefix=${prefix}
exec_prefix=${prefix}
libdir=${libDir}
includedir=${includeDir}

Name: live555
Description: multimedia RTSP streaming library
Version: $portVersion
Libs: -L${developLibDir} -lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment
Cflags: -I${includeDir}/liveMedia -I${includeDir}/groupsock -I${includeDir}/BasicUsageEnvironment -I${includeDir}/UsageEnvironment
EOF

	# devel package
	packageEntries devel $developDir
}
