2018-03-13 10:16:03 +00:00
|
|
|
{ stdenv, fetchurl, lib, xorg }:
|
2015-08-28 17:27:43 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
name = "scilab-bin-${ver}";
|
|
|
|
|
2019-07-20 16:33:18 +00:00
|
|
|
ver = "6.0.2";
|
2015-08-28 17:27:43 +00:00
|
|
|
|
|
|
|
badArch = throw "${name} requires i686-linux or x86_64-linux";
|
|
|
|
|
|
|
|
architecture =
|
2018-08-20 19:11:29 +00:00
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then
|
2015-08-28 17:27:43 +00:00
|
|
|
"i686"
|
2018-08-20 19:11:29 +00:00
|
|
|
else if stdenv.hostPlatform.system == "x86_64-linux" then
|
2015-08-28 17:27:43 +00:00
|
|
|
"x86_64"
|
|
|
|
else
|
|
|
|
badArch;
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit name;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 18:43:35 +00:00
|
|
|
url = "https://www.scilab.org/download/${ver}/scilab-${ver}.bin.linux-${architecture}.tar.gz";
|
2015-08-28 17:27:43 +00:00
|
|
|
sha256 =
|
2018-08-20 19:11:29 +00:00
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then
|
2018-08-05 08:27:35 +00:00
|
|
|
"0fgjc2ak3b2qi6yin3fy50qwk2bcj0zbz1h4lyyic9n1n1qcliib"
|
2018-08-20 19:11:29 +00:00
|
|
|
else if stdenv.hostPlatform.system == "x86_64-linux" then
|
2019-07-20 16:33:18 +00:00
|
|
|
"05clcdgry90drirl3swbxn5q36fmgknnhs6h5pr7mmrzfr6r818w"
|
2015-08-28 17:27:43 +00:00
|
|
|
else
|
|
|
|
badArch;
|
|
|
|
};
|
|
|
|
|
|
|
|
libPath = lib.makeLibraryPath [
|
|
|
|
stdenv.cc.cc
|
2018-03-13 10:16:03 +00:00
|
|
|
xorg.libX11
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXi
|
|
|
|
xorg.libXrender
|
|
|
|
xorg.libXtst
|
|
|
|
xorg.libXxf86vm
|
2015-08-28 17:27:43 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
phases = [ "unpackPhase" "fixupPhase" "installPhase" ];
|
|
|
|
|
|
|
|
fixupPhase = ''
|
|
|
|
sed -i 's|\$(/bin/|$(|g' bin/scilab
|
|
|
|
sed -i 's|/usr/bin/||g' bin/scilab
|
|
|
|
|
|
|
|
sci="$out/opt/scilab-${ver}"
|
|
|
|
fullLibPath="$sci/lib/scilab:$sci/lib/thirdparty:$libPath"
|
|
|
|
fullLibPath="$fullLibPath:$sci/lib/thirdparty/redist"
|
|
|
|
|
|
|
|
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
--set-rpath "$fullLibPath" bin/scilab-bin
|
|
|
|
find . -name '*.so' -type f | while read file; do
|
|
|
|
patchelf --set-rpath "$fullLibPath" "$file" 2>/dev/null
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/opt/scilab-${ver}"
|
|
|
|
cp -r . "$out/opt/scilab-${ver}/"
|
2018-12-02 07:53:40 +00:00
|
|
|
|
|
|
|
# Create bin/ dir
|
2015-08-28 17:27:43 +00:00
|
|
|
mkdir "$out/bin"
|
2018-12-02 07:53:40 +00:00
|
|
|
|
|
|
|
# Creating executable symlinks
|
2018-12-01 22:25:40 +00:00
|
|
|
ln -s "$out/opt/scilab-${ver}/bin/scilab" "$out/bin/scilab"
|
2018-12-02 07:53:40 +00:00
|
|
|
ln -s "$out/opt/scilab-${ver}/bin/scilab-cli" "$out/bin/scilab-cli"
|
|
|
|
ln -s "$out/opt/scilab-${ver}/bin/scilab-adv-cli" "$out/bin/scilab-adv-cli"
|
|
|
|
|
|
|
|
# Creating desktop config dir
|
|
|
|
mkdir -p "$out/share/applications"
|
|
|
|
|
|
|
|
# Moving desktop config files
|
|
|
|
mv $out/opt/scilab-${ver}/share/applications/*.desktop $out/share/applications
|
|
|
|
|
|
|
|
# Fixing Exec paths and launching each app with a terminal
|
|
|
|
sed -i -e "s|Exec=|Exec=$out/opt/scilab-${ver}/bin/|g" \
|
|
|
|
-e "s|Terminal=.*$|Terminal=true|g" $out/share/applications/*.desktop
|
|
|
|
|
|
|
|
# Moving icons to the appropriate locations
|
|
|
|
for path in $out/opt/scilab-${ver}/share/icons/hicolor/*/*/*
|
|
|
|
do
|
|
|
|
newpath=$(echo $path | sed 's|/opt/scilab-${ver}||g')
|
|
|
|
filename=$(echo $path | sed 's|.*/||g')
|
|
|
|
dir=$(echo $newpath | sed "s|$filename||g")
|
|
|
|
mkdir -p $dir
|
|
|
|
mv $path $newpath
|
|
|
|
done
|
|
|
|
|
|
|
|
# Removing emptied folders
|
|
|
|
rm -rf $out/opt/scilab-${ver}/share/{applications,icons}
|
|
|
|
|
|
|
|
# Moving other share/ folders
|
|
|
|
mv $out/opt/scilab-${ver}/share/{appdata,locale,mime} $out/share
|
2015-08-28 17:27:43 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = http://www.scilab.org/;
|
|
|
|
description = "Scientific software package for numerical computations (Matlab lookalike)";
|
|
|
|
# see http://www.scilab.org/legal_notice
|
|
|
|
license = "Scilab";
|
|
|
|
};
|
|
|
|
}
|