nixpkgs/pkgs/development/libraries/clfft/default.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

44 lines
1.3 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, fftw, fftwFloat, boost, opencl-clhpp, ocl-icd, darwin }:
let
inherit (darwin.apple_sdk.frameworks) OpenCL;
in
stdenv.mkDerivation rec {
pname = "clfft";
version = "2.12.2";
src = fetchFromGitHub {
owner = "clMathLibraries";
repo = "clFFT";
rev = "v${version}";
hash = "sha256-yp7u6qhpPYQpBw3d+VLg0GgMyZONVII8BsBCEoRZm4w=";
};
sourceRoot = "${src.name}/src";
postPatch = ''
sed -i '/-m64/d;/-m32/d' CMakeLists.txt
'';
nativeBuildInputs = [ cmake ];
buildInputs = [ fftw fftwFloat boost ]
++ lib.optionals stdenv.hostPlatform.isLinux [ opencl-clhpp ocl-icd ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenCL ];
# https://github.com/clMathLibraries/clFFT/issues/237
CXXFLAGS = "-std=c++98";
meta = with lib; {
description = "Library containing FFT functions written in OpenCL";
longDescription = ''
clFFT is a software library containing FFT functions written in OpenCL.
In addition to GPU devices, the library also supports running on CPU devices to facilitate debugging and heterogeneous programming.
'';
license = licenses.asl20;
homepage = "http://clmathlibraries.github.io/clFFT/";
platforms = platforms.unix;
maintainers = with maintainers; [ chessai ];
};
}