summaryrefslogtreecommitdiff
path: root/java/apache-ant/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'java/apache-ant/PKGBUILD')
-rw-r--r--java/apache-ant/PKGBUILD142
1 files changed, 142 insertions, 0 deletions
diff --git a/java/apache-ant/PKGBUILD b/java/apache-ant/PKGBUILD
new file mode 100644
index 000000000..ae8967a2f
--- /dev/null
+++ b/java/apache-ant/PKGBUILD
@@ -0,0 +1,142 @@
+# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
+# Maintainer (Arch): Paul Mattal <paul@archlinux.org>
+# Contributor: Andrew Wright <andreww@photism.org>
+
+pkgname=apache-ant
+pkgver=1.9.2
+pkgdesc="A Java-based build tool"
+license=('Apache' 'custom:BSD3')
+url="http://ant.apache.org/"
+
+provides=("apache-ant-libre=$pkgver")
+replaces=("apache-ant-libre")
+conflicts=("apache-ant-libre")
+
+pkgrel=3.2 # newer than Arch's 1.9.2-3
+arch=('any')
+depends=('java-environment')
+makedepends=('jh')
+
+_mirror=http://archive.apache.org/dist
+source=($_mirror/ant/source/${pkgname}-${pkgver}-src.tar.bz2
+ ${pkgname}.sh ${pkgname}.csh)
+
+# This list is adapted from https://ant.apache.org/manual/install.html#librarydependencies
+# The format is:
+# jarname:description:pkgname:jarpath
+_library_dependencies=(
+ #jakarta-regexp-1.3.jar:Disregard
+ jakarta-oro-2.0.8.jar:'<ftp task>':jakarta-oro:/usr/share/java/jakarta-oro.jar
+ junit.jar:'<junit> task':junit:/usr/share/java/junit.jar
+ xalan.jar:'<junitreport> task':xalan-java:/usr/share/java/xalan.jar
+ antlr.jar:'<antlr> task':java-antlr2:/usr/share/java/antlr2.jar
+ bsf.jar:'<script> task':java-commons-bsf2:/usr/share/java/bsf2.jar
+ groovy-all.jar:'Groovy with <script> and <scriptdef> tasks':groovy:/usr/share/groovy/embeddable/groovy-all.jar
+ #netrexx.jar:'<netrexx> task, Rexx with <script> task':???????:???????
+ js.jar:'Javascript with <script> task':java-rhino:/usr/share/java/js.jar
+ jython.jar:'Python with <script> task':jython:/opt/jython/jython.jar
+ #jpython.jar:Disregard
+ #jacl.jar:'TCL with <script> task':???????:???????
+ #tcljava.jar:'TCL with <script> task':???????:???????
+ beanshell.jar:'BeanShell with <script> task':'beanshell>=1.3':/usr/share/java/bsh.jar
+ jruby.jar:'Ruby with <script> task':jruby:/opt/jruby/lib/jruby.jar
+ #judo.jar:Judoscript with <script> task:???????:??????
+ commons-logging.jar:'CommonsLoggingListener':java-commons-logging:/usr/share/java/commons-logging/commons-logging.jar
+ #log4j.jar:'Log4jListener':???????:???????
+ commons-net.jar:'<ftp>, <rexec> and <telnet> tasks':'java-commons-net1>=1.4.0':/usr/share/java/commons-net.jar
+ bcel.jar:"'classfileset' data type, JavaClassHelper for ClassConstants filter reader":java-bcel:/usr/share/java/bcel.jar
+ mail.jar:'<mimemail> task, mime encoding with <mail>':java-gnumail:/usr/share/java/gnumail.jar
+ activation.jar:'<mimemail> task, mime encoding with <mail>':java-activation-gnu:/usr/share/java/activation.jar
+ jdepend.jar:'<jdepend> task':java-jdepend:/usr/share/java/jdepend.jar
+# FIXME: When FS#38243 is fixed, 'xerces2-java' should be changed to 'java-resolver'.
+# We use xerces in the mean time because xalan depends on it.
+ resolver.jar:"external files for 'xmlcatalog' datatype":xerces2-java:/usr/share/java/resolver.jar
+ jsch.jar:'<sshexec> and <scp> tasks':'java-jsch>=0.1.42':/usr/share/java/jsch.jar
+ #jai.jar:'<image> task':???????:???????
+)
+
+for _dep in "${_library_dependencies[@]}"; do
+ IFS=: read _jarname _desc _pkgname _jarpath <<<"$_dep"
+ optdepends+=("${_pkgname}: ${_desc}")
+ makedepends+=("${_pkgname}")
+done
+unset _dep _jarname _desc _pkgname _jarpath
+
+build() {
+ # This directory is what becomes
+ # http://archive.apache.org/dist/ant/binaries/${pkgname}-${pkgver}-bin.tar.bz2
+ # which is what Arch uses
+ rm -rf "${srcdir}"/${pkgname}-${pkgver}-bin
+ mkdir -p "${srcdir}"/${pkgname}-${pkgver}-bin
+
+ cd "${srcdir}"/${pkgname}-${pkgver}
+ # Symlink to external optional libraries/
+ local _dep _jarname _desc _pkgname _jarpath
+ for _dep in "${_library_dependencies[@]}"; do
+ IFS=: read _jarname _desc _pkgname _jarpath <<<"$_dep"
+ ln -sfv "${_jarpath}" lib/optional/${_jarname}
+ done
+ # Build
+ source "/etc/profile.d/jdk.sh" # Get the JAVA_HOME env var
+ sh build.sh -Ddist.dir="${srcdir}"/${pkgname}-${pkgver}-bin dist
+}
+
+# Create a relative symlink
+_rellink() {
+ local src=$1
+ local dst=$2
+ mkdir -p "${pkgdir}/${dst%/*}"
+ ln -sfv "$(realpath -m "$src" --relative-to="${dst%/*}")" "${pkgdir}/${dst}"
+}
+
+package() {
+ cd "${srcdir}"/${pkgname}-${pkgver}-bin
+ source "${srcdir}"/${pkgname}.sh # Get the ANT_HOME env var
+ source "/etc/profile.d/jdk.sh" # Get the JAVA_HOME env var
+
+ ## Install profile.d script
+ install -d "${pkgdir}"/etc/profile.d
+ install -m755 "${srcdir}"/${pkgname}.{csh,sh} "${pkgdir}"/etc/profile.d/
+
+ ## Install the main distribution
+ install -d "${pkgdir}"/${ANT_HOME}
+ cp -Rp * "${pkgdir}"/${ANT_HOME}
+
+ ## Fix the distribution
+ # Remove Windows .bat/.cmd files
+ rm -f "${pkgdir}"/${ANT_HOME}/bin/*.{bat,cmd}
+ # Fix python2 path
+ sed -i 's|/usr/bin/python|/usr/bin/python2|' "${pkgdir}"/${ANT_HOME}/bin/runant.py
+ # Symlink to external optional libraries
+ local _dep _jarname _desc _pkgname _jarpath
+ for _dep in "${_library_dependencies[@]}"; do
+ IFS=: read _jarname _desc _pkgname _jarpath <<<"$_dep"
+ _rellink "${_jarpath}" "${ANT_HOME}/lib/${_jarname}"
+ done
+
+ ## Symlink the /opt distribution to the normal places
+
+ cd "${pkgdir}"/${ANT_HOME}/lib
+ local pom a
+ for pom in *.pom; do
+ a=${pom%.pom}
+ base=$(jh mvn-basename org.apache.ant $a $pkgver)
+ _rellink "${ANT_HOME}/lib/$a.pom" "${base}.pom"
+ _rellink "${ANT_HOME}/lib/$a.jar" "${base}.jar"
+ done
+
+ cd "${pkgdir}"/${ANT_HOME}/bin
+ local prog
+ for prog in *; do
+ _rellink "${ANT_HOME}/bin/$prog" "/usr/bin/$prog"
+ done
+ _rellink "${ANT_HOME}/README" "/usr/share/doc/${pkgname}/README"
+ _rellink "${ANT_HOME}/WHATSNEW" "/usr/share/doc/${pkgname}/WHATSNEW"
+ _rellink "${ANT_HOME}/docs" "/usr/share/doc/${pkgname}/html"
+ _rellink "${ANT_HOME}/LICENSE" "/usr/share/licenses/${pkgname}/LICENSE"
+ _rellink "${ANT_HOME}/NOTICE" "/usr/share/licenses/${pkgname}/NOTICE"
+}
+
+md5sums=('8f610c1a0183507c2beebbf230f456af'
+ 'bd63c881be406f515fc4d22635e8326a'
+ 'aaa615512cbe1ed7f3b62c1ff46802f8')