about summary refs log tree commit diff
path: root/pkgs/applications/science/math/yacas/default.nix
blob: f7dc2a344e1851eb5a6e4ba7e6c1d7e2546e3081 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, perl
, enableGui ? false
, qtbase
, wrapQtAppsHook
, qtwebengine
, enableJupyter ? true
, boost
, jsoncpp
, openssl
, zmqpp
, enableJava ? false
, openjdk
, gtest
}:

stdenv.mkDerivation rec {
  pname = "yacas";
  version = "1.9.1";

  src = fetchFromGitHub {
    owner = "grzegorzmazur";
    repo = "yacas";
    rev = "v${version}";
    sha256 = "0dqgqvsb6ggr8jb3ngf0jwfkn6xwj2knhmvqyzx3amc74yd3ckqx";
  };

  hardeningDisable = [ "format" ];

  cmakeFlags = [
    "-DENABLE_CYACAS_GUI=${if enableGui then "ON" else "OFF"}"
    "-DENABLE_CYACAS_KERNEL=${if enableJupyter then "ON" else "OFF"}"
    "-DENABLE_JYACAS=${if enableJava then "ON" else "OFF"}"
    "-DENABLE_CYACAS_UNIT_TESTS=ON"
  ];
  patches = [
    # upstream issue: https://github.com/grzegorzmazur/yacas/issues/340
    # Upstream patch which doesn't apply on 1.9.1 is:
    # https://github.com/grzegorzmazur/yacas/pull/342
    ./jsoncpp-fix-include.patch
    # Fixes testing - https://github.com/grzegorzmazur/yacas/issues/339
    # PR: https://github.com/grzegorzmazur/yacas/pull/343
    (fetchpatch {
      url = "https://github.com/grzegorzmazur/yacas/commit/8bc22d517ecfdde3ac94800dc8506f5405564d48.patch";
      sha256 = "sha256-aPO5T8iYNkGtF8j12YxNJyUPJJPKrXje1DmfCPt317A=";
    })
  ];
  preCheck = ''
    patchShebangs ../tests/test-yacas
  '';
  checkInputs = [
    gtest
  ];
  doCheck = true;

  nativeBuildInputs = [
    cmake
    # Perl is only for the documentation
    perl
  ] ++ lib.optionals enableJava [
    openjdk
  ];
  buildInputs = [
  ] ++ lib.optionals enableGui [
    qtbase
    wrapQtAppsHook
    qtwebengine
  ] ++ lib.optionals enableJupyter [
    boost
    jsoncpp
    openssl
    zmqpp
  ];

  meta = {
    description = "Easy to use, general purpose Computer Algebra System${lib.optionalString enableGui ", built with GUI."}";
    homepage = "http://www.yacas.org/";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ viric ];
    platforms = with lib.platforms; linux;
  };
}