From 7b2494e31b77d773f705764080aa0e61f653bda5 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 6 Aug 2011 00:12:12 -0500
Subject: apache-ant: Bump to latest.

---
 abs/extra/apache-ant/PKGBUILD              | 80 +++++++++++++++++-------------
 abs/extra/apache-ant/ant_diagnostics.patch | 23 +++++++++
 abs/extra/apache-ant/apache-ant.csh        |  2 +
 abs/extra/apache-ant/apache-ant.sh         |  3 ++
 4 files changed, 74 insertions(+), 34 deletions(-)
 create mode 100644 abs/extra/apache-ant/ant_diagnostics.patch
 create mode 100644 abs/extra/apache-ant/apache-ant.csh
 create mode 100644 abs/extra/apache-ant/apache-ant.sh

diff --git a/abs/extra/apache-ant/PKGBUILD b/abs/extra/apache-ant/PKGBUILD
index 663cc19..eaafed4 100644
--- a/abs/extra/apache-ant/PKGBUILD
+++ b/abs/extra/apache-ant/PKGBUILD
@@ -1,41 +1,53 @@
-# $Id: PKGBUILD 24082 2009-01-12 21:42:39Z paul $
+# $Id$
 # Contributor: Andrew Wright <andreww@photism.org>
 # Maintainer: Paul Mattal <paul@archlinux.org>
 
 pkgname=apache-ant
-pkgver=1.7.1
-pkgrel=1
-pkgdesc="Ant is a java-based build tool."
-arch=(i686 x86_64)
+pkgver=1.8.2
+pkgrel=2
+pkgdesc="A java-based build tool"
+arch=('any')
 license=('APACHE')
 url="http://ant.apache.org/"
-depends=('java-runtime')
-makedepends=('java-environment')
-noextract=('junit3.8.1.zip')
-source=(http://archive.apache.org/dist/ant/source/${pkgname}-${pkgver}-src.tar.bz2
-        http://heanet.dl.sourceforge.net/sourceforge/junit/junit3.8.1.zip)
-md5sums=('0d68db4a1ada5c91bcbf53cefd0c2fd7' '5110326e4b7f7497dfa60ede4b626751')
-
-build() {
-  cd ${startdir}/src || return 1
-  unzip junit3.8.1.zip || return 1
-
-  cd ${startdir}/src/${pkgname}-${pkgver}
-  if [ -f /etc/profile.d/java-gcj-compat.sh ]; then
-    . /etc/profile.d/java-gcj-compat.sh
-  elif [ -f /etc/profile.d/jdk.sh ]; then
-    . /etc/profile.d/jre.sh
-    . /etc/profile.d/jdk.sh
-  fi
-
-   # we need the junit jar in the classpath to build ant
-  export CLASSPATH="${startdir}/src/junit3.8.1/junit.jar"
-
-  # build
-  mkdir dist || return 1
-  ./build.sh -Ddist.dir=dist/ dist || return 1
-
-  # install
-  export ANT_HOME="${startdir}/pkg/usr"
-  ./build.sh install-lite || return 1
+depends=('java-environment')
+optdepends=('junit: to jave junit on the classpath in javac tasks')
+source=(http://archive.apache.org/dist/ant/binaries/${pkgname}-${pkgver}-bin.tar.bz2
+        ${pkgname}.sh ${pkgname}.csh
+        ant_diagnostics.patch)
+md5sums=('9e9ae9fc7352960191489a1286fb0928'
+         '593ee6ebd9b8ec321534a028e686880f'
+         '475b684eb8202c09cbb51496cd8ee1e0'
+         'cbaab423be40a6e63f0fde901b91eb50')
+
+package() {
+  # install profile.d script
+  install -dm755 "${pkgdir}"/etc/profile.d
+  install -m755 "${srcdir}"/${pkgname}.{csh,sh} "${pkgdir}"/etc/profile.d/
+
+  # Get the ANT_HOME env var
+  source "${srcdir}"/${pkgname}.sh
+
+  cd "${srcdir}"/${pkgname}-${pkgver}
+  install -dm755 "${pkgdir}"/${ANT_HOME}/{bin,lib}
+
+  install -m644 ./lib/*.jar "${pkgdir}"/${ANT_HOME}/lib
+  cp -Rp ./etc "${pkgdir}"/${ANT_HOME}
+
+  # Do not copy Windows .bat/.cmd files
+  find ./bin -type f -a ! -name \*.bat -a ! -name \*.cmd \
+    -exec install -m755 {} "${pkgdir}"/${ANT_HOME}/bin \;
+
+  # symlink to junit so it's on the javac build path for ant
+  # matches behavior on ubuntu 9 and makes sense for compatibility
+  # http://bugs.archlinux.org/task/15229
+  ln -sf /usr/share/java/junit.jar "${pkgdir}"/usr/share/java/apache-ant/lib/
+
+  # fix python2 path
+  sed -i 's|/usr/bin/python|/usr/bin/python2|' "${pkgdir}"/usr/share/java/apache-ant/bin/runant.py
+
+  # The license says the NOTICE file should be redistributed for derivative
+  # works, so lets supply it.
+  cd "${srcdir}"/${pkgname}-${pkgver} 
+  install -dm755 "${pkgdir}"/usr/share/licenses/${pkgname}
+  install -m644 LICENSE NOTICE "${pkgdir}"/usr/share/licenses/${pkgname}
 }
diff --git a/abs/extra/apache-ant/ant_diagnostics.patch b/abs/extra/apache-ant/ant_diagnostics.patch
new file mode 100644
index 0000000..38148b4
--- /dev/null
+++ b/abs/extra/apache-ant/ant_diagnostics.patch
@@ -0,0 +1,23 @@
+--- a/src/main/org/apache/tools/ant/Diagnostics.java
++++ b/src/main/org/apache/tools/ant/Diagnostics.java
+@@ -179,7 +179,10 @@
+      * @param clazz the class to get the information from.
+      * @since Ant 1.8.0
+      */
+-    private static URL getClassLocation(Class clazz) {
++    private static URL getClassLocation(Class clazz) {
++		if (clazz.getProtectionDomain().getCodeSource() == null) {
++			return null;
++		}
+         return clazz.getProtectionDomain().getCodeSource().getLocation();
+     }
+ 
+@@ -241,7 +244,7 @@
+         }
+         Transformer transformer = null;
+         try {
+-            transformer = transformerFactory.newTransformer();
++            transformer = transformerFactory.newTransformer();
+         } catch (Exception e) {
+             // ignore
+             ignoreThrowable(e);
diff --git a/abs/extra/apache-ant/apache-ant.csh b/abs/extra/apache-ant/apache-ant.csh
new file mode 100644
index 0000000..b6a6d58
--- /dev/null
+++ b/abs/extra/apache-ant/apache-ant.csh
@@ -0,0 +1,2 @@
+setenv ANT_HOME /usr/share/java/apache-ant
+setenv PATH ${PATH}:${ANT_HOME}/bin
diff --git a/abs/extra/apache-ant/apache-ant.sh b/abs/extra/apache-ant/apache-ant.sh
new file mode 100644
index 0000000..ab602fb
--- /dev/null
+++ b/abs/extra/apache-ant/apache-ant.sh
@@ -0,0 +1,3 @@
+export ANT_HOME=/usr/share/java/apache-ant
+export PATH=$PATH:$ANT_HOME/bin
+
-- 
cgit v0.12

