about summary refs log tree commit diff
path: root/pkgs/applications/science/math/mathematica
diff options
context:
space:
mode:
authorAristid Breitkreuz <aristidb@gmail.com>2014-09-17 23:25:10 +0200
committerAristid Breitkreuz <aristidb@gmail.com>2014-09-17 23:25:35 +0200
commit6fc7efa7b3529f6358ea7083f6d1782f20a5ad98 (patch)
tree45ea8063e570c33c81ff70bcf57d08e40e449ce3 /pkgs/applications/science/math/mathematica
parent55909ad36bf9a1d92a0031f3b0faf1bfcc15327e (diff)
downloadnixlib-6fc7efa7b3529f6358ea7083f6d1782f20a5ad98.tar
nixlib-6fc7efa7b3529f6358ea7083f6d1782f20a5ad98.tar.gz
nixlib-6fc7efa7b3529f6358ea7083f6d1782f20a5ad98.tar.bz2
nixlib-6fc7efa7b3529f6358ea7083f6d1782f20a5ad98.tar.lz
nixlib-6fc7efa7b3529f6358ea7083f6d1782f20a5ad98.tar.xz
nixlib-6fc7efa7b3529f6358ea7083f6d1782f20a5ad98.tar.zst
nixlib-6fc7efa7b3529f6358ea7083f6d1782f20a5ad98.zip
add mathematica 10 (slightly borked but runs)
Diffstat (limited to 'pkgs/applications/science/math/mathematica')
-rw-r--r--pkgs/applications/science/math/mathematica/9.nix124
-rw-r--r--pkgs/applications/science/math/mathematica/default.nix28
2 files changed, 144 insertions, 8 deletions
diff --git a/pkgs/applications/science/math/mathematica/9.nix b/pkgs/applications/science/math/mathematica/9.nix
new file mode 100644
index 000000000000..d4d352c95bbb
--- /dev/null
+++ b/pkgs/applications/science/math/mathematica/9.nix
@@ -0,0 +1,124 @@
+{ stdenv
+, coreutils
+, patchelf
+, requireFile
+, alsaLib
+, fontconfig
+, freetype
+, gcc
+, glib
+, libpng
+, ncurses
+, opencv
+, openssl
+, unixODBC
+, xlibs
+, zlib
+}:
+
+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 {
+
+  name = "mathematica-9.0.0";
+
+  src = requireFile rec {
+    name = "Mathematica_9.0.0_LINUX.sh";
+    message = '' 
+      This nix expression requires that Mathematica_9.0.0_LINUX.sh 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 = "106zfaplhwcfdl9rdgs25x83xra9zcny94gb22wncbfxvrsk3a4q";
+  };
+
+  buildInputs = [
+    coreutils
+    patchelf
+    alsaLib
+    coreutils
+    fontconfig
+    freetype
+    gcc.gcc
+    gcc.libc
+    glib
+    ncurses
+    opencv
+    openssl
+    unixODBC
+  ] ++ (with xlibs; [
+    libX11
+    libXext
+    libXtst
+    libXi
+    libXmu
+    libXrender
+    libxcb
+  ]);
+
+  ldpath = stdenv.lib.makeLibraryPath buildInputs
+    + stdenv.lib.optionalString (stdenv.system == "x86_64-linux")
+      (":" + stdenv.lib.makeSearchPath "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 ==="
+    find $out/libexec/Mathematica/SystemFiles -type f -perm +100 | 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 \
+            --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+            --set-rpath "${ldpath}" \
+            "$f"
+        patchelf --shrink-rpath "$f"
+      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 d4d352c95bbb..2f11144bad40 100644
--- a/pkgs/applications/science/math/mathematica/default.nix
+++ b/pkgs/applications/science/math/mathematica/default.nix
@@ -14,6 +14,8 @@
 , unixODBC
 , xlibs
 , zlib
+, libxml2
+, libuuid
 }:
 
 let
@@ -24,17 +26,18 @@ let
       throw "Mathematica requires i686-linux or x86_64 linux";
 in
 stdenv.mkDerivation rec {
+  version = "10.0.1";
 
-  name = "mathematica-9.0.0";
+  name = "mathematica-${version}";
 
   src = requireFile rec {
-    name = "Mathematica_9.0.0_LINUX.sh";
+    name = "Mathematica_${version}_LINUX.sh";
     message = '' 
-      This nix expression requires that Mathematica_9.0.0_LINUX.sh is
+      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 = "106zfaplhwcfdl9rdgs25x83xra9zcny94gb22wncbfxvrsk3a4q";
+    sha256 = "1514qy5kbyislv8j7ryw8021k26y0z6dndliwy8hfi7w7kgb3ynq";
   };
 
   buildInputs = [
@@ -51,6 +54,8 @@ stdenv.mkDerivation rec {
     opencv
     openssl
     unixODBC
+    libxml2
+    libuuid
   ] ++ (with xlibs; [
     libX11
     libXext
@@ -59,6 +64,11 @@ stdenv.mkDerivation rec {
     libXmu
     libXrender
     libxcb
+    libXcursor
+    libXfixes
+    libXrandr
+    libICE
+    libSM
   ]);
 
   ldpath = stdenv.lib.makeLibraryPath buildInputs
@@ -92,11 +102,13 @@ stdenv.mkDerivation rec {
         :
       elif [ "$type" == "EXEC" ]; then
         echo "patching $f executable <<"
-        patchelf \
-            --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
-            --set-rpath "${ldpath}" \
-            "$f"
         patchelf --shrink-rpath "$f"
+        patchelf \
+	  --set-interpreter "$(cat $NIX_GCC/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 \