apache-ant: init 1.9

1.9.x is a legacy version of ant supporting Java 5, 6, and 7

Fixes #37747

+114
+111
pkgs/development/tools/build-managers/apache-ant/1.9.nix
··· 1 + { fetchurl, stdenv, coreutils, makeWrapper }: 2 + 3 + let version = "1.9.6"; in 4 + 5 + stdenv.mkDerivation { 6 + name = "ant-${version}"; 7 + 8 + buildInputs = [ makeWrapper ]; 9 + 10 + src = fetchurl { 11 + url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2"; 12 + sha256 = "1cwd5vq175gyicw0hkm8idwa33zxwhf7xlxywaqxcqqdjql0jfx4"; 13 + }; 14 + 15 + contrib = fetchurl { 16 + url = mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2; 17 + sha256 = "96effcca2581c1ab42a4828c770b48d54852edf9e71cefc9ed2ffd6590571ad1"; 18 + }; 19 + 20 + installPhase = 21 + '' 22 + mkdir -p $out/bin $out/lib/ant 23 + mv * $out/lib/ant/ 24 + 25 + # Get rid of the manual (35 MiB). Maybe we should put this in a 26 + # separate output. Keep the antRun script since it's vanilla sh 27 + # and needed for the <exec/> task (but since we set ANT_HOME to 28 + # a weird value, we have to move antRun to a weird location). 29 + # Get rid of the other Ant scripts since we provide our own. 30 + mv $out/lib/ant/bin/antRun $out/bin/ 31 + rm -rf $out/lib/ant/{manual,bin,WHATSNEW} 32 + mkdir $out/lib/ant/bin 33 + mv $out/bin/antRun $out/lib/ant/bin/ 34 + 35 + # Install ant-contrib. 36 + unpackFile $contrib 37 + cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/ 38 + 39 + cat >> $out/bin/ant <<EOF 40 + #! ${stdenv.shell} -e 41 + 42 + ANT_HOME=$out/lib/ant 43 + 44 + # Find the JDK by looking for javac. As a fall-back, find the 45 + # JRE by looking for java. The latter allows just the JRE to be 46 + # used with (say) ECJ as the compiler. Finally, allow the GNU 47 + # JVM. 48 + if [ -z "\$JAVA_HOME" ]; then 49 + for i in javac java gij; do 50 + if p="\$(type -p \$i)"; then 51 + export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))" 52 + break 53 + fi 54 + done 55 + if [ -z "\$JAVA_HOME" ]; then 56 + echo "\$0: cannot find the JDK or JRE" >&2 57 + exit 1 58 + fi 59 + fi 60 + 61 + if [ -z \$NIX_JVM ]; then 62 + if [ -e \$JAVA_HOME/bin/java ]; then 63 + NIX_JVM=\$JAVA_HOME/bin/java 64 + elif [ -e \$JAVA_HOME/bin/gij ]; then 65 + NIX_JVM=\$JAVA_HOME/bin/gij 66 + else 67 + NIX_JVM=java 68 + fi 69 + fi 70 + 71 + LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH" 72 + 73 + exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \ 74 + -Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \ 75 + org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \ 76 + -cp "\$CLASSPATH" "\$@" 77 + EOF 78 + 79 + chmod +x $out/bin/ant 80 + ''; # */ 81 + 82 + meta = { 83 + homepage = http://ant.apache.org/; 84 + description = "A Java-based build tool"; 85 + 86 + longDescription = '' 87 + Apache Ant is a Java-based build tool. In theory, it is kind of like 88 + Make, but without Make's wrinkles. 89 + 90 + Why another build tool when there is already make, gnumake, nmake, jam, 91 + and others? Because all those tools have limitations that Ant's 92 + original author couldn't live with when developing software across 93 + multiple platforms. Make-like tools are inherently shell-based -- they 94 + evaluate a set of dependencies, then execute commands not unlike what 95 + you would issue in a shell. This means that you can easily extend 96 + these tools by using or writing any program for the OS that you are 97 + working on. However, this also means that you limit yourself to the 98 + OS, or at least the OS type such as Unix, that you are working on. 99 + 100 + Ant is different. Instead of a model where it is extended with 101 + shell-based commands, Ant is extended using Java classes. Instead of 102 + writing shell commands, the configuration files are XML-based, calling 103 + out a target tree where various tasks get executed. Each task is run 104 + by an object that implements a particular Task interface. 105 + ''; 106 + 107 + license = stdenv.lib.licenses.asl20; 108 + maintainers = [ stdenv.lib.maintainers.eelco ]; 109 + platforms = stdenv.lib.platforms.all; 110 + }; 111 + }
+3
pkgs/top-level/all-packages.nix
··· 6360 6360 callPackage ../development/compilers/openjdk-darwin { } 6361 6361 else 6362 6362 callPackage ../development/compilers/openjdk/7.nix { 6363 + ant = apacheAnt_1_9; 6363 6364 bootjdk = callPackage ../development/compilers/openjdk/bootstrap.nix { version = "7"; }; 6364 6365 }; 6365 6366 ··· 7422 7423 ant = apacheAnt; 7423 7424 7424 7425 apacheAnt = callPackage ../development/tools/build-managers/apache-ant { }; 7426 + 7427 + apacheAnt_1_9 = callPackage ../development/tools/build-managers/apache-ant/1.9.nix { }; 7425 7428 7426 7429 apacheKafka = apacheKafka_1_0; 7427 7430 apacheKafka_0_9 = callPackage ../servers/apache-kafka { majorVersion = "0.9"; };