From 2dd4f2a0042a686652910359fe13ea6855bc626f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Thu, 14 May 2020 06:52:32 +0200 Subject: [PATCH] mkl: fix expectation of MKLROOT being set in pkg-config files The Intel MKL pkg-config files did not work, because they expect that the MKLROOT environment variable is set. This change replaces occurences by the actual path of MKL in the Nix store. Since the pkg-config files seem to break quite frequently after upgrades, add a post-install check to validate the pkg-config files. (cherry picked from commit e88673aa27dea719295bcb6ec1ae6a67eca3d683) --- .../libraries/science/math/mkl/default.nix | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/mkl/default.nix b/pkgs/development/libraries/science/math/mkl/default.nix index 3def5e5b403c..909869021009 100644 --- a/pkgs/development/libraries/science/math/mkl/default.nix +++ b/pkgs/development/libraries/science/math/mkl/default.nix @@ -1,4 +1,12 @@ -{ stdenvNoCC, fetchurl, rpmextract, undmg, darwin, enableStatic ? false }: +{ stdenvNoCC +, fetchurl +, pkgconfig +, rpmextract +, undmg +, darwin +, enableStatic ? false +}: + /* For details on using mkl as a blas provider for python packages such as numpy, numexpr, scipy, etc., see the Python section of the NixPkgs manual. @@ -42,6 +50,10 @@ in stdenvNoCC.mkDerivation { else [ rpmextract ]; + installCheckInputs = [ pkgconfig ]; + + doInstallCheck = true; + buildPhase = if stdenvNoCC.isDarwin then '' for f in Contents/Resources/pkg/*.tgz; do tar xzvf $f @@ -75,6 +87,7 @@ in stdenvNoCC.mkDerivation { bn=$(basename $f) substituteInPlace $f \ --replace "prefix=/mkl" "prefix=$out" \ + --replace $\{MKLROOT} "$out" \ --replace "lib/intel64_lin" "lib" done @@ -125,6 +138,11 @@ in stdenvNoCC.mkDerivation { install_name_tool -change @rpath/libtbbmalloc.dylib $out/lib/libtbbmalloc.dylib $out/lib/libtbbmalloc_proxy.dylib ''; + # Validate pkgconfig files, since they break often on updates. + installCheckPhase = '' + pkg-config --validate $out/lib/pkgconfig/*.pc + ''; + # Per license agreement, do not modify the binary dontStrip = true; dontPatchELF = true;