lol
1{ lib, stdenv
2, fetchFromGitHub
3, perl
4, python3
5
6# Enable BLAS interface with 64-bit integer width.
7, blas64 ? false
8
9# Target architecture. x86_64 builds Intel and AMD kernels.
10, withArchitecture ? "x86_64"
11
12# Enable OpenMP-based threading.
13, withOpenMP ? true
14}:
15
16let
17 blasIntSize = if blas64 then "64" else "32";
18in stdenv.mkDerivation rec {
19 pname = "blis";
20 version = "0.9.0";
21
22 src = fetchFromGitHub {
23 owner = "flame";
24 repo = "blis";
25 rev = version;
26 sha256 = "sha256-1aHIdt5wCDrT1hBPnaUVThwjwDkJQ0G0+tao2iFXYpM=";
27 };
28
29 inherit blas64;
30
31 nativeBuildInputs = [
32 perl
33 python3
34 ];
35
36 doCheck = true;
37
38 enableParallelBuilding = true;
39
40 configureFlags = [
41 "--enable-cblas"
42 "--blas-int-size=${blasIntSize}"
43 ] ++ lib.optionals withOpenMP [ "--enable-threading=openmp" ]
44 ++ [ withArchitecture ];
45
46 postPatch = ''
47 patchShebangs configure build/flatten-headers.py
48 '';
49
50 postInstall = ''
51 ln -s $out/lib/libblis.so.4 $out/lib/libblas.so.3
52 ln -s $out/lib/libblis.so.4 $out/lib/libcblas.so.3
53 ln -s $out/lib/libblas.so.3 $out/lib/libblas.so
54 ln -s $out/lib/libcblas.so.3 $out/lib/libcblas.so
55 '';
56
57 meta = with lib; {
58 description = "BLAS-compatible linear algebra library";
59 homepage = "https://github.com/flame/blis";
60 license = licenses.bsd3;
61 maintainers = [ ];
62 platforms = [ "x86_64-linux" ];
63 };
64}