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

R.setup             cran cran defm 0.1-1
revision            1
categories-append   math
maintainers         nomaintainer
license             MIT
description         Estimation and simulation of multi-binary response models
long_description    {*}${description}
checksums           rmd160  2832843db6ca9c8172fa10e197e5b8a768628a5d \
                    sha256  5a62436d2f8970a4297c06886d653f1b99135a97ac50d3a084aabea3ea4d08df \
                    size    208324

depends_lib-append  port:R-Rcpp

# configure script detects OpenMP support, but fails to set correct flags.
patchfiles          patch-openmp.diff

post-patch {
    if {[string match macports-gcc* ${configure.compiler}]} {
        reinplace "s,@OPENMP_CXXFLAGS@,-fopenmp," ${worksrcpath}/src/Makevars.in
        reinplace "s,@OPENMP_LDFLAGS@,-fopenmp," ${worksrcpath}/src/Makevars.in
    } elseif {[string match macports-clang* ${configure.compiler}]} {
        reinplace "s,@OPENMP_CXXFLAGS@,-I${prefix}/include/libomp -fopenmp," ${worksrcpath}/src/Makevars.in
        reinplace "s,@OPENMP_LDFLAGS@,-L${prefix}/lib/libomp -lomp," ${worksrcpath}/src/Makevars.in
    }
}

compiler.openmp_version 3.0
compilers.setup     require_fortran

depends_test-append port:R-texreg

test.run            yes
