Merge pull request #189206 from wegank/scilab-bin-darwin

This commit is contained in:
Sandro 2022-09-16 10:59:26 +02:00 committed by GitHub
commit cba7f9e9ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,30 +1,49 @@
{ stdenv, fetchurl, lib, xorg }:
{ lib, stdenv, fetchurl, undmg, makeWrapper, xorg }:
let
badArch = throw "scilab-bin requires i686-linux or x86_64-linux";
architecture =
if stdenv.hostPlatform.system == "i686-linux" then
"i686"
else if stdenv.hostPlatform.system == "x86_64-linux" then
"x86_64"
else
badArch;
in
stdenv.mkDerivation rec {
pname = "scilab-bin";
version = "6.1.1";
src = fetchurl {
url = "https://www.scilab.org/download/${version}/scilab-${version}.bin.linux-${architecture}.tar.gz";
sha256 =
if stdenv.hostPlatform.system == "i686-linux" then
"0fgjc2ak3b2qi6yin3fy50qwk2bcj0zbz1h4lyyic9n1n1qcliib"
else if stdenv.hostPlatform.system == "x86_64-linux" then
"sha256-PuGnz2YdAhriavwnuf5Qyy0cnCeRHlWC6dQzfr7bLHk="
else
badArch;
srcs = {
aarch64-darwin = fetchurl {
url = "https://www.utc.fr/~mottelet/scilab/download/${version}/scilab-${version}-accelerate-arm64.dmg";
sha256 = "sha256-L4dxD8R8bY5nd+4oDs5Yk0LlNsFykLnAM+oN/O87SRI=";
};
x86_64-darwin = fetchurl {
url = "https://www.utc.fr/~mottelet/scilab/download/${version}/scilab-${version}-x86_64.dmg";
sha256 = "sha256-tBeqzllMuogrGcJxGqEl2DdNXaiwok3yhzWSdlWY5Fc=";
};
x86_64-linux = fetchurl {
url = "https://www.scilab.org/download/${version}/scilab-${version}.bin.linux-x86_64.tar.gz";
sha256 = "sha256-PuGnz2YdAhriavwnuf5Qyy0cnCeRHlWC6dQzfr7bLHk=";
};
};
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
meta = {
homepage = "http://www.scilab.org/";
description = "Scientific software package for numerical computations (Matlab lookalike)";
platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.gpl2Only;
};
darwin = stdenv.mkDerivation rec {
inherit pname version src meta;
nativeBuildInputs = [ undmg makeWrapper ];
sourceRoot = "scilab-${version}.app";
installPhase = ''
mkdir -p $out/{Applications/scilab.app,bin}
cp -R . $out/Applications/scilab.app
makeWrapper $out/{Applications/scilab.app/Contents/MacOS,bin}/scilab
'';
};
linux = stdenv.mkDerivation rec {
inherit pname version src meta;
libPath = lib.makeLibraryPath [
stdenv.cc.cc
@ -89,12 +108,6 @@ stdenv.mkDerivation rec {
# Moving other share/ folders
mv $out/opt/scilab-${version}/share/{appdata,locale,mime} $out/share
'';
meta = {
homepage = "http://www.scilab.org/";
description = "Scientific software package for numerical computations (Matlab lookalike)";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
# see http://www.scilab.org/legal_notice
license = "Scilab";
};
}
in
if stdenv.isDarwin then darwin else linux