nixpkgs/pkgs/by-name/sp/spral/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

66 lines
1.4 KiB
Nix

{
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 ];
};
}