Merge pull request #37047 from dtzWill/fix/openblas-numpy-musl

openblas, numpy: fix w/musl
This commit is contained in:
Will Dietz
2018-03-19 13:39:24 -05:00
committed by GitHub
2 changed files with 16 additions and 4 deletions

View File

@@ -1,14 +1,14 @@
{lib, fetchPypi, python, buildPythonPackage, isPy27, isPyPy, gfortran, nose, blas}:
{lib, fetchPypi, python, buildPythonPackage, isPy27, isPyPy, gfortran, nose, blas, hostPlatform }:
buildPythonPackage rec {
pname = "numpy";
version = "1.14.1";
version = "1.14.2";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
extension = "zip";
sha256 = "fa0944650d5d3fb95869eaacd8eedbd2d83610c85e271bd9d3495ffa9bc4dc9c";
sha256 = "facc6f925c3099ac01a1f03758100772560a0b020fb9d70f210404be08006bcb";
};
disabled = isPyPy;
@@ -20,6 +20,18 @@ buildPythonPackage rec {
./numpy-distutils-C++.patch
];
postPatch = lib.optionalString hostPlatform.isMusl ''
# Use fenv.h
sed -i \
numpy/core/src/npymath/ieee754.c.src \
numpy/core/include/numpy/ufuncobject.h \
-e 's/__GLIBC__/__linux__/'
# Don't use various complex trig functions
substituteInPlace numpy/core/src/private/npy_config.h \
--replace '#if defined(__GLIBC__)' "#if 1" \
--replace '#if !__GLIBC_PREREQ(2, 18)' "#if 1"
'';
preConfigure = ''
sed -i 's/-faltivec//' numpy/distutils/system_info.py
export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES