2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, boost, gmp, openssl, pkg-config }:
|
2020-11-28 22:14:07 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libff";
|
2021-12-15 14:21:35 +00:00
|
|
|
version = "0.2.1";
|
2020-11-28 22:14:07 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "scipr-lab";
|
|
|
|
repo = "libff";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0dczi829497vqlmn6n4fgi89bc2h9f13gx30av5z2h6ikik7crgn";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2021-12-15 14:21:35 +00:00
|
|
|
cmakeFlags = [ "-DWITH_PROCPS=Off" ]
|
|
|
|
++ lib.optional stdenv.isAarch64 [ "-DCURVE=ALT_BN128" "-DUSE_ASM=OFF" ];
|
2020-11-28 22:14:07 +00:00
|
|
|
|
2020-12-05 01:13:54 +00:00
|
|
|
# CMake is hardcoded to always build static library which causes linker
|
|
|
|
# failure for Haskell applications depending on haskellPackages.hevm on macOS.
|
2021-01-21 17:00:13 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
2020-12-05 01:13:54 +00:00
|
|
|
substituteInPlace libff/CMakeLists.txt --replace "STATIC" "SHARED"
|
|
|
|
'';
|
|
|
|
|
2020-11-28 22:14:07 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
|
|
|
buildInputs = [ boost gmp openssl ];
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-11-28 22:14:07 +00:00
|
|
|
description = "C++ library for Finite Fields and Elliptic Curves";
|
|
|
|
changelog = "https://github.com/scipr-lab/libff/blob/develop/CHANGELOG.md";
|
|
|
|
homepage = "https://github.com/scipr-lab/libff";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ arturcygan ];
|
|
|
|
};
|
|
|
|
}
|