2014-09-16 03:25:14 +01:00
|
|
|
{ fetchurl, stdenv, coreutils, makeWrapper }:
|
2004-07-10 17:17:48 +01:00
|
|
|
|
2020-11-04 21:07:36 +00:00
|
|
|
let version = "1.10.9"; in
|
2008-04-11 22:32:00 +01:00
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
stdenv.mkDerivation {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "ant";
|
|
|
|
inherit version;
|
2014-01-03 12:29:06 +00:00
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
|
2020-11-04 21:07:36 +00:00
|
|
|
sha256 = "1ab8ybczvk12501dnj450a3d4v43ca0pjhk33s175hax46s58z47";
|
2012-06-13 15:11:52 +01:00
|
|
|
};
|
2008-04-11 22:32:00 +01:00
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
contrib = fetchurl {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2";
|
2020-08-16 16:19:35 +01:00
|
|
|
sha256 = "1l8say86bz9gxp4yy777z7nm4j6m905pg342li1aphc14p5grvwn";
|
2014-01-03 12:29:06 +00:00
|
|
|
};
|
2008-04-11 22:32:00 +01:00
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
installPhase =
|
|
|
|
''
|
|
|
|
mkdir -p $out/bin $out/lib/ant
|
|
|
|
mv * $out/lib/ant/
|
2004-07-10 17:17:48 +01:00
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
# Get rid of the manual (35 MiB). Maybe we should put this in a
|
2016-02-18 14:57:15 +00:00
|
|
|
# separate output. Keep the antRun script since it's vanilla sh
|
|
|
|
# and needed for the <exec/> task (but since we set ANT_HOME to
|
|
|
|
# a weird value, we have to move antRun to a weird location).
|
|
|
|
# Get rid of the other Ant scripts since we provide our own.
|
|
|
|
mv $out/lib/ant/bin/antRun $out/bin/
|
2014-01-03 12:29:06 +00:00
|
|
|
rm -rf $out/lib/ant/{manual,bin,WHATSNEW}
|
2016-02-18 14:57:15 +00:00
|
|
|
mkdir $out/lib/ant/bin
|
|
|
|
mv $out/bin/antRun $out/lib/ant/bin/
|
2012-06-13 15:11:52 +01:00
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
# Install ant-contrib.
|
|
|
|
unpackFile $contrib
|
|
|
|
cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
|
2012-06-13 15:11:52 +01:00
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
cat >> $out/bin/ant <<EOF
|
|
|
|
#! ${stdenv.shell} -e
|
2012-06-13 15:11:52 +01:00
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
ANT_HOME=$out/lib/ant
|
|
|
|
|
2014-01-09 10:14:36 +00: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.
|
2019-11-01 19:30:09 +00:00
|
|
|
if [ -z "\''${JAVA_HOME-}" ]; then
|
2014-01-09 10:14:36 +00:00
|
|
|
for i in javac java gij; do
|
|
|
|
if p="\$(type -p \$i)"; then
|
2014-09-16 03:25:14 +01:00
|
|
|
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
|
2014-01-09 10:14:36 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2019-11-01 19:30:09 +00:00
|
|
|
if [ -z "\''${JAVA_HOME-}" ]; then
|
2014-01-09 10:14:36 +00:00
|
|
|
echo "\$0: cannot find the JDK or JRE" >&2
|
2014-01-03 12:29:06 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-01-09 10:14:36 +00: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"
|
|
|
|
|
|
|
|
exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
|
2014-01-03 12:29:06 +00: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 15:22:46 +01:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://ant.apache.org/";
|
2014-01-03 12:29:06 +00:00
|
|
|
description = "A Java-based build tool";
|
2014-01-09 12:06:51 +00:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Apache Ant is a Java-based build tool. In theory, it is kind of like
|
|
|
|
Make, but without Make's wrinkles.
|
|
|
|
|
|
|
|
Why another build tool when there is already make, gnumake, nmake, jam,
|
|
|
|
and others? Because all those tools have limitations that Ant's
|
|
|
|
original author couldn't live with when developing software across
|
|
|
|
multiple platforms. Make-like tools are inherently shell-based -- they
|
|
|
|
evaluate a set of dependencies, then execute commands not unlike what
|
|
|
|
you would issue in a shell. This means that you can easily extend
|
|
|
|
these tools by using or writing any program for the OS that you are
|
|
|
|
working on. However, this also means that you limit yourself to the
|
|
|
|
OS, or at least the OS type such as Unix, that you are working on.
|
|
|
|
|
|
|
|
Ant is different. Instead of a model where it is extended with
|
|
|
|
shell-based commands, Ant is extended using Java classes. Instead of
|
|
|
|
writing shell commands, the configuration files are XML-based, calling
|
|
|
|
out a target tree where various tasks get executed. Each task is run
|
|
|
|
by an object that implements a particular Task interface.
|
|
|
|
'';
|
|
|
|
|
2014-01-03 12:29:06 +00:00
|
|
|
license = stdenv.lib.licenses.asl20;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.eelco ];
|
2014-01-03 15:32:58 +00:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2013-10-05 15:22:46 +01:00
|
|
|
};
|
2004-07-10 17:17:48 +01:00
|
|
|
}
|