File libprelude.spec of Package libprelude

#
# spec file for package libprelude
#
# Copyright (c) 2015 SUSE LINUX Products 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/

%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?python_sitearch3: %global python_sitearch3 %(%{__python}3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"] ')}
%{!?luaver: %global luaver %(lua -e "print(string.sub(_VERSION, 5))")}
%{!?luapkgdir: %global luapkgdir %{_libdir}/lua/%{luaver}}

%define soname 23
%define soname_cpp 8

Name:           libprelude
Version:        3.0.0
Release:        0
Summary:        Secure Connections between all Sensors and the Prelude Manager
# Prelude is GPL-2.0+
# libmissing is LGPL-2.1+
# libmissing/test is GPL-3.0+
License:        GPL-2.0+ and LGPL-2.1 and GPL-3.0+
Group:          Productivity/Networking/Security
Url:            https://www.prelude-siem.org
Source0:        https://www.prelude-siem.org/pkg/src/3.0.0/%{name}-%{version}.tar.gz
Patch0:         libprelude-fsf-address.patch
Patch1:         libprelude-rpm-opt-flags.patch
Patch2:         libprelude-ruby-include-path.patch
Patch3:         libprelude-python-swig.patch
Patch4:         libprelude-ruby-swig.patch
BuildRequires:  gcc-c++
BuildRequires:  libgnutls-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libgpg-error-devel
BuildRequires:  pkg-config
BuildRequires:  python-devel
BuildRequires:  gtk-doc
BuildRequires:  ruby
BuildRequires:  ruby-devel
BuildRequires:  lua-devel
%if 0%{?suse_version}
%if 0%{?suse_version} >= 1310
BuildRequires:  python3-devel
BuildRequires:  pkgconfig(glib-2.0)
%endif
%endif

%description
Libprelude is a library that guarantees secure connections between all sensors
and the Prelude Manager. Libprelude provides an Application Programming Interface
(API) for the communication with Prelude sub-systems, it supplies the necessary
functionality for generating and emitting IDMEF events with Prelude and automates
the saving and re-transmission of data in times of temporary interruption of one
of the components of the system.

%package -n %{name}%{soname}
Summary:        Prelude Libraries
Group:          System/Libraries

%description -n %{name}%{soname}
Libprelude is a library that guarantees secure connections between all sensors
and the Prelude Manager. Libprelude provides an Application Programming Interface
(API) for the communication with Prelude sub-systems, it supplies the necessary
functionality for generating and emitting IDMEF events with Prelude and automates
the saving and re-transmission of data in times of temporary interruption of one
of the components of the system.

%package -n %{name}cpp%{soname_cpp}
Summary:        Prelude Libraries
Group:          System/Libraries

%description -n %{name}cpp%{soname_cpp}
Libprelude is a library that guarantees secure connections between all sensors
and the Prelude Manager. Libprelude provides an Application Programming Interface
(API) for the communication with Prelude sub-systems, it supplies the necessary
functionality for generating and emitting IDMEF events with Prelude and automates
the saving and re-transmission of data in times of temporary interruption of one
of the components of the system.

%package -n prelude-tools
Summary:        Tools for libprelude
Group:          Development/Libraries/C and C++
Requires:       libprelude%{soname} = %{version}

%description -n prelude-tools
Libprelude is a library that guarantees secure connections between all sensors
and the Prelude Manager. Libprelude provides an Application Programming Interface
(API) for the communication with Prelude sub-systems, it supplies the necessary
functionality for generating and emitting IDMEF events with Prelude and automates
the saving and re-transmission of data in times of temporary interruption of one
of the components of the system.

%package -n %{name}-devel
Summary:        Development files for libprelude
Group:          Development/Libraries/C and C++
Requires:       libprelude%{soname} = %{version}
Requires:       libpreludecpp%{soname_cpp} = %{version}
Requires:       libgnutls-devel
Requires:       libgcrypt-devel
Requires:       libgpg-error-devel

%description -n %{name}-devel
Libprelude is a library that guarantees secure connections between all sensors
and the Prelude Manager. Libprelude provides an Application Programming Interface
(API) for the communication with Prelude sub-systems, it supplies the necessary
functionality for generating and emitting IDMEF events with Prelude and automates
the saving and re-transmission of data in times of temporary interruption of one
of the components of the system.

%package -n %{name}-devel-bindings
Summary:        Development files for libprelude
Group:          Development/Libraries/C and C++
Requires:       libprelude-devel = %{version}
Requires:       lua-devel
Requires:       python-devel
Requires:       python3-devel
Requires:       ruby-devel
Requires:       swig

%description -n %{name}-devel-bindings
Libprelude is a library that guarantees secure connections between all sensors
and the Prelude Manager. Libprelude provides an Application Programming Interface
(API) for the communication with Prelude sub-systems, it supplies the necessary
functionality for generating and emitting IDMEF events with Prelude and automates
the saving and re-transmission of data in times of temporary interruption of one
of the components of the system.

%package -n python-%{name}
Summary:        Python bindings for libprelude
Group:          Development/Languages/Python
Requires:       libprelude%{soname} = %{version}
Requires:       python = %{py_ver}

%description -n python-%{name}
Python bindings for libprelude generated by SWIG.

%package -n perl-%{name}
Summary:        Perl bindings for libprelude
Group:          Development/Languages/Perl
BuildRequires:  perl
Requires:       libprelude%{soname} = %{version}
Requires:       perl = %{perl_version}

%description -n perl-%{name}
Perl bindings for libprelude generated by SWIG.

%package -n python3-%{name}
Summary:        Python 3 bindings for libprelude
Group:          Development/Languages/Python3
Requires:       libprelude%{soname} = %{version}
Requires:       python = %{py3_ver}

%description -n python3-%{name}
Python 3 bindings for libprelude generated by SWIG.

%package -n ruby-%{name}
Summary:        Ruby bindings for libprelude
Group:          Development/Languages/Ruby
Requires:       libprelude%{soname} = %{version}
Requires:       ruby

%description -n ruby-%{name}
Ruby bindings for libprelude generated by SWIG.

%package -n lua-%{name}
Summary:        Lua bindings for libprelude
Group:          Development/Languages/Lua
Requires:       libprelude%{soname} = %{version}
Requires:       lua

%description -n lua-%{name}
Lua bindings for libprelude generated by SWIG.


%package -n %{name}-doc
Summary:        Libprelude documentation
Group:          System/Libraries

%description -n %{name}-doc
Libprelude documentation files.

%prep
%setup -q
%patch0 -p0
%patch1 -p0
%patch2 -p0
%patch3 -p0
%patch4 -p0

%build
%configure    --disable-static \
              --with-html-dir=%{_defaultdocdir}/%{name}-%{version}/html \
              --with-perl-installdirs=vendor \
              --enable-gtk-doc \
  	      gl_cv_func_printf_directive_n=yes \
  	      gl_cv_func_printf_infinite_long_double=yes

make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}
find %{buildroot}%{_libdir} -name "*.la" -delete
%perl_process_packlist
%perl_gen_filelist
mkdir -p %{buildroot}/${_localstatedir}/spool/prelude

