aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/spooles/default.nix
blob: c55a1b8002e1ed36b18899eda92a8b12b9bf74a0 (plain)
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
{ stdenv, fetchurl, gfortran, perl }:

stdenv.mkDerivation rec {
  pname = "spooles";
  version = "2.2";

  src = fetchurl {
    url = "http://www.netlib.org/linalg/spooles/spooles.${version}.tgz";
    sha256 = "1pf5z3vvwd8smbpibyabprdvcmax0grzvx2y0liy98c7x6h5jid8";
  };

  sourceRoot = ".";

  patches = [
    ./spooles.patch
  ];

  postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace makefile --replace '-Wl,-soname' '-Wl,-install_name'
  '';

  buildPhase = ''
    make lib
  '';

  installPhase = ''
    mkdir -p $out/lib $out/include/spooles
    cp libspooles.a libspooles.so.2.2 $out/lib/
    ln -s libspooles.so.2.2 $out/lib/libspooles.so.2
    ln -s libspooles.so.2 $out/lib/libspooles.so
    for h in *.h; do
      if [ $h != 'MPI.h' ]; then
         cp $h $out/include/spooles
         d=`basename $h .h`
         if [ -d $d ]; then
            mkdir $out/include/spooles/$d
            cp $d/*.h $out/include/spooles/$d
         fi
      fi
    done
  '';

  nativeBuildInputs = [ perl ];

  meta = with stdenv.lib; {
    homepage = "http://www.netlib.org/linalg/spooles/";
    description = "Library for solving sparse real and complex linear systems of equations";
    license = licenses.publicDomain;
    maintainers = with maintainers; [ gebner ];
    platforms = platforms.unix;
  };
}