# -*- 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           compilers 1.0
PortGroup           github 1.0
PortGroup           meson 1.0

github.setup        fortran-lang minpack c0b5aea9fcd2b83865af921a7a7e881904f8d3c2
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             20220613
revision            0
categories          math devel
license             BSD
maintainers         {gmail.com:jjstickel @jjstickel} openmaintainer

description         Minpack includes software for solving nonlinear equations \
                    and nonlinear least squares problems.

long_description    Minpack includes software for solving nonlinear equations \
                    and nonlinear least squares problems. Five algorithmic paths \
                    each include a core subroutine and an easy-to-use driver. \
                    The algorithms proceed either from an analytic specification \
                    of the Jacobian matrix or directly from the problem functions. \
                    The paths include facilities for systems of equations \
                    with a banded Jacobian matrix, for least squares problems \
                    with a large amount of data, and for checking the consistency \
                    of the Jacobian matrix with the functions.

checksums           rmd160  7b05267755fbe5720112532a1ea5104adfedb451 \
                    sha256  750792dc8d9911f0786774c201c14ef5d6037a2b41b33ba938463a79c3690409 \
                    size    9672292

set py_ver          3.11
set py_ver_nodot    [string map {. {}} ${py_ver}]
depends_build-append \
                    port:pkgconfig
depends_lib-append  port:py${py_ver_nodot}-cffi \
                    port:python${py_ver_nodot}

compilers.choose    fc
compilers.setup     require_fortran

compiler.c_standard 2011

post-patch {
    reinplace "s,env python,env ${prefix}/bin/python${py_ver}," ${worksrcpath}/config/install-mod.py
}

configure.args-append \
                    -Dapi=true \
                    -Dpython=true \
                    -Dpython_version=${prefix}/bin/python${py_ver}

test.run            yes
test.target         test
