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

pkgname=args4j
pkgver=2.33
pkgrel=1.1
pkgdesc="Java command line options parser"
arch=('any')
url='http://args4j.kohsuke.org/'
license=('MIT')
depends=('java-runtime')
makedepends=('java-environment' 'jh')
source=("https://github.com/kohsuke/$pkgname/archive/$pkgname-site-$pkgver.tar.gz")
sha256sums=('b4305ca1ff31d3492dd93770f302242c2bf536b440bca24b2580646b184a3733')

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

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

  javac -d build/classes $(find src -name \*.java)
  javadoc -d build/javadoc -sourcepath src -subpackages org

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

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

  # 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 \
    pom.xml "$pkgname.jar" "$pkgname.jar"

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