summaryrefslogtreecommitdiff
path: root/libre/java-avalon-framework/PKGBUILD
blob: 60c30d9553cb31654733843801e6b94f021a499e (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: Omar Vega Ramos <ovruni@gnu.org.pe>

_libname=avalon-framework
pkgname=java-${_libname}
pkgver=4.2.0
pkgrel=6.parabola1
pkgdesc="Reusable components for J2SE applications."
arch=('any')
url="http://excalibur.apache.org/"
license=('APACHE')
depends=('java-runtime')
makedepends=('java-environment' 'java-avalon-logkit' 'jh' 'log4j-1.2')
source=("https://archive.apache.org/dist/excalibur/${_libname}/source/${_libname}-${pkgver}-src.tar.gz"
        "https://repo.maven.apache.org/maven2/${_libname}/${_libname}-api/${pkgver}/${_libname}-api-${pkgver}.pom"
        "https://repo.maven.apache.org/maven2/${_libname}/${_libname}-impl/${pkgver}/${_libname}-impl-${pkgver}.pom"
        'avalon-framework-rename_enum.patch')
md5sums=('fd42e4ed9d9cd7a4d2e7fca7ab8e847f'
         '7dd8406e2fda8ec924f094761b4695de'
         '1ae6d40afceecb706838ca4eb3157776'
         '577de617b81a6d73f2f19c543af99922')

prepare() {
  cd "${srcdir}/${_libname}"
  patch -Np1 -i "${srcdir}/avalon-framework-rename_enum.patch"
  mkdir -p build/classes
  mkdir -p build/classes/{api,impl,all}
}

build() {
  cd "${srcdir}/${_libname}"

  CLASSPATH="/usr/share/java/avalon-logkit.jar:/usr/share/java/log4j-1.2.jar"

  javac -cp $CLASSPATH -d "build/classes/api" \
    $(find "api/src/java" -name \*.java)
  javac -cp "$CLASSPATH:build/classes/api" -d "build/classes/impl" \
    $(find "impl/src/java" -name \*.java)
  javac -cp $CLASSPATH -d "build/classes/all" \
    $(find "api/src/java" "impl/src/java" -name \*.java)

  javadoc -classpath $CLASSPATH -d "build/javadoc" \
    -sourcepath "api/src/java" -subpackages org

  jar -cvf "${_libname}-api.jar" -C "build/classes/api" .
  jar -cvf "${_libname}-impl.jar" -C "build/classes/impl" .
  jar -cvf "${_libname}.jar" -C "build/classes/all" .
}

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

  # 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
  artifacts=("${_libname}-api" "${_libname}-impl")
  export DESTDIR=${pkgdir}
  for artifact in "${artifacts[@]}"; do
    jh mvn-install ${_libname} ${artifact} ${pkgver} \
      "${srcdir}/${artifact}-${pkgver}.pom" \
      "${artifact}.jar" \
      "${artifact}-${pkgver}.jar"
    ln -s "/usr/share/java/${artifact}-${pkgver}.jar" \
      "${pkgdir}/usr/share/java/${artifact}.jar"
  done

  install -Dm644 "${_libname}.jar" "${pkgdir}/usr/share/java/${_libname}/${_libname}.jar"
}