protobuf-3.1.0.ebuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 python3_4 python3_5 )
  5. inherit autotools elisp-common flag-o-matic python-r1 toolchain-funcs multilib-minimal
  6. # If you bump this package, also consider bumping the official language bindings!
  7. # At the current time these are java and python.
  8. MY_PV=${PV/_beta/-beta-}
  9. MY_PV=${MY_PV/_p/.}
  10. DESCRIPTION="Google's Protocol Buffers -- an efficient method of encoding structured data"
  11. HOMEPAGE="https://github.com/google/protobuf/ https://developers.google.com/protocol-buffers/"
  12. SRC_URI="https://github.com/google/protobuf/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
  13. LICENSE="Apache-2.0"
  14. SLOT="0/11"
  15. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos"
  16. IUSE="emacs examples java python static-libs test vim-syntax zlib"
  17. REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
  18. DEPEND="
  19. emacs? ( virtual/emacs )
  20. zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
  21. test? ( dev-cpp/gmock[${MULTILIB_USEDEP}] )"
  22. # This is provided for backwards compatibility due to (likely incorrect) use in consumers.
  23. PDEPEND="
  24. java? ( dev-java/protobuf-java )
  25. python? ( dev-python/protobuf-python[${PYTHON_USEDEP}] )"
  26. DOCS=( CHANGES.txt CONTRIBUTORS.txt README.md )
  27. PATCHES=(
  28. "${FILESDIR}/${PN}-2.6.1-protoc-cmdline.patch"
  29. "${FILESDIR}/${PN}-3.0.0_beta2-disable-local-gmock.patch"
  30. )
  31. S="${WORKDIR}/${PN}-${MY_PV}"
  32. src_prepare() {
  33. append-cppflags -DGOOGLE_PROTOBUF_NO_RTTI
  34. default
  35. eautoreconf
  36. }
  37. multilib_src_configure() {
  38. local myeconfargs=(
  39. $(use_enable static-libs static)
  40. $(use_with zlib)
  41. )
  42. if tc-is-cross-compiler; then
  43. # The build system wants `protoc` when building, so we need a copy that
  44. # runs on the host. This is more hermetic than relying on the version
  45. # installed in the host being the exact same version.
  46. mkdir -p "${WORKDIR}"/build || die
  47. pushd "${WORKDIR}"/build >/dev/null || die
  48. ECONF_SOURCE=${S} econf_build "${myeconfargs[@]}"
  49. myeconfargs+=( --with-protoc="${PWD}"/src/protoc )
  50. popd >/dev/null || die
  51. fi
  52. ECONF_SOURCE=${S} econf "${myeconfargs[@]}"
  53. }
  54. multilib_src_compile() {
  55. if tc-is-cross-compiler; then
  56. emake -C "${WORKDIR}"/build/src protoc
  57. fi
  58. default
  59. if use emacs; then
  60. elisp-compile "${S}"/editors/protobuf-mode.el
  61. fi
  62. }
  63. multilib_src_test() {
  64. emake check
  65. }
  66. multilib_src_install_all() {
  67. if use vim-syntax; then
  68. insinto /usr/share/vim/vimfiles/syntax
  69. doins editors/proto.vim
  70. insinto /usr/share/vim/vimfiles/ftdetect/
  71. doins "${FILESDIR}/proto.vim"
  72. fi
  73. if use emacs; then
  74. elisp-install "${PN}" editors/protobuf-mode.el*
  75. elisp-site-file-install "${FILESDIR}/70${PN}-gentoo.el"
  76. fi
  77. if use examples; then
  78. DOCS+=( examples )
  79. docompress -x /usr/share/doc/"${PF}"/examples
  80. fi
  81. einstalldocs
  82. }
  83. pkg_postinst() {
  84. use emacs && elisp-site-regen
  85. }
  86. pkg_postrm() {
  87. use emacs && elisp-site-regen
  88. }