# -*- 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.14.0 v
    revision                        0
    checksums                       rmd160  51690857e5cbb250d7f44a58631c8809eccd4cda \
                                    sha256  ea0842c7f81abb7f3f0feb6f36d80abb193498321baa41d9bea7ac684e1ab8f6 \
                                    size    34667
}

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}
    }
}
