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

pkgname=objenesis
pkgver=2.2
pkgrel=1
pkgdesc="Java library to instantiate a new object of a particular class"
arch=('any')
url="http://objenesis.org/"
license=('APACHE')
depends=('java-runtime')
makedepends=('java-environment' 'jh')
source=("https://github.com/easymock/${pkgname}/archive/${pkgver}.tar.gz")
md5sums=('92e3bd808297c684cdc95eccfb94ec61')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  mkdir -p build/classes
}

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

  CLASSPATH="build/classes"
  javac -encoding utf8 -classpath $CLASSPATH -d "build/classes" \
    $(find "main/src/main/java/" -name \*.java)
  javadoc -encoding utf8 -classpath $CLASSPATH -d "build/javadoc" \
    -sourcepath "main/src/main/java/" -subpackages org

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

package() {
  cd "${srcdir}/${pkgname}-${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 "org.objenesis" "${pkgname}-parent" ${pkgver} \
    "${srcdir}/${pkgname}-${pkgver}/pom.xml"
  jh mvn-install "org.objenesis" ${pkgname} ${pkgver} \
    "${srcdir}/${pkgname}-${pkgver}/main/pom.xml" \
    "${srcdir}/${pkgname}-${pkgver}/${pkgname}.jar" \
    "${pkgname}.jar"
  ln -s "/usr/share/java/${pkgname}.jar" \
    "${pkgdir}/usr/share/java/${pkgname}-${pkgver}.jar"
}