# -*- 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           cmake   1.1
PortGroup           github  1.0
PortGroup           boost   1.0

categories          gis
maintainers         {vince @Veence} {yahoo.com:n_larsson @nilason} openmaintainer
description         Routing algorithms for PostgreSQL/PostGIS
long_description    pgRouting is a PostGreSQL/PostGIS extension\
                    that contains a variety of algorithms to solve\
                    traditional network problems such as finding\
                    shortest paths or the Traveling Sales Person (TSP).

license             LGPL-2

homepage            http://www.pgrouting.org/

github.setup        pgRouting pgrouting 3.7.1 v
revision            0

checksums           rmd160  603cf21469a6d3e5fc2a5e6e73d5fda5d34212f5 \
                    sha256  7d34c3b70bc612120c7cd87c89c1e9dc8dacc2f355d9cecd1327f7c928ed55f4 \
                    size    3874346

compiler.cxx_standard   2014
compiler.c_standard     1999
cmake.build_type        Release

# PostgreSQL subports
set postgresql_suffixes {12 13 14 15 16}
set subport_names {}
set docports {}
foreach v ${postgresql_suffixes} {
    lappend subport_names pg${v}-${name}
}

foreach v ${postgresql_suffixes} {
    subport pg${v}-${name} {
        if {${v} == 12} {
            github.setup    pgRouting pgrouting 3.6.3 v
            revision        0
            checksums       rmd160  7c8ded4e2d9164c6e5c51919a59528d2df0b4d0d \
                            sha256  aa4c1d56914c9cba8f65ceaefe8a42625d60a85d7f74d74d7b41297a1b31c673 \
                            size    3888623
        }

        set p postgresql${v}

        depends_build-append \
                            port:perl5

        depends_lib-append  port:${p} \
                            port:pg${v}-postgis3

        configure.args-append \
                            -DPOSTGRESQL_PG_CONFIG=${prefix}/lib/${p}/bin/pg_config \
                            -DPOSTGRESQL_EXECUTABLE=${prefix}/lib/${p}/bin/postgres

       variant doc description {install documentation} {
           depends_lib-append      port:sphinx
           configure.args-append   -DWITH_DOC=YES
        }

        livecheck.type          none
    }
}

if {${name} eq ${subport}} {
    PortGroup   stub 1.0

    platforms   any
    supported_archs noarch

    notes "The $name port is just a stub. Please install one of the\
          subports: ${subport_names}."
}
