From 675dc1bfbfd87c02c8588d78ffc903fb6987f6e4 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sun, 25 Mar 2018 14:11:00 -0500 Subject: [PATCH] apache-ant: init 1.9 1.9.x is a legacy version of ant supporting Java 5, 6, and 7 Fixes #37747 --- .../tools/build-managers/apache-ant/1.9.nix | 111 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 + 2 files changed, 114 insertions(+) create mode 100644 pkgs/development/tools/build-managers/apache-ant/1.9.nix diff --git a/pkgs/development/tools/build-managers/apache-ant/1.9.nix b/pkgs/development/tools/build-managers/apache-ant/1.9.nix new file mode 100644 index 000000000000..8816a005ca0f --- /dev/null +++ b/pkgs/development/tools/build-managers/apache-ant/1.9.nix @@ -0,0 +1,111 @@ +{ fetchurl, stdenv, coreutils, makeWrapper }: + +let version = "1.9.6"; in + +stdenv.mkDerivation { + name = "ant-${version}"; + + buildInputs = [ makeWrapper ]; + + src = fetchurl { + url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2"; + sha256 = "1cwd5vq175gyicw0hkm8idwa33zxwhf7xlxywaqxcqqdjql0jfx4"; + }; + + 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. Keep the antRun script since it's vanilla sh + # and needed for the 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/ + rm -rf $out/lib/ant/{manual,bin,WHATSNEW} + mkdir $out/lib/ant/bin + mv $out/bin/antRun $out/lib/ant/bin/ + + # Install ant-contrib. + unpackFile $contrib + cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/ + + cat >> $out/bin/ant <&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" + + 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 = { + 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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3f0efc2d8f42..a4726f59b893 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6360,6 +6360,7 @@ with pkgs; callPackage ../development/compilers/openjdk-darwin { } else callPackage ../development/compilers/openjdk/7.nix { + ant = apacheAnt_1_9; bootjdk = callPackage ../development/compilers/openjdk/bootstrap.nix { version = "7"; }; }; @@ -7423,6 +7424,8 @@ with pkgs; apacheAnt = callPackage ../development/tools/build-managers/apache-ant { }; + apacheAnt_1_9 = callPackage ../development/tools/build-managers/apache-ant/1.9.nix { }; + apacheKafka = apacheKafka_1_0; apacheKafka_0_9 = callPackage ../servers/apache-kafka { majorVersion = "0.9"; }; apacheKafka_0_10 = callPackage ../servers/apache-kafka { majorVersion = "0.10"; };