File pdserv3.spec of Package pdserv3

#
#  vim:tw=78
#
#  spec file for pdserv library
#
#  Copyright (c) 2011 - 2022  Florian Pose <fp@igh.de>
#                2016 - 2018  Richard Hacker <ha@igh.de>
#
#  This file is part of the pdserv library.
#
#  The pdserv library is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or (at your
#  option) any later version.
#
#  The pdserv library is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
#  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
#  License for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with the pdserv library. If not, see <http://www.gnu.org/licenses/>.
#
#

%define libname lib%{name}3_2

%{!?make_jobs: %global make_jobs %__make %{?_smp_mflags} VERBOSE=1}
%{!?cmake_install: %global cmake_install DESTDIR=%{buildroot} %__make install}
%{!?cmake_build: %global cmake_build %__make %{?_smp_mflags}}


Name:           pdserv
Version:        1
Release:        0

Summary:        Process-data server library
License:        LGPL-3.0+
Group:          System/Libraries
Url:            http://etherlab.org/en/pdserv
Source:         http://etherlab.org/download/pdserv/pdserv-%version.tar.bz2

BuildRequires:  gcc-c++
BuildRequires:  cmake
BuildRequires:  fdupes

%if 0%{?suse_version}

BuildRequires:  db-devel

%else

BuildRequires:  libdb-devel

# Fedora
BuildRequires: glibc-all-langpacks

%endif

BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libsasl2)
BuildRequires:  pkgconfig(yaml-0.1)
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(log4cplus)
BuildRequires:  doxygen
BuildRequires:  graphviz
BuildRequires:  fdupes

%description
The PdServ library provides process data communication mechanisms for Linux
realtime applications in user space (i.e. using RT-PREEMPT). The main focus is
placed on providing a process-data interface without interfering realtime
operation.  It implements the MSR protocol, so Testmanager, DLS or any
application based on PdCom can act as a client.

#----------------------------------------------------------------------------
# Build step
# This must be before packaging, because otherwise the version number
# changes
#----------------------------------------------------------------------------
%prep
%setup
%__mkdir doc/examples
%__cp example/*.c doc/examples

%build
%cmake --no-warn-unused-cli -Wno-dev \
    -DCMAKE_INSTALL_SYSCONFDIR=%_sysconfdir \
    -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} \
    -DVERSION_HASH=%{version} \
    -DPAM_SERVICE_DIR=%{_sysconfdir}/pam.d \
    -DENABLE_EXAMPLE=1

%cmake_build

%install
%cmake_install

rm -rf html
mv %{buildroot}/%{_docdir}/%{name}/html .
%fdupes -s html

#----------------------------------------------------------------------------
# C++ library
#----------------------------------------------------------------------------
%package -n %libname
Summary:        Process-data server library
Obsoletes:      %{libname} < %{version}
Requires:       %{name}
Recommends:     cyrus-sasl-saslauthd cyrus-sasl-plain

%description -n %libname
The PdServ library provides process data communication mechanisms for Linux
realtime applications in user space (i.e. using RT-PREEMPT). The main focus is
placed on providing a process-data interface without interfering realtime
operation.  It implements the MSR protocol, so Testmanager, DLS or any
application based on PdCom can act as a client.

%files -n %libname
%defattr(-,root,root)
%{_libdir}/lib%{name}.so.*

#----------------------------------------------------------------------------
# Development package
#----------------------------------------------------------------------------
%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       %{libname} = %{version}
Provides:       lib%{name}.so

%description devel
The %{name}-devel package contains the static libraries and header files
needed for development with %{name}.

%files devel
%defattr(-,root,root)
%{_libdir}/lib%{name}.so
%{_includedir}/%{name}.h
%{_libdir}/pkgconfig/lib%{name}.pc
%{_libdir}/cmake/%{name}

#----------------------------------------------------------------------------
# Example package
#----------------------------------------------------------------------------
%package example
Summary:        Examples for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description example
The %{name}-example package contains some working examples using pdserv

%files example
%defattr(-,root,root)
%{_bindir}/pdserv-example-st

#----------------------------------------------------------------------------
# Documentation
#----------------------------------------------------------------------------
%package doc
Summary:        Documentation for %{name}
Group:          System/Libraries
BuildArch:      noarch

%description doc
Doxygen-generated API documentation for %{name}

%files doc
%defattr(-,root,root)
%doc doc/examples
%doc html

#----------------------------------------------------------------------------
# Base package
#----------------------------------------------------------------------------
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS
%config(noreplace) %{_sysconfdir}/pdserv.conf
%config(noreplace) %{_sysconfdir}/pam.d/pdserv

#----------------------------------------------------------------------------

%post   -n %libname -p /sbin/ldconfig
%postun -n %libname -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by