# -*- 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.1
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  dc9e2a090bb848a5b6093b6725cfb7bf64ba9dc5 \
                    sha256  523868c283f334329084df457739baf29b0a21e679830e5326965b0d128db1d4 \
                    size    186015

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

configure.pre_args-replace \
                        -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                        -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

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

default_variants +openmp

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