Files
macports-ports/python/py-scipy/Portfile
T
2025-02-24 22:37:00 -05:00

147 lines
6.2 KiB
Tcl

# -*- 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 active_variants 1.1
PortGroup boost 1.0
PortGroup compilers 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup python 1.0
name py-scipy
version 1.15.2
revision 0
checksums rmd160 07a89c025b97435948fc4c8cdd47ffc4ce37dbe5 \
sha256 cd58a314d92838f7e6f755c8a2167ead4f27e1fd5c1251fd54289569ef3495ec \
size 59417316
license BSD
maintainers {michaelld @michaelld} {reneeotten @reneeotten} openmaintainer
description An opensource library of scientific tools for Python
long_description {*}${description}
homepage https://www.scipy.org/
universal_variant no
python.versions 39 310 311 312 313
python.pep517_backend meson
python.add_archflags no
if {${name} ne ${subport}} {
compiler.c_standard 2017
compiler.cxx_standard 2017
# SciPy requires GCC >= 9.1
compilers.setup require_fortran -clang -gcc44 -gcc45 -gcc46 \
-gcc47 -gcc48 -gcc5 -gcc6 -gcc7 -gcc8 -g95
# and Clang >= 12.0
compiler.blacklist-append {clang < 1200}
patchfiles-append patch-version-caps-pyproject.toml.diff \
patch_scipy_meson.build.diff
boost.version 1.81
if {${os.platform} eq "darwin" && [string match *gcc* ${configure.compiler}]} {
# dfitpackmodule.c: error: passing argument 1 of 'f2py_func'
# from incompatible pointer type [-Wincompatible-pointer-types]
patchfiles-append \
0001-patch-extra-flags.patch
}
if {${os.platform} eq "darwin" && ${os.major} < 11} {
# Use legacysupport for strnlen, but for select sources.
# Adding portgroup breaks the build: https://trac.macports.org/ticket/71272
depends_lib-append \
path:lib/libMacportsLegacySupport.dylib:legacy-support
patchfiles-append \
0002-Use-legacysupport-manually-for-strnlen.patch
post-patch {
reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/scipy/io/meson.build \
${worksrcpath}/scipy/optimize/meson.build \
${worksrcpath}/scipy/sparse/linalg/_eigen/arpack/meson.build \
${worksrcpath}/scipy/sparse/linalg/_propack/meson.build
}
}
if {${python.version} == 39} {
version 1.13.1
revision 0
checksums rmd160 ab376ae8d339135b8edb8220d28c26fb495a0609 \
sha256 095a87a0312b08dfd6a6155cbbd310a8c51800fc931b8c0b84003014b874ed3c \
size 57210720
patchfiles-replace \
patch-version-caps-pyproject.toml.diff \
patch-v1.13.1-version-caps-pyproject.toml.diff
patchfiles-delete \
patch_scipy_meson.build.diff
}
configure.fflags-append -fno-second-underscore
depends_build-append \
port:py${python.version}-cython \
path:bin/pkg-config:pkgconfig \
port:py${python.version}-pythran
build.env-append PATH=${python.prefix}/bin:$env(PATH)
depends_lib-append port:py${python.version}-numpy \
port:py${python.version}-pybind11 \
port:py${python.version}-mypy
# SciPy (and NumPy) only support the Accelerate framework for macOS 13.3+
# see: https://scipy.github.io/devdocs/building/blas_lapack.html
if {${os.platform} eq "darwin" && (${os.major} > 22 || ${os.major} == 22 && ${os.minor} >= 4)} {
variant accelerate conflicts openblas flexiblas blis description "Use Apples Accelerate Framework" {
build.args-append -Csetup-args=-Dblas=accelerate -Csetup-args=-Dlapack=accelerate
}
}
variant openblas conflicts accelerate flexiblas blis description "Use MacPorts OpenBLAS Libraries" {
depends_lib-append path:lib/libopenblas.dylib:OpenBLAS
build.args-append -Csetup-args=-Dblas=openblas -Csetup-args=-Dlapack=openblas \
-Csetup-args=-Dpkg_config_path=${prefix}/lib/pkgconfig
}
variant flexiblas conflicts accelerate openblas blis description "Use MacPorts FlexiBLAS libraries" {
depends_lib-append port:flexiblas
build.args-append -Csetup-args=-Dblas=flexiblas -Csetup-args=-Dlapack=flexiblas \
-Csetup-args=-Dpkg_config_path=${prefix}/lib/pkgconfig
}
variant blis conflicts accelerate openblas flexiblas description "Use MacPorts BLIS/lapack libraries" {
# TODO: eventually this could/should use libFLAME, but currently SciPy cannot be convinced to use it
depends_lib-append port:blis \
port:lapack
build.args-append -Csetup-args=-Dblas=blis -Csetup-args=-Dlapack=lapack \
-Csetup-args=-Dpkg_config_path=${prefix}/share/pkgconfig:${prefix}/lib/lapack/pkgconfig
}
# set default BLAS/LAPACK variant if none is explicitly selected by the user
if {![variant_isset accelerate] && ![variant_isset openblas] && ![variant_isset flexiblas] && ![variant_isset blis]} {
# default to macOS Accelerate framework if macOS 13.3 or higher, otherwise OpenBLAS
if {${os.platform} eq "darwin" && (${os.major} > 22 || ${os.major} == 22 && ${os.minor} >= 4) && ${python.version} > 39} {
default_variants +accelerate
} else {
default_variants +openblas
}
}
test.run yes
test.dir ${destroot}${python.pkgd}
test.env-append PYTHONPATH=${destroot}${python.pkgd}
depends_test-append port:py${python.version}-hypothesis \
port:py${python.version}-pooch \
port:py${python.version}-mpmath \
port:py${python.version}-gmpy2 \
port:py${python.version}-threadpoolctl \
port:py${python.version}-scikit-umfpack
}