# -*- 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           python 1.0
PortGroup           compiler_wrapper 1.0

name                py-scikit-learn
version             1.5.2
revision            0
distname            scikit_learn-${version}
categories-append   science
license             BSD

python.versions     39 310 311 312

maintainers         {stromnov @stromnov} openmaintainer

description         Easy-to-use and general-purpose machine learning in Python

long_description    Scikit-learn integrates machine learning algorithms \
                    in the tightly-knit scientific Python world, building upon \
                    numpy, scipy, and matplotlib. As a machine-learning module, \
                    it provides versatile tools for data mining and analysis \
                    in any field of science and engineering.

homepage            https://scikit-learn.org/

checksums           rmd160  c44852ef8d63ca0da228bc7a3850ef99900568a9 \
                    sha256  b4237ed7b3fdd0a4882792e68ef2545d5baa50aca3bb45aa7df468138ad8f94d \
                    size    7001680

if {${name} ne ${subport}} {
    depends_build-append \
                        path:bin/cython-${python.branch}:py${python.version}-cython

    depends_lib-append  port:py${python.version}-numpy \
                        port:py${python.version}-scipy \
                        port:py${python.version}-joblib \
                        port:py${python.version}-threadpoolctl

    compiler.openmp_version 2.5
    depends_lib-append  port:libomp

    python.pep517_backend meson
    python.add_archflags no

    # Remove after numpy v2
    build.args          --skip-dependency-check
    build.env-append    "CPPFLAGS=${configure.cppflags} -I${prefix}/include/libomp -Xpreprocessor -fopenmp" \
                        "CFLAGS=${configure.cc_archflags} -I${prefix}/include/libomp" \
                        "CXXFLAGS=${configure.cxx_archflags} -I${prefix}/include/libomp" \
                        "LDFLAGS=${configure.ld_archflags} -L${prefix}/lib/libomp -lomp" \
                        DYLD_LIBRARY_PATH=${prefix}/lib/libomp CYTHON=${prefix}/bin/cython-${python.branch}
    destroot.env-append "CPPFLAGS=${configure.cppflags} -I${prefix}/include/libomp -Xpreprocessor -fopenmp" \
                        "CFLAGS=${configure.cc_archflags} -I${prefix}/include/libomp" \
                        "CXXFLAGS=${configure.cxx_archflags} -I${prefix}/include/libomp" \
                        "LDFLAGS=${configure.ld_archflags} -L${prefix}/lib/libomp -lomp" \
                        DYLD_LIBRARY_PATH=${prefix}/lib/libomp CYTHON=${prefix}/bin/cython-${python.branch}

    livecheck.type      none
}
