summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-09-16 10:59:26 +0200
committerGitHub <noreply@github.com>2022-09-16 10:59:26 +0200
commitcba7f9e9edeb3d7a4fd76c382ef540727b21e878 (patch)
tree115c5c12566a81aca6d5c4c7cdeb727857c94f63
parent55f4a5304a36447c8f803780559bf20343d68c43 (diff)
parent34456529c9dca679916279ab198da7d4a4fd45eb (diff)
Merge pull request #189206 from wegank/scilab-bin-darwin
-rw-r--r--pkgs/applications/science/math/scilab-bin/default.nix71
1 files changed, 42 insertions, 29 deletions
diff --git a/pkgs/applications/science/math/scilab-bin/default.nix b/pkgs/applications/science/math/scilab-bin/default.nix
index 327472e88c75..59e64bd0b8ef 100644
--- a/pkgs/applications/science/math/scilab-bin/default.nix
+++ b/pkgs/applications/science/math/scilab-bin/default.nix
@@ -1,31 +1,50 @@
-{ 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
xorg.libX11
@@ -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