# -*- 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.0
PortGroup           github  1.0

categories          gis
maintainers         {vince @Veence}
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). 

platforms           darwin
license             LGPL-2

homepage            http://www.pgrouting.org/

# https://github.com/pgRouting/pgrouting/archive/v2.0.0.tar.gz
github.setup        pgRouting pgrouting 2.0.0 v
revision            2

patchfiles          patch-unistd_h.diff

checksums           rmd160  c2eacfb36fc977f63cb52c8e171936a08ed78dcb \
                    sha256  0f918e1938570e59f309dc7d8fe16de8c0edcb52cc870bdd60b144c4bb51c777

depends_lib-append  port:cgal\
                    port:postgis2

# Variants
variant postgresql92 conflicts postgresql93 description {Use postgresql92} {
    depends_lib-append      port:postgresql92
    configure.args-append   -DPOSTGRESQL_PG_CONFIG=${prefix}/lib/postgresql92/bin/pg_config
    configure.args-append   -DPOSTGRESQL_EXECUTABLE=${prefix}/lib/postgresql92/bin/postgres
}

variant postgresql93 conflicts postgresql92 description {Use postgresql93} {
    depends_lib-append      port:postgresql93
    configure.args-append   -DPOSTGRESQL_PG_CONFIG=${prefix}/lib/postgresql93/bin/pg_config
    configure.args-append   -DPOSTGRESQL_EXECUTABLE=${prefix}/lib/postgresql93/bin/postgres
}

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

if {![variant_isset postgresql92] && ![variant_isset postgresql93]} {
    default_variants    +postgresql93
}

post-extract {
    reinplace -E \
        "s|-fno-delete-null-pointer-checks||" \
        ${worksrcpath}/src/apsp_johnson/src/CMakeLists.txt

    reinplace -E \
        "s|-fno-delete-null-pointer-checks||" \
        ${worksrcpath}/src/apsp_warshall/src/CMakeLists.txt
}