File libbtbb.spec of Package libbtbb
#
# spec file for package libbtbb
#
# Copyright (c) 2017-2020, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define realver 2020-12-R1
%define sover 1
%define build_wireshark_plugins 0
%define wireshark_version %(rpm -q --qf '%%{VERSION}' wireshark)
%define is_wireshark_one %(rpm -q --qf '%%{VERSION}' wireshark | egrep -q '^1.'; if test $? == 0; then echo 1; else echo 0; fi)
Name: libbtbb
Version: 2020.12.R1
Release: 0
Summary: A Bluetooth baseband decoding library
License: GPL-2.0-only
Group: System/Libraries
URL: https://github.com/greatscottgadgets/libbtbb
Source: https://github.com/greatscottgadgets/libbtbb/archive/%{realver}.tar.gz#/%{name}-%{realver}.tar.xz
Patch0: libbtbb-fix-version.patch
Patch1: libbtbb-remove-old-links.patch
Patch2: libbtbb-update-setup_py.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libpcap-devel
BuildRequires: pkgconfig
%if 0%{?suse_version} >= 1500
BuildRequires: python3
%else
BuildRequires: python
%endif
%if 0%{?suse_version} >= 1600
BuildRequires: python3-distutils-extra
%endif
BuildRequires: wireshark-devel
BuildRequires: pkgconfig(bluez)
%if 0%{?build_wireshark_plugins}
BuildRequires: wireshark-devel
%endif
%description
A library for decoding and processing Bluetooth baseband packets.
It can be used with any raw bitstream receiver, such as Ubertooth or
gr-bluetooth.
%package -n libbtbb%{sover}
Summary: A Bluetooth baseband decoding library
Group: System/Libraries
%description -n libbtbb%{sover}
A library for decoding and processing Bluetooth baseband packets.
It can be used with any raw bitstream receiver, such as Ubertooth or
gr-bluetooth.
%package devel
Summary: Development files for the libbtbb library
Group: Development/Libraries/C and C++
Requires: libbtbb%{sover} = %{version}
%description devel
A library for decoding and processing Bluetooth baseband packets.
It can be used with any raw bitstream receiver, such as ubertooth or
gr-bluetooth.
This subpackage contains libraries and header files for developing
applications that want to make use of libbtbb.
%package -n python3-pcapdump
Summary: A Python module for pcap
Group: Development/Languages/Python
%description -n python3-pcapdump
A Python module for pcap
%prep
%setup -q -n %{name}-%{realver}
%patch -P 1 -p1
%if 0%{?suse_version} >= 1600
%patch -P 2 -p1
%endif
%patch -P 0 -p1
sed -i 's|#!/usr/bin/env python3|#!/usr/bin/python3|' ./python/pcaptools/btaptap
%build
%cmake \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DBUILD_ROOT=%{buildroot} \
-DBUILD_SHARED_LIBS=ON
make %{?_smp_mflags}
%if 0%{?build_wireshark_plugins}
%if 0%{?is_wireshark_one}
cd ../wireshark/plugins-legacy
# Bluetooth baseband plugin
cd btbb
%cmake \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}/wireshark/plugins/%{wireshark_version}
make %{?_smp_mflags}
cd ../..
# BTBB Basic and Enhanced Data Rate Wireshark plugin
cd btbredr
%cmake \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}/wireshark/plugins/%{wireshark_version}
make %{?_smp_mflags}
cd ../..
# Bluetooth Low Energy plugin
cd btle
%cmake \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}/wireshark/plugins/%{wireshark_version}
make %{?_smp_mflags}
cd ../..
# Bluetooth Low Energy Security Manager plugin
cd btsm
%cmake \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}/wireshark/plugins/%{wireshark_version}
make %{?_smp_mflags}
make %{?_smp_mflags}
cd ../..
%else
cd ../wireshark/plugins
# Bluetooth baseband plugin
cd btbb
%cmake \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}/wireshark/plugins/%{wireshark_version}
make %{?_smp_mflags}
cd ../..
# BTBB Basic and Enhanced Data Rate Wireshark plugin
cd btbredr
%cmake \
-DCMAKE_SHARED_LINKER_FLAGS="" \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}/wireshark/plugins/%{wireshark_version}
make %{?_smp_mflags}
%endif
%endif
%install
cd build
%make_install
%if 0%{?build_wireshark_plugins}
%if 0%{?is_wireshark_one}
cd ../wireshark/plugins-legacy
cd btbb/build
%make_install
cd ../..
cd btbredr/build
%make_install
cd ../..
cd btle/build
%make_install
cd ../..
cd btsm/build
%make_install
%else
cd ../wireshark/plugins
cd btbb/build
%make_install
cd ../..
cd btbredr/build
%make_install
%endif
%endif
%post -n libbtbb%{sover} -p /sbin/ldconfig
%postun -n libbtbb%{sover} -p /sbin/ldconfig
%files -n libbtbb%{sover}
%doc README.md
%{_libdir}/libbtbb.so.%{sover}*
%if 0%{?build_wireshark_plugins}
%{_libdir}/wireshark/plugins/%{wireshark_version}/*.so
%endif
%files devel
%{_includedir}/btbb.h
%{_libdir}/libbtbb.so
%{_libdir}/pkgconfig/libbtbb.pc
%if 0%{?suse_version} >= 1500
%files -n python3-pcapdump
%doc python/pcaptools/README
%{_bindir}/btaptap
%{python3_sitelib}/pcapdump*
%endif
%changelog