File fx2adc.spec of Package fx2adc

#
# spec file for package fx2adc
#
# Copyright (c) 2024, 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 https://bugs.opensuse.org/
#


%define sover	0
%define libname libfx2adc%{sover}
Name:           fx2adc
Version:        0~git20240406.61ce046
Release:        0
Summary:        Use USB oscilloscopes based on Cypress FX2 and AD9288 as general purpose ADC
License:        GPL-2.0-or-later
Group:          Productivity/Hamradio/Other
URL:            https://github.com/steve-m/fx2adc
#Git-Clone:     https://github.com/steve-m/fx2adc
Source:         %{name}-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  git-core
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(udev)

%description
fx2adc userspace library and set of commandline applications for acquiring
a continuous, uninterrupted stream of samples from USB oscilloscopes that
are based on the Cypress FX2 high-speed USB interface chip and the
AD9288 ADC.

%package -n %{libname}
Summary:        Library to use USB oscilloscopes as general purpose ADC
Group:          System/Libraries
Requires:       %{name}-udev

%description -n %{libname}
fx2adc userspace library and set of commandline applications for acquiring
a continuous, uninterrupted stream of samples from USB oscilloscopes that
are based on the Cypress FX2 high-speed USB interface chip and the
AD9288 ADC.

%package udev
Summary:        Udev rules for fx2adc
Group:          Hardware/Other

%description udev
Udev rules for fx2adc.

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

%description devel
Library headers for fx2adc.

%prep
%setup -q

# HACK: udev permissions/location
sed -i 's|%{_sysconfdir}/udev/rules.d|%{_prefix}/lib/udev/rules.d|g' CMakeLists.txt
sed -i 's|MODE="660"|MODE="666"|g' fx2adc.rules

%build
%cmake \
    -DINSTALL_UDEV_RULES=on
%{make_build}

%install
%cmake_install
rm %{buildroot}%{_libdir}/libfx2adc.a

%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%post udev
%udev_rules_update

%postun udev
%udev_rules_update

%files
#%%license COPYING ### ??? ###
%doc README.md
%{_bindir}/fx2adc_file
%{_bindir}/fx2adc_tcp
%{_bindir}/fx2adc_test
%{_datadir}/fx2adc-firmware

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

%files udev
%{_udevrulesdir}/fx2adc.rules

%files devel
%{_libdir}/libfx2adc.so
%{_includedir}/fx2adc.h
%{_includedir}/fx2adc_export.h
%dir %{_libdir}/cmake/fx2adc
%{_libdir}/cmake/fx2adc/fx2adc*.cmake
%{_libdir}/pkgconfig/libfx2adc.pc

%changelog
openSUSE Build Service is sponsored by