about summary refs log tree commit diff
path: root/pkgs/applications/misc/calcoo/default.nix
blob: b0fc6da5eb4653fc0c5cad42e2097208da05f464 (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
{ lib
, stdenv
, fetchzip
, ant
, jdk
, makeWrapper
}:

stdenv.mkDerivation rec {
  pname = "calcoo";
  version = "2.1.0";

  src = fetchzip {
    url = "mirror://sourceforge/project/calcoo/calcoo/${version}/${pname}-${version}.zip";
    hash = "sha256-Bdavj7RaI5CkWiOJY+TPRIRfNelfW5qdl/74J1KZPI0=";
  };

  patches = [
    # Sets javac encoding option on build.xml
    ./0001-javac-encoding.diff
  ];

  nativeBuildInputs = [
    ant
    jdk
    makeWrapper
  ];

  dontConfigure = true;

  buildPhase = ''
    runHook preBuild

    ant

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/share/${pname}
    mv dist/lib/calcoo.jar $out/share/${pname}

    makeWrapper ${jdk}/bin/java $out/bin/calcoo \
    --add-flags "-jar $out/share/${pname}/calcoo.jar"

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://calcoo.sourceforge.net/";
    description = "RPN and algebraic scientific calculator";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ AndersonTorres ];
    inherit (jdk.meta) platforms;
  };
}