SUMMARY="A small dynamic DNS client"
DESCRIPTION="Yaddns is a small dynamic dns client with multiple servers \
support and a high flexibility."
HOMEPAGE="https://yaddns.github.io/"
COPYRIGHT="2015 Anthony Viallard and Raphael Huck"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/yaddns/yaddns/archive/yaddns-$portVersion.tar.gz"
CHECKSUM_SHA256="23b527b7f71e1449746f1e39cbc3a074d58bd261a33399fb4e2d90eb63149059"
SOURCE_DIR="yaddns-yaddns-$portVersion"
PATCHES="yaddns-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2 ?x86"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi

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

PROVIDES="
	yaddns$secondaryArchSuffix = $portVersion
	cmd:yaddns = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autom4te
	cmd:automake
	cmd:autoreconf
	cmd:g++$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:makeinfo
	"

USER_SETTINGS_FILES="
	settings/yaddns.conf
	"

defineDebugInfoPackage yaddns$secondaryArchSuffix \
	$commandBinDir/yaddns

PATCH()
{
	sed -i -e "s|/etc\(/yaddns\.conf\)|`finddir B_SYSTEM_SETTINGS_DIRECTORY`\1|;" \
		doc/yaddns.1
}

BUILD()
{
	./autogen.sh
	CPPFLAGS="-D_BSD_SOURCE" \
	LIBS="-Wl,--as-needed -lbnetapi -lbsd -lnetwork" runConfigure \
		--omit-dirs binDir ./configure --bindir $commandBinDir

	make $jobArgs
}

INSTALL()
{
	make install
	install -d $docDir
	install AUTHORS $docDir
	install etc/yaddns.conf $docDir/yaddns.conf.example
}

TEST()
{
	LIBS="-Wl,--as-needed -lbnetapi -lnetwork" make check
}
