summary refs log tree commit diff
path: root/pkgs/development/tools/java/cfr/default.nix
blob: a7be59a1fea18d20a8f4aa8d9350eb7c537e778a (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
{ stdenv, fetchurl, jre }:

let version = "0_101"; in
stdenv.mkDerivation rec {
  name = "cfr-${version}";

  src = fetchurl {
    sha256 = "0zwl3whypdm2qrw3hwaqjnifkb4wcdn8fx9scrjkli54bhr6dqch";
    url = "http://www.benf.org/other/cfr/cfr_${version}.jar";
  };

  meta = with stdenv.lib; {
    inherit version;
    description = "Another java decompiler";
    longDescription = ''
      CFR will decompile modern Java features - Java 8 lambdas (pre and post
      Java beta 103 changes), Java 7 String switches etc, but is written
      entirely in Java 6.
    '';
    homepage = http://www.benf.org/other/cfr/;
    license = with licenses; mit;
    platforms = with platforms; all;
    maintainers = with maintainers; [ nckx ];
  };

  buildInputs = [ jre ];

  phases = [ "installPhase" ];

  installPhase = ''
    jar=$out/share/cfr/cfr_${version}.jar

    install -Dm644 ${src} $jar

    cat << EOF > cfr
    #!${stdenv.shell}
    exec ${jre}/bin/java -jar $jar "\''${@}"
    EOF
    install -Dm755 cfr $out/bin/cfr
  '';
}