summaryrefslogtreecommitdiff
path: root/libre/java-hamcrest/PKGBUILD
blob: 0ae7f0c95880e085396d9ade54980eb17cbcbb08 (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
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

_libname=hamcrest
pkgname=java-${_libname}
pkgver=1.3
pkgrel=3.parabola1
pkgdesc="Java matcher objects library"
arch=('any')
url="https://code.google.com/p/hamcrest"
license=('BSD')
depends=('java-runtime')
makedepends=('apache-ant' 'easymock' 'java-jarjar' 'java-qdox' 'jmock' 'jh' 'junit')
source=("https://${_libname}.googlecode.com/files/${_libname}-${pkgver}.tgz"
        "hamcrest-build.patch"
        "hamcrest-random_compilation_failure.patch")
md5sums=('92e91c2754d44e49b72d70c10a04cb08'
         '37e8a9c44743d52054d690e98bee013a'
         'b0009aa6a6a6ea97987016d9d323c949')

prepare() {
  cd "${srcdir}/${_libname}-${pkgver}"
  rm -v $(find . -name \*.jar)
  patch -Np1 -i "${srcdir}/hamcrest-build.patch"
  patch -Np1 -i "${srcdir}/hamcrest-random_compilation_failure.patch"
}

build() {
  cd "${srcdir}/${_libname}-${pkgver}"
  ant bigjar unit-test javadoc \
    -Dhaltonfailure=false -Dversion=${pkgver}
}

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

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

  # Install documentation
  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r "build/temp/hamcrest-all-${pkgver}-javadoc.jar.contents" \
    "${pkgdir}/usr/share/doc/${pkgname}/javadoc"

  # Install Maven artifacts
  install -d "${pkgdir}/usr/share/java/${_libname}"
  export DESTDIR=${pkgdir}
  for artifact in $(printf '%s\n' *.pom|sed 's/-[0-9.]*\.pom$//'); do
    if [[ -f "build/${artifact}-${pkgver}.jar" ]]; then
      # This artifact has a jar file
      jh mvn-install "org.hamcrest" ${artifact} ${pkgver} \
        "${artifact}-${pkgver}.pom" \
        "build/${artifact}-${pkgver}.jar" \
        "${artifact}.jar"

      # Symlink them to /usr/share/java
      ln -s "/usr/share/java/${artifact}.jar" \
        "${pkgdir}/usr/share/java/${artifact//-/\/}-${pkgver}.jar"
      ln -s "/usr/share/java/${artifact}.jar" \
        "${pkgdir}/usr/share/java/${artifact//-/\/}.jar"
    else
      # This artifact is just a pom
      jh mvn-install "org.hamcrest" ${artifact} ${pkgver} \
        "${artifact}-${pkgver}.pom"
    fi
  done
}