Merge branch 'java'

This commit is contained in:
Eelco Dolstra
2014-01-13 13:16:17 +01:00
42 changed files with 476 additions and 899 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,110 @@
{ 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
# 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.
if [ -z "\$JAVA_HOME" ]; then
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
exit 1
fi
fi
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
exec \$NIX_JVM \$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";
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.
'';
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.eelco ];
platforms = stdenv.lib.platforms.all;
};
}

View File

@@ -1,90 +0,0 @@
{ stdenv, fetchurl, gcj, junit }:
let version = "1.7.1"; in
/* TODO: Once we have Icedtea, use this Nix expression to build Ant with
Sun's javac. */
stdenv.mkDerivation {
name = "ant-gcj-${version}";
src = fetchurl {
url = "mirror://apache/ant/source/apache-ant-${version}-src.tar.bz2";
sha256 = "19pvqvgkxgpgsqm4lvbki5sm0z84kxmykdqicvfad47gc1r9mi2d";
};
patches = [ ./use-gcj.patch ];
buildInputs = [ gcj junit ];
configurePhase = ''
mkdir -p "tool-aliases/bin"
cd "tool-aliases/bin"
cat > javac <<EOF
#!/bin/sh
opts="-C"
echo 'running \`gcj '"\$opts \$@'..."
exec "$(type -P gcj)" \$opts \$@
EOF
chmod +x javac
ln -sv $(type -P gij) java
export PATH="$PWD:$PATH"
cd ../..
export JAVA_HOME="$PWD/tool-aliases"
# Make JUnit visible.
export CLASSPATH="$(find ${junit} -name \*.jar -printf "%p:")"
'';
# Note: We don't build the javadoc.
buildPhase = ''
mkdir -p "$out"
./build.sh -Dant.install="$out" install-lite
'';
installPhase = ''
# Actually, everything is already installed at this point, so we just
# rearrange a few things.
rm -v "$out/bin/"*.bat
mkdir -p "$out/lib/java"
mv -v "$out/lib/"*.jar "$out/lib/java"
sed -i "$out/bin/ant" \
-e "s|^ANT_LIB=.*$|ANT_LIB=$out/lib/java|g ;
s|JAVACMD=java.*$|JAVACMD=${gcj}/lib/jvm/bin/java|g ;
/^ant_exec_command/i export ANT_HOME=$out"
'';
meta = {
description = "Java-based build tool";
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.
'';
homepage = http://ant.apache.org/;
license = "APLv2";
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
};
}

View File

@@ -1,18 +0,0 @@
Setting `java.compiler' or `build.compiler' in `build.properties' isn't enough.
--- apache-ant-1.7.1/build.xml 2008-06-27 07:05:23.000000000 +0200
+++ apache-ant-1.7.1/build.xml 2009-09-24 15:10:53.000000000 +0200
@@ -578,12 +578,7 @@
classname="com.jcraft.jsch.Session"
classpathref="classpath"/>
- <condition property="build.compiler" value="classic">
- <not>
- <isset property="jdk1.3+"/>
- </not>
- </condition>
- <property name="build.compiler" value="modern"/>
+ <property name="build.compiler" value="gcj"/>
<!--check for XSD support in the parser-->
<condition property="xmlschema.present">

View File

@@ -1,16 +1,14 @@
#!/bin/bash
set -e
source $stdenv/setup
mkdir -pv $out/bin $out/lib
mkdir -pv $out/bin $out/share/java
out_bin=$out/bin/lein
cp -v $src $out_bin
cp -v $jarsrc $out/lib
cp -v $clojure/lib/java/* $out/lib
cp -v $jarsrc $out/share/java
cp -v $clojure/share/java/* $out/share/java/
for p in $patches;
do

View File

@@ -1,4 +1,4 @@
46c47
< LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
---
> LEIN_JAR=$(find $(dirname $0)/../lib -name *-standalone.jar | head -n 1)
> LEIN_JAR=$(find $(dirname $0)/../share/java -name *-standalone.jar | head -n 1)

View File

@@ -1,15 +0,0 @@
source $stdenv/setup
set -e
configurePhase() {
tar zxvf $src
cd jikespg/src
}
installPhase() {
mkdir -p $out/bin
cp jikespg $out/bin
}
genericBuild

View File

@@ -2,9 +2,22 @@
stdenv.mkDerivation {
name = "jikespg-1.3";
builder = ./builder.sh;
src = fetchurl {
url = mirror://sourceforge/jikes/jikespg-1.3.tar.gz;
md5 = "eba183713d9ae61a887211be80eeb21f";
};
sourceRoot = "jikespg/src";
installPhase =
''
mkdir -p $out/bin
cp jikespg $out/bin
'';
meta = {
homepage = http://jikes.sourceforge.net/;
description = "The Jikes Parser Generator";
};
}