2021-03-23 13:50:54 +03:00
|
|
|
{ stdenv
|
|
|
|
, pkg-config
|
|
|
|
, mkl
|
2020-11-06 11:56:13 +03:00
|
|
|
|
2021-03-23 13:50:54 +03:00
|
|
|
, enableStatic ? false
|
|
|
|
, execution ? "seq"
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
linkType = if enableStatic then "static" else "dynamic";
|
|
|
|
in stdenv.mkDerivation {
|
2020-11-06 11:56:13 +03:00
|
|
|
pname = "mkl-test";
|
|
|
|
version = mkl.version;
|
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
|
2021-03-23 13:50:54 +03:00
|
|
|
buildInputs = [ (mkl.override { inherit enableStatic; }) ];
|
2020-11-06 11:56:13 +03:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
# Check regular Nix build.
|
2021-03-23 13:50:54 +03:00
|
|
|
gcc test.c -o test $(pkg-config --cflags --libs mkl-${linkType}-ilp64-${execution})
|
2020-11-06 11:56:13 +03:00
|
|
|
|
|
|
|
# Clear flags to ensure that we are purely relying on options
|
|
|
|
# provided by pkg-config.
|
|
|
|
NIX_CFLAGS_COMPILE="" \
|
|
|
|
NIX_LDFLAGS="" \
|
2021-03-23 13:50:54 +03:00
|
|
|
gcc test.c -o test $(pkg-config --cflags --libs mkl-${linkType}-ilp64-${execution})
|
2020-11-06 11:56:13 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
./test
|
|
|
|
'';
|
|
|
|
}
|