summary refs log tree commit diff
path: root/pkgs/development/libraries/science/math/zn_poly/default.nix
blob: bc322d4c534195c9e9e45af12a0abe268c45d939 (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
{ stdenv
, fetchurl
, gmp
, python2
}:

stdenv.mkDerivation rec {
  version = "0.9";
  pname = "zn_poly";
  name = "${pname}-${version}";

  src = fetchurl {
    url = "http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/releases/zn_poly-${version}.tar.gz";
    sha256 = "1kxl25av7i3v68k32hw5bayrfcvmahmqvs97mlh9g238gj4qb851";
  };

  buildInputs = [
    gmp
  ];

  nativeBuildInputs = [
    python2 # needed by ./configure to create the makefile
  ];

  libname = "libzn_poly${stdenv.targetPlatform.extensions.sharedLibrary}";

  # Tuning (either autotuning or with hand-written paramters) is possible
  # but not implemented here.
  # It seems buggy anyways (see homepage).
  buildFlags = [ "all" libname ];


  # `make install` fails to install some header files and the lib file.
  installPhase = ''
    mkdir -p "$out/include/zn_poly"
    mkdir -p "$out/lib"
    cp "${libname}" "$out/lib"
    cp include/*.h "$out/include/zn_poly"
  '';

  doCheck = true;

  meta = with stdenv.lib; {
    homepage = http://web.maths.unsw.edu.au/~davidharvey/code/zn_poly/;
    description = "Polynomial arithmetic over Z/nZ";
    license = with licenses; [ gpl3 ];
    maintainers = with maintainers; [ timokau ];
    platforms = platforms.linux;
  };
}