# -*- 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         {yahoo.com:n_larsson @nilason} {vince @Veence} 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.8.0 v
github.tarball_from releases
revision            1

checksums           rmd160  b92caa81f131fafb201f37befccebf2efaa86fb5 \
                    sha256  b8a5f0472934fdf7cda3fb4754d01945378d920cdaddc01f378617ddbb9c447f \
                    size    3878578

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

# PostgreSQL subports
set postgresql_suffixes {12 13 14 15 16 17}
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
            # Change github.tarball_from to 'releases' or 'archive' next update
            github.tarball_from tarball
            revision        1
            checksums       rmd160  7c8ded4e2d9164c6e5c51919a59528d2df0b4d0d \
                            sha256  aa4c1d56914c9cba8f65ceaefe8a42625d60a85d7f74d74d7b41297a1b31c673 \
                            size    3888623
        }

        set p postgresql${v}

        depends_build-append \
                            port:perl5

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

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