libbtbb-2015.10.1.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit multilib cmake-utils
  5. DESCRIPTION="A library to decode Bluetooth baseband packets"
  6. HOMEPAGE="http://libbtbb.sourceforge.net/"
  7. if [[ ${PV} == "9999" ]] ; then
  8. EGIT_REPO_URI="https://github.com/greatscottgadgets/libbtbb.git"
  9. inherit git-r3
  10. KEYWORDS=""
  11. else
  12. MY_PV=${PV/\./-}
  13. MY_PV=${MY_PV/./-R}
  14. S=${WORKDIR}/${PN}-${MY_PV}
  15. SRC_URI="https://github.com/greatscottgadgets/${PN}/archive/${MY_PV}.tar.gz -> ${PN}-${MY_PV}.tar.gz"
  16. KEYWORDS="~amd64 ~arm ~x86"
  17. fi
  18. LICENSE="GPL-2"
  19. SLOT="0/${PV}"
  20. IUSE="+pcap +wireshark-plugins"
  21. RDEPEND="
  22. pcap? ( net-libs/libpcap )
  23. wireshark-plugins? (
  24. >=net-analyzer/wireshark-1.8.3-r1:=
  25. !>net-analyzer/wireshark-1.98
  26. )
  27. "
  28. DEPEND="${RDEPEND}
  29. wireshark-plugins? ( dev-libs/glib
  30. virtual/pkgconfig )"
  31. get_PV() { local pv=$(best_version $1); pv=${pv#$1-}; pv=${pv%-r*}; pv=${pv//_}; echo ${pv}; }
  32. which_plugins() {
  33. if has_version '>=net-analyzer/wireshark-1.12.0'; then
  34. plugins="btbb btbredr"
  35. elif has_version '<net-analyzer/wireshark-1.12.0'; then
  36. plugins="btbb btle btsm"
  37. fi
  38. }
  39. src_prepare(){
  40. CMAKE_USE_DIR="${S}"
  41. BUILD_DIR="${S}"_build
  42. cmake-utils_src_prepare
  43. if use wireshark-plugins; then
  44. which_plugins
  45. for i in ${plugins}
  46. do
  47. sed -i 's#column_info#packet#' wireshark/plugins/${i}/cmake/FindWireshark.cmake || die
  48. CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
  49. BUILD_DIR="${WORKDIR}"/${i}_build
  50. cmake-utils_src_prepare
  51. done
  52. fi
  53. }
  54. src_configure() {
  55. CMAKE_USE_DIR="${S}"
  56. BUILD_DIR="${S}"_build
  57. local mycmakeargs=(
  58. -DDISABLE_PYTHON=true
  59. -DPACKAGE_MANAGER=true
  60. $(cmake-utils_use pcap PCAPDUMP)
  61. $(cmake-utils_use pcap USE_PCAP)
  62. )
  63. cmake-utils_src_configure
  64. if use wireshark-plugins; then
  65. for i in ${plugins}
  66. do
  67. CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
  68. BUILD_DIR="${WORKDIR}"/${i}_build
  69. local mycmakeargs=(
  70. -DCMAKE_INSTALL_LIBDIR="/usr/$(get_libdir)/wireshark/plugins/$(get_PV net-analyzer/wireshark)"
  71. )
  72. cmake-utils_src_configure
  73. done
  74. fi
  75. }
  76. src_compile(){
  77. CMAKE_USE_DIR="${S}"
  78. BUILD_DIR="${S}"_build
  79. cmake-utils_src_compile
  80. if use wireshark-plugins; then
  81. for i in ${plugins}
  82. do
  83. CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
  84. BUILD_DIR="${WORKDIR}"/${i}_build
  85. cmake-utils_src_compile
  86. done
  87. fi
  88. }
  89. src_test(){
  90. CMAKE_USE_DIR="${S}"
  91. BUILD_DIR="${S}"_build
  92. cmake-utils_src_test
  93. if use wireshark-plugins; then
  94. for i in ${plugins}
  95. do
  96. CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
  97. BUILD_DIR="${WORKDIR}"/${i}_build
  98. cmake-utils_src_test
  99. done
  100. fi
  101. }
  102. src_install(){
  103. CMAKE_USE_DIR="${S}"
  104. BUILD_DIR="${S}"_build
  105. cmake-utils_src_install
  106. if use wireshark-plugins; then
  107. for i in ${plugins}
  108. do
  109. CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
  110. BUILD_DIR="${WORKDIR}"/${i}_build
  111. cmake-utils_src_install
  112. done
  113. fi
  114. }