about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix18
1 files changed, 13 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix b/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix
index 688c0ec7c399..cb3355260d12 100644
--- a/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix
+++ b/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix
@@ -1,6 +1,14 @@
-{ stdenv, pkg-config, mkl }:
+{ stdenv
+, pkg-config
+, mkl
 
-stdenv.mkDerivation {
+, enableStatic ? false
+, execution ? "seq"
+}:
+
+let
+  linkType = if enableStatic then "static" else "dynamic";
+in stdenv.mkDerivation {
   pname = "mkl-test";
   version = mkl.version;
 
@@ -8,19 +16,19 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ pkg-config ];
 
-  buildInputs = [ mkl ];
+  buildInputs = [ (mkl.override { inherit enableStatic; }) ];
 
   doCheck = true;
 
   buildPhase = ''
     # Check regular Nix build.
-    gcc $(pkg-config --cflags --libs mkl-dynamic-ilp64-seq) test.c -o test
+    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 $(pkg-config --cflags --libs mkl-dynamic-ilp64-seq) test.c -o test
+      gcc test.c -o test $(pkg-config --cflags --libs mkl-${linkType}-ilp64-${execution})
   '';
 
   installPhase = ''