2013-09-15 13:22:27 +01:00
|
|
|
{ stdenv
|
|
|
|
, coreutils
|
|
|
|
, patchelf
|
2019-07-23 21:23:00 +01:00
|
|
|
, requireFile
|
2018-01-17 16:50:24 +00:00
|
|
|
, callPackage
|
2013-09-15 13:22:27 +01:00
|
|
|
, alsaLib
|
2017-10-05 01:14:53 +01:00
|
|
|
, dbus
|
2013-09-15 13:22:27 +01:00
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, gcc
|
|
|
|
, glib
|
2020-03-29 13:03:53 +01:00
|
|
|
, libssh2
|
2013-09-15 13:22:27 +01:00
|
|
|
, ncurses
|
2020-05-05 11:48:55 +01:00
|
|
|
, opencv2
|
2013-09-15 13:22:27 +01:00
|
|
|
, openssl
|
|
|
|
, unixODBC
|
2017-10-05 01:14:53 +01:00
|
|
|
, xkeyboard_config
|
2015-09-15 10:26:18 +01:00
|
|
|
, xorg
|
2013-09-15 13:22:27 +01:00
|
|
|
, zlib
|
2014-09-17 22:25:10 +01:00
|
|
|
, libxml2
|
|
|
|
, libuuid
|
2018-01-17 16:50:24 +00:00
|
|
|
, lang ? "en"
|
2018-05-04 12:02:02 +01:00
|
|
|
, libGL
|
|
|
|
, libGLU
|
2013-09-15 13:22:27 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-01-17 16:50:24 +00:00
|
|
|
l10n =
|
2019-07-23 21:23:00 +01:00
|
|
|
import ./l10ns.nix {
|
|
|
|
lib = stdenv.lib;
|
|
|
|
inherit requireFile lang;
|
|
|
|
};
|
2013-09-15 13:22:27 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2018-01-17 16:50:24 +00:00
|
|
|
inherit (l10n) version name src;
|
2013-09-15 13:22:27 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
coreutils
|
|
|
|
patchelf
|
|
|
|
alsaLib
|
|
|
|
coreutils
|
2017-10-05 01:14:53 +01:00
|
|
|
dbus
|
2013-09-15 13:22:27 +01:00
|
|
|
fontconfig
|
|
|
|
freetype
|
2015-01-15 04:44:00 +00:00
|
|
|
gcc.cc
|
2013-09-15 13:22:27 +01:00
|
|
|
gcc.libc
|
|
|
|
glib
|
2020-03-29 13:03:53 +01:00
|
|
|
libssh2
|
2013-09-15 13:22:27 +01:00
|
|
|
ncurses
|
2020-05-05 11:48:55 +01:00
|
|
|
opencv2
|
2013-09-15 13:22:27 +01:00
|
|
|
openssl
|
2020-03-29 13:03:53 +01:00
|
|
|
stdenv.cc.cc.lib
|
2013-09-15 13:22:27 +01:00
|
|
|
unixODBC
|
2017-10-05 01:14:53 +01:00
|
|
|
xkeyboard_config
|
2014-09-17 22:25:10 +01:00
|
|
|
libxml2
|
|
|
|
libuuid
|
2017-07-17 04:32:16 +01:00
|
|
|
zlib
|
2018-05-04 12:02:02 +01:00
|
|
|
libGL
|
|
|
|
libGLU
|
2015-09-15 10:26:18 +01:00
|
|
|
] ++ (with xorg; [
|
2013-09-15 13:22:27 +01:00
|
|
|
libX11
|
|
|
|
libXext
|
|
|
|
libXtst
|
|
|
|
libXi
|
|
|
|
libXmu
|
|
|
|
libXrender
|
|
|
|
libxcb
|
2014-09-17 22:25:10 +01:00
|
|
|
libXcursor
|
|
|
|
libXfixes
|
|
|
|
libXrandr
|
|
|
|
libICE
|
|
|
|
libSM
|
2013-09-15 13:22:27 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
ldpath = stdenv.lib.makeLibraryPath buildInputs
|
2018-08-20 20:11:29 +01:00
|
|
|
+ stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
|
2016-04-14 16:14:28 +01:00
|
|
|
(":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
|
2013-09-15 13:22:27 +01:00
|
|
|
|
|
|
|
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
|
2016-11-23 15:54:06 +00:00
|
|
|
sed -i -e 's/\/bin\/bash/\/bin\/sh/' MathInstaller
|
2013-09-15 13:22:27 +01:00
|
|
|
|
|
|
|
echo "=== Running MathInstaller ==="
|
2016-11-23 15:54:06 +00:00
|
|
|
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent
|
2017-07-17 04:32:16 +01:00
|
|
|
|
|
|
|
# Fix library paths
|
|
|
|
cd $out/libexec/Mathematica/Executables
|
2017-07-19 09:39:36 +01:00
|
|
|
for path in mathematica MathKernel Mathematica WolframKernel wolfram math; do
|
2020-03-29 13:03:53 +01:00
|
|
|
sed -i -e "2iexport LD_LIBRARY_PATH=${zlib}/lib:${stdenv.cc.cc.lib}/lib:${libssh2}/lib:\''${LD_LIBRARY_PATH}\n" $path
|
2017-07-17 04:32:16 +01:00
|
|
|
done
|
2017-10-05 01:14:53 +01:00
|
|
|
|
|
|
|
# Fix xkeyboard config path for Qt
|
|
|
|
for path in mathematica Mathematica; do
|
2019-07-23 21:23:00 +01:00
|
|
|
sed -i -e "2iexport QT_XKB_CONFIG_ROOT=\"${xkeyboard_config}/share/X11/xkb\"\n" $path
|
2017-10-05 01:14:53 +01:00
|
|
|
done
|
2019-11-14 22:19:30 +00:00
|
|
|
|
|
|
|
# Remove some broken libraries
|
2020-03-29 13:03:53 +01:00
|
|
|
rm -f $out/libexec/Mathematica/SystemFiles/Libraries/Linux-x86-64/libz.so*
|
2013-09-15 13:22:27 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
echo "=== PatchElfing away ==="
|
2015-11-30 20:07:26 +00:00
|
|
|
# This code should be a bit forgiving of errors, unfortunately
|
|
|
|
set +e
|
2015-09-06 09:21:43 +01:00
|
|
|
find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
|
2013-09-15 13:22:27 +01:00
|
|
|
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"
|
2014-09-17 22:25:10 +01:00
|
|
|
patchelf \
|
2014-12-17 18:11:30 +00:00
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
2014-09-17 22:25:10 +01:00
|
|
|
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
|
|
|
|
"$f" \
|
|
|
|
&& patchelf --shrink-rpath "$f" \
|
|
|
|
|| echo unable to patch ... ignoring 1>&2
|
2013-09-15 13:22:27 +01:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2019-07-23 21:23:00 +01:00
|
|
|
dontBuild = true;
|
|
|
|
|
2013-09-15 13:22:27 +01:00
|
|
|
# all binaries are already stripped
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
# we did this in prefixup already
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
2019-07-23 21:23:00 +01:00
|
|
|
meta = with stdenv.lib; {
|
2013-09-15 13:22:27 +01:00
|
|
|
description = "Wolfram Mathematica computational software system";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.wolfram.com/mathematica/";
|
2019-07-23 21:23:00 +01:00
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [ herberteuler ];
|
|
|
|
platforms = [ "x86_64-linux" ];
|
2013-09-15 13:22:27 +01:00
|
|
|
};
|
|
|
|
}
|