2018-05-14 11:47:45 +01:00
|
|
|
{ stdenv, fetchurl, fetchpatch, texlive, bison, flex, liblapackWithoutAtlas
|
2018-05-13 17:33:51 +01:00
|
|
|
, gmp, mpfr, pari, ntl, gsl, blas, mpfi
|
2017-09-30 14:34:11 +01:00
|
|
|
, readline, gettext, libpng, libao, gfortran, perl
|
2018-02-24 13:12:44 +00:00
|
|
|
, enableGUI ? false, libGLU_combined ? null, xorg ? null, fltk ? null
|
2017-09-30 10:33:14 +01:00
|
|
|
}:
|
|
|
|
|
2018-02-24 13:12:44 +00:00
|
|
|
assert enableGUI -> libGLU_combined != null && xorg != null && fltk != null;
|
2017-09-30 10:33:14 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2017-09-30 14:34:11 +01:00
|
|
|
name = "${attr}-${version}";
|
|
|
|
attr = if enableGUI then "giac-with-xcas" else "giac";
|
2018-03-25 20:09:21 +01:00
|
|
|
version = "1.4.9-59";
|
2017-09-30 10:33:14 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-03-25 20:09:21 +01:00
|
|
|
url = "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_${version}.tar.gz";
|
|
|
|
sha256 = "0dv5p5y6gkrsmz3xa7fw87rjyabwdwk09mqb09kb7gai9n9dgayk";
|
2017-09-30 10:33:14 +01:00
|
|
|
};
|
|
|
|
|
2018-04-11 20:14:16 +01:00
|
|
|
patches = stdenv.lib.optionals (!enableGUI) [
|
|
|
|
# when enableGui is false, giac is compiled without fltk. That means some
|
|
|
|
# outputs differ in the make check. Patch around this:
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/giac/patches/nofltk-check.patch?id=7553a3c8dfa7bcec07241a07e6a4e7dcf5bb4f26";
|
|
|
|
sha256 = "0xkmfc028vg5w6va04gp2x2iv31n8v4shd6vbyvk4blzgfmpj2cw";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2017-09-30 14:34:11 +01:00
|
|
|
postPatch = ''
|
|
|
|
for i in doc/*/Makefile*; do
|
2017-09-30 10:33:14 +01:00
|
|
|
substituteInPlace "$i" --replace "/bin/cp" "cp";
|
|
|
|
done;
|
2017-09-30 14:34:11 +01:00
|
|
|
'';
|
2017-09-30 10:33:14 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2017-09-30 14:34:11 +01:00
|
|
|
texlive.combined.scheme-small bison flex
|
2017-09-30 10:33:14 +01:00
|
|
|
];
|
|
|
|
|
2017-09-30 14:34:11 +01:00
|
|
|
# perl is only needed for patchShebangs fixup.
|
2017-09-30 10:33:14 +01:00
|
|
|
buildInputs = [
|
2018-05-13 17:33:51 +01:00
|
|
|
gmp mpfr pari ntl gsl blas mpfi
|
2018-01-10 16:49:06 +00:00
|
|
|
readline gettext libpng libao perl
|
|
|
|
# gfortran.cc default output contains static libraries compiled without -fPIC
|
|
|
|
# we want libgfortran.so.3 instead
|
|
|
|
(stdenv.lib.getLib gfortran.cc)
|
2018-05-14 11:47:45 +01:00
|
|
|
liblapackWithoutAtlas
|
2017-09-30 14:34:11 +01:00
|
|
|
] ++ stdenv.lib.optionals enableGUI [
|
2018-02-24 13:12:44 +00:00
|
|
|
libGLU_combined fltk xorg.libX11
|
2017-09-30 10:33:14 +01:00
|
|
|
];
|
|
|
|
|
2018-04-11 20:14:16 +01:00
|
|
|
outputs = [ "out" "doc" ];
|
|
|
|
|
|
|
|
doCheck = true;
|
2017-09-30 14:34:11 +01:00
|
|
|
|
2017-09-30 10:33:14 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
configureFlags = [
|
2017-09-30 14:34:11 +01:00
|
|
|
"--enable-gc" "--enable-png" "--enable-gsl" "--enable-lapack"
|
|
|
|
"--enable-pari" "--enable-ntl" "--enable-gmpxx" # "--enable-cocoa"
|
|
|
|
"--enable-ao"
|
|
|
|
] ++ stdenv.lib.optionals enableGUI [
|
|
|
|
"--enable-gui" "--with-x"
|
|
|
|
];
|
2017-09-30 10:33:14 +01:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# example Makefiles contain the full path to some commands
|
|
|
|
# notably texlive, and we don't want texlive to become a runtime
|
|
|
|
# dependency
|
|
|
|
for file in $(find $out -name Makefile) ; do
|
|
|
|
sed -i "s@/nix/store/[^/]*/bin/@@" "$file" ;
|
|
|
|
done;
|
2018-04-11 20:14:16 +01:00
|
|
|
|
|
|
|
# reference cycle
|
|
|
|
rm "$out/share/giac/doc/el/"{casinter,tutoriel}/Makefile
|
|
|
|
|
|
|
|
mkdir -p "$doc/share/giac"
|
|
|
|
mv "$out/share/giac/doc" "$doc/share/giac"
|
|
|
|
mv "$out/share/giac/examples" "$doc/share/giac"
|
2017-09-30 10:33:14 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A free computer algebra system (CAS)";
|
|
|
|
homepage = "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html";
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
## xcas is buildable on darwin but there are specific instructions I could
|
|
|
|
## not test
|
|
|
|
platforms = platforms.linux;
|
2017-09-30 20:40:50 +01:00
|
|
|
maintainers = [ maintainers.symphorien ];
|
2017-09-30 10:33:14 +01:00
|
|
|
};
|
|
|
|
}
|