about summary refs log tree commit diff
path: root/pkgs/applications/science/math
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/math')
-rw-r--r--pkgs/applications/science/math/eigenmath/default.nix39
-rw-r--r--pkgs/applications/science/math/glsurf/default.nix6
-rw-r--r--pkgs/applications/science/math/mathematica/versions.nix14
-rw-r--r--pkgs/applications/science/math/maxima/5.45.nix126
-rw-r--r--pkgs/applications/science/math/maxima/default.nix10
-rw-r--r--pkgs/applications/science/math/mxnet/default.nix2
-rw-r--r--pkgs/applications/science/math/qalculate-gtk/default.nix4
-rw-r--r--pkgs/applications/science/math/qalculate-qt/default.nix4
-rw-r--r--pkgs/applications/science/math/sage/default.nix2
-rw-r--r--pkgs/applications/science/math/scilab-bin/default.nix118
-rw-r--r--pkgs/applications/science/math/wxmaxima/default.nix4
11 files changed, 248 insertions, 81 deletions
diff --git a/pkgs/applications/science/math/eigenmath/default.nix b/pkgs/applications/science/math/eigenmath/default.nix
new file mode 100644
index 0000000000000..ddeba369366e5
--- /dev/null
+++ b/pkgs/applications/science/math/eigenmath/default.nix
@@ -0,0 +1,39 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+}:
+
+stdenv.mkDerivation rec {
+  pname = "eigenmath";
+  version = "unstable-2023-03-05";
+
+  src = fetchFromGitHub {
+    owner = "georgeweigt";
+    repo = pname;
+    rev = "633d5b0b2f2b87b6377bc4f715604f79b17aab66";
+    hash = "sha256-5LOSyfeGavWesAR7jqd37Z845iyNstr/cJdQiWHlIPg=";
+  };
+
+  patches = [
+    # treewide: use $(CC) instead of hardcoding gcc
+    # https://github.com/georgeweigt/eigenmath/pull/18
+    (fetchpatch {
+      url = "https://github.com/georgeweigt/eigenmath/commit/70551b3624ea25911f6de608c9ee9833885ab0b8.patch";
+      hash = "sha256-g2crXOlC5SM1vAq87Vg/2zWMvx9DPFWEPaTrrPbcDZ0=";
+    })
+  ];
+
+  installPhase = ''
+    runHook preInstall
+    install -Dm555 eigenmath "$out/bin/eigenmath"
+    runHook postInstall
+  '';
+
+  meta = with lib;{
+    description = "Computer algebra system written in C";
+    homepage = "https://georgeweigt.github.io";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ nickcao ];
+  };
+}
diff --git a/pkgs/applications/science/math/glsurf/default.nix b/pkgs/applications/science/math/glsurf/default.nix
index 808d89ef96361..ec3bb4c795b32 100644
--- a/pkgs/applications/science/math/glsurf/default.nix
+++ b/pkgs/applications/science/math/glsurf/default.nix
@@ -40,7 +40,8 @@ stdenv.mkDerivation rec {
   ] ++ (with ocamlPackages; [
     camlp4
     lablgl
-    camlimages_4_2_4
+    camlimages
+    num
   ]);
 
   postPatch = ''
