SUMMARY="Manage and use Maxmind's GeoIP databases"
DESCRIPTION="GeoIP is a database of IP addresses that allow mapping IPs to a
physical location. The GeoIP database is distributed in a specific format, and
this library is used to query the database."
HOMEPAGE="https://github.com/maxmind/libmaxminddb"
REVISION="1"
COPYRIGHT="2013-2014 Maxmind"
LICENSE="Apache v2"

ARCHITECTURES=""
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

SOURCE_URI="https://github.com/maxmind/libmaxminddb/releases/download/$portVersion/libmaxminddb-$portVersion.tar.gz"
CHECKSUM_SHA256="260d2d56376c156da7ddecddec55621f5f1c4c6351e1f78116b8846c42ae7bce"

PROVIDES="
	libmaxminddb$secondaryArchSuffix = $portVersion
	cmd:mmdblookup$secondaryArchSuffix
	lib:libmaxminddb$secondaryArchSuffix = 0.0.7 compat = 0
"

REQUIRES="
	haiku$secondaryArchSuffix
"

PROVIDES_devel="
	devel:libmaxminddb$secondaryArchSuffix = 0.0.7 compat = 0
"

REQUIRES_devel="
	libmaxminddb$secondaryArchSuffix == $portVersion base
"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
"

BUILD()
{
	LDFLAGS=-lnetwork runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLib libmaxminddb
	mkdir -p $developDir
	mv $prefix/include $developDir/headers

	packageEntries devel $developDir
}

TEST()
{
	make check
}
