dev-python/zipp: keyworded 0.5.2 for ppc, bug #690956
[gentoo.git] / net-libs / libbtbb / libbtbb-9999.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 )
7 DISTUTILS_OPTIONAL=1
8
9 inherit multilib cmake-utils python-single-r1
10
11 DESCRIPTION="A library to decode Bluetooth baseband packets"
12 HOMEPAGE="http://libbtbb.sourceforge.net/"
13
14 if [[ ${PV} == "9999" ]] ; then
15         EGIT_REPO_URI="https://github.com/greatscottgadgets/libbtbb.git"
16         inherit git-r3
17 else
18         MY_PV=${PV/\./-}
19         MY_PV=${MY_PV/./-R}
20         S=${WORKDIR}/${PN}-${MY_PV}
21         SRC_URI="https://github.com/greatscottgadgets/${PN}/archive/${MY_PV}.tar.gz -> ${PN}-${MY_PV}.tar.gz"
22         KEYWORDS="~amd64 ~arm ~x86"
23 fi
24
25 LICENSE="GPL-2"
26 SLOT="0/${PV}"
27 IUSE="extras static-libs wireshark-plugins"
28
29 RDEPEND="extras? ( ${PYTHON_DEPS} )
30         wireshark-plugins? (
31                 >=net-analyzer/wireshark-1.8.3-r1:=
32         )
33 "
34 DEPEND="${RDEPEND}
35         wireshark-plugins? ( dev-libs/glib
36                         virtual/pkgconfig )"
37
38 REQUIRED_USE="extras? ( ${PYTHON_REQUIRED_USE} )"
39
40 get_PV() { local pv=$(best_version $1); pv=${pv#$1-}; pv=${pv%-r*}; pv=${pv//_}; echo ${pv}; }
41
42 which_plugins() {
43         if has_version '>=net-analyzer/wireshark-2.2.0'; then
44                 plugins=""
45         elif has_version '>=net-analyzer/wireshark-1.12.0'; then
46                 plugins="btbb btbredr"
47         elif has_version '<net-analyzer/wireshark-1.12.0'; then
48                 plugins="btbb btle btsm"
49         fi
50 }
51
52 src_prepare(){
53         CMAKE_USE_DIR="${S}"
54         BUILD_DIR="${S}"_build
55         cmake-utils_src_prepare
56
57         if use wireshark-plugins; then
58                 which_plugins
59                 for i in ${plugins}
60                 do
61                         sed -i 's#column_info#packet#' wireshark/plugins/${i}/cmake/FindWireshark.cmake || die
62                         if has_version '>=net-analyzer/wireshark-2.0';  then
63                                 CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
64                         else
65                                 CMAKE_USE_DIR="${S}"/wireshark/plugins-legacy/${i}
66                         fi
67                         BUILD_DIR="${WORKDIR}"/${i}_build
68                         cmake-utils_src_prepare
69                 done
70         fi
71 }
72
73 src_configure() {
74         CMAKE_USE_DIR="${S}"
75         BUILD_DIR="${S}"_build
76         local mycmakeargs=(
77                 -DENABLE_PYTHON=$(usex extras)
78                 -DBUILD_STATIC_LIB=$(usex static-libs)
79                 -DBUILD_ROOT="${ED}"
80         )
81         cmake-utils_src_configure
82
83         if use wireshark-plugins; then
84                 for i in ${plugins}
85                 do
86                         if has_version '>=net-analyzer/wireshark-2.0';  then
87                                 CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
88                         else
89                                 CMAKE_USE_DIR="${S}"/wireshark/plugins-legacy/${i}
90                         fi
91                         BUILD_DIR="${WORKDIR}"/${i}_build
92                         local mycmakeargs=(
93                         -DCMAKE_INSTALL_LIBDIR="/usr/$(get_libdir)/wireshark/plugins/$(get_PV net-analyzer/wireshark)"
94                         )
95                         cmake-utils_src_configure
96                 done
97         fi
98 }
99
100 src_compile(){
101         CMAKE_USE_DIR="${S}"
102         BUILD_DIR="${S}"_build
103         cmake-utils_src_compile
104
105         if use wireshark-plugins; then
106                 for i in ${plugins}
107                 do
108                         if has_version '>=net-analyzer/wireshark-2.0';  then
109                                 CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
110                         else
111                                 CMAKE_USE_DIR="${S}"/wireshark/plugins-legacy/${i}
112                         fi
113                         BUILD_DIR="${WORKDIR}"/${i}_build
114                         cmake-utils_src_compile
115                 done
116         fi
117 }
118
119 src_test(){
120         CMAKE_USE_DIR="${S}"
121         BUILD_DIR="${S}"_build
122         cmake-utils_src_test
123
124         if use wireshark-plugins; then
125                 for i in ${plugins}
126                 do
127                         if has_version '>=net-analyzer/wireshark-2.0';  then
128                                 CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
129                         else
130                                 CMAKE_USE_DIR="${S}"/wireshark/plugins-legacy/${i}
131                         fi
132                         BUILD_DIR="${WORKDIR}"/${i}_build
133                         cmake-utils_src_test
134                 done
135         fi
136 }
137
138 src_install(){
139         CMAKE_USE_DIR="${S}"
140         BUILD_DIR="${S}"_build
141         cmake-utils_src_install
142
143         if use wireshark-plugins; then
144                 for i in ${plugins}
145                 do
146                         if has_version '>=net-analyzer/wireshark-2.0';  then
147                                 CMAKE_USE_DIR="${S}"/wireshark/plugins/${i}
148                         else
149                                 CMAKE_USE_DIR="${S}"/wireshark/plugins-legacy/${i}
150                         fi
151                         BUILD_DIR="${WORKDIR}"/${i}_build
152                         cmake-utils_src_install
153                 done
154         fi
155 }