# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libmaxminddb
pkgver=1.3.1
pkgrel=0
pkgdesc="Maxmind GeoIP2 database library"
url="https://github.com/maxmind/libmaxminddb"
arch="all"
license="Apache-2.0"
depends="curl"
makedepends="automake autoconf libtool"
install=""
options=""
subpackages="$pkgname-dev $pkgname-doc"
source="$url/releases/download/$pkgver/$pkgname-$pkgver.tar.gz
	libmaxminddb.cron
	libmaxminddb.confd
	"

builddir="$srcdir"/$pkgname-$pkgver

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-pic
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make install DESTDIR="$pkgdir"

	# install alpine specifics
	mkdir -p "$pkgdir"/var/lib/libmaxminddb
	install -m755 -D "$srcdir"/libmaxminddb.cron "$pkgdir"/etc/periodic/weekly/libmaxminddb
	install -m755 -D "$srcdir"/libmaxminddb.confd "$pkgdir"/etc/conf.d/libmaxminddb
}

sha512sums="c13a18483caf720808d6a02baf8abe48c3aa4dd38ddc7ddd79b5d95d686600e19bb4b2242da08623f5d363a5be4b7636f7fcb59a5a7c9df9ab5a359ecd30b293  libmaxminddb-1.3.1.tar.gz
1feb1f2dd57991d729b6f9d29834f43d7405038cdbdfb0113a0e8f8f951a74c5e40651f9d241460f110acdd300196cf580b370e6cec56985cca797ba5610e622  libmaxminddb.cron
5f8dc6dad84cb1d188504a22470acf89542755c0bb3a78e4d3ae4e5bfa49fe64a7d2ee17441084db2710115463d39361df060a74b3a48fc4d8fc5e802afd2099  libmaxminddb.confd"
