From 0ac4c031bc819028701b85955dbf27bdab57481d Mon Sep 17 00:00:00 2001 From: Tomodachi94 Date: Tue, 26 Nov 2024 21:55:35 +0000 Subject: [PATCH] ant: use upstream launcher script --- pkgs/by-name/an/ant/package.nix | 50 ++++++--------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/pkgs/by-name/an/ant/package.nix b/pkgs/by-name/an/ant/package.nix index bedaa9b1394949..4a26d132ccdd5f 100644 --- a/pkgs/by-name/an/ant/package.nix +++ b/pkgs/by-name/an/ant/package.nix @@ -11,6 +11,8 @@ stdenv.mkDerivation (finalAttrs: { pname = "ant"; version = "1.10.15"; + buildInputs = [ jre ]; + nativeBuildInputs = [ makeWrapper ]; src = fetchurl { @@ -41,47 +43,13 @@ stdenv.mkDerivation (finalAttrs: { 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 + # Wrap the wrappers. + for wrapper in ant runant.py runant.pl; do + wrapProgram "$out/lib/ant/bin/$wrapper" \ + --set JAVA_HOME "${jre.home}" \ + --set ANT_HOME "$out/lib/ant" \ + --prefix CLASSPATH : "$out/lib/ant/lib" + done ''; passthru = {