summaryrefslogtreecommitdiff
path: root/pcr/easymock/PKGBUILD
blob: a7118371083bc6fa8dd151da9096fee78447d46d (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
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=easymock
pkgver=3.4
pkgrel=1
pkgdesc="Java library to generate Mock Objects for given interfaces"
arch=('any')
url="http://easymock.org/"
license=('APACHE')
depends=('java-runtime')
makedepends=('cglib' 'java-environment' 'jh' 'junit' 'objenesis')
source=("https://github.com/${pkgname}/${pkgname}/archive/${pkgname}-${pkgver}.tar.gz"
        "easymock-no_android.patch")
md5sums=('2c17cff0e93bb88ddb30f09eb3b684ee'
         '8d9cb4aabfd48b88bc8a0c932e0399df')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgname}-${pkgver}"
  mkdir -p build/classes
  rm -v "core/src/main/java/org/easymock/internal/AndroidClassProxyFactory.java"
  patch -Np1 -i "${srcdir}/easymock-no_android.patch"
}

build() {
  cd "${srcdir}/${pkgname}-${pkgname}-${pkgver}"

  CLASSPATH="/usr/share/java/cglib.jar:/usr/share/java/objenesis.jar:/usr/share/java/junit.jar"
  javac -classpath $CLASSPATH -d "build/classes" \
    $(find "core/src/main/java" -name \*.java)
  javadoc -classpath $CLASSPATH -d "build/javadoc" \
    -sourcepath "core/src/main/java" -subpackages org

  jar -cvf "${pkgname}.jar" -C "build/classes" .
}

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

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

  # Install documentation
  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r "build/javadoc" "${pkgdir}/usr/share/doc/${pkgname}"

  # Install Maven artifacts
  export DESTDIR=${pkgdir}
  jh mvn-install "org.easymock" ${pkgname} ${pkgver} \
    "${srcdir}/${pkgname}-${pkgname}-${pkgver}/pom.xml" \
    "${srcdir}/${pkgname}-${pkgname}-${pkgver}/${pkgname}.jar" \
    "${pkgname}.jar"
  ln -s "/usr/share/java/${pkgname}.jar" \
    "${pkgdir}/usr/share/java/${pkgname}-${pkgver}.jar"
}