File libpreludedb.spec of Package libpreludedb

#
# spec file for package libpreludedb
#
# 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/
#


%{!?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))")}

%define sover 7
%define sover_cpp 2

Name:           libpreludedb
Version:        3.0.0
Release:        0
Summary:        Framework to easy access to the Prelude database
License:        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:         libpreludedb-python-swig.patch
BuildRequires:  gcc-c++
BuildRequires:  gtk-doc
BuildRequires:  libgcrypt-devel
BuildRequires:  libprelude-devel
BuildRequires:  mysql-devel
BuildRequires:  pkg-config
BuildRequires:  postgresql94-devel
BuildRequires:  python-devel
BuildRequires:  python3-devel
BuildRequires:  sqlite-devel
Requires:       libprelude-tools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The PreludeDB Library provides an abstraction layer upon the type and the
format of the database used to store IDMEF alerts. It allows developers
to use the Prelude IDMEF database easily and efficiently without
worrying about SQL, and to access the database independently of the
type/format of the database.

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

%description -n %{name}%{sover}
The PreludeDB Library provides an abstraction layer upon the type and the
format of the database used to store IDMEF alerts. It allows developers
to use the Prelude IDMEF database easily and efficiently without
worrying about SQL, and to access the database independently of the
type/format of the database.

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

%description -n %{name}cpp%{sover_cpp}
The PreludeDB Library provides an abstraction layer upon the type and the
format of the database used to store IDMEF alerts. It allows developers
to use the Prelude IDMEF database easily and efficiently without
worrying about SQL, and to access the database independently of the
type/format of the database.

%package devel
Summary:        Development files for libpreludedb
Group:          Development/Libraries/C and C++
Requires:       automake
Requires:       libprelude-devel
Requires:       libpreludedb%{sover} = %{version}
Requires:       libpreludedbcpp%{sover_cpp} = %{version}
Requires:       mysql-devel
Requires:       postgresql94-devel
Requires:       sqlite-devel

%description devel
The PreludeDB Library provides an abstraction layer upon the type
and the format of the database used to store IDMEF alerts. It
allows developers to use the Prelude IDMEF database easily and
efficiently without worrying about SQL, and to access the
database independently of the type/format of the database.

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

%description devel-bindings
The PreludeDB Library provides an abstraction layer upon the type
and the format of the database used to store IDMEF alerts. It
allows developers to use the Prelude IDMEF database easily and
efficiently without worrying about SQL, and to access the
database independently of the type/format of the database.

%package -n preludedb-tools
Summary:        Tools of libpreludedb
Group:          Productivity/Networking/Security

%description -n preludedb-tools
The PreludeDB Library provides an abstraction layer upon the type
and the format of the database used to store IDMEF alerts. It
allows developers to use the Prelude IDMEF database easily and
efficiently without worrying about SQL, and to access the
database independently of the type/format of the database.

%package plugins
Summary:        Plugin to use prelude with a classic schema
Group:          Productivity/Networking/Security

%description plugins
This plugin allows prelude to store alerts into a classic
schema in database.

%package mysql
Summary:        Plugin to use prelude with a mysql database
Group:          Productivity/Networking/Security
Requires:       libpreludedb-plugins = %{version}
Requires:       mysql
Requires:       mysql-server

%description mysql
This plugin allows prelude to store alerts into a mysql database.

%package pgsql
Summary:        Plugin to use prelude with a pgsql database
Group:          Productivity/Networking/Security
Requires:       libpreludedb-plugins = %{version}
Requires:       postgresql94-server

%description pgsql
This plugin allows prelude to store alerts into a pgsql database.

%package sqlite
Summary:        Plugin to use prelude with a sqlite database
Group:          Productivity/Networking/Security
Requires:       libpreludedb-plugins = %{version}
Requires:       sqlite

%description sqlite
This plugin allows prelude to store alerts into a sqlite database.

%package -n python-%{name}
Summary:        Python bindings for libpreludedb
Group:          Development/Languages/Python

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

%package -n python3-%{name}
Summary:        Python 3 bindings for libpreludedb
Group:          Development/Languages/Python3

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

%package doc
Summary:        Libprelude documentation
Group:          Documentation/HTML

%description doc
Libprelude documentation files.

%prep
%setup -q
%patch0 -p0

%build
%configure --with-html-dir=%{_defaultdocdir}/%{name}-%{version}/html \
           --disable-static \
           --enable-gtk-doc

sed -i.rpath -e 's|LD_RUN_PATH=""||' bindings/Makefile
sed -i.rpath -e 's|^sys_lib_dlsearch_path_spec="/lib /usr/lib|sys_lib_dlsearch_path_spec="/%{_lib} %{_libdir}|' libtool

make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/usr/share/libpreludedb/swig/python
cp bindings/libpreludedbcpp.i %{buildroot}/usr/share/libpreludedb/swig/
cp bindings/python/libpreludedbcpp-python.i %{buildroot}/usr/share/libpreludedb/swig/python
find %{buildroot}%{_libdir} -name "*.la" -delete
find %{buildroot} -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'

%post -n libpreludedb%{sover} -p /sbin/ldconfig
%post -n libpreludedbcpp%{sover_cpp} -p /sbin/ldconfig

%postun -n libpreludedb%{sover} -p /sbin/ldconfig
%postun -n libpreludedbcpp%{sover_cpp} -p /sbin/ldconfig

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

%files -n preludedb-tools
%defattr(-,root,root)
%{_mandir}/man1/preludedb-admin.1.*
%{_bindir}/preludedb-admin

%files plugins
%defattr(-,root,root)
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/plugins
%{_libdir}/%{name}/plugins/formats/

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

%files devel
%defattr(-,root,root)
%{_bindir}/libpreludedb-config
%{_includedir}/libpreludedb
%{_libdir}/libpreludedb.so
%{_libdir}/libpreludedbcpp.so
%{_datadir}/aclocal/libpreludedb.m4

%files devel-bindings
%defattr(-,root,root)
%dir %{_datadir}/libpreludedb/
%{_datadir}/libpreludedb/swig/

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

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

%files mysql
%defattr(0755,root,root)
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/plugins
%dir %{_libdir}/%{name}/plugins/sql
%{_libdir}/%{name}/plugins/sql/mysql.so
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/classic
%attr(0644,root,root) %{_datadir}/%{name}/classic/mysql*.sql
%attr(0755,root,root) %{_datadir}/%{name}/classic/*.sh

%files sqlite
%defattr(-,root,root)
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/plugins
%dir %{_libdir}/%{name}/plugins/sql
%{_libdir}/%{name}/plugins/sql/sqlite3.so
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/classic
%{_datadir}/%{name}/classic/sqlite*

%files pgsql
%defattr(-,root,root)
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/plugins
%dir %{_libdir}/%{name}/plugins/sql
%{_libdir}/%{name}/plugins/sql/pgsql.so
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/classic
%{_datadir}/%{name}/classic/pgsql*

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

%changelog
openSUSE Build Service is sponsored by