SUMMARY="A server software compliant with multiple clients"
DESCRIPTION="MiniDLNA MiniDLNA (aka ReadyDLNA) is server software with the \
aim of being fully compliant with DLNA/UPnP-AV clients."
HOMEPAGE="http://minidlna.sourceforge.net/
	https://sourceforge.net/projects/minidlna/"
COPYRIGHT="2008-2017 Justin Maggard"
LICENSE="GNU GPL v2
	BSD (3-clause)"
REVISION="6"
SOURCE_URI="https://downloads.sourceforge.net/minidlna/minidlna-$portVersion.tar.gz"
CHECKSUM_SHA256="67388ba23ab0c7033557a32084804f796aa2a796db7bb2b770fb76ac2a742eec"
PATCHES="minidlna-$portVersion.patchset"

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

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

GLOBAL_WRITABLE_FILES="
	settings/minidlna.conf keep-old
	"

PROVIDES="
	minidlna$secondaryArchSuffix = $portVersion
	cmd:minidlnad$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libexif$secondaryArchSuffix
	lib:libflac$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libid3tag$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libavformat$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libexif$secondaryArchSuffix
	devel:libflac$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libid3tag$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autopoint
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export CFLAGS="-D_BSD_SOURCE"
	export LDFLAGS="-lnetwork -lbsd"

	autoreconf -vfi
	runConfigure --omit-dirs sbinDir ./configure --sbindir="$commandBinDir"
	make $jobArgs
}

INSTALL()
{
	make install
	cp minidlna.conf $settingsDir
}
