diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index e2cc262d418e..222445f947d1 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, perl, which, # Most packages depending on openblas expect integer width to match @@ -178,7 +179,7 @@ let shlibExt = stdenv.hostPlatform.extensions.sharedLibrary; in -stdenv.mkDerivation rec { +stdenv.mkDerivation(finalAttrs: { pname = "openblas"; version = "0.3.31"; @@ -190,10 +191,18 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "OpenMathLib"; repo = "OpenBLAS"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-YBR81GOLnTsc0g1SZL+j31/OFucJrBRFqtOTV8lcy8U="; }; + ${if singleThreaded then "patches" else null} = [ + # fix single threaded build + (fetchpatch { + url = "https://github.com/OpenMathLib/OpenBLAS/commit/874243421298866d116e1e8bdbd7e0ed4e31e4f6.diff"; + hash = "sha256-+L98AjuMaDdmEdF8yruvBpljQ+hGmsfNuJSLxB4quDU="; + }) + ]; + inherit blas64; # Some hardening features are disabled due to sporadic failures in @@ -271,7 +280,7 @@ stdenv.mkDerivation rec { ); # The default "all" target unconditionally builds the "tests" target. - buildFlags = lib.optionals (!doCheck) [ "shared" ]; + buildFlags = lib.optionals (!finalAttrs.doCheck) [ "shared" ]; doCheck = true; checkTarget = "tests"; @@ -282,7 +291,7 @@ stdenv.mkDerivation rec { for alias in blas cblas lapack; do cat < $out/lib/pkgconfig/$alias.pc Name: $alias - Version: ${version} + Version: ${finalAttrs.version} Description: $alias provided by the OpenBLAS package. Cflags: -I$dev/include Libs: -L$out/lib -lopenblas @@ -330,4 +339,4 @@ stdenv.mkDerivation rec { platforms = lib.attrNames configs; maintainers = with lib.maintainers; [ ttuegel ]; }; -} +})