%post -n libprelude%{soname} -p /sbin/ldconfig
%post -n libpreludecpp%{soname_cpp} -p /sbin/ldconfig

%postun -n libprelude%{soname} -p /sbin/ldconfig
%postun -n libpreludecpp%{soname_cpp} -p /sbin/ldconfig

%files -n %{name}%{soname}
%defattr(-,root,root)
%{_libdir}/libprelude.so.%{soname}*
%dir %{_localstatedir}/spool/prelude

%files -n prelude-tools
%defattr(-,root,root)
%{_bindir}/prelude-adduser
%{_bindir}/prelude-admin
%{_mandir}/man1/prelude-admin.1.*
%dir %{_sysconfdir}/prelude
%dir %{_sysconfdir}/prelude/default
%dir %{_sysconfdir}/prelude/profile
%config(noreplace) %{_sysconfdir}/prelude/default/client.conf
%config(noreplace) %{_sysconfdir}/prelude/default/global.conf
%config(noreplace) %{_sysconfdir}/prelude/default/idmef-client.conf
%config(noreplace) %{_sysconfdir}/prelude/default/tls.conf

%files -n %{name}cpp%{soname_cpp}
%defattr(-,root,root)
%{_libdir}/libpreludecpp.so.%{soname_cpp}*

%files -n %{name}-devel
%defattr(-,root,root)
%{_bindir}/libprelude-config
%{_includedir}/libprelude
%{_libdir}/libprelude.so
%{_libdir}/libpreludecpp.so
%{_libdir}/pkgconfig/libprelude.pc
%{_datadir}/aclocal/libprelude.m4

%files -n %{name}-devel-bindings
%defattr(-,root,root)
%dir %{_datadir}/libprelude/
%dir %{_datadir}/libprelude/swig
%{_datadir}/libprelude/swig/libpreludecpp.i
%dir %{_datadir}/libprelude/swig/lua/
%{_datadir}/libprelude/swig/lua/libpreludecpp-lua.i
%dir %{_datadir}/libprelude/swig/perl/
%{_datadir}/libprelude/swig/perl/libpreludecpp-perl.i
%dir %{_datadir}/libprelude/swig/python/
%{_datadir}/libprelude/swig/python/libpreludecpp-python.i
%dir %{_datadir}/libprelude/swig/ruby/
%{_datadir}/libprelude/swig/ruby/libpreludecpp-ruby.i

%files -n python-%{name}
%defattr(-,root,root)
%{python_sitearch}/*

%files -n perl-%{name} -f %{name}.files
%defattr(-,root,root)
%exclude %{_bindir}/libprelude-config
%exclude %{_bindir}/prelude-adduser
%exclude %{_bindir}/prelude-admin
%exclude %{_mandir}/man1/prelude-admin.1.gz

%files -n %{name}-doc
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-%{version}
%doc AUTHORS ChangeLog README NEWS COPYING LICENSE.README HACKING.README

%files -n python3-%{name}
%defattr(-,root,root)
%{python_sitearch3}/*

%files -n ruby-%{name}
%defattr(-,root,root)
%{ruby_sitearch}/Prelude.so

%files -n lua-%{name}
%defattr(-,root,root)
%{luapkgdir}/prelude.so

%changelog

openSUSE Build Service is sponsored by