about summary refs log tree commit diff
path: root/pkgs/tools/security/dieharder/default.nix
blob: c7804f0c5f4dfc30048fc6fc3b556210bb3cb9c3 (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
{ lib, stdenv, fetchurl, gsl
, testers }:

stdenv.mkDerivation (finalAttrs: {
  pname = "dieharder";
  version = "3.31.1";

  src = fetchurl {
    url = "http://webhome.phy.duke.edu/~rgb/General/dieharder/dieharder-${finalAttrs.version}.tgz";
    hash = "sha256-bP8P+DlMVTVJrHQzNZzPyVX7JnlCYDFGIN+l5M1Lcn8=";
  };

  patches = [
    # Include missing stdint.h header
    ./stdint.patch
  ];

  # Workaround build failure on -fno-common toolchains:
  #   ld: include/dieharder/parse.h:21: multiple definition of `splitbuf';
  #     include/dieharder/parse.h:21: first defined here
  env.NIX_CFLAGS_COMPILE = "-fcommon";

  buildInputs = [ gsl ];

  passthru = {
    tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
  };

  meta = with lib; {
    description = "Random Number Generator test suite";
    mainProgram = "dieharder";
    homepage = "https://webhome.phy.duke.edu/~rgb/General/dieharder.php";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ zhaofengli ];
    platforms = platforms.unix;
  };
})