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

pkgname=jmock
pkgver=1.2.0
pkgrel=1
pkgdesc="A library that supports test-driven development of Java code with mock objects"
arch=('any')
url="http://www.jmock.org/"
license=('custom')
depends=('java-runtime')
makedepends=('java-environment' 'cglib' 'jh' 'junit')
source=("https://github.com/${pkgname}-developers/${pkgname}-library/archive/${pkgver}.tar.gz"
        "https://repo1.maven.org/maven2/${pkgname}/${pkgname}/${pkgver}/${pkgname}-${pkgver}.pom"
        "https://repo1.maven.org/maven2/${pkgname}/${pkgname}-cglib/${pkgver}/${pkgname}-cglib-${pkgver}.pom"
        "jmock-junit3_api.patch")
md5sums=('624d6a8a60ba6caa3abb2e5cdff86560'
         'd045f9fa7c37e604b2e7724f7d22c05d'
         '1d4816028f07a979c31cbe984d9ff850'
         'd213e801f1b50f773e033da0dd20ecf2')

prepare() {
  cd "${srcdir}/${pkgname}-library-${pkgver}"
  patch -Np1 -i "${srcdir}/jmock-junit3_api.patch"
  find . -name \*.jar -delete
  mkdir -p build/classes
  mkdir -p build/cglib/classes
}

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

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

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

package() {
  cd "${srcdir}/${pkgname}-library-${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/javadoc" "${pkgdir}/usr/share/doc/${pkgname}"

  # Install Maven artifacts
  export DESTDIR=${pkgdir}
  jh mvn-install ${pkgname} ${pkgname} ${pkgver} \
    "${srcdir}/${pkgname}-${pkgver}.pom" \
    "${srcdir}/${pkgname}-library-${pkgver}/${pkgname}.jar" \
    "${pkgname}.jar"
  jh mvn-install ${pkgname} "${pkgname}-cglib" ${pkgver} \
    "${srcdir}/${pkgname}-cglib-${pkgver}.pom" \
    "${srcdir}/${pkgname}-library-${pkgver}/${pkgname}-cglib.jar" \
    "${pkgname}-cglib.jar"

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