Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 74 additions & 40 deletions pkgs/applications/science/math/maxima/default.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
{ stdenv, fetchurl, fetchpatch, sbcl, texinfo, perl, python, makeWrapper, rlwrap ? null
, tk ? null, gnuplot ? null, ecl ? null, ecl-fasl ? false
{ stdenv, fetchurl, fetchpatch, gnuplot, texinfo, perl, python, makeWrapper
, withSbcl ? true, sbcl
, withEcl ? false, ecl
, withRlwrap ? false, rlwrap
, withTk ? false, tk
, withTests ? false
}:

#Either SBCL or ECL but not both of them can be used.
assert withSbcl != withEcl;

let
name = "maxima";
version = "5.42.2";

searchPath =
stdenv.lib.makeBinPath
(stdenv.lib.filter (x: x != null) [ sbcl ecl rlwrap tk gnuplot ]);
# Fetch a patch from the SageMath Git repository.
fetchPatchFromSage = { name, rev, hash } @args : (
fetchpatch {
inherit name;
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/${name}?id=${rev}";
sha256 = hash;
}
);

searchPath = stdenv.lib.makeBinPath ([
] ++ stdenv.lib.optionals withSbcl [
sbcl
] ++ stdenv.lib.optionals withEcl [
ecl
] ++ stdenv.lib.optionals withRlwrap [
rlwrap
] ++ stdenv.lib.optionals withTk [
tk
] ++ stdenv.lib.optionals withTests [
gnuplot
]);

in
stdenv.mkDerivation ({
inherit version;
name = "${name}-${version}";
stdenv.mkDerivation rec {
pname = "maxima";
version = "5.42.2";
name = "${pname}-${version}";

src = fetchurl {
url = "mirror://sourceforge/${name}/${name}-${version}.tar.gz";
url = "mirror://sourceforge/${pname}/${name}.tar.gz";
sha256 = "0kdncy6137sg3rradirxzj10mkcvafxd892zlclwhr9sa7b12zhn";
};

buildInputs = stdenv.lib.filter (x: x != null) [
sbcl ecl texinfo perl python makeWrapper
buildInputs = [
texinfo perl python makeWrapper
] ++ stdenv.lib.optionals withSbcl [
sbcl
] ++ stdenv.lib.optionals withEcl [
ecl
] ++ stdenv.lib.optionals withTests [
gnuplot # required in the test suite
];

Expand All @@ -34,62 +64,66 @@ stdenv.mkDerivation ({
ln -s ../maxima/${version}/emacs $out/share/emacs/site-lisp
ln -s ../maxima/${version}/doc $out/share/doc/maxima
''
+ (stdenv.lib.optionalString ecl-fasl ''
+ (stdenv.lib.optionalString withEcl ''
cp src/binary-ecl/maxima.fas* "$out/lib/maxima/${version}/binary-ecl/"
'')
;

patches = [
# fix path to info dir (see https://trac.sagemath.org/ticket/11348)
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/infodir.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "09v64n60f7i6frzryrj0zd056lvdpms3ajky4f9p6kankhbiv21x";
(fetchPatchFromSage {
name = "infodir.patch";
rev = "07d6c37d18811e2b377a9689790a7c5e24da16ba";
hash = "09v64n60f7i6frzryrj0zd056lvdpms3ajky4f9p6kankhbiv21x";
})

# fix https://sourceforge.net/p/maxima/bugs/2596/
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/matrixexp.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "06961hn66rhjijfvyym21h39wk98sfxhp051da6gz0n9byhwc6zg";
(fetchPatchFromSage {
name = "matrixexp.patch";
rev = "07d6c37d18811e2b377a9689790a7c5e24da16ba";
hash = "06961hn66rhjijfvyym21h39wk98sfxhp051da6gz0n9byhwc6zg";
})

# undo https://sourceforge.net/p/maxima/code/ci/f5e9b0f7eb122c4e48ea9df144dd57221e5ea0ca, see see https://trac.sagemath.org/ticket/13364#comment:93
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/undoing_true_false_printing_patch.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "0fvi3rcjv6743sqsbgdzazy9jb6r1p1yq63zyj9fx42wd1hgf7yx";
# undo https://sourceforge.net/p/maxima/code/ci/f5e9b0f7eb122c4e48ea9df144dd57221e5ea0ca
# see https://trac.sagemath.org/ticket/13364#comment:93
(fetchPatchFromSage {
name = "undoing_true_false_printing_patch.patch";
rev = "07d6c37d18811e2b377a9689790a7c5e24da16ba";
hash = "0fvi3rcjv6743sqsbgdzazy9jb6r1p1yq63zyj9fx42wd1hgf7yx";
})

# upstream bug https://sourceforge.net/p/maxima/bugs/2520/ (not fixed)
# introduced in https://trac.sagemath.org/ticket/13364
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "0xa0b6cr458zp7lc7qi0flv5ar0r3ivsqhjl0c3clv86di2y522d";
(fetchPatchFromSage {
name = "0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn.patch";
rev = "07d6c37d18811e2b377a9689790a7c5e24da16ba";
hash = "0xa0b6cr458zp7lc7qi0flv5ar0r3ivsqhjl0c3clv86di2y522d";
})
] ++ stdenv.lib.optionals ecl-fasl [
] ++ stdenv.lib.optionals withEcl [
# build fasl, needed for ECL support
(fetchpatch {
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/maxima.system.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "18zafig8vflhkr80jq2ivk46k92dkszqlyq8cfmj0b2vcfjwwbar";
(fetchPatchFromSage {
name = "maxima.system.patch";
rev = "07d6c37d18811e2b377a9689790a7c5e24da16ba";
hash = "18zafig8vflhkr80jq2ivk46k92dkszqlyq8cfmj0b2vcfjwwbar";
})
];

# The test suite is disabled since 5.42.2 because of the following issues:
#
# Errors found in /build/maxima-5.42.2/share/linearalgebra/rtest_matrixexp.mac, problems:
# (20 21 22)
# Error found in rtest_arag, problem:
# (error break)
# 3 tests failed out of 3,881 total tests.
# 3 tests failed out of 3,988 total tests.
#
# These failures don't look serious. It would be nice to fix them, but I
# don't know how and probably won't have the time to find out.
doCheck = false; # try to re-enable after next version update
doCheck = withTests; # try to re-enable after next version update

enableParallelBuilding = true;

meta = {
meta = with stdenv.lib; {
description = "Computer algebra system";
homepage = "http://maxima.sourceforge.net";
license = stdenv.lib.licenses.gpl2;
license = licenses.gpl2;

longDescription = ''
Maxima is a fairly complete computer algebra system written in
Expand All @@ -98,7 +132,7 @@ stdenv.mkDerivation ({
symbolic integration, 3D plotting, and an ODE solver.
'';

platforms = stdenv.lib.platforms.unix;
maintainers = [ stdenv.lib.maintainers.peti ];
platforms = platforms.unix;
maintainers = with maintainers; [ peti ];
};
})
}
8 changes: 3 additions & 5 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26761,13 +26761,11 @@ in
geogebra = callPackage ../applications/science/math/geogebra { };
geogebra6 = callPackage ../applications/science/math/geogebra/geogebra6.nix { };

maxima = callPackage ../applications/science/math/maxima {
ecl = null;
};
maxima = callPackage ../applications/science/math/maxima { };
maxima-ecl = maxima.override {
ecl = ecl_16_1_2;
ecl-fasl = true;
sbcl = null;
withEcl = true;
withSbcl = false;
};

mxnet = callPackage ../applications/science/math/mxnet {
Expand Down