summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pr/prpll/package.nix
blob: 75d0bb73a53c80bdfd07cc0aa6603d06fe1205b5 (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
53
54
55
56
57
58
59
60
{
  fetchFromGitHub,
  lib,
  ocl-icd,
  opencl-headers,
  stdenv,
  installShellFiles,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "prpll";
  version = "0.15";

  src = fetchFromGitHub {
    owner = "preda";
    repo = "gpuowl";
    tag = "v/prpll/${finalAttrs.version}";
    hash = "sha256-uARWaY48IdqWqiX4Z1ZZdhCNGqqVKbyFKOiILSln7ao=";
  };

  enableParallelBuilding = true;

  buildInputs = [
    ocl-icd
    opencl-headers
  ];

  nativeBuildInputs = [ installShellFiles ];

  # Fix stricter compilation rules on aarch64
  postPatch = ''
    substituteInPlace src/common.h \
      --replace-fail "__float128" "_Float128"
  '';

  installPhase = ''
    runHook preInstall

    installBin build-release/prpll

    runHook postInstall
  '';

  meta = {
    description = "Probable Prime and Lucas-Lehmer mersenne categorizer";
    longDescription = ''
      PRPLL implements two primality tests for Mersenne numbers: PRP ("PRobable Prime") and LL ("Lucas-Lehmer") as
      the name suggests.
      PRPLL is an OpenCL (GPU) program for primality testing Mersenne numbers.
    '';
    homepage = "https://github.com/preda/gpuowl";
    maintainers = with lib.maintainers; [ dstremur ];
    license = lib.licenses.gpl3Only;
    platforms = [
      "aarch64-linux"
      "x86_64-linux"
    ];
    mainProgram = "prpll";
  };
})