summaryrefslogtreecommitdiff
path: root/libre/apache-ant-libre/PKGBUILD
blob: 9f5ef223b4621659438133e5741c48788b2d4326 (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
# Maintainer (Arch): Paul Mattal <paul@archlinux.org>
# Contributor: Andrew Wright <andreww@photism.org>

_pkgname=apache-ant
pkgname=apache-ant-libre
pkgver=1.8.2

provides=("$_pkgname=$pkgver")
replaces=("$_pkgname")
conflicts=("$_pkgname")

pkgrel=3
pkgdesc="A java-based build tool"
arch=('any')
license=('APACHE')
url="http://ant.apache.org/"
depends=('java-environment')
makedepends=('junit')
optdepends=('junit: to have JUnit on the classpath in javac tasks')
source=(http://archive.apache.org/dist/ant/source/${_pkgname}-${pkgver}-src.tar.bz2
        ${_pkgname}.sh ${_pkgname}.csh
        ant_diagnostics.patch)

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}
  ln -sf /usr/share/java/junit.jar lib/optional # JUnit isn't really optional
  sh build.sh -Ddist.dir="${srcdir}"/${_pkgname}-${pkgver}-bin dist
}

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}-bin
  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}
}

md5sums=('0d9e108afcd15b820150b8085c96d2b1'
         '593ee6ebd9b8ec321534a028e686880f'
         '475b684eb8202c09cbb51496cd8ee1e0'
         'cbaab423be40a6e63f0fde901b91eb50')