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

stdenv.mkDerivation (finalAttrs: {
  pname = "calcoo";
  version = "2.1.0";

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

  nativeBuildInputs = [
    ant
    canonicalize-jars-hook
    jdk
    makeWrapper
  ];

  dontConfigure = true;

  env.JAVA_TOOL_OPTIONS = "-Dfile.encoding=iso-8859-1";

  buildPhase = ''
    runHook preBuild
    ant
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -Dm644 dist/lib/calcoo.jar -t $out/share/calcoo

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

    runHook postInstall
  '';

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