@@ -48,6 +49,9 @@ stdenv.mkDerivation rec {
       substituteInPlace "$f" --replace "+camlp4" \
         "${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4"
     done
+
+    # Fatal error: exception Sys_error("Mutex.unlock: Operation not permitted")
+    sed -i "/gl_started/d" src/draw.ml* src/main.ml
   '';
 
   installPhase = ''
diff --git a/pkgs/applications/science/math/mathematica/versions.nix b/pkgs/applications/science/math/mathematica/versions.nix
index 09df9e13977e1..5fd879b133384 100644
--- a/pkgs/applications/science/math/mathematica/versions.nix
+++ b/pkgs/applications/science/math/mathematica/versions.nix
@@ -8,6 +8,20 @@
 
 let versions = [
   {
+    version = "13.2.1";
+    lang = "en";
+    language = "English";
+    sha256 = "sha256-GA2k+jvE4mTJsIbMHce5c516h/glHLnXdthEfnNmk0w=";
+    installer = "Mathematica_13.2.1_LINUX.sh";
+  }
+  {
+    version = "13.2.1";
+    lang = "en";
+    language = "English";
+    sha256 = "sha256-ZvgG2W/gjQIo4hyXHsGta5FyTslrz/ltOe/ZK/U2Sx8=";
+    installer = "Mathematica_13.2.1_BNDL_LINUX.sh";
+  }
+  {
     version = "13.2.0";
     lang = "en";
     language = "English";
diff --git a/pkgs/applications/science/math/maxima/5.45.nix b/pkgs/applications/science/math/maxima/5.45.nix
new file mode 100644
index 0000000000000..cdf5421ce19d0
--- /dev/null
+++ b/pkgs/applications/science/math/maxima/5.45.nix
@@ -0,0 +1,126 @@
+{ lib
+, stdenv
+, fetchurl
+, fetchpatch
+, texinfo
+, perl
+, python3
+, makeWrapper
+, autoreconfHook
+, rlwrap ? null
+, tk ? null
+, gnuplot ? null
+, lisp-compiler
+}:
+
+let
+  # 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";
+  # old version temporarily kept for sage due to
+  # https://github.com/sagemath/sage/issues/33718
+  version = "5.45.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "sha256-/pAWJ2lwvvIUoaJENIVYZEUU1/36pPyLnQ6Hr8u059w=";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    lisp-compiler
+    makeWrapper
+    python3
+    texinfo
+  ];
+
+  strictDeps = true;
+
+  nativeCheckInputs = [
+    gnuplot
+  ];
+
+  postPatch = ''
+    substituteInPlace doc/info/Makefile.am --replace "/usr/bin/env perl" "${perl}/bin/perl"
+  '';
+
+  postInstall = ''
+    # Make sure that maxima can find its runtime dependencies.
+    for prog in "$out/bin/"*; do
+      wrapProgram "$prog" --prefix PATH ":" "$out/bin:${searchPath}"
+    done
+    # Move emacs modules and documentation into the right place.
+    mkdir -p $out/share/emacs $out/share/doc
+    ln -s ../maxima/${version}/emacs $out/share/emacs/site-lisp
+    ln -s ../maxima/${version}/doc $out/share/doc/maxima
+  ''
+   + (lib.optionalString (lisp-compiler.pname == "ecl") ''
+     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";
+    })
+
+    # 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";
+    })
+
+    # undo https://sourceforge.net/p/maxima/code/ci/f5e9b0f7eb122c4e48ea9df144dd57221e5ea0ca
+    # 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";
+    })
+  ] ++ 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";
+      sha256 = "18zafig8vflhkr80jq2ivk46k92dkszqlyq8cfmj0b2vcfjwwbar";
+    })
+  ];
+
+  # The test suite is disabled since 5.42.2 because of the following issues:
+  #
+  #   Error(s) found:
+  #   /build/maxima-5.44.0/share/linearalgebra/rtest_matrixexp.mac problems:
+  #   (20 21 22)
+  #   Tests that were expected to fail but passed:
+  #   /build/maxima-5.44.0/share/vector/rtest_vect.mac problem:
+  #   (19)
+  #   3 tests failed out of 16,184 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
+
+  enableParallelBuilding = true;
+
+  passthru = {
+    inherit lisp-compiler;
+  };
+
+  meta = with lib; {
+    description = "Computer algebra system";
+    homepage = "http://maxima.sourceforge.net";
+    license = licenses.gpl2Plus;
+
+    longDescription = ''
+      Maxima is a fairly complete computer algebra system written in
+      lisp with an emphasis on symbolic computation. It is based on
+      DOE-MACSYMA and licensed under the GPL. Its abilities include
+      symbolic integration, 3D plotting, and an ODE solver.
+    '';
+    maintainers = with maintainers; [ doronbehar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/applications/science/math/maxima/default.nix b/pkgs/applications/science/math/maxima/default.nix
index dffc212176b30..9d1b5c09b8252 100644
--- a/pkgs/applications/science/math/maxima/default.nix
+++ b/pkgs/applications/science/math/maxima/default.nix
@@ -20,11 +20,11 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "maxima";
-  version = "5.45.1";
+  version = "5.46.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
-    sha256 = "sha256-/pAWJ2lwvvIUoaJENIVYZEUU1/36pPyLnQ6Hr8u059w=";
+    sha256 = "sha256-c5Dwa0jaZckDPosvYpuXi5AFZFSlQCLbfecOIiWqiwc=";
   };
 
   nativeBuildInputs = [
@@ -79,12 +79,6 @@ 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 (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";
-      sha256 = "18zafig8vflhkr80jq2ivk46k92dkszqlyq8cfmj0b2vcfjwwbar";
-    })
   ];
 
   # The test suite is disabled since 5.42.2 because of the following issues:
diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix
index c1a329c608864..240a1759397fe 100644
--- a/pkgs/applications/science/math/mxnet/default.nix
+++ b/pkgs/applications/science/math/mxnet/default.nix
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
       "-DUSE_OLDCMAKECUDA=ON"  # see https://github.com/apache/incubator-mxnet/issues/10743
       "-DCUDA_ARCH_NAME=All"
       "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
-      "-DMXNET_CUDA_ARCH=${builtins.concatStringsSep ";" cudaFlags.cudaRealArches}"
+      "-DMXNET_CUDA_ARCH=${builtins.concatStringsSep ";" cudaFlags.realArches}"
     ] else [ "-DUSE_CUDA=OFF" ])
     ++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";
 
diff --git a/pkgs/applications/science/math/qalculate-gtk/default.nix b/pkgs/applications/science/math/qalculate-gtk/default.nix
index dd1b7c301ae2d..0c82e7ebf376b 100644
--- a/pkgs/applications/science/math/qalculate-gtk/default.nix
+++ b/pkgs/applications/science/math/qalculate-gtk/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "qalculate-gtk";
-  version = "4.5.1";
+  version = "4.6.0";
 
   src = fetchFromGitHub {
     owner = "qalculate";
     repo = "qalculate-gtk";
     rev = "v${version}";
-    sha256 = "sha256-ilPz2W9pcbK5dnYl7Tuxf9p7ag/KmEufckooXBUcCk0=";
+    sha256 = "sha256-RdvoBs/QeBR032nMh79TLMGU6U7dsY6Ep+QKq4IKRTk=";
   };
 
   hardeningDisable = [ "format" ];
diff --git a/pkgs/applications/science/math/qalculate-qt/default.nix b/pkgs/applications/science/math/qalculate-qt/default.nix
index dbcacb36be6b9..e610297a90202 100644
--- a/pkgs/applications/science/math/qalculate-qt/default.nix
+++ b/pkgs/applications/science/math/qalculate-qt/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "qalculate-qt";
-  version = "4.5.1";
+  version = "4.6.0";
 
   src = fetchFromGitHub {
     owner = "qalculate";
     repo = "qalculate-qt";
     rev = "v${version}";
-    hash = "sha256-1MU/Wici+NQWbjoNpE9q6jKx8aKt85OAfb+ZsN/oK5w=";
+    hash = "sha256-/TDzjlB8rW/TorndcLbxY9pc3q7vY3M6eLxBRfnBs9Y=";
   };
 
   nativeBuildInputs = [ qmake intltool pkg-config wrapQtAppsHook ];
diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix
index eced57706d276..fa65ce0f36414 100644
--- a/pkgs/applications/science/math/sage/default.nix
+++ b/pkgs/applications/science/math/sage/default.nix
@@ -128,7 +128,7 @@ let
 
   singular = pkgs.singular.override { inherit flint; };
 
-  maxima = pkgs.maxima.override {
+  maxima = pkgs.maxima-ecl-5_45.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
diff --git a/pkgs/applications/science/math/scilab-bin/default.nix b/pkgs/applications/science/math/scilab-bin/default.nix
index 59e64bd0b8eff..f6da20531385b 100644
--- a/pkgs/applications/science/math/scilab-bin/default.nix
+++ b/pkgs/applications/science/math/scilab-bin/default.nix
@@ -1,4 +1,13 @@
-{ lib, stdenv, fetchurl, undmg, makeWrapper, xorg }:
+{ lib
+, stdenv
+, fetchurl
+, makeWrapper
+, undmg
+, autoPatchelfHook
+, alsa-lib
+, ncurses5
+, xorg
+}:
 
 let
   pname = "scilab-bin";
@@ -26,88 +35,69 @@ let
     platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
     license = lib.licenses.gpl2Only;
+    mainProgram = "scilab";
   };
 
   darwin = stdenv.mkDerivation rec {
     inherit pname version src meta;
 
-    nativeBuildInputs = [ undmg makeWrapper ];
+    nativeBuildInputs = [
+      makeWrapper
+      undmg
+    ];
 
     sourceRoot = "scilab-${version}.app";
 
     installPhase = ''
+      runHook preInstall
+
       mkdir -p $out/{Applications/scilab.app,bin}
       cp -R . $out/Applications/scilab.app
       makeWrapper $out/{Applications/scilab.app/Contents/MacOS,bin}/scilab
+
+      runHook postInstall
     '';
   };
 
   linux = stdenv.mkDerivation rec {
     inherit pname version src meta;
 
-  libPath = lib.makeLibraryPath [
-    stdenv.cc.cc
-    xorg.libX11
-    xorg.libXext
-    xorg.libXi
-    xorg.libXrender
-    xorg.libXtst
-    xorg.libXxf86vm
-  ];
-
-  fixupPhase = ''
-    sed -i 's|\$(/bin/|$(|g' bin/scilab
-    sed -i 's|/usr/bin/||g' bin/scilab
-
-    sci="$out/opt/scilab-${version}"
-    fullLibPath="$sci/lib/scilab:$sci/lib/thirdparty:$libPath"
-    fullLibPath="$fullLibPath:$sci/lib/thirdparty/redist"
-
-    patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
-             --set-rpath "$fullLibPath" bin/scilab-bin
-    find . -name '*.so' -type f | while read file; do
-      patchelf --set-rpath "$fullLibPath" "$file" 2>/dev/null
-    done
-  '';
-
-  installPhase = ''
-    mkdir -p "$out/opt/scilab-${version}"
-    cp -r . "$out/opt/scilab-${version}/"
-
-    # Create bin/ dir
-    mkdir "$out/bin"
-
-    # Creating executable symlinks
-    ln -s "$out/opt/scilab-${version}/bin/scilab" "$out/bin/scilab"
-    ln -s "$out/opt/scilab-${version}/bin/scilab-cli" "$out/bin/scilab-cli"
-    ln -s "$out/opt/scilab-${version}/bin/scilab-adv-cli" "$out/bin/scilab-adv-cli"
+    nativeBuildInputs = [
+      autoPatchelfHook
+    ];
+
+    buildInputs = [
+      alsa-lib
+      ncurses5
+      stdenv.cc.cc
+    ] ++ (with xorg; [
+      libX11
+      libXcursor
+      libXext
+      libXft
+      libXi
+      libXrandr
+      libXrender
+      libXtst
+      libXxf86vm
+    ]);
 
-    # Creating desktop config dir
-    mkdir -p "$out/share/applications"
-
-    # Moving desktop config files
-    mv $out/opt/scilab-${version}/share/applications/*.desktop $out/share/applications
-
-    # Fixing Exec paths and launching each app with a terminal
-    sed -i -e "s|Exec=|Exec=$out/opt/scilab-${version}/bin/|g" \
-           -e "s|Terminal=.*$|Terminal=true|g" $out/share/applications/*.desktop
-
-    # Moving icons to the appropriate locations
-    for path in $out/opt/scilab-${version}/share/icons/hicolor/*/*/*
-    do
-      newpath=$(echo $path | sed 's|/opt/scilab-${version}||g')
-      filename=$(echo $path | sed 's|.*/||g')
-      dir=$(echo $newpath | sed "s|$filename||g")
-      mkdir -p $dir
-      mv $path $newpath
-    done
-
-    # Removing emptied folders
-    rm -rf $out/opt/scilab-${version}/share/{applications,icons}
-
-    # Moving other share/ folders
-    mv $out/opt/scilab-${version}/share/{appdata,locale,mime} $out/share
-  '';
+    installPhase = ''
+      runHook preInstall
+
+      mkdir -p $out
+      mv -t $out bin include lib share thirdparty
+      sed -i \
+        -e 's|\$(/bin/|$(|g' \
+        -e 's|/usr/bin/||g' \
+        $out/bin/{scilab,xcos}
+      sed -i \
+        -e "s|Exec=|Exec=$out/bin/|g" \
+        -e "s|Terminal=.*$|Terminal=true|g" \
+        $out/share/applications/*.desktop
+
+      runHook postInstall
+    '';
   };
 in
 if stdenv.isDarwin then darwin else linux
diff --git a/pkgs/applications/science/math/wxmaxima/default.nix b/pkgs/applications/science/math/wxmaxima/default.nix
index 205fe3ebed5de..ee2f62317c0cd 100644
--- a/pkgs/applications/science/math/wxmaxima/default.nix
+++ b/pkgs/applications/science/math/wxmaxima/default.nix
@@ -12,13 +12,13 @@
 
 stdenv.mkDerivation rec {
   pname = "wxmaxima";
-  version = "22.12.0";
+  version = "23.02.1";
 
   src = fetchFromGitHub {
     owner = "wxMaxima-developers";
     repo = "wxmaxima";
     rev = "Version-${version}";
-    sha256 = "sha256-RT6y4M6LQD1fXJcjtdSXnDmoJvv160g2asdV4WtTcok=";
+    sha256 = "sha256-Lrj/oJNmKlCkNbnCGY2TewCospwajKdWgmKkreHzEIU=";
   };
 
   buildInputs = [