From 57ab62314b18dcdeb4c3e0365cf1821dd1f3340b Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 29 Nov 2021 14:43:39 +0200 Subject: [PATCH] maxima, sage: Simplify lisp-compiler arguments namings Make clearer the difference between `maxima` and `maxima-ecl` top-level attributes. Use the `lisp-compiler` as a passthru for all of sage's expressions. Add the `pname` attribute for `ecl` for compatibility with other lisp implementations. --- .../science/math/maxima/default.nix | 18 +++++++----------- .../applications/science/math/sage/default.nix | 16 +++++++--------- .../science/math/sage/env-locations.nix | 9 ++++----- .../science/math/sage/sage-env.nix | 7 +++---- .../science/math/sage/sage-with-env.nix | 4 ++-- .../applications/science/math/sage/sagedoc.nix | 4 ++-- .../applications/science/math/sage/sagelib.nix | 6 +++--- pkgs/development/compilers/ecl/default.nix | 3 ++- pkgs/top-level/all-packages.nix | 6 ++---- 9 files changed, 32 insertions(+), 41 deletions(-) diff --git a/pkgs/applications/science/math/maxima/default.nix b/pkgs/applications/science/math/maxima/default.nix index 4fbd6e5a00d1..8bad09f17880 100644 --- a/pkgs/applications/science/math/maxima/default.nix +++ b/pkgs/applications/science/math/maxima/default.nix @@ -10,17 +10,13 @@ , rlwrap ? null , tk ? null , gnuplot ? null -, ecl ? null -, ecl-fasl ? false -, sbcl +, lisp-compiler }: let - lisp-compiler = if ecl-fasl then ecl else sbcl; - - searchPath = - lib.makeBinPath - (lib.filter (x: x != null) [ lisp-compiler rlwrap tk gnuplot ]); + # Allow to remove some executables from the $PATH of the wrapped binary + searchPath = lib.makeBinPath + (lib.filter (x: x != null) [ lisp-compiler rlwrap tk gnuplot ]); in stdenv.mkDerivation rec { pname = "maxima"; @@ -59,7 +55,7 @@ stdenv.mkDerivation rec { ln -s ../maxima/${version}/emacs $out/share/emacs/site-lisp ln -s ../maxima/${version}/doc $out/share/doc/maxima '' - + (lib.optionalString ecl-fasl '' + + (lib.optionalString (lisp-compiler.pname == "ecl") '' cp src/binary-ecl/maxima.fas* "$out/lib/maxima/${version}/binary-ecl/" '') ; @@ -83,7 +79,7 @@ stdenv.mkDerivation rec { url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/undoing_true_false_printing_patch.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba"; sha256 = "0fvi3rcjv6743sqsbgdzazy9jb6r1p1yq63zyj9fx42wd1hgf7yx"; }) - ] ++ lib.optionals ecl-fasl [ + ] ++ lib.optionals (lisp-compiler.pname == "ecl") [ # build fasl, needed for ECL support (fetchpatch { url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/maxima.system.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba"; @@ -108,7 +104,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; passthru = { - ecl = ecl; + inherit lisp-compiler; }; meta = with lib; { diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix index b7821db1f9a7..e9dae55fbae3 100644 --- a/pkgs/applications/science/math/sage/default.nix +++ b/pkgs/applications/science/math/sage/default.nix @@ -15,7 +15,7 @@ let sagelib = self.callPackage ./sagelib.nix { inherit flint arb; inherit sage-src env-locations pynac singular; - ecl = maxima-ecl.ecl; + inherit (maxima) lisp-compiler; linbox = pkgs.linbox.override { withSage = true; }; pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config }; @@ -48,9 +48,8 @@ let # the files its looking fore are located. Also see `sage-env`. env-locations = callPackage ./env-locations.nix { inherit pari_data; - inherit singular maxima-ecl; + inherit singular maxima; inherit three; - ecl = maxima-ecl.ecl; cysignals = python3.pkgs.cysignals; mathjax = nodePackages.mathjax; }; @@ -61,22 +60,21 @@ let sagelib = python3.pkgs.sagelib; sage_docbuild = python3.pkgs.sage_docbuild; inherit env-locations; - inherit python3 singular palp flint pynac pythonEnv maxima-ecl; - ecl = maxima-ecl.ecl; + inherit python3 singular palp flint pynac pythonEnv maxima; pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config }; # The documentation for sage, building it takes a lot of ram. sagedoc = callPackage ./sagedoc.nix { inherit sage-with-env; - inherit python3 maxima-ecl; + inherit python3 maxima; }; # sagelib with added wrappers and a dependency on sage-tests to make sure thet tests were run. sage-with-env = callPackage ./sage-with-env.nix { inherit python3 pythonEnv; inherit sage-env; - inherit pynac singular maxima-ecl; + inherit pynac singular maxima; inherit three; pkg-config = pkgs.pkg-config; # not to confuse with pythonPackages.pkg-config }; @@ -118,8 +116,8 @@ let singular = pkgs.singular.override { inherit flint; }; - maxima-ecl = pkgs.maxima-ecl.override { - ecl = pkgs.ecl.override { + maxima = pkgs.maxima.override { + lisp-compiler = pkgs.ecl.override { # "echo syntax error | ecl > /dev/full 2>&1" segfaults in # ECL. We apply a patch to fix it (write_error.patch), but it # only works if threads are disabled. sage 9.2 tests this diff --git a/pkgs/applications/science/math/sage/env-locations.nix b/pkgs/applications/science/math/sage/env-locations.nix index b1ad0aad9c76..45a4799d1a03 100644 --- a/pkgs/applications/science/math/sage/env-locations.nix +++ b/pkgs/applications/science/math/sage/env-locations.nix @@ -2,13 +2,12 @@ , pari_data , pari , singular -, maxima-ecl +, maxima , conway_polynomials , graphs , elliptic_curves , polytopes_db , gap -, ecl , combinatorial_designs , jmol , mathjax @@ -30,14 +29,14 @@ writeTextFile rec { export SINGULAR_SO='${singular}/lib/libSingular.so' export GAP_SO='${gap}/lib/libgap.so' export SINGULAR_EXECUTABLE='${singular}/bin/Singular' - export MAXIMA_FAS='${maxima-ecl}/lib/maxima/${maxima-ecl.version}/binary-ecl/maxima.fas' - export MAXIMA_PREFIX="${maxima-ecl}" + export MAXIMA_FAS='${maxima}/lib/maxima/${maxima.version}/binary-ecl/maxima.fas' + export MAXIMA_PREFIX="${maxima}" export CONWAY_POLYNOMIALS_DATA_DIR='${conway_polynomials}/share/conway_polynomials' export GRAPHS_DATA_DIR='${graphs}/share/graphs' export ELLCURVE_DATA_DIR='${elliptic_curves}/share/ellcurves' export POLYTOPE_DATA_DIR='${polytopes_db}/share/reflexive_polytopes' export GAP_ROOT_DIR='${gap}/share/gap/build-dir' - export ECLDIR='${ecl}/lib/ecl-${ecl.version}/' + export ECLDIR='${maxima.lisp-compiler}/lib/${maxima.lisp-compiler.pname}-${maxima.lisp-compiler.version}/' export COMBINATORIAL_DESIGN_DATA_DIR="${combinatorial_designs}/share/combinatorial_designs" export CREMONA_MINI_DATA_DIR="${elliptic_curves}/share/cremona" export JMOL_DIR="${jmol}/share/jmol" # point to the directory that contains JmolData.jar diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix index fd67076c97de..ae0b9f7453b5 100644 --- a/pkgs/applications/science/math/sage/sage-env.nix +++ b/pkgs/applications/science/math/sage/sage-env.nix @@ -15,8 +15,7 @@ , pkg-config , pari , gap -, ecl -, maxima-ecl +, maxima , singular , fflas-ffpack , givaro @@ -77,8 +76,8 @@ let pkg-config pari gap - ecl - maxima-ecl + maxima.lisp-compiler + maxima singular giac palp diff --git a/pkgs/applications/science/math/sage/sage-with-env.nix b/pkgs/applications/science/math/sage/sage-with-env.nix index f204d97961b6..b74ec4007e62 100644 --- a/pkgs/applications/science/math/sage/sage-with-env.nix +++ b/pkgs/applications/science/math/sage/sage-with-env.nix @@ -9,7 +9,7 @@ , singular , gap , giac -, maxima-ecl +, maxima , pari , gmp , gfan @@ -42,7 +42,7 @@ let pari gmp gfan - maxima-ecl + maxima eclib flintqs ntl diff --git a/pkgs/applications/science/math/sage/sagedoc.nix b/pkgs/applications/science/math/sage/sagedoc.nix index 76bbc90773b4..6016b3baeb48 100644 --- a/pkgs/applications/science/math/sage/sagedoc.nix +++ b/pkgs/applications/science/math/sage/sagedoc.nix @@ -1,7 +1,7 @@ { stdenv , sage-with-env , python3 -, maxima-ecl +, maxima , tachyon , jmol , cddlib @@ -18,7 +18,7 @@ stdenv.mkDerivation rec { buildInputs = [ sage-with-env.env.lib python3 - maxima-ecl + maxima tachyon jmol cddlib diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix index b9c98ed64d01..a884ad8899d4 100644 --- a/pkgs/applications/science/math/sage/sagelib.nix +++ b/pkgs/applications/science/math/sage/sagelib.nix @@ -10,7 +10,7 @@ , cypari2 , cysignals , cython -, ecl +, lisp-compiler , eclib , ecm , flint @@ -74,7 +74,7 @@ buildPythonPackage rec { jupyter_core pkg-config pip # needed to query installed packages - ecl + lisp-compiler ]; buildInputs = [ @@ -92,7 +92,7 @@ buildPythonPackage rec { arb brial cliquer - ecl + lisp-compiler eclib ecm fflas-ffpack diff --git a/pkgs/development/compilers/ecl/default.nix b/pkgs/development/compilers/ecl/default.nix index 5896e9488268..9d2ded48a377 100644 --- a/pkgs/development/compilers/ecl/default.nix +++ b/pkgs/development/compilers/ecl/default.nix @@ -28,7 +28,8 @@ let ]; in stdenv.mkDerivation { - inherit (s) name version; + inherit (s) version; + pname = s.baseName; inherit nativeBuildInputs propagatedBuildInputs; src = fetchurl { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 76ca8774dcfe..dcc51574d764 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31880,12 +31880,10 @@ with pkgs; }; maxima = callPackage ../applications/science/math/maxima { - ecl = null; + lisp-compiler = sbcl; }; maxima-ecl = maxima.override { - inherit ecl; - ecl-fasl = true; - sbcl = null; + lisp-compiler = ecl; }; mxnet = callPackage ../applications/science/math/mxnet {