summary refs log tree commit diff
path: root/pkgs/applications/science/logic/poly/default.nix
blob: c80b9bf1f0c47e6308fd75dcf4d05966a72a77d4 (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
{lib, stdenv, fetchFromGitHub, gmp, cmake, python3}:

stdenv.mkDerivation rec {
  pname = "libpoly";
  version = "0.1.10";

  src = fetchFromGitHub {
    owner = "SRI-CSL";
    repo = "libpoly";
    # they've pushed to the release branch, use explicit tag
    rev = "refs/tags/v${version}";
    sha256 = "sha256-22Y4L5NFnCzKwZt0A/ChMuGPU4Dk1Qyke6mdvfN063w=";
  };

  # https://github.com/SRI-CSL/libpoly/pull/52
  postPatch = lib.optionalString stdenv.isDarwin ''
    substituteInPlace src/CMakeLists.txt --replace \
      '"utils/open_memstream.c ''${poly_SOURCES}"' \
      'utils/open_memstream.c ''${poly_SOURCES}'
  '';

  nativeBuildInputs = [ cmake ];

  buildInputs = [ gmp python3 ];

  strictDeps = true;

  meta = with lib; {
    homepage = "https://github.com/SRI-CSL/libpoly";
    description = "C library for manipulating polynomials";
    license = licenses.lgpl3;
    platforms = platforms.all;
  };
}