-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlapack.nix
61 lines (54 loc) · 1.25 KB
/
lapack.nix
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
lib,
stdenv,
fetchurl,
gfortran,
pkg-config,
withCrlibm ? true,
crlibm-fortran,
}: let
version = "3.0";
crlibm-patch =
if withCrlibm
then
/*
bash
*/
''
${./crmath_lapack}/fix_crmath_lapack.sh
export FFLAGS=`pkg-config --cflags crlibm-fortran`
export LDLIBS=`pkg-config --libs crlibm-fortran`
''
else "";
in
stdenv.mkDerivation {
inherit version;
pname = "lapack";
src = fetchurl {
url = "https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.11.tar.gz";
hash = "sha256-Wls7rCdwnYxmKGt6DR178tcXDsGJoadW/fgSyXqn/RA=";
};
nativeBuildInputs = [gfortran pkg-config];
buildInputs = lib.optional withCrlibm crlibm-fortran;
buildPhase = ''
make blaslib
make lib
'';
configurePhase = ''
${crlibm-patch}
cp ${./lapack.make.inc} make.inc
'';
installPhase = ''
mkdir -p $out/lib
mkdir -p $out/lib/pkgconfig
cp BLAS/SRC/libblas.a $out/lib
cp SRC/liblapack.a $out/lib
cp TESTING/MATGEN/libtmg.a $out/lib
cat <<EOF > $out/lib/pkgconfig/lapack.pc
Name: lapack
Version: ${version}
Description: LAPACK
Libs: -L$out/lib -llapack -lblas
EOF
'';
}