SUMMARY="Open source multimedia framework"
DESCRIPTION="GStreamer is a library for constructing graphs of media-handling components. \
The applications it supports range from simple Ogg/Vorbis playback, audio/video streaming \
to complex audio (mixing) and video (non-linear editing) processing."
HOMEPAGE="https://gstreamer.freedesktop.org/"
COPYRIGHT="Erik Walthinsen"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-$portVersion.tar.xz"
CHECKSUM_SHA256="55862232a63459bbf56abebde3085ca9aec211b478e891dacea4d6df8cafe80a"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	gstreamer$secondaryArchSuffix = $portVersion
	cmd:gst_inspect_1.0$secondaryArchSuffix = $portVersion
	cmd:gst_launch_1.0$secondaryArchSuffix = $portVersion
	cmd:gst_stats_1.0$secondaryArchSuffix = $portVersion
	cmd:gst_tester_1.0$secondaryArchSuffix = $portVersion
	cmd:gst_typefind_1.0$secondaryArchSuffix = $portVersion
	lib:libgstbase_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	lib:libgstcheck_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	lib:libgstcontroller_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	lib:libgstnet_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	lib:libgstreamer_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	gstreamer${secondaryArchSuffix}_devel = $portVersion
	devel:libgstbase_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	devel:libgstcheck_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	devel:libgstcontroller_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	devel:libgstnet_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	devel:libgstreamer_1.0$secondaryArchSuffix = 0.1805.0 compat >= 0
	"
REQUIRES_devel="
	gstreamer$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libglib_2.0$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:bison
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:grep
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:meson
	cmd:ninja
	cmd:pkg_config$secondaryArchSuffix
	cmd:python
	cmd:python3
	cmd:which
	"

BUILD()
{
	export CFLAGS="-lnetwork"

	meson build \
		--buildtype=release \
		--prefix=$prefix \
		--bindir=$binDir \
		--libdir=$libDir \
		--libexecdir=$libDir \
		--datadir=$dataDir \
		--mandir=$manDir \
		--includedir=$includeDir \
		-D doc=disabled \
		-D examples=disabled \
		-D nls=disabled

	ninja -C build $jobArgs
}

INSTALL()
{
	ninja -C build install

	prepareInstalledDevelLibs libgstreamer-1.0 libgstbase-1.0 \
		libgstcontroller-1.0 libgstnet-1.0
	fixPkgconfig

	mv -f $includeDir/gstreamer-1.0/gst $includeDir/
	rm -rf $includeDir/gstreamer-1.0

	# devel package
	packageEntries devel $developDir
}
