1{
2 lib,
3 stdenv,
4 fetchurl,
5 gmp,
6 libX11,
7 libpthreadstubs,
8 perl,
9 readline,
10 texliveBasic,
11 withThread ? true,
12}:
13
14assert withThread -> libpthreadstubs != null;
15
16stdenv.mkDerivation rec {
17 pname = "pari";
18 version = "2.17.2";
19
20 src = fetchurl {
21 urls = [
22 "https://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz"
23 # old versions are at the url below
24 "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz"
25 ];
26 hash = "sha256-fTBXj1z5exN6KB9FSNExqvwM3oa8/RDMHhvXKoHmUGE=";
27 };
28
29 buildInputs = [
30 gmp
31 libX11
32 perl
33 readline
34 texliveBasic
35 ]
36 ++ lib.optionals withThread [
37 libpthreadstubs
38 ];
39
40 configureScript = "./Configure";
41 configureFlags = [
42 "--with-gmp=${lib.getDev gmp}"
43 "--with-readline=${lib.getDev readline}"
44 ]
45 ++ lib.optional withThread "--mt=pthread";
46
47 preConfigure = ''
48 export LD=$CC
49 '';
50
51 makeFlags = [ "all" ];
52
53 meta = with lib; {
54 homepage = "http://pari.math.u-bordeaux.fr";
55 description = "Computer algebra system for high-performance number theory computations";
56 longDescription = ''
57 PARI/GP is a widely used computer algebra system designed for fast
58 computations in number theory (factorizations, algebraic number theory,
59 elliptic curves...), but also contains a large number of other useful
60 functions to compute with mathematical entities such as matrices,
61 polynomials, power series, algebraic numbers etc., and a lot of
62 transcendental functions. PARI is also available as a C library to allow
63 for faster computations.
64
65 Originally developed by Henri Cohen and his co-workers (Université
66 Bordeaux I, France), PARI is now under the GPL and maintained by Karim
67 Belabas with the help of many volunteer contributors.
68
69 - PARI is a C library, allowing fast computations.
70 - gp is an easy-to-use interactive shell giving access to the PARI
71 functions.
72 - GP is the name of gp's scripting language.
73 - gp2c, the GP-to-C compiler, combines the best of both worlds by
74 compiling GP scripts to the C language and transparently loading the
75 resulting functions into gp. (gp2c-compiled scripts will typically run
76 3 or 4 times faster.) gp2c currently only understands a subset of the
77 GP language.
78 '';
79 downloadPage = "http://pari.math.u-bordeaux.fr/download.html";
80 license = licenses.gpl2Plus;
81 maintainers = with maintainers; [ ertes ];
82 teams = [ teams.sage ];
83 platforms = platforms.linux ++ platforms.darwin;
84 mainProgram = "gp";
85 };
86}