2019-03-05 20:21:26 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
2019-03-05 20:23:30 +01:00
|
|
|
, fetchpatch
|
2019-03-05 20:21:26 +01:00
|
|
|
, gmp
|
|
|
|
, readline
|
|
|
|
, libX11
|
|
|
|
, tex
|
|
|
|
, perl
|
2018-04-23 19:46:12 +02:00
|
|
|
, withThread ? true, libpthreadstubs
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert withThread -> libpthreadstubs != null;
|
2010-12-05 20:11:21 +01:00
|
|
|
|
2013-07-19 17:20:37 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2019-03-05 20:21:26 +01:00
|
|
|
pname = "pari";
|
2018-12-15 07:17:15 +01:00
|
|
|
version = "2.11.1";
|
2013-07-19 17:20:37 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-03-05 20:21:26 +01:00
|
|
|
url = "https://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz";
|
2018-12-15 07:17:15 +01:00
|
|
|
sha256 = "1jfax92jpydjd02fwl30r6b8kfzqqd6sm4yx94gidyz9lqjb7a94";
|
2010-12-05 20:11:21 +01:00
|
|
|
};
|
|
|
|
|
2019-03-05 20:23:30 +01:00
|
|
|
patches = [
|
|
|
|
# Fix a off-by-one bug that can potentially lead to segfaults (accepted upstream)
|
|
|
|
# https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2117
|
|
|
|
# https://trac.sagemath.org/ticket/27335
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-off-by-one-error.patch";
|
|
|
|
# only relevant parts of https://pari.math.u-bordeaux.fr/cgi-bin/gitweb.cgi?p=pari.git;a=patch;h=aa1ee6e0898d177e6bcf49237d82c804bc410985
|
|
|
|
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/pari/patches/red_montgomery.patch?id=bbea55c96e1f05302b3c7f593cf64492497047c5";
|
|
|
|
sha256 = "0vqkmhgv9splsdswp6zjnkj50z76rc1m6k9iy3cf9dxwqw3h3nr6";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-04-23 19:46:12 +02:00
|
|
|
buildInputs = [
|
|
|
|
gmp
|
|
|
|
readline
|
|
|
|
libX11
|
|
|
|
tex
|
|
|
|
perl
|
|
|
|
] ++ stdenv.lib.optionals withThread [
|
|
|
|
libpthreadstubs
|
|
|
|
];
|
2013-07-19 17:20:37 +02:00
|
|
|
|
|
|
|
configureScript = "./Configure";
|
2017-10-30 09:52:29 +01:00
|
|
|
configureFlags = [
|
|
|
|
"--with-gmp=${gmp.dev}"
|
|
|
|
"--with-readline=${readline.dev}"
|
2018-04-23 19:46:12 +02:00
|
|
|
] ++ stdenv.lib.optional stdenv.isDarwin "--host=x86_64-darwin"
|
|
|
|
++ stdenv.lib.optional withThread "--mt=pthread";
|
2010-12-05 20:11:21 +01:00
|
|
|
|
2017-10-30 09:52:29 +01:00
|
|
|
preConfigure = ''
|
|
|
|
export LD=$CC
|
|
|
|
'';
|
|
|
|
|
|
|
|
postConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
echo 'echo x86_64-darwin' > config/arch-osname
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [ "all" ];
|
2016-11-23 02:47:43 +01:00
|
|
|
|
2015-05-27 21:56:04 +02:00
|
|
|
meta = with stdenv.lib; {
|
2010-12-05 20:11:21 +01:00
|
|
|
description = "Computer algebra system for high-performance number theory computations";
|
2016-11-23 02:47:43 +01:00
|
|
|
longDescription = ''
|
|
|
|
PARI/GP is a widely used computer algebra system designed for fast
|
|
|
|
computations in number theory (factorizations, algebraic number theory,
|
|
|
|
elliptic curves...), but also contains a large number of other useful
|
|
|
|
functions to compute with mathematical entities such as matrices,
|
|
|
|
polynomials, power series, algebraic numbers etc., and a lot of
|
|
|
|
transcendental functions. PARI is also available as a C library to allow
|
|
|
|
for faster computations.
|
|
|
|
|
|
|
|
Originally developed by Henri Cohen and his co-workers (Université
|
|
|
|
Bordeaux I, France), PARI is now under the GPL and maintained by Karim
|
|
|
|
Belabas with the help of many volunteer contributors.
|
|
|
|
|
2017-10-30 09:52:29 +01:00
|
|
|
- PARI is a C library, allowing fast computations.
|
2016-11-23 02:47:43 +01:00
|
|
|
- gp is an easy-to-use interactive shell giving access to the
|
|
|
|
PARI functions.
|
|
|
|
- GP is the name of gp's scripting language.
|
2017-10-30 09:52:29 +01:00
|
|
|
- gp2c, the GP-to-C compiler, combines the best of both worlds
|
|
|
|
by compiling GP scripts to the C language and transparently loading
|
2016-11-23 02:47:43 +01:00
|
|
|
the resulting functions into gp. (gp2c-compiled scripts will typically
|
|
|
|
run 3 or 4 times faster.) gp2c currently only understands a subset
|
|
|
|
of the GP language.
|
|
|
|
'';
|
2018-07-26 16:46:33 +02:00
|
|
|
homepage = http://pari.math.u-bordeaux.fr;
|
|
|
|
downloadPage = http://pari.math.u-bordeaux.fr/download.html;
|
2015-05-28 19:20:29 +02:00
|
|
|
license = licenses.gpl2Plus;
|
2019-03-05 20:23:04 +01:00
|
|
|
maintainers = with maintainers; [ ertes raskin AndersonTorres timokau ];
|
2017-10-30 09:52:29 +01:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2014-09-02 11:41:46 +02:00
|
|
|
updateWalker = true;
|
2010-12-05 20:11:21 +01:00
|
|
|
};
|
2013-07-19 17:20:37 +02:00
|
|
|
}
|