about summary refs log tree commit diff
path: root/pkgs/applications/science/math/mathematica
diff options
context:
space:
mode:
authorOle Krüger <ole@kru.gr>2016-11-23 16:54:06 +0100
committerOle Krüger <ole@kru.gr>2016-11-25 12:13:41 +0100
commita31c37c75925c5c66aa43d175da6bd1c3ddde9f5 (patch)
treed23a233706539e5758f3bab53225fe0094d08301 /pkgs/applications/science/math/mathematica
parentea743a97f5043ee47ff39ece8cb8464c80e6a107 (diff)
downloadnixlib-a31c37c75925c5c66aa43d175da6bd1c3ddde9f5.tar
nixlib-a31c37c75925c5c66aa43d175da6bd1c3ddde9f5.tar.gz
nixlib-a31c37c75925c5c66aa43d175da6bd1c3ddde9f5.tar.bz2
nixlib-a31c37c75925c5c66aa43d175da6bd1c3ddde9f5.tar.lz
nixlib-a31c37c75925c5c66aa43d175da6bd1c3ddde9f5.tar.xz
nixlib-a31c37c75925c5c66aa43d175da6bd1c3ddde9f5.tar.zst
nixlib-a31c37c75925c5c66aa43d175da6bd1c3ddde9f5.zip
[mathematica] 10.0.2 -> 11.0.1
Diffstat (limited to 'pkgs/applications/science/math/mathematica')
-rw-r--r--pkgs/applications/science/math/mathematica/10.nix138
-rw-r--r--pkgs/applications/science/math/mathematica/default.nix7
2 files changed, 142 insertions, 3 deletions
diff --git a/pkgs/applications/science/math/mathematica/10.nix b/pkgs/applications/science/math/mathematica/10.nix
new file mode 100644
index 000000000000..4de4a0c261d5
--- /dev/null
+++ b/pkgs/applications/science/math/mathematica/10.nix
@@ -0,0 +1,138 @@
+{ stdenv
+, coreutils
+, patchelf
+, requireFile
+, alsaLib
+, fontconfig
+, freetype
+, gcc
+, glib
+, libpng
+, ncurses
+, opencv
+, openssl
+, unixODBC
+, xorg
+, zlib
+, libxml2
+, libuuid
+}:
+
+let
+  platform =
+    if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then
+      "Linux"
+    else
+      throw "Mathematica requires i686-linux or x86_64 linux";
+in
+stdenv.mkDerivation rec {
+  version = "10.0.2";
+
+  name = "mathematica-${version}";
+
+  src = requireFile rec {
+    name = "Mathematica_${version}_LINUX.sh";
+    message = '' 
+      This nix expression requires that ${name} is
+      already part of the store. Find the file on your Mathematica CD
+      and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
+    '';
+    sha256 = "1d2yaiaikzcacjamlw64g3xkk81m3pb4vz4an12cv8nb7kb20x9l";
+  };
+
+  buildInputs = [
+    coreutils
+    patchelf
+    alsaLib
+    coreutils
+    fontconfig
+    freetype
+    gcc.cc
+    gcc.libc
+    glib
+    ncurses
+    opencv
+    openssl
+    unixODBC
+    libxml2
+    libuuid
+  ] ++ (with xorg; [
+    libX11
+    libXext
+    libXtst
+    libXi
+    libXmu
+    libXrender
+    libxcb
+    libXcursor
+    libXfixes
+    libXrandr
+    libICE
+    libSM
+  ]);
+
+  ldpath = stdenv.lib.makeLibraryPath buildInputs
+    + stdenv.lib.optionalString (stdenv.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
+
+    echo "=== Running MathInstaller ==="
+    ./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -platforms=${platform} -silent
+  '';
+
+  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/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix
index 4de4a0c261d5..1a9adcd4782f 100644
--- a/pkgs/applications/science/math/mathematica/default.nix
+++ b/pkgs/applications/science/math/mathematica/default.nix
@@ -26,7 +26,7 @@ let
       throw "Mathematica requires i686-linux or x86_64 linux";
 in
 stdenv.mkDerivation rec {
-  version = "10.0.2";
+  version = "11.0.1";
 
   name = "mathematica-${version}";
 
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
       already part of the store. Find the file on your Mathematica CD
       and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
     '';
-    sha256 = "1d2yaiaikzcacjamlw64g3xkk81m3pb4vz4an12cv8nb7kb20x9l";
+    sha256 = "1qqwz8gbw74rnnyirpbdanwx3d25s4x0i4zc7bs6kp959x66cdkw";
   };
 
   buildInputs = [
@@ -89,9 +89,10 @@ stdenv.mkDerivation rec {
     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 -platforms=${platform} -silent
+    ./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent
   '';
 
   preFixup = ''