diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-08-14 00:20:49 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-08-14 00:23:16 +0000 |
commit | 4999a38db7c5de0ea9f514a12ecd4133cce647f3 (patch) | |
tree | bbb659ab07fda4c9b98053499b7e3f046ac6d5dc /nixpkgs/pkgs/applications/science/math/mathematica | |
parent | f9abd30e11337cf07034f2cc8ad1691aa4a69386 (diff) | |
parent | 8746c77a383f5c76153c7a181f3616d273acfa2a (diff) | |
download | nixlib-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/mathematica')
3 files changed, 188 insertions, 15 deletions
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 |