1{ lib, stdenv
2, fetchurl
3, autoreconfHook
4, pari
5, ntl
6, gmp
7# "FLINT is optional and only used for one part of sparse matrix reduction,
8# which is used in the modular symbol code but not mwrank or other elliptic
9# curve programs." -- https://github.com/JohnCremona/eclib/blob/master/README
10, withFlint ? false, flint ? null
11}:
12
13assert withFlint -> flint != null;
14
15stdenv.mkDerivation rec {
16 pname = "eclib";
17 version = "20230424"; # upgrade might break the sage interface
18 # sage tests to run:
19 # src/sage/interfaces/mwrank.py
20 # src/sage/libs/eclib
21 # ping @timokau for more info
22 src = fetchurl {
23 # all releases for this project appear on its GitHub releases page
24 # by definition! other distros sometimes update whenever they see
25 # a version bump in configure.ac or a new tag (and this might show
26 # up on repology). however, a version bump or a new tag may not
27 # represent a new release, and a new release might not be tagged.
28 #
29 # see https://github.com/JohnCremona/eclib/issues/64#issuecomment-789788561
30 # for upstream's explanation of the above
31 url = "https://github.com/JohnCremona/eclib/releases/download/v${version}/eclib-${version}.tar.bz2";
32 sha256 = "sha256-FCLez8q+uwrUL39Yxa7+W9j6EXV7ReMaGGOE/QN81cE=";
33 };
34 buildInputs = [
35 pari
36 ntl
37 gmp
38 ] ++ lib.optionals withFlint [
39 flint
40 ];
41 nativeBuildInputs = [
42 autoreconfHook
43 ];
44 doCheck = true;
45 meta = with lib; {
46 description = "Elliptic curve tools";
47 homepage = "https://github.com/JohnCremona/eclib";
48 license = licenses.gpl2Plus;
49 maintainers = teams.sage.members;
50 platforms = platforms.all;
51 };
52}