blob: cb3355260d127d68d2c8b485b34489fc3cbab30b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{ stdenv
, pkg-config
, mkl
, enableStatic ? false
, execution ? "seq"
}:
let
linkType = if enableStatic then "static" else "dynamic";
in stdenv.mkDerivation {
pname = "mkl-test";
version = mkl.version;
src = ./.;
nativeBuildInputs = [ pkg-config ];
buildInputs = [ (mkl.override { inherit enableStatic; }) ];
doCheck = true;
buildPhase = ''
# Check regular Nix build.
gcc test.c -o test $(pkg-config --cflags --libs mkl-${linkType}-ilp64-${execution})
# Clear flags to ensure that we are purely relying on options
# provided by pkg-config.
NIX_CFLAGS_COMPILE="" \
NIX_LDFLAGS="" \
gcc test.c -o test $(pkg-config --cflags --libs mkl-${linkType}-ilp64-${execution})
'';
installPhase = ''
touch $out
'';
checkPhase = ''
./test
'';
}
|