2014-01-03 13:29:06 +01:00
|
|
|
{ fetchurl, stdenv, makeWrapper }:
|
2004-07-10 18:17:48 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
let version = "1.9.3"; in
|
2008-04-11 23:32:00 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "ant-${version}";
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
|
|
|
|
sha1 = "efcf206e24b0dd1583c501182ad163af277951a4";
|
2012-06-13 16:11:52 +02:00
|
|
|
};
|
2008-04-11 23:32:00 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
contrib = fetchurl {
|
|
|
|
url = mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2;
|
|
|
|
sha256 = "96effcca2581c1ab42a4828c770b48d54852edf9e71cefc9ed2ffd6590571ad1";
|
|
|
|
};
|
2008-04-11 23:32:00 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
installPhase =
|
|
|
|
''
|
|
|
|
mkdir -p $out/bin $out/lib/ant
|
|
|
|
mv * $out/lib/ant/
|
2004-07-10 18:17:48 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
# Get rid of the manual (35 MiB). Maybe we should put this in a
|
|
|
|
# separate output. Also get rid of the Ant scripts since we
|
|
|
|
# provide our own.
|
|
|
|
rm -rf $out/lib/ant/{manual,bin,WHATSNEW}
|
2012-06-13 16:11:52 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
# Install ant-contrib.
|
|
|
|
unpackFile $contrib
|
|
|
|
cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
|
2012-06-13 16:11:52 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
cat >> $out/bin/ant <<EOF
|
|
|
|
#! ${stdenv.shell} -e
|
2012-06-13 16:11:52 +02:00
|
|
|
|
2014-01-03 13:29:06 +01:00
|
|
|
ANT_HOME=$out/lib/ant
|
|
|
|
|
2014-01-09 11:14:36 +01:00
|
|
|
# Find the JDK by looking for javac. As a fall-back, find the
|
|
|
|
# JRE by looking for java. The latter allows just the JRE to be
|
|
|
|
# used with (say) ECJ as the compiler. Finally, allow the GNU
|
|
|
|
# JVM.
|
2014-01-03 13:29:06 +01:00
|
|
|
if [ -z "\$JAVA_HOME" ]; then
|
2014-01-09 11:14:36 +01:00
|
|
|
for i in javac java gij; do
|
|
|
|
if p="\$(type -p \$i)"; then
|
|
|
|
export JAVA_HOME="\$(dirname \$(dirname \$(readlink -f \$p)))"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "\$JAVA_HOME" ]; then
|
|
|
|
echo "\$0: cannot find the JDK or JRE" >&2
|
2014-01-03 13:29:06 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-01-09 11:14:36 +01:00
|
|
|
if [ -z \$NIX_JVM ]; then
|
|
|
|
if [ -e \$JAVA_HOME/bin/java ]; then
|
|
|
|
NIX_JVM=\$JAVA_HOME/bin/java
|
|
|
|
elif [ -e \$JAVA_HOME/bin/gij ]; then
|
|
|
|
NIX_JVM=\$JAVA_HOME/bin/gij
|
|
|
|
else
|
|
|
|
NIX_JVM=java
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
|
|
|
|
|
|
|
|
if [ -e \$JAVA_HOME/lib/tools.jar ]; then
|
|
|
|
LOCALCLASSPATH="\$JAVA_HOME/lib/tools.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
|
|
|
|
fi
|
2014-01-03 13:29:06 +01:00
|
|
|
|
2014-01-09 11:14:36 +01:00
|
|
|
exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
|
2014-01-03 13:29:06 +01:00
|
|
|
-Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \
|
|
|
|
org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \
|
|
|
|
-cp "\$CLASSPATH" "\$@"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod +x $out/bin/ant
|
|
|
|
''; # */
|
2013-10-05 16:22:46 +02:00
|
|
|
|
|
|
|
meta = {
|
2014-01-03 13:29:06 +01:00
|
|
|
homepage = http://ant.apache.org/;
|
|
|
|
description = "A Java-based build tool";
|
|
|
|
license = stdenv.lib.licenses.asl20;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.eelco ];
|
2014-01-03 16:32:58 +01:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2013-10-05 16:22:46 +02:00
|
|
|
};
|
2004-07-10 18:17:48 +02:00
|
|
|
}
|