SUMMARY="Modern, multi-OS, networked Sound System"
DESCRIPTION="RoarAudio is a modern, multi OS sound system. Its main purpose \
is to connect software (like media players) and devices (like soundcards) as \
a mid-layer adding features you expect from a modern sound system like \
software mixing and full network transparency.

RoarAudio can also be used to connect multiple software components. An \
example for such a setup is a common webradio setup where the used playback \
software is connected to a streaming server in addition to a local soundcard. \
RoarAudio has special features for such setups like meta data passing."
HOMEPAGE="http://roaraudio.keep-cool.org/"
COPYRIGHT="2008-2019 Philipp 'ph3-der-loewe' Schafft"
LICENSE="GNU GPL v2
	GNU GPL v3
	GNU LGPL v3"
REVISION="1"
SOURCE_URI="http://roaraudio.keep-cool.org/dl/roaraudio-$portVersion.tar.gz"
CHECKSUM_SHA256="f3899329cd5761253d4b72ab9f5a790b862b0757bdc87fdb87c97531c56a799c"
PATCHES="roaraudio-$portVersion.patchset"

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

commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	roaraudio$secondaryArchSuffix = $portVersion
	cmd:roarbidir$commandSuffix
	cmd:roarcat$commandSuffix
	cmd:roarcatplay$commandSuffix
	cmd:roarcatvio$commandSuffix
	cmd:roarclientpass$commandSuffix
	cmd:roarctl$commandSuffix
	cmd:roardtmf$commandSuffix
	cmd:roarfilt$commandSuffix
	cmd:roarify$commandSuffix
	cmd:roarinterconnect$commandSuffix
	cmd:roarlight$commandSuffix
	cmd:roarmon$commandSuffix
	cmd:roarmonhttp$commandSuffix
	cmd:roarphone$commandSuffix
	cmd:roarpluginapplication$commandSuffix
	cmd:roarpluginrunner$commandSuffix
	cmd:roarradio$commandSuffix
	cmd:roarshout$commandSuffix
	cmd:roarsin$commandSuffix
	cmd:roarsockconnect$commandSuffix
	cmd:roartypes$commandSuffix
	cmd:roarvio$commandSuffix
	cmd:roarvorbis$commandSuffix
	cmd:roarvumeter$commandSuffix
	lib:libroar$secondaryArchSuffix = 2
	lib:libroardsp$secondaryArchSuffix = 2
	lib:libroareio$secondaryArchSuffix = 2
	lib:libroarlight$secondaryArchSuffix = 2
	lib:libroarmidi$secondaryArchSuffix = 2
	lib:libroaross$secondaryArchSuffix = 2
	lib:libroarsndio$secondaryArchSuffix = 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libao$secondaryArchSuffix
	lib:libFLAC$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libportaudio$secondaryArchSuffix
	lib:libsamplerate$secondaryArchSuffix
	lib:libshout$secondaryArchSuffix
	lib:libsndfile$secondaryArchSuffix
	lib:libspeex$secondaryArchSuffix
	lib:libspeexdsp$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvorbisenc$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	roaraudio${secondaryArchSuffix}_devel = $portVersion
	cmd:roar_config$commandSuffix
	devel:libroar$secondaryArchSuffix = 2
	devel:libroardsp$secondaryArchSuffix = 2
	devel:libroareio$secondaryArchSuffix = 2
	devel:libroarlight$secondaryArchSuffix = 2
	devel:libroarmidi$secondaryArchSuffix = 2
	devel:libroaross$secondaryArchSuffix = 2
	devel:libroarsndio$secondaryArchSuffix = 2
	"
REQUIRES_devel="
	roaraudio$secondaryArchSuffix == $portVersion base
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libao$secondaryArchSuffix
	devel:libFLAC$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libportaudio$secondaryArchSuffix
	devel:libsamplerate$secondaryArchSuffix
	devel:libshout$secondaryArchSuffix
	devel:libsndfile$secondaryArchSuffix
	devel:libspeex$secondaryArchSuffix
	devel:libspeexdsp$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvorbisenc$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:gnuplot
	cmd:gpg$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:ogg123
	cmd:pkg_config$secondaryArchSuffix
	cmd:ssh
	cmd:which
	"

defineDebugInfoPackage roaraudio$secondaryArchSuffix \
	$libDir/libroar.so.2 \
	$libDir/libroardsp.so.2 \
	$libDir/libroareio.so.2 \
	$libDir/libroarlight.so.2 \
	$libDir/libroarmidi.so.2 \
	$libDir/libroaross.so.2 \
	$libDir/libroarsndio.so.2 \
	$commandBinDir/roarbidir \
	$commandBinDir/roarcat \
	$commandBinDir/roarcatplay \
	$commandBinDir/roarcatvio \
	$commandBinDir/roarclientpass \
	$commandBinDir/roarctl \
	$commandBinDir/roardtmf \
	$commandBinDir/roarfilt \
	$commandBinDir/roarinterconnect \
	$commandBinDir/roarlight \
	$commandBinDir/roarmon \
	$commandBinDir/roarmonhttp \
	$commandBinDir/roarphone \
	$commandBinDir/roarpluginrunner \
	$commandBinDir/roarradio \
	$commandBinDir/roarshout \
	$commandBinDir/roarsin \
	$commandBinDir/roarsockconnect \
	$commandBinDir/roartypes \
	$commandBinDir/roarvio \
	$commandBinDir/roarvorbis \
	$commandBinDir/roarvumeter

BUILD()
{
	export LDFLAGS="-lnetwork"
	./configure --prefix-bin=$commandBinDir \
		--prefix-lib=$libDir \
		--prefix-inc=$includeDir \
		--prefix-man=$manDir \
		--prefix-sysconf=$settingsDir \
		--prefix-doc=$docDir \
		--without-comp-roard
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs \
		libroar \
		libroardsp \
		libroareio \
		libroarlight \
		libroarmidi \
		libroaross \
		libroarsndio
	fixPkgconfig

	packageEntries devel \
		$developDir \
		$commandBinDir/roar-config
}

TEST()
{
	make check
}
