summaryrefslogtreecommitdiff
path: root/pcr/apache-ant-contrib/PKGBUILD
blob: ff4d4b53597bdcd51be35cdacb13fe823aee090e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

_pkgname=ant-contrib
pkgname=apache-${_pkgname}
pkgver=1.0b5
pkgrel=1.parabola1
pkgdesc="Extra task definitions for apache ant."
arch=('any')
url='http://ant-contrib.sourceforge.net'
license=('APACHE')
depends=('apache-ant')
makedepends=('apache-ivy' 'jh' 'subversion')
source=("${_pkgname}-${pkgver}::svn+http://svn.code.sf.net/p/${_pkgname}/code/${_pkgname}/trunk/"
        'apache-ant-contrib-for_task.patch'
        'apache-ant-contrib-parabolize.patch')
sha1sums=('SKIP'
          'af77026f41c0405c53d7e2a65c12e9f894b060c6'
          '35d35ccd7d85e7bdd6be0cc3c684f23cacd60b05')

# The format is:
#   jarname:description:pkgname:jarpath
_library_dependencies=(
  ant-1.7.0.jar:'':apache-ant:/usr/share/java/ant.jar
  xercesImpl-2.6.2.jar:'Java XML parser':xerces2-java:/usr/share/java/xercesImpl.jar
  oro-2.0.8.jar:'Regular expressions API':jakarta-oro:/usr/share/java/jakarta-oro.jar
  junit-3.8.1.jar:'<junit> task':junit:/usr/share/java/junit.jar
  ivy-2.0.0.jar:'<ivy> task':apache-ivy:/usr/share/java/apache-ivy/ivy.jar
  commons-logging-1.0.4.jar:'CommonsLoggingListener':java-commons-logging:/usr/share/java/commons-logging.jar
  commons-httpclient-3.0.1.jar:'':java-commons-httpclient:/usr/share/java/commons-httpclient.jar
  commons-codec-1.3.jar:'Common encoders and decoders':java-commons-codec:/usr/share/java/commons-codec.jar
  commons-cli-1.0.jar:'Parsing command line options':java-commons-cli:/usr/share/java/commons-cli.jar
  bcel-5.1.jar:"'classfileset' data type, JavaClassHelper for ClassConstants filter reader":java-bcel:/usr/share/java/bcel.jar
)

for _dep in "${_library_dependencies[@]}"; do
  IFS=: read _jarname _desc _libname _jarpath <<<"$_dep"
  optdepends+=("${_libname}: ${_desc}")
  makedepends+=("${_libname}")
done
unset _dep _jarname _desc _libname _jarpath

prepare() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  rm -rv $(find lib -name \*.jar)

  patch -Np1 -i "${srcdir}/apache-ant-contrib-for_task.patch"
  patch -Np1 -i "${srcdir}/apache-ant-contrib-parabolize.patch"
  sed -i 's/-SNAPSHOT//g' pom.xml
}

build() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  ant jar javadoc test \
    -Dant.jar=/usr/share/java/ant.jar \
    -Dbcel.jar=/usr/share/java/bcel.jar \
    -Dhttpclient.jar=/usr/share/java/commons-httpclient.jar \
    -Divy.jar=/usr/share/java/apache-ivy/ivy.jar \
    -Djunit.jar=/usr/share/java/junit.jar \
    -Dno-ivy=true \
    -lib /usr/share/java/xercesImpl.jar
}

package() {
  cd "${srcdir}/${_pkgname}-${pkgver}"

  # Install license file
  install -Dm644 docs/LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"

  # Install documentation
  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r target/docs/api "${pkgdir}/usr/share/doc/${pkgname}"

  # Install Maven artifacts
  export DESTDIR=${pkgdir}
  jh mvn-install ${_pkgname} ${_pkgname} ${pkgver} \
    pom.xml \
    "target/${_pkgname}.jar" \
    "${_pkgname}-${pkgver}.jar"

  ln -s "/usr/share/java/${_pkgname}-${pkgver}.jar" \
    "${pkgdir}/usr/share/java/${_pkgname}.jar"

  install -d "${pkgdir}/usr/share/java/apache-ant/"
  ln -s "/usr/share/java/${_pkgname}-${pkgver}.jar" \
    "${pkgdir}/usr/share/java/apache-ant/${_pkgname}-${pkgver}.jar"
}