about summary refs log tree commit diff
path: root/pkgs/development/eclipse/ecj
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-06 13:42:37 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-06 14:36:14 +0100
commit5d6259a9739d03f6ae2751b342689c877e7209df (patch)
tree9f051e9ee23a6de43a137799c5ebdd49081219ed /pkgs/development/eclipse/ecj
parente36427fd4e7f33360bbbcd85d8cf276664c277b1 (diff)
downloadnixlib-5d6259a9739d03f6ae2751b342689c877e7209df.tar
nixlib-5d6259a9739d03f6ae2751b342689c877e7209df.tar.gz
nixlib-5d6259a9739d03f6ae2751b342689c877e7209df.tar.bz2
nixlib-5d6259a9739d03f6ae2751b342689c877e7209df.tar.lz
nixlib-5d6259a9739d03f6ae2751b342689c877e7209df.tar.xz
nixlib-5d6259a9739d03f6ae2751b342689c877e7209df.tar.zst
nixlib-5d6259a9739d03f6ae2751b342689c877e7209df.zip
Add a setup hook that automatically sets up $CLASSPATH
All JARs in $pkg/share/java (for each $pkg in the build inputs) are
added to $CLASSPATH.  Thus, you can say

  buildInputs = [ setJavaClassPath someJavaDependency ];

and the JARs in someJavaDependency will be found automatically by
tools like javac or ant.

Note that the manual used to say that JARs should be installed in
lib/java; this is now share/java, following the Debian policy:

  http://www.debian.org/doc/packaging-manuals/java-policy/x110.html

The directory share/java makes more sense because JARs are
architecture-independent.  (Also, a quick grep shows that we were not
exactly consistent about this in Nixpkgs.)
Diffstat (limited to 'pkgs/development/eclipse/ecj')
-rw-r--r--pkgs/development/eclipse/ecj/default.nix16
1 files changed, 6 insertions, 10 deletions
diff --git a/pkgs/development/eclipse/ecj/default.nix b/pkgs/development/eclipse/ecj/default.nix
index 7b3940cc2e1e..432bdc72b3c8 100644
--- a/pkgs/development/eclipse/ecj/default.nix
+++ b/pkgs/development/eclipse/ecj/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, ant, jdk }:
+{ stdenv, fetchurl, unzip, ant, jdk, makeWrapper }:
 
 let
   version = "3.7.2";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "0swyysbyfmv068x8q1c5jqpwk5zb4xahg17aypx5rwb660f8fpbm";
   };
 
-  buildInputs = [ unzip ant jdk ];
+  buildInputs = [ unzip ant jdk makeWrapper ];
 
   unpackPhase = ''
     mkdir "${name}"
@@ -25,16 +25,12 @@ stdenv.mkDerivation rec {
   buildPhase = "ant build";
 
   installPhase = ''
-    mkdir -pv $out/lib/java
-    cp -v *.jar $out/lib/java
+    mkdir -pv $out/share/java
+    cp -v *.jar $out/share/java
 
     mkdir -pv $out/bin
-    cat > $out/bin/ecj <<EOF
-    #! /bin/sh
-    exec ${jdk.jre}/bin/java -cp $out/lib/java/ecj.jar org.eclipse.jdt.internal.compiler.batch.Main "\$@"
-    EOF
-
-    chmod u+x $out/bin/ecj
+    makeWrapper ${jdk.jre}/bin/java $out/bin/ecj \
+      --add-flags "-cp $out/share/java/ecj.jar org.eclipse.jdt.internal.compiler.batch.Main"
   '';
 
   meta = {