wolfram-engine: init at 13.0.1

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Federico Beffa 2022-01-30 18:37:55 +01:00
parent 9bce1fb5ac
commit 2055f85304
3 changed files with 196 additions and 0 deletions

View file

@ -0,0 +1,143 @@
{ lib
, stdenv
, autoPatchelfHook
, requireFile
, callPackage
, makeWrapper
, alsa-lib
, dbus
, fontconfig
, freetype
, gcc
, glib
, installShellFiles
, libssh2
, ncurses
, opencv4
, openssl
, unixODBC
, xkeyboard_config
, xorg
, zlib
, libxml2
, libuuid
, lang ? "en"
, libGL
, libGLU
}:
let
l10n = import ./l10ns.nix {
lib = lib;
inherit requireFile lang;
};
dirName = "WolframEngine";
in
stdenv.mkDerivation rec {
inherit (l10n) version name src;
nativeBuildInputs = [
autoPatchelfHook
installShellFiles
makeWrapper
];
buildInputs = [
alsa-lib
dbus
fontconfig
freetype
gcc.cc
gcc.libc
glib
libssh2
ncurses
opencv4
openssl
stdenv.cc.cc.lib
unixODBC
xkeyboard_config
libxml2
libuuid
zlib
libGL
libGLU
] ++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
libXcursor
libXfixes
libXrandr
libICE
libSM
]);
# some bundled libs are found through LD_LIBRARY_PATH
autoPatchelfIgnoreMissingDeps = true;
ldpath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
unpackPhase = ''
# 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
sed -i -e 's/^PATH=/# PATH=/' -e 's/=`id -[ug]`/=0/' MathInstaller
# Installer wants to write default config in HOME
export HOME=$(mktemp -d)
# Fix the installation script
patchShebangs MathInstaller
substituteInPlace MathInstaller \
--replace "`hostname`" "" \
--replace "chgrp" "# chgrp" \
--replace "chown" ": # chown"
# Install the desktop items
export XDG_DATA_HOME="$out/share"
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/${dirName} -silent
# Fix library paths
cd $out/libexec/${dirName}/Executables
for path in MathKernel WolframKernel math mcc wolfram; do
makeWrapper $out/libexec/${dirName}/Executables/$path $out/bin/$path --set LD_LIBRARY_PATH "${zlib}/lib:${stdenv.cc.cc.lib}/lib:${libssh2}/lib:\''${LD_LIBRARY_PATH}"
done
# ... and xkeyboard config path for Qt
for path in WolframPlayer wolframplayer; do
makeWrapper $out/libexec/${dirName}/Executables/$path $out/bin/$path \
--set LD_LIBRARY_PATH "${zlib}/lib:${stdenv.cc.cc.lib}/lib:${libssh2}/lib:\''${LD_LIBRARY_PATH}" \
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb"
done
# Install man pages
installManPage $out/libexec/${dirName}/SystemFiles/SystemDocumentation/Unix/*
'';
# This is primarily an IO bound build; there's little benefit to building remotely.
preferLocalBuild = true;
# Stripping causes the program to core dump.
dontStrip = true;
meta = with lib; {
description = "Wolfram Engine computational software system";
homepage = "https://www.wolfram.com/engine/";
license = licenses.unfree;
maintainers = with maintainers; [ fbeffa ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,51 @@
{ lib
, requireFile
, lang
, majorVersion ? null
}:
let allVersions = with lib; flip map
# N.B. Versions in this list should be ordered from newest to oldest.
[
{
version = "13.0.1";
lang = "en";
language = "English";
sha256 = "1rrxi7d51m02407k719fq829jzanh550wr810i22n3irhk8axqga";
installer = "WolframEngine_13.0.1_LINUX.sh";
}
{
version = "13.0.0";
lang = "en";
language = "English";
sha256 = "10cpwllz9plxz22iqdh6xgkxqphl9s9nq8ax16pafjll6j9kqy1q";
installer = "WolframEngine_13.0.0_LINUX.sh";
}
]
({ version, lang, language, sha256, installer }: {
inherit version lang;
name = "wolfram-engine-${version}" + optionalString (lang != "en") "-${lang}";
src = requireFile {
name = installer;
message = ''
This nix expression requires that ${installer} is
already part of the store. Download the file from
https://www.wolfram.com/engine/ and add it to the nix store
with nix-store --add-fixed sha256 <FILE>.
'';
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

View file

@ -32635,6 +32635,8 @@ with pkgs;
trilinos-mpi = callPackage ../development/libraries/science/math/trilinos { withMPI = true; };
wolfram-engine = callPackage ../applications/science/math/wolfram-engine { };
ipopt = callPackage ../development/libraries/science/math/ipopt { };
gmsh = callPackage ../applications/science/math/gmsh { };