Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python311Packages.cvxopt: use LP64 blas on darwin; fix build #270016

Merged
merged 2 commits into from Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 21 additions & 31 deletions pkgs/development/python-modules/cvxopt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
, fetchPypi
, isPyPy
, python
, openblas
, blas
, lapack # build segfaults with 64-bit blas
, lapack
, suitesparse
, unittestCheckHook
, glpk ? null
Expand All @@ -30,38 +29,29 @@ buildPythonPackage rec {
hash = "sha256-NGH6QsGyJAuk2h2YXKc1A5FBV/xMd0FzJ+1tfYWs2+Y=";
};

buildInputs = (if stdenv.isDarwin then [ openblas ] else [ blas lapack ]);
doCheck = !stdenv.isDarwin;
buildInputs = [ blas lapack ];

# similar to Gsl, glpk, fftw there is also a dsdp interface
# but dsdp is not yet packaged in nixpkgs
preConfigure = (if stdenv.isDarwin then
''
export CVXOPT_BLAS_LIB=openblas
export CVXOPT_LAPACK_LIB=openblas
''
else
''
export CVXOPT_BLAS_LIB=blas
export CVXOPT_LAPACK_LIB=lapack
'') +
''
export CVXOPT_BUILD_DSDP=0
export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib
export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include
'' + lib.optionalString withGsl ''
export CVXOPT_BUILD_GSL=1
export CVXOPT_GSL_LIB_DIR=${lib.getLib gsl}/lib
export CVXOPT_GSL_INC_DIR=${lib.getDev gsl}/include
'' + lib.optionalString withGlpk ''
export CVXOPT_BUILD_GLPK=1
export CVXOPT_GLPK_LIB_DIR=${lib.getLib glpk}/lib
export CVXOPT_GLPK_INC_DIR=${lib.getDev glpk}/include
'' + lib.optionalString withFftw ''
export CVXOPT_BUILD_FFTW=1
export CVXOPT_FFTW_LIB_DIR=${lib.getLib fftw}/lib
export CVXOPT_FFTW_INC_DIR=${lib.getDev fftw}/include
'';
env = {
CVXOPT_BLAS_LIB = "blas";
CVXOPT_LAPACK_LIB = "lapack";
CVXOPT_BUILD_DSDP = "0";
CVXOPT_SUITESPARSE_LIB_DIR = "${lib.getLib suitesparse}/lib";
CVXOPT_SUITESPARSE_INC_DIR = "${lib.getDev suitesparse}/include";
} // lib.optionalAttrs withGsl {
CVXOPT_BUILD_GSL = "1";
CVXOPT_GSL_LIB_DIR= "${lib.getLib gsl}/lib";
CVXOPT_GSL_INC_DIR= "${lib.getDev gsl}/include";
} // lib.optionalAttrs withGlpk {
CVXOPT_BUILD_GLPK = "1";
CVXOPT_GLPK_LIB_DIR = "${lib.getLib glpk}/lib";
CVXOPT_GLPK_INC_DIR = "${lib.getDev glpk}/include";
} // lib.optionalAttrs withFftw {
CVXOPT_BUILD_FFTW = "1";
CVXOPT_FFTW_LIB_DIR = "${lib.getLib fftw}/lib";
CVXOPT_FFTW_INC_DIR = "${lib.getDev fftw}/include";
};

nativeCheckInputs = [ unittestCheckHook ];

Expand Down