2014-01-06 16:42:37 +04:00
|
|
|
{ stdenv, fetchurl, unzip, ant, jdk, makeWrapper }:
|
2009-09-22 18:40:54 +04:00
|
|
|
|
|
|
|
let
|
2012-08-25 21:39:19 +04:00
|
|
|
version = "3.7.2";
|
|
|
|
date = "201202080800";
|
2009-09-22 18:40:54 +04:00
|
|
|
in
|
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "ecj-${version}";
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://eclipse.ialto.org/eclipse/downloads/drops/R-${version}-${date}/ecjsrc-${version}.jar";
|
|
|
|
sha256 = "0swyysbyfmv068x8q1c5jqpwk5zb4xahg17aypx5rwb660f8fpbm";
|
|
|
|
};
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-06 16:42:37 +04:00
|
|
|
buildInputs = [ unzip ant jdk makeWrapper ];
|
2014-01-03 19:15:46 +04:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
mkdir "${name}"
|
|
|
|
cd "${name}"
|
|
|
|
unzip "$src"
|
|
|
|
'';
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
# Use whatever compiler Ant knows.
|
|
|
|
buildPhase = "ant build";
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
installPhase = ''
|
2014-01-06 16:42:37 +04:00
|
|
|
mkdir -pv $out/share/java
|
|
|
|
cp -v *.jar $out/share/java
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:24:37 +04:00
|
|
|
mkdir -pv $out/bin
|
2014-01-06 16:42:37 +04:00
|
|
|
makeWrapper ${jdk.jre}/bin/java $out/bin/ecj \
|
|
|
|
--add-flags "-cp $out/share/java/ecj.jar org.eclipse.jdt.internal.compiler.batch.Main"
|
2014-01-06 17:22:33 +04:00
|
|
|
|
|
|
|
# Add a setup hook that causes Ant to use the ECJ.
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
cat <<EOF > $out/nix-support/setup-hook
|
|
|
|
export NIX_ANT_ARGS="-Dbuild.compiler=org.eclipse.jdt.core.JDTCompilerAdapter \$NIX_ANT_ARGS"
|
|
|
|
EOF
|
2014-01-03 19:15:46 +04:00
|
|
|
'';
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
meta = {
|
|
|
|
description = "The Eclipse Compiler for Java (ECJ)";
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
longDescription = ''
|
|
|
|
ECJ is an incremental Java compiler. Implemented as an Eclipse
|
|
|
|
builder, it is based on technology evolved from VisualAge for Java
|
|
|
|
compiler. In particular, it allows users to run and debug code which
|
|
|
|
still contains unresolved errors.
|
|
|
|
'';
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
homepage = http://www.eclipse.org/jdt/core/index.php;
|
2009-09-22 18:40:54 +04:00
|
|
|
|
2014-01-03 19:15:46 +04:00
|
|
|
# http://www.eclipse.org/legal/epl-v10.html (free software, copyleft)
|
2014-11-06 03:44:33 +03:00
|
|
|
license = stdenv.lib.licenses.epl10;
|
2014-01-03 19:24:37 +04:00
|
|
|
|
2014-07-15 13:51:27 +04:00
|
|
|
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
|
2014-01-03 19:15:46 +04:00
|
|
|
};
|
|
|
|
}
|