protobuf-java-3.0.2.ebuild 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. JAVA_PKG_IUSE="doc source"
  5. inherit java-pkg-2 java-pkg-simple
  6. MY_PV=${PV/_beta/-beta-}
  7. MY_PV=${MY_PV/_p/.}
  8. DESCRIPTION="Google's Protocol Buffers - official Java Bindings"
  9. HOMEPAGE="https://github.com/google/protobuf/ https://developers.google.com/protocol-buffers/"
  10. SRC_URI="https://github.com/google/protobuf/archive/v${MY_PV}.tar.gz -> protobuf-${PV}.tar.gz"
  11. LICENSE="Apache-2.0"
  12. SLOT="0/10"
  13. KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~sh ~x86 ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos"
  14. IUSE="nano"
  15. # Protobuf is only a build-time dep, but depends on the exact same version
  16. # (excluding revision), since we are using the same tarball.
  17. # But probably same subslot is sufficient.
  18. DEPEND=">=virtual/jdk-1.7
  19. >=dev-libs/protobuf-3"
  20. RDEPEND=">=virtual/jre-1.7
  21. !<dev-libs/protobuf-3[java(-)]"
  22. S="${WORKDIR}/protobuf-${MY_PV}"
  23. src_prepare() {
  24. default
  25. java-pkg-2_src_prepare
  26. }
  27. src_compile() {
  28. pushd "${S}/java" >/dev/null || die
  29. einfo "Compiling Java library ..."
  30. "${EPREFIX}"/usr/bin/protoc --java_out=core/src/main/java -I../src ../src/google/protobuf/descriptor.proto || die
  31. JAVA_SRC_DIR="${S}/java/core/src/main/java"
  32. JAVA_JAR_FILENAME="protobuf.jar"
  33. java-pkg-simple_src_compile
  34. popd >/dev/null || die
  35. if use nano; then
  36. einfo "Compiling Java Nano library ..."
  37. pushd "${S}/javanano" >/dev/null || die
  38. "${EPREFIX}"/usr/bin/protoc --java_out=src/main/java -I../src ../src/google/protobuf/descriptor.proto || die
  39. JAVA_SRC_DIR="${S}/javanano/src/main/java"
  40. JAVA_GENTOO_CLASSPATH_EXTRA="${S}/java/core/src/main/java/"
  41. JAVA_JAR_FILENAME="protobuf-nano.jar"
  42. java-pkg-simple_src_compile
  43. popd >/dev/null || die
  44. fi
  45. }
  46. src_install() {
  47. JAVA_JAR_FILENAME="${S}/java/protobuf.jar"
  48. JAVA_SRC_DIR="${S}/java/core/src/main/java"
  49. if use nano; then
  50. JAVA_JAR_FILENAME="${JAVA_JAR_FILENAME} ${S}/javanano/protobuf-nano.jar"
  51. JAVA_SRC_DIR="${JAVA_SRC_DIR} ${S}/javanano/src/main/java"
  52. fi
  53. mv "${S}/java/target" . || die
  54. if use nano; then
  55. cp -Rvf "${S}/javanano/target" . || die
  56. fi
  57. java-pkg-simple_src_install
  58. }