summaryrefslogtreecommitdiffstats
path: root/makefu/5pkgs/jd-gui/default.nix
blob: adefd80dd9786c35ca6a2e979413983645765502 (plain)
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
{ stdenv, lib, pkgs, fetchurl, jre, makeWrapper, unzip }:
stdenv.mkDerivation rec {
  name = "${packageName}-${version}";
  packageName = "jd-gui";
  version  = "1.4.0";

  src = fetchurl {
    url = "https://github.com/java-decompiler/jd-gui/releases/download/v${version}/${name}.jar";
    sha256 = "0rvbplkhafb6s9aiwgcq4ffz4bvzyp7q511pd46hx4ahhzfg7lmx";
  };

  nativeBuildInputs = [ makeWrapper unzip ];

  phases = [ "installPhase" ];

  installPhase = ''
    f=$out/lib/jd-gui/
    bin=$out/bin
    name=$(basename $src)
    mkdir -p $f $bin

    # fixup path to java
    cp $src $f
    cat > $bin/jd-gui <<EOF
    #!/bin/sh
    exec ${pkgs.jre}/bin/java -jar $f/$name \$@
    EOF
    chmod +x $bin/jd-gui
  '';

  meta = {
    homepage = https://github.com/java-decompiler/jd-gui;
    description = "A standalone Java Decompiler GUI";
    license = lib.licenses.gpl3;
  };
}