about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-08-14 00:20:49 +0000
committerAlyssa Ross <hi@alyssa.is>2019-08-14 00:23:16 +0000
commit4999a38db7c5de0ea9f514a12ecd4133cce647f3 (patch)
treebbb659ab07fda4c9b98053499b7e3f046ac6d5dc /nixpkgs/pkgs/applications/science/math
parentf9abd30e11337cf07034f2cc8ad1691aa4a69386 (diff)
parent8746c77a383f5c76153c7a181f3616d273acfa2a (diff)
downloadnixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.gz
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.bz2
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.lz
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.xz
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.zst
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.zip
Merge commit '8746c77a383f5c76153c7a181f3616d273acfa2a'
Diffstat (limited to 'nixpkgs/pkgs/applications/science/math')
-rw-r--r--nixpkgs/pkgs/applications/science/math/caffe/default.nix20
-rw-r--r--nixpkgs/pkgs/applications/science/math/caffe/python.patch2
-rw-r--r--nixpkgs/pkgs/applications/science/math/gmsh/default.nix4
-rw-r--r--nixpkgs/pkgs/applications/science/math/mathematica/11.nix150
-rw-r--r--nixpkgs/pkgs/applications/science/math/mathematica/default.nix22
-rw-r--r--nixpkgs/pkgs/applications/science/math/mathematica/l10ns.nix31
-rw-r--r--nixpkgs/pkgs/applications/science/math/pari/gp2c.nix4
-rw-r--r--nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix4
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/patches/sympow-cache.patch21
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/sage-src.nix5
-rw-r--r--nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix4
11 files changed, 237 insertions, 30 deletions
diff --git a/nixpkgs/pkgs/applications/science/math/caffe/default.nix b/nixpkgs/pkgs/applications/science/math/caffe/default.nix
index 3367fa87422b..e8171bcb256a 100644
--- a/nixpkgs/pkgs/applications/science/math/caffe/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/caffe/default.nix
@@ -3,7 +3,7 @@
 , fetchurl
 , cmake
 , boost
-, google-gflags
+, gflags
 , glog
 , hdf5-cpp
 , opencv3
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
   cmakeFlags =
     # It's important that caffe is passed the major and minor version only because that's what
     # boost_python expects
-    [ (if pythonSupport then "-Dpython_version=3${python.pythonVersion}" else "-DBUILD_python=OFF")
+    [ (if pythonSupport then "-Dpython_version=${python.pythonVersion}" else "-DBUILD_python=OFF")
       "-DBLAS=open"
     ] ++ (if cudaSupport then [
            "-DCUDA_ARCH_NAME=All"
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
       ++ ["-DUSE_LEVELDB=${toggle leveldbSupport}"]
       ++ ["-DUSE_LMDB=${toggle lmdbSupport}"];
 
-  buildInputs = [ boost google-gflags glog protobuf hdf5-cpp opencv3 openblas ]
+  buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv3 openblas ]
                 ++ lib.optional cudaSupport cudatoolkit
                 ++ lib.optional cudnnSupport cudnn
                 ++ lib.optional lmdbSupport lmdb
@@ -73,9 +73,17 @@ stdenv.mkDerivation rec {
                 ++ lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreVideo ]
                 ;
 
-  propagatedBuildInputs = lib.optional pythonSupport python.pkgs.protobuf;
-
-  outputs = [ "bin" "out"];
+  propagatedBuildInputs = lib.optionals pythonSupport (
+    # requirements.txt
+    let pp = python.pkgs; in ([
+      pp.numpy pp.scipy pp.scikitimage pp.h5py
+      pp.matplotlib pp.ipython pp.networkx pp.nose
+      pp.pandas pp.dateutil pp.protobuf pp.gflags
+      pp.pyyaml pp.pillow pp.six
+    ] ++ lib.optional leveldbSupport pp.leveldb)
+  );
+
+  outputs = [ "bin" "out" ];
   propagatedBuildOutputs = []; # otherwise propagates out -> bin cycle
 
   patches = [
diff --git a/nixpkgs/pkgs/applications/science/math/caffe/python.patch b/nixpkgs/pkgs/applications/science/math/caffe/python.patch
index b1bed6c174b8..dac5071aa08c 100644
--- a/nixpkgs/pkgs/applications/science/math/caffe/python.patch
+++ b/nixpkgs/pkgs/applications/science/math/caffe/python.patch
@@ -64,7 +64,7 @@ index 4a5bac47..be026d43 100644
 -  if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)
 +  find_package(NumPy 1.7.1)
 +  find_package(Boost 1.46 REQUIRED COMPONENTS python@major@@minor@)
-+  if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND BOOST_PYTHON@major@@minor@_FOUND)
++  if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON@major@@minor@_FOUND)
      set(HAVE_PYTHON TRUE)
      if(BUILD_python_layer)
        list(APPEND Caffe_DEFINITIONS PRIVATE -DWITH_PYTHON_LAYER)
diff --git a/nixpkgs/pkgs/applications/science/math/gmsh/default.nix b/nixpkgs/pkgs/applications/science/math/gmsh/default.nix
index 1a3ba8096e29..fbdbac003dcd 100644
--- a/nixpkgs/pkgs/applications/science/math/gmsh/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/gmsh/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl, cmake, openblasCompat, gfortran, gmm, fltk, libjpeg
 , zlib, libGLU_combined, libGLU, xorg }:
 
-let version = "4.4.0"; in
+let version = "4.4.1"; in
 
 stdenv.mkDerivation {
   name = "gmsh-${version}";
 
   src = fetchurl {
     url = "http://gmsh.info/src/gmsh-${version}-source.tgz";
-    sha256 = "0b0h15cmi6zy31cii7r9jmfm9xksljff255dn6l9frhdjymkmx7l";
+    sha256 = "1p7hibmsgv961lfkzdxlgcvmcb0q155m2sp60r97cjsfzhw68g45";
   };
 
   buildInputs = [ openblasCompat gmm fltk libjpeg zlib libGLU_combined
diff --git a/nixpkgs/pkgs/applications/science/math/mathematica/11.nix b/nixpkgs/pkgs/applications/science/math/mathematica/11.nix
new file mode 100644
index 000000000000..521cb70099b9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/math/mathematica/11.nix
@@ -0,0 +1,150 @@
+{ stdenv
+, coreutils
+, patchelf
+, requireFile
+, callPackage
+, alsaLib
+, dbus
+, fontconfig
+, freetype
+, gcc
+, glib
+, ncurses
+, opencv
+, openssl
+, unixODBC
+, xkeyboard_config
+, xorg
+, zlib
+, libxml2
+, libuuid
+, lang ? "en"
+, libGL
+, libGLU
+}:
+
+let
+  l10n =
+    import ./l10ns.nix {
+      lib = stdenv.lib;
+      inherit requireFile lang;
+      majorVersion = "11";
+    };
+in
+stdenv.mkDerivation rec {
+  inherit (l10n) version name src;
+
+  buildInputs = [
+    coreutils
+    patchelf
+    alsaLib
+    coreutils
+    dbus
+    fontconfig
+    freetype
+    gcc.cc
+    gcc.libc
+    glib
+    ncurses
+    opencv
+    openssl
+    unixODBC
+    xkeyboard_config
+    libxml2
+    libuuid
+    zlib
+    libGL
+    libGLU
+  ] ++ (with xorg; [
+    libX11
+    libXext
+    libXtst
+    libXi
+    libXmu
+    libXrender
+    libxcb
+    libXcursor
+    libXfixes
+    libXrandr
+    libICE
+    libSM
+  ]);
+
+  ldpath = stdenv.lib.makeLibraryPath buildInputs
+    + stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
+      (":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
+
+  phases = "unpackPhase installPhase fixupPhase";
+
+  unpackPhase = ''
+    echo "=== Extracting makeself archive ==="
+    # find offset from file
+    offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
+    dd if="$src" ibs=$offset skip=1 | tar -xf -
+    cd Unix
+  '';
+
+  installPhase = ''
+    cd Installer
+    # don't restrict PATH, that has already been done
+    sed -i -e 's/^PATH=/# PATH=/' MathInstaller
+    sed -i -e 's/\/bin\/bash/\/bin\/sh/' MathInstaller
+
+    echo "=== Running MathInstaller ==="
+    ./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent
+
+    # Fix library paths
+    cd $out/libexec/Mathematica/Executables
+    for path in mathematica MathKernel Mathematica WolframKernel wolfram math; do
+      sed -i -e 's#export LD_LIBRARY_PATH$#export LD_LIBRARY_PATH=${zlib}/lib:\''${LD_LIBRARY_PATH}#' $path
+    done
+
+    # Fix xkeyboard config path for Qt
+    for path in mathematica Mathematica; do
+      line=$(grep -n QT_PLUGIN_PATH $path | sed 's/:.*//')
+      sed -i -e "$line iexport QT_XKB_CONFIG_ROOT=\"${xkeyboard_config}/share/X11/xkb\"" $path
+    done
+  '';
+
+  preFixup = ''
+    echo "=== PatchElfing away ==="
+    # This code should be a bit forgiving of errors, unfortunately
+    set +e
+    find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
+      type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
+      if [ -z "$type" ]; then
+        :
+      elif [ "$type" == "EXEC" ]; then
+        echo "patching $f executable <<"
+        patchelf --shrink-rpath "$f"
+        patchelf \
+	  --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+          --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
+          "$f" \
+          && patchelf --shrink-rpath "$f" \
+          || echo unable to patch ... ignoring 1>&2
+      elif [ "$type" == "DYN" ]; then
+        echo "patching $f library <<"
+        patchelf \
+          --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
+          "$f" \
+          && patchelf --shrink-rpath "$f" \
+          || echo unable to patch ... ignoring 1>&2
+      else
+        echo "not patching $f <<: unknown elf type"
+      fi
+    done
+  '';
+
+  # all binaries are already stripped
+  dontStrip = true;
+
+  # we did this in prefixup already
+  dontPatchELF = true;
+
+  meta = {
+    description = "Wolfram Mathematica computational software system";
+    homepage = http://www.wolfram.com/mathematica/;
+    license = stdenv.lib.licenses.unfree;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/science/math/mathematica/default.nix b/nixpkgs/pkgs/applications/science/math/mathematica/default.nix
index 165a56605579..ca9a87abe13b 100644
--- a/nixpkgs/pkgs/applications/science/math/mathematica/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/mathematica/default.nix
@@ -1,6 +1,7 @@
 { stdenv
 , coreutils
 , patchelf
+, requireFile
 , callPackage
 , alsaLib
 , dbus
@@ -24,10 +25,10 @@
 
 let
   l10n =
-    with stdenv.lib;
-    with callPackage ./l10ns.nix {};
-    flip (findFirst (l: l.lang == lang)) l10ns
-      (throw "Language '${lang}' not supported");
+    import ./l10ns.nix {
+      lib = stdenv.lib;
+      inherit requireFile lang;
+    };
 in
 stdenv.mkDerivation rec {
   inherit (l10n) version name src;
@@ -72,8 +73,6 @@ stdenv.mkDerivation rec {
     + stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
       (":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
 
-  phases = "unpackPhase installPhase fixupPhase";
-
   unpackPhase = ''
     echo "=== Extracting makeself archive ==="
     # find offset from file
@@ -99,8 +98,7 @@ stdenv.mkDerivation rec {
 
     # Fix xkeyboard config path for Qt
     for path in mathematica Mathematica; do
-      line=$(grep -n QT_PLUGIN_PATH $path | sed 's/:.*//')
-      sed -i -e "$line iexport QT_XKB_CONFIG_ROOT=\"${xkeyboard_config}/share/X11/xkb\"" $path
+      sed -i -e "2iexport QT_XKB_CONFIG_ROOT=\"${xkeyboard_config}/share/X11/xkb\"\n" $path
     done
   '';
 
@@ -134,15 +132,19 @@ stdenv.mkDerivation rec {
     done
   '';
 
+  dontBuild = true;
+
   # all binaries are already stripped
   dontStrip = true;
 
   # we did this in prefixup already
   dontPatchELF = true;
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Wolfram Mathematica computational software system";
     homepage = http://www.wolfram.com/mathematica/;
-    license = stdenv.lib.licenses.unfree;
+    license = licenses.unfree;
+    maintainers = with maintainers; [ herberteuler ];
+    platforms = [ "x86_64-linux" ];
   };
 }
diff --git a/nixpkgs/pkgs/applications/science/math/mathematica/l10ns.nix b/nixpkgs/pkgs/applications/science/math/mathematica/l10ns.nix
index 065360a112d8..51fb489be7ec 100644
--- a/nixpkgs/pkgs/applications/science/math/mathematica/l10ns.nix
+++ b/nixpkgs/pkgs/applications/science/math/mathematica/l10ns.nix
@@ -1,10 +1,19 @@
-{ lib, requireFile }:
+{ lib
+, requireFile
+, lang
+, majorVersion ? null
+}:
 
-with lib;
-{
-  l10ns = flip map
+let allVersions = with lib; flip map
+  # N.B. Versions in this list should be ordered from newest to oldest.
   [
     {
+      version = "12.0.0";
+      lang = "en";
+      language = "English";
+      sha256 = "b9fb71e1afcc1d72c200196ffa434512d208fa2920e207878433f504e58ae9d7";
+    }
+    {
       version = "11.3.0";
       lang = "en";
       language = "English";
@@ -30,4 +39,16 @@ with lib;
       inherit sha256;
     };
   });
-}
+minVersion =
+  with lib;
+  if majorVersion == null
+  then elemAt (builtins.splitVersion (elemAt allVersions 0).version) 0
+  else majorVersion;
+maxVersion = toString (1 + builtins.fromJSON minVersion);
+in
+with lib;
+findFirst (l: (l.lang == lang
+               && l.version >= minVersion
+               && l.version < maxVersion))
+          (throw "Version ${minVersion} in language ${lang} not supported")
+          allVersions
diff --git a/nixpkgs/pkgs/applications/science/math/pari/gp2c.nix b/nixpkgs/pkgs/applications/science/math/pari/gp2c.nix
index 4915e42025b5..86bd2e843678 100644
--- a/nixpkgs/pkgs/applications/science/math/pari/gp2c.nix
+++ b/nixpkgs/pkgs/applications/science/math/pari/gp2c.nix
@@ -4,11 +4,11 @@
 stdenv.mkDerivation rec {
 
   name = "gp2c-${version}";
-  version = "0.0.11pl1";
+  version = "0.0.11pl2";
 
   src = fetchurl {
     url = "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/${name}.tar.gz";
-    sha256 = "1c6f6vmncw032kfzrfyr8bynw6yd3faxpy2285r009fmr0zxfs5s";
+    sha256 = "0wqsf05wgkqvmmsx7jinvzdqav6rl56sr8haibgs31nzz4x9xz9g";
   };
 
   buildInputs = [ pari perl ];
diff --git a/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix b/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix
index 4da3a3f3d7bc..b4d82b9583c4 100644
--- a/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/qalculate-gtk/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "qalculate-gtk";
-  version = "3.2.0";
+  version = "3.3.0";
 
   src = fetchFromGitHub {
     owner = "qalculate";
     repo = "qalculate-gtk";
     rev = "v${version}";
-    sha256 = "1yhhfqcxi1b7dfrl8qh16l9iwgzvw1p0hhl7nnjpxhdwxz880sv0";
+    sha256 = "1z2d32dcvdd66114j3km58xfk80hc5rd0zrh2fgz1azv8r4cqq1b";
   };
 
   patchPhase = ''
diff --git a/nixpkgs/pkgs/applications/science/math/sage/patches/sympow-cache.patch b/nixpkgs/pkgs/applications/science/math/sage/patches/sympow-cache.patch
new file mode 100644
index 000000000000..20020d610f80
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/math/sage/patches/sympow-cache.patch
@@ -0,0 +1,21 @@
+diff --git a/src/sage/lfunctions/sympow.py b/src/sage/lfunctions/sympow.py
+index 1640ac4f6a..03578be7b8 100644
+--- a/src/sage/lfunctions/sympow.py
++++ b/src/sage/lfunctions/sympow.py
+@@ -50,6 +50,7 @@ from __future__ import print_function, absolute_import
+ 
+ import os
+ 
++from sage.env import DOT_SAGE
+ from sage.structure.sage_object import SageObject
+ from sage.misc.all import pager, verbose
+ import sage.rings.all
+@@ -76,7 +77,7 @@ class Sympow(SageObject):
+         """
+         Used to call sympow with given args
+         """
+-        cmd = 'sympow %s'%args
++        cmd = 'env SYMPOW_CACHEDIR="%s/sympow///" sympow %s' % (DOT_SAGE, args)
+         v = os.popen(cmd).read().strip()
+         verbose(v, level=2)
+         return v
diff --git a/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix b/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix
index 51460154c5de..04a2cde9ba99 100644
--- a/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix
+++ b/nixpkgs/pkgs/applications/science/math/sage/sage-src.nix
@@ -100,6 +100,11 @@ stdenv.mkDerivation rec {
       rev = "c11d9cfa23ff9f77681a8f12742f68143eed4504";
       sha256 = "0xzra7mbgqvahk9v45bjwir2mqz73hrhhy314jq5nxrb35ysdxyi";
     })
+
+    # After updating smypow to (https://trac.sagemath.org/ticket/3360) we can
+    # now set the cache dir to be withing the .sage directory. This is not
+    # strictly necessary, but keeps us from littering in the user's HOME.
+    ./patches/sympow-cache.patch
   ];
 
   patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
diff --git a/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix b/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix
index 262ee7d0d5da..21ce53e70c51 100644
--- a/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix
+++ b/nixpkgs/pkgs/applications/science/math/scilab-bin/default.nix
@@ -3,7 +3,7 @@
 let
   name = "scilab-bin-${ver}";
 
-  ver = "6.0.1";
+  ver = "6.0.2";
 
   badArch = throw "${name} requires i686-linux or x86_64-linux";
 
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
       if stdenv.hostPlatform.system == "i686-linux" then
         "0fgjc2ak3b2qi6yin3fy50qwk2bcj0zbz1h4lyyic9n1n1qcliib"
       else if stdenv.hostPlatform.system == "x86_64-linux" then
-        "1scswlznc14vyzg0gqa1q9gcpwx05kz1sbn563463mzkdp7nd35d"
+        "05clcdgry90drirl3swbxn5q36fmgknnhs6h5pr7mmrzfr6r818w"
       else
         badArch;
   };