about summary refs log tree commit diff
path: root/pkgs/by-name/sp/spral/package.nix
blob: 19fc5c5a5ff073310a499243b346619de3efc546 (plain) (blame)
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
62
63
64
65
{
  blas,
  fetchFromGitHub,
  gfortran,
  lapack,
  lib,
  llvmPackages,
  meson,
  metis,
  ninja,
  stdenv,
}:

stdenv.mkDerivation rec {
  pname = "spral";
  version = "2024.05.08";

  src = fetchFromGitHub {
    owner = "ralna";
    repo = "spral";
    rev = "v${version}";
    hash = "sha256-1CdRwQ0LQrYcXvoGtGxR9Ug3Q2N4skXq8z+LdNpv8p4=";
  };

  postPatch =
    ''
      # Skipped test: ssidst
      # hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery.
      substituteInPlace tests/meson.build --replace-fail \
        "subdir('ssids')" \
        ""
    ''
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
      # Skipped test: lsmrt, segfault
      substituteInPlace tests/meson.build --replace-fail \
        "['lsmrt', files('lsmr.f90')]," \
        ""
    '';

  nativeBuildInputs = [
    gfortran
    meson
    ninja
  ];

  buildInputs = [
    blas
    lapack
    metis
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ llvmPackages.openmp ];

  mesonFlags = [ (lib.mesonBool "tests" true) ];

  LDFLAGS = lib.optionals stdenv.hostPlatform.isDarwin [ "-lomp" ];

  doCheck = true;

  meta = {
    description = "Sparse Parallel Robust Algorithms Library";
    homepage = "https://github.com/ralna/spral";
    changelog = "https://github.com/ralna/spral/blob/${src.rev}/ChangeLog";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ nim65s ];
  };
}