File libiio.spec of Package libiio

#
# spec file for package libiio
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


Name:           libiio
Version:        0.14
Release:        0
%define so_ver  0
Url:            https://wiki.analog.com/resources/tools-software/linux-software/libiio
Summary:        Industrial I/O tools
License:        LGPL-2.1+
Group:          System/Libraries
Source:         https://github.com/analogdevicesinc/libiio/archive/v%{version}.tar.gz#/libiio-%{version}.tar.gz
BuildRequires:  bison
BuildRequires:  cmake
BuildRequires:  flex
BuildRequires:  libxml2-devel
BuildRequires:  python3-devel
BuildRequires:  systemd-rpm-macros
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}

%description
Library for industrial I/O.

%package -n libiio%{so_ver}
Summary:        Industrial I/O library
Group:          System/Libraries

%description -n libiio%{so_ver}
Library for industrial I/O.

%package devel
Summary:        Industrial I/O library -- development files
Group:          Development/Libraries/C and C++
Requires:       libiio%{so_ver} = %{version}-%{release}
Recommends:     libiio = %{version}-%{release}

%description devel
Library for industrial I/O.

This sub-package contains the development files.

%package python
Summary:        Industrial I/O library -- Python bindings
Group:          System/Libraries

%description python
Library for industrial I/O.

This sub-package contains the Python bindings.

%package daemon
Summary:        Industrial I/O library -- iiod
Group:          System/Libraries

%description daemon
Library for industrial I/O.

This sub-package contains the iiod daemon.

%prep
%setup -q

%build
%cmake \
  -DPYTHON_EXECUTABLE=/usr/bin/python3
%make_jobs

%install
%cmake_install
install -D -m 444 iiod/init/iiod.service %{buildroot}%{_unitdir}/iiod.service

%check
%ctest

%post -n libiio%{so_ver} -p /sbin/ldconfig

%postun -n libiio%{so_ver} -p /sbin/ldconfig

%pre daemon
%service_add_pre iiod.service

%post daemon
%service_add_post iiod.service

%preun daemon
%service_del_preun iiod.service

%postun daemon
%service_del_postun iiod.service

%files
%defattr(-,root,root,-)
%doc COPYING.txt README.md
%{_bindir}/iio_adi_xflow_check
%{_bindir}/iio_attr
%{_bindir}/iio_genxml
%{_bindir}/iio_info
%{_bindir}/iio_readdev
%{_bindir}/iio_reg

%files -n libiio%{so_ver}
%defattr(-,root,root,-)
%{_libdir}/libiio.so.%{so_ver}*

%files -n libiio-devel
%defattr(-,root,root,-)
%{_includedir}/iio.h
%{_libdir}/libiio.so
%{_libdir}/pkgconfig/libiio.pc

%files python
%defattr(-,root,root,-)
%{python3_sitelib}/*

%files daemon
%defattr(-,root,root,-)
%{_sbindir}/iiod
%{_unitdir}/iiod.service

%changelog
openSUSE Build Service is sponsored by