pyodide/packages/scipy/meta.yaml

147 lines
5.3 KiB
YAML
Raw Normal View History

2018-07-18 13:32:16 +00:00
package:
name: scipy
2022-04-09 01:43:30 +00:00
version: 1.8.0
2022-01-03 22:07:13 +00:00
# See extra explanation in info.md
#
# For future reference: if you see the following errors:
# Declaration error: adjustable dimension on non-argument
# or:
# nonconstant array size
# you are trying to compile code that isn't written to the fortran 77 standard.
# The line number in the error points to the last line of the problematic
# subroutine. Try deleting it.
2018-07-18 13:32:16 +00:00
source:
2022-04-09 01:43:30 +00:00
url: https://files.pythonhosted.org/packages/b4/a2/4faa34bf0cdbefd5c706625f1234987795f368eb4e97bde9d6f46860843e/scipy-1.8.0.tar.gz
sha256: 31d4f2d6b724bc9a98e527b5849b8a7e589bf1ea630c33aa563eda912c9ff0bd
2018-10-05 13:26:21 +00:00
patches:
- patches/0001-Fix-dstevr-in-special-lapack_defs.h.patch
2022-04-09 01:43:30 +00:00
- patches/0002-loadDynamicLibrary-flapack.patch
- patches/0003-Add-lapack_extras-to-linalg-setup.py.patch
- patches/0004-int-to-string.patch
- patches/0005-disable-blas-detection.patch
- patches/0006-fix-fotran-files-minpack.patch
- patches/0007-gemm_-no-const.patch
- patches/0008-make-int-return-values.patch
- patches/0009-Rename-_page_trend_test.py-to-prevent-test-unvendori.patch
- patches/0010-sasum-returns-double-not-float.patch
- patches/0011-skip-fortran-fails-to-link.patch
- patches/0012-Disable-lapack-detection.patch
- patches/0013-Add-extra-END-to-prini.f.patch
- patches/0014-BUG-Fix-signature-of-D_IIR_forback-1-2.patch
2018-07-18 13:32:16 +00:00
build:
cflags: |
-I$(PYODIDE_ROOT)/packages/CLAPACK/build/CLAPACK-3.2.1/INCLUDE
Use pypa/build (#2272) This resolves #2189. > build isolation would be a bit difficult to use in our case, as for instance > when building scipy we need the patched numpy on the host and not the numpy > version specified in pyproject.toml (which would be unpatched) This is indeed the case, certain packages cannot be isolated. My strategy is to make a list of packages that shouldn't be isolated and add symlinks from the isolated build environment into the `.artifacts` directory to "unisolate" them. Then we remove the unisolated package requirements from the list of packages to install, in case pesky constraints aren't satisfied. In particular, packages that expect to be used with `pypa/build` often feel free to put very specific constraints on their build dependencies (often asking them to be == to a particular version). Specific version constraints is good for build reproducibility and with build isolation doesn't cost anything. So we just ignore the constraints. Hopefully nothing goes wrong. In particular, any package that does stuff both at build time and at runtime and requires synchronization between the build time and run time environments needs the unisolation. This includes cffi with `_cffi_backend.so`, and of course numpy and scipy. pycparser needs to be unisolated because it is a dependency of cffi. Currently I have also unisolated pythran and cython, though these are build time only tools and do not really need to be unisolated. Cython I unisolated specifically because numcodecs needs it but it isn't in the numcodecs build dependencies. Pythran I unisolated because of a problem with the scipy build which I don't fully understand (some problem with long double feature detection).
2022-03-22 05:05:30 +00:00
-I$(HOSTSITEPACKAGES)/pythran/
2022-01-03 22:07:13 +00:00
-Wno-return-type
-DUNDERSCORE_G77
ldflags: |
-L$(NUMPY_LIB)/core/lib/
-L$(NUMPY_LIB)/random/lib/
2022-01-03 22:07:13 +00:00
# IMPORTANT: Other locations important in scipy build process:
# There are two files built in the "capture" pass that need patching:
# _blas_subroutines.h, and _cython
# Scipy has a bunch of custom logic implemented in
# pyodide-build/pyodide_build/_f2c_fixes.py.
script: |
pip install -t $HOSTSITEPACKAGES pythran
2022-01-03 22:07:13 +00:00
# We get linker errors because the following 36 functions are missing
# Copying them from a more recent LAPACK seems to work fine.
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.0.tar.gz
tar xzf v3.10.0.tar.gz
cd lapack-3.10.0/SRC
2022-04-09 01:43:30 +00:00
2022-01-03 22:07:13 +00:00
cat \
2022-04-09 01:43:30 +00:00
cgemqrt.f cgeqrfp.f cgeqrt.f clahqr.f csyconv.f csyconvf.f csyconvf_rook.f ctpmqrt.f ctpqrt.f cuncsd.f \
dgemqrt.f dgeqrfp.f dgeqrt.f dlahqr.f dsyconv.f dsyconvf.f dsyconvf_rook.f dtpmqrt.f dtpqrt.f dorcsd.f \
sgemqrt.f sgeqrfp.f sgeqrt.f slahqr.f ssyconv.f ssyconvf.f ssyconvf_rook.f stpmqrt.f stpqrt.f sorcsd.f \
zgemqrt.f zgeqrfp.f zgeqrt.f zlahqr.f zsyconv.f zsyconvf.f zsyconvf_rook.f ztpmqrt.f ztpqrt.f zuncsd.f \
2022-01-03 22:07:13 +00:00
>> ../../scipy/linalg/lapack_extras.f
sed -i 's/CHARACTER/INTEGER/g' ../../scipy/linalg/lapack_extras.f
2022-04-09 01:43:30 +00:00
sed -i 's/RECURSIVE//g' ../../scipy/linalg/lapack_extras.f
2022-01-03 22:07:13 +00:00
cd ../..
# Change many functions that return void into functions that return int
find scipy -name "*.c*" | xargs sed -i 's/extern void F_FUNC/extern int F_FUNC/g'
sed -i 's/void F_FUNC/int F_FUNC/g' scipy/odr/__odrpack.c
sed -i 's/^void/int/g' scipy/odr/odrpack.h
sed -i 's/^void/int/g' scipy/odr/__odrpack.c
sed -i 's/void BLAS_FUNC/int BLAS_FUNC/g' scipy/special/lapack_defs.h
# sed -i 's/void F_FUNC/int F_FUNC/g' scipy/linalg/_lapack_subroutines.h
2022-01-03 22:07:13 +00:00
sed -i 's/extern void/extern int/g' scipy/optimize/__minpack.h
sed -i 's/void/int/g' scipy/linalg/cython_blas_signatures.txt
sed -i 's/^void/int/g' scipy/interpolate/src/_fitpackmodule.c
sed -i 's/^void/int/g' scipy/optimize/_trlib/trlib_private.h
sed -i 's/^void/int/g' scipy/optimize/_trlib/trlib/trlib_private.h
sed -i 's/, int)/)/g' scipy/optimize/_trlib/trlib_private.h
sed -i 's/, 1)/)/g' scipy/optimize/_trlib/trlib_private.h
sed -i 's/^void/int/g' scipy/spatial/qhull_misc.h
sed -i 's/, size_t)/)/g' scipy/spatial/qhull_misc.h
sed -i 's/,1)/)/g' scipy/spatial/qhull_misc.h
2022-01-03 22:07:13 +00:00
# Missing declaration from cython_lapack_signatures.txt
echo "void ilaenv(int *ispec, char *name, char *opts, int *n1, int *n2, int *n3, int *n4)" \
>> scipy/linalg/cython_lapack_signatures.txt
# sed -i 's/^void/int/g' scipy/linalg/cython_lapack_signatures.txt
2022-01-03 22:07:13 +00:00
# Input error causes "duplicate symbol" linker errors. Empty out the file.
2022-04-09 01:43:30 +00:00
echo "" > scipy/sparse/linalg/_dsolve/SuperLU/SRC/input_error.c
cross-build-env: true
cross-build-files:
- scipy/linalg/cython_lapack.pxd
- scipy/linalg/cython_blas.pxd
2022-01-03 22:07:13 +00:00
2018-07-18 13:32:16 +00:00
requirements:
run:
- numpy
- CLAPACK
2018-10-30 12:10:10 +00:00
test:
imports:
- scipy
2018-10-31 14:06:08 +00:00
- scipy.cluster
2022-01-03 22:07:13 +00:00
- scipy.cluster.vq
- scipy.cluster.hierarchy
2018-10-31 14:06:08 +00:00
- scipy.constants
2022-01-03 22:07:13 +00:00
- scipy.fft
2018-10-31 14:06:08 +00:00
- scipy.fftpack
- scipy.integrate
2022-01-03 22:07:13 +00:00
- scipy.interpolate
- scipy.io
- scipy.io.arff
- scipy.io.matlab
- scipy.io.wavfile
2018-10-30 12:10:10 +00:00
- scipy.linalg
2022-01-03 22:07:13 +00:00
- scipy.linalg.blas
- scipy.linalg.cython_blas
- scipy.linalg.lapack
- scipy.linalg.cython_lapack
- scipy.linalg.interpolative
2018-10-31 14:06:08 +00:00
- scipy.misc
- scipy.ndimage
2022-01-03 22:07:13 +00:00
- scipy.odr
- scipy.optimize
- scipy.signal
- scipy.signal.windows
- scipy.sparse
- scipy.sparse.linalg
- scipy.sparse.csgraph
2018-10-31 14:06:08 +00:00
- scipy.spatial
2022-01-03 22:07:13 +00:00
- scipy.spatial.distance
- scipy.spatial.transform
2018-10-30 12:10:10 +00:00
- scipy.special
2022-01-03 22:07:13 +00:00
- scipy.stats
- scipy.stats.contingency
- scipy.stats.distributions
- scipy.stats.mstats
- scipy.stats.qmc