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

_libname=gson
pkgname=java-${_libname}
pkgver=2.8.0
pkgrel=1
pkgdesc="Java library to convert Java Objects into JSON and back"
arch=('any')
url='https://github.com/google/gson'
license=('APACHE')
depends=('java-runtime')
makedepends=('java-environment' 'jh')
conflicts=('google-gson')
replaces=('google-gson')
source=("https://github.com/google/${_libname}/archive/${_libname}-parent-$pkgver.tar.gz")
sha256sums=('ea1d641fb1a19d243c37f5c1e5e2e23c32f9fbfc1ec5f95af9933d685e5057da')

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

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

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

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

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

  # 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 "com.google.code.${_libname}" ${_libname} $pkgver \
    pom.xml "${_libname}.jar" "${_libname}.jar"

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