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

_pkgname=geronimo-osgi-support
pkgname=java-${_pkgname}
pkgver=1.1
pkgrel=1
pkgdesc="Java libraries providing OSGi lookup support for Geronimo projects"
arch=('any')
url='http://geronimo.apache.org/'
license=('APACHE')
depends=('java-runtime')
makedepends=('java-environment' 'jh' 'osgi-compendium' 'osgi-core' 'subversion')
source=("svn+https://svn.apache.org/repos/asf/geronimo/specs/tags/${_pkgname}-${pkgver}/")
md5sums=('SKIP')

_artifacts=(geronimo-osgi-registry geronimo-osgi-locator)

prepare() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  mkdir -p {source,dist}
  for artifact in ${_artifacts[@]}; do
    mkdir -p "build/${artifact}/classes"
    cp -rv "${artifact}/src" source
  done
}

build() {
  cd "${srcdir}/${_pkgname}-${pkgver}"
  CLASSPATH="/usr/share/java/osgi.compendium.jar:/usr/share/java/osgi.core.jar:dist/*"
  for artifact in ${_artifacts[@]}; do
    javac -cp $CLASSPATH -d "build/${artifact}/classes" -encoding UTF-8 \
      $(find "${artifact}/src/main/java" -name \*.java)
    jar -cvf "dist/${artifact}.jar" -C "build/${artifact}/classes" .
  done

  javadoc -classpath $CLASSPATH -d build/javadoc -encoding UTF-8 \
    -sourcepath source/src/main/java -subpackages org
}

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

  # Install license file
  install -Dm644 LICENSE "${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.apache.geronimo.specs ${_pkgname} ${pkgver} pom.xml

  for artifact in ${_artifacts[@]}; do
    jh mvn-install org.apache.geronimo.specs ${artifact} ${pkgver} \
      "${artifact}/pom.xml" \
      "dist/${artifact}.jar" \
      "${artifact}-${pkgver}.jar"
    ln -s "/usr/share/java/${artifact}-${pkgver}.jar" \
      "${pkgdir}/usr/share/java/${artifact}.jar"
  done
}