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

_libname=protobuf
pkgname=${_libname}-java
pkgver=3.3.0
pkgrel=1
pkgdesc="Google's data interchange format utility (Java API)."
url="https://github.com/google/protobuf"
license=('custom:BSD')
arch=('any')
depends=('java-runtime')
makedepends=('java-environment' 'jh' "${_libname}>=$pkgver")
source=("https://github.com/google/${_libname}/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz"
        'protobuf-java.patch')
sha256sums=('8cdd5a71a350331f18789bcb7e1e9e6e82765e4529b43e6cd9bafbf6c1c1677c'
            'eb76e92d5a0778bb0518651e225571bb3e439cd569d9b11bfa3ef5625635e2b9')

prepare() {
  cd "${_libname}-$pkgver"
  patch -Np1 -i ../protobuf-java.patch

  cd java
  mkdir -p build/classes
}

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

  protoc --java_out=core/src/main/java -I../src ../src/google/protobuf/descriptor.proto

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

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

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

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

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