2018-07-21 02:44:44 +02:00
|
|
|
{ stdenv, fetchurl, gradle_2_5, perl, makeWrapper, jre, makeDesktopItem, writeText }:
|
2014-06-17 21:20:54 +02:00
|
|
|
|
|
|
|
let
|
2018-06-26 18:48:07 +02:00
|
|
|
version = "1.4.0";
|
|
|
|
name = "jd-gui-${version}";
|
2014-06-17 21:20:54 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-26 18:48:07 +02:00
|
|
|
url = "https://github.com/java-decompiler/jd-gui/archive/v${version}.tar.gz";
|
|
|
|
sha256 = "0anz7szlr5kgmsmkyv34jdynsnk8v6kvibcyz98jsd96fh725lax";
|
2014-06-17 21:20:54 +02:00
|
|
|
};
|
|
|
|
|
2018-06-26 18:48:07 +02:00
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
name = "${name}-deps";
|
|
|
|
inherit src;
|
|
|
|
nativeBuildInputs = [ gradle_2_5 perl ];
|
2014-06-17 21:20:54 +02:00
|
|
|
|
2018-06-26 18:48:07 +02:00
|
|
|
buildPhase = ''
|
|
|
|
export GRADLE_USER_HOME=$(mktemp -d);
|
|
|
|
gradle --no-daemon build
|
|
|
|
'';
|
2017-07-04 20:13:50 +02:00
|
|
|
|
2018-06-26 18:48:07 +02:00
|
|
|
# Mavenize dependency paths
|
|
|
|
# e.g. org.codehaus.groovy/groovy/2.4.0/{hash}/groovy-2.4.0.jar -> org/codehaus/groovy/groovy/2.4.0/groovy-2.4.0.jar
|
|
|
|
installPhase = ''
|
|
|
|
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
|
|
|
|
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
|
|
|
| sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHash = "1apmqiphnav79m4rdii58h7f4qslpfig4qybyyl2fr7zk92gv3l9";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Point to our local deps repo
|
|
|
|
gradleInit = writeText "init.gradle" ''
|
|
|
|
logger.lifecycle 'Replacing Maven repositories with ${deps}...'
|
|
|
|
|
|
|
|
gradle.projectsLoaded {
|
|
|
|
rootProject.allprojects {
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
clear()
|
|
|
|
maven { url '${deps}' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
clear()
|
|
|
|
maven { url '${deps}' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItem = launcher: makeDesktopItem {
|
|
|
|
name = "jd-gui";
|
|
|
|
exec = "${launcher} %F";
|
|
|
|
icon = "jd-gui";
|
|
|
|
comment = "Java Decompiler JD-GUI";
|
|
|
|
desktopName = "JD-GUI";
|
|
|
|
genericName = "Java Decompiler";
|
|
|
|
mimeType = "application/x-java-archive;application/x-java";
|
|
|
|
categories = "Development;Debugger;";
|
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit name version src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ gradle_2_5 perl makeWrapper ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export GRADLE_USER_HOME=$(mktemp -d)
|
|
|
|
gradle --offline --no-daemon --info --init-script ${gradleInit} jar
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = let
|
|
|
|
jar = "$out/share/jd-gui/${name}.jar";
|
|
|
|
in ''
|
|
|
|
mkdir -p $out/bin $out/share/{jd-gui,icons/hicolor/128x128/apps}
|
|
|
|
cp build/libs/${name}.jar ${jar}
|
|
|
|
cp src/linux/resources/jd_icon_128.png $out/share/icons/hicolor/128x128/apps/jd-gui.png
|
|
|
|
|
|
|
|
cat > $out/bin/jd-gui <<EOF
|
|
|
|
#!${stdenv.shell}
|
|
|
|
export JAVA_HOME=${jre}
|
|
|
|
${jre}/bin/java -jar ${jar} $@
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/jd-gui
|
|
|
|
|
|
|
|
${(desktopItem "$out/bin/jd-gui").buildCommand}
|
2014-06-17 21:20:54 +02:00
|
|
|
'';
|
|
|
|
|
2017-08-11 11:40:08 +02:00
|
|
|
dontStrip = true;
|
|
|
|
|
2018-06-26 18:48:07 +02:00
|
|
|
meta = with stdenv.lib; {
|
2014-06-17 21:20:54 +02:00
|
|
|
description = "Fast Java Decompiler with powerful GUI";
|
|
|
|
homepage = "http://jd.benow.ca/";
|
2018-06-26 18:48:07 +02:00
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.thoughtpolice ];
|
2014-06-17 21:20:54 +02:00
|
|
|
};
|
|
|
|
}
|