base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / sp / spooles / package.nix
blob47738008b02d9ff5caef855b9efe3387d8e9a7df
1 { lib, stdenv, fetchurl, perl }:
3 stdenv.mkDerivation rec {
4   pname = "spooles";
5   version = "2.2";
7   src = fetchurl {
8     url = "http://www.netlib.org/linalg/spooles/spooles.${version}.tgz";
9     sha256 = "1pf5z3vvwd8smbpibyabprdvcmax0grzvx2y0liy98c7x6h5jid8";
10   };
12   sourceRoot = ".";
14   patches = [
15     ./spooles.patch
16     # fix compiler error where NULL is used as a zero parameter
17     ./transform.patch
18     # use proper format specifier for size_t
19     ./allocate.patch
20   ];
22   postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
23     substituteInPlace makefile --replace "-Wl,-soname," "-Wl,-install_name,$out/lib/"
24   '';
26   buildPhase = ''
27     make lib
28   '';
30   installPhase = ''
31     mkdir -p $out/lib $out/include/spooles
32     cp libspooles.a libspooles.so.2.2 $out/lib/
33     ln -s libspooles.so.2.2 $out/lib/libspooles.so.2
34     ln -s libspooles.so.2 $out/lib/libspooles.so
35     for h in *.h; do
36       if [ $h != 'MPI.h' ]; then
37          cp $h $out/include/spooles
38          d=`basename $h .h`
39          if [ -d $d ]; then
40             mkdir $out/include/spooles/$d
41             cp $d/*.h $out/include/spooles/$d
42          fi
43       fi
44     done
45   '';
47   nativeBuildInputs = [ perl ];
49   meta = with lib; {
50     homepage = "http://www.netlib.org/linalg/spooles/";
51     description = "Library for solving sparse real and complex linear systems of equations";
52     license = licenses.publicDomain;
53     maintainers = with maintainers; [ gebner ];
54     platforms = platforms.unix;
55   };