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

github.setup        ntamas plfit 1.0.0
revision            0
github.tarball_from archive

categories          math science devel
license             GPL-2+
maintainers         {gmail.com:szhorvat @szhorvat} openmaintainer
description         Fit discrete or continuous power-law distributions to data.
long_description    This program fits power-law distributions to empirical (discrete \
                    or continuous) data, according to the method of Clauset, Shalizi \
                    and Newman.

checksums           rmd160  58af3ed82ea2a939097bc73d7c7c07e56695b87f \
                    sha256  b64eff580c721809d32be69c43070c37c9200ca02e5169d9ae7972fbd759977e \
                    size    185990

test.run            yes
test.target         test

compiler.c_standard 1999

configure.args-append    -DBUILD_SHARED_LIBS=ON \
                         -DPLFIT_ENABLE_LTO=AUTO \
                         -DPLFIT_USE_OPENMP=OFF

variant openmp description {Enable OpenMP support} {
    configure.args-replace       -DPLFIT_USE_OPENMP=OFF -DPLFIT_USE_OPENMP=ON
}

# See https://github.com/macports/macports-base/commit/7c91604891fa0d071b8d598490c4dc2edb8e0031
if {[variant_isset openmp]} {
    compiler.openmp_version 2.0
    if {[info exists compiler.log_verbose_output]} {
        compiler.log_verbose_output no
    } else {
        configure.cppflags-append -fopenmp
        configure.ldflags-append  -fopenmp
    }
}

default_variants +openmp
