# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 110350 2013-08-30 13:47:45Z devans@macports.org $

PortSystem          1.0

name                libgeoip
version             1.5.1
categories          devel net
license             LGPL-2.1+
platforms           darwin
maintainers         pixilla openmaintainer
description         Gets country code by IP address
long_description    ${description}

homepage            http://www.maxmind.com/app/c
master_sites        http://www.maxmind.com/download/geoip/api/c/ \
                    http://www.maxmind.com/download/geoip/api/c/old/
distname            GeoIP-${version}

checksums           rmd160  cc9c7eb86904b90dd53c49dd3eb3bcac2379d226 \
                    sha256  ec35ee73fcc54c493f4252565d1c81d022b398dd16de3af1522c8cab016f8731

patchfiles          patch-geoip.pc.in.diff

use_autoreconf      yes

# For stricter sed, some files are not UTF-8
build.env           LC_CTYPE=C
destroot.env        LC_CTYPE=C

test.run            yes
test.target         check

post-destroot {
    delete ${destroot}${prefix}/etc/GeoIP.conf
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        ChangeLog \
        NEWS \
        README \
        TODO \
        ${destroot}${prefix}/share/doc/${name}
}

livecheck.type      regex
livecheck.url       http://geolite.maxmind.com/download/geoip/api/c/
livecheck.regex     {GeoIP-(\d+(?:\.\d+)*)}
