# -*- 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

PortSystem                          1.0
PortGroup                           github 1.0
PortGroup                           php 1.1

name                                php-maxminddb
license                             Apache-2
categories-append                   devel
maintainers                         {ryandesign @ryandesign} {mathiesen.info:macintosh @BjarneDMat} openmaintainer

php.branches                        7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 8.6

description                         PHP API for reading MaxMind DB files

long_description \
    This is the {*}${description}. \
    MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).

github.tarball_from                 archive

if {[vercmp ${php.branch} >= 7.2]} {
    github.setup                    maxmind MaxMind-DB-Reader-php 1.15.0 v
    revision                        0
    checksums                       rmd160  a37bb9fdc219e173b700a5d409e94b277356f6a4 \
                                    sha256  838c2afd64d09f31cde106ef458f69a864d895a1c0eddecacbc0c484dc2143d2 \
                                    size    35184
}

if {${name} ne ${subport}} {
    # remove w/ next update
    dist_subdir                     ${name}/${version}_1

    depends_build-append            path:bin/pkg-config:pkgconfig

    depends_lib-append              port:libmaxminddb

    php.build_dirs                  ${worksrcpath}/ext

    configure.args                  --with-maxminddb

    test.run                        yes

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} LICENSE README.md ${destroot}${docdir}
    }
}
