about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/java/dex2jar/default.nix
blob: 97fa2298b051ccb0797ec9184ae6278abeb5a5fe (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
{ lib
, stdenvNoCC
, fetchurl
, jre
, makeWrapper
, unzip
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "dex2jar";
  version  = "2.1";

  src = fetchurl {
    url = "https://github.com/pxb1988/dex2jar/releases/download/v${finalAttrs.version}/dex2jar-${finalAttrs.version}.zip";
    hash = "sha256-epvfhD1D3k0elOwue29VglAXsMSn7jn/gmYOJJOkbwg=";
  };

  nativeBuildInputs = [ makeWrapper unzip ];

  postPatch = ''
    rm *.bat
    chmod +x *.sh
  '';

  installPhase = ''
    f=$out/share/dex2jar/

    mkdir -p $f $out/bin

    mv * $f
    for i in $f/*.sh; do
      n=$(basename ''${i%.sh})
      makeWrapper $i $out/bin/$n --prefix PATH : ${lib.makeBinPath [ jre ] }
    done
  '';

  meta = with lib; {
    homepage = "https://github.com/pxb1988/dex2jar";
    description = "Tools to work with android .dex and java .class files";
    maintainers = with maintainers; [ makefu ];
    sourceProvenance = with sourceTypes; [ binaryBytecode ];
    license = licenses.asl20;
    platforms = platforms.unix;
  };
})