File ubertooth.spec of Package ubertooth

#
# spec file for package ubertooth
#
# 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 ubertooth_group ubertooth

Name:           ubertooth
Version:        2020.12.R1
Release:        0
Summary:        Project Ubertooth
License:        GPL-2.0-only
Group:          Productivity/Hamradio/Other
URL:            https://github.com/greatscottgadgets/ubertooth
Source:         https://github.com/greatscottgadgets/ubertooth/archive/%{realver}.tar.gz#/%{name}-%{realver}.tar.xz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libbtbb-devel >= 2020.12.R1
BuildRequires:  libpcap-devel
BuildRequires:  pkgconfig
BuildRequires:  python3-setuptools
BuildRequires:  pkgconfig(bluez)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(udev)
Requires:       python3-qt5
Requires:       python3-numpy

%description
An open source wireless development platform
suitable for Bluetooth experimentation.

%package -n libubertooth%{sover}
Summary:        Driver for the ubertooth hardare
Group:          System/Libraries
Requires:       %{name}-udev

%description -n libubertooth%{sover}
Driver for the ubertooth hardware

%package udev
Summary:        Udev rules for ubertooth
Group:          Hardware/Other
Requires(pre):  shadow

%description udev
Udev rules for ubertooth.

%package devel
Summary:        Development files for libubertooth
Group:          Development/Libraries/C and C++
Requires:       libubertooth%{sover} = %{version}

%description devel
Development files for libubertooth

%prep
%setup -q -n %{name}-%{realver}
sed -i 's|#!/usr/bin/env python3|#!/usr/bin/python3|' \
  ./host/python/ubtbr/ubertooth-btbr \
  ./host/python/specan_ui/ubertooth-specan-ui

%build
cd host
%cmake .. \
    -DCMAKE_SHARED_LINKER_FLAGS="" \
    -DBUILD_SHARED_LIBS=ON \
    -DUDEV_RULES_PATH=%{_udevrulesdir} \
    -DUDEV_RULES_GROUP=%{ubertooth_group}
%make_build

%install
cd host/build
%make_install
# HACK: python module installation should be properly done upstream
install -d %{buildroot}%{python3_sitelib}/
mv -v ../../host/python/specan_ui/specan %{buildroot}%{python3_sitelib}/

%post -n libubertooth%{sover} -p /sbin/ldconfig
%postun -n libubertooth%{sover} -p /sbin/ldconfig
%pre udev
%{_sbindir}/groupadd -r %{ubertooth_group} 2> /dev/null || :

%post udev
%udev_rules_update

%postun udev
%udev_rules_update

%files
%license COPYING
%doc README.md TRADEMARK
%{_bindir}/ubertooth-*
%{_mandir}/man1/ubertooth-*.1%{?ext_man}
%{_mandir}/man7/ubertooth.7%{?ext_man}
%{python3_sitelib}/specan

%files udev
%{_udevrulesdir}/40-ubertooth.rules

%files -n libubertooth%{sover}
%{_libdir}/libubertooth.so.%{sover}*

%files devel
%{_includedir}/ubertooth.h
%{_includedir}/ubertooth_*.h
%{_libdir}/libubertooth.so

%changelog
openSUSE Build Service is sponsored by