ant: Update to 1.9.3

Also, Ant no longer has a build-time dependency on a particular JDK.
It finds the JDK via $JAVA_HOME or $PATH (by looking up javac).  This
way, we don't need to have separate packages like apacheAntOpenJDK and
apacheAntOracleJDK.  It also seems reasonable: after all, installing
GNU Make doesn't give you a C compiler either.  It does mean that
instead of

  buildInputs = [ ant ];

you now need to write something like

  buildInputs = [ ant jdk ];
This commit is contained in:
Eelco Dolstra 2014-01-03 13:29:06 +01:00
parent e1f7144aa8
commit 54d1721414
4 changed files with 53 additions and 93 deletions

View File

@ -1,17 +0,0 @@
args: with args;
stdenv.mkDerivation {
name = "ant-contrib-1.0b3";
installPhase = ''
mkdir -p $out
mv ant-contrib*.jar $out/
'';
phases = "unpackPhase installPhase";
src = fetchurl {
url = mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2;
sha256 = "96effcca2581c1ab42a4828c770b48d54852edf9e71cefc9ed2ffd6590571ad1";
};
}

View File

@ -1,53 +0,0 @@
source $stdenv/setup
tar jxf $src || exit 1
mkdir -p $out
mv apache-ant-*/* $out || exit 1
# add ant-contrib
cp $antContrib/*.jar $out/lib
# remove crap in the root directory
for file in $out/*
do
if test -f $file ; then
rm $file
fi
done
rm -rf $out/docs
# prevent the use of hacky scripts. This will be handled in Nix.
rm $out/bin/* || exit 1
# add ant script. This script is to be invoked with all
# appropiate variables and will try to be clever or user-friendly.
cat >> $out/bin/ant <<EOF
#! /bin/sh
export JAVA_HOME=$jdk
export JAVACMD=$jdk/bin/java
export LANG="en_US"
export ANT_HOME=$out
if [ -z "\$LOCALCLASSPATH" ] ; then
LOCALCLASSPATH=\$ANT_HOME/lib/ant-launcher.jar
else
LOCALCLASSPATH=\$ANT_HOME/lib/ant-launcher.jar:\$LOCALCLASSPATH
fi
if [ -n "\$JIKESPATH" ]; then
exec "\$JAVACMD" \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" -Dant.home="\${ANT_HOME}" -Djikes.class.path="\$JIKESPATH" org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS -lib "$CLASSPATH" "\$@"
else
exec "\$JAVACMD" \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" -Dant.home="\${ANT_HOME}" org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS -lib "$CLASSPATH" "\$@"
fi
fi
EOF
chmod a+x $out/bin/ant
ln -s $out/bin/ant $out/bin/antRun

View File

@ -1,30 +1,64 @@
{ fetchurl, stdenv, jdk }:
{ fetchurl, stdenv, makeWrapper }:
let
antContrib = import ./ant-contrib.nix {
inherit fetchurl stdenv;
};
version = "1.8.4";
in
let version = "1.9.3"; in
stdenv.mkDerivation {
name = "ant-${(builtins.parseDrvName jdk.name).name}-${version}";
name = "ant-${version}";
builder = ./builder.sh;
buildInputs = [ antContrib jdk ];
inherit antContrib jdk;
buildInputs = [ makeWrapper ];
src = fetchurl {
url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
sha1 = "d9e3e83dd9664cfe1dcd4841c082db3f559af922";
sha1 = "efcf206e24b0dd1583c501182ad163af277951a4";
};
contrib = fetchurl {
url = mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2;
sha256 = "96effcca2581c1ab42a4828c770b48d54852edf9e71cefc9ed2ffd6590571ad1";
};
installPhase =
''
mkdir -p $out/bin $out/lib/ant
mv * $out/lib/ant/
# 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}
# Install ant-contrib.
unpackFile $contrib
cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
cat >> $out/bin/ant <<EOF
#! ${stdenv.shell} -e
ANT_HOME=$out/lib/ant
if [ -z "\$JAVA_HOME" ]; then
if ! JAVACCMD="\$(type -p javac)"; then
echo "\$0: cannot find the Java SDK" >&2
exit 1
fi
export JAVA_HOME="\$(dirname \$(dirname \$(readlink -f \$JAVACCMD)))"
fi
LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar:\$JAVA_HOME/lib/tools.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
exec "\$JAVA_HOME/bin/java" \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
-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
''; # */
meta = {
description = "Java-based build tool";
homepage = http://ant.apache.org/;
description = "A Java-based build tool";
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.eelco ];
};
}

View File

@ -2827,10 +2827,9 @@ let
callPackage ../development/compilers/openjdk-darwin { }
else
let
openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix {};
openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix { };
in callPackage ../development/compilers/openjdk {
jdk = openjdkBootstrap;
ant = pkgs.ant.override { jdk = openjdkBootstrap; };
};
openjre = pkgs.openjdk.jre;
@ -3457,9 +3456,6 @@ let
apacheAnt = callPackage ../development/tools/build-managers/apache-ant { };
apacheAntOpenJDK = apacheAnt.override { jdk = openjdk; };
apacheAntOracleJDK = ant.override { jdk = pkgs.oraclejdk; };
apacheAntGcj = callPackage ../development/tools/build-managers/apache-ant/from-source.nix {
# must be either pre-built or built with GCJ *alone*
gcj = gcj.gcc; # use the raw GCJ, which has ${gcj}/lib/jvm