#
# Conditional build:
-%bcond_without lua # Lua (5.1) bindings
-%bcond_without perl # Perl bindings
-%bcond_without python # Python bindings (required by prewikka)
-%bcond_without ruby # Ruby bindings
+%bcond_without lua # Lua (5.1) bindings
+%bcond_without perl # Perl bindings
+%bcond_without python2 # Python 2.x bindings (required by prewikka)
+%bcond_without python3 # Python 3.x bindings
+%bcond_without ruby # Ruby bindings
+%bcond_without static_libs # static libraries
#
+# 5.1 also possible, 5.2 is preferred
+%define lua_ver 5.2
+%define lua_pkg lua%(echo %{lua_ver} | tr -d .)
%include /usr/lib/rpm/macros.perl
Summary: The Prelude library
Summary(pl.UTF-8): Biblioteka Prelude
Name: libprelude
-Version: 1.0.1
-Release: 3
+Version: 3.1.0
+Release: 1
License: GPL v2 or commercial
Group: Libraries
-# https://www.prelude-ids.org/projects/prelude/files
-Source0: https://www.prelude-ids.org/attachments/download/241/%{name}-%{version}.tar.gz
-# Source0-md5: dce1ea9f82cf436830567894e7ee622f
-Patch0: %{name}-libtool.patch
-Patch1: %{name}-ruby.patch
-Patch2: %{name}-gnutls.patch
-Patch3: %{name}-gets.patch
-Patch4: %{name}-python.patch
-URL: http://www.prelude-ids.com/
+#Source0Download: https://www.prelude-ids.org/projects/prelude/files
+Source0: https://www.prelude-ids.org/attachments/download/721/%{name}-%{version}.tar.gz
+# Source0-md5: 2e1a5d7cbf98a2d57fbb367a578dbf8c
+Patch0: python-install.patch
+Patch1: %{name}-lua.patch
+URL: https://www.prelude-ids.org/
BuildRequires: autoconf >= 2.59
-BuildRequires: automake
+BuildRequires: automake >= 1:1.9
BuildRequires: bison
BuildRequires: flex
BuildRequires: gnutls-devel >= 1.0.17
BuildRequires: libltdl-devel >= 2:2.0
BuildRequires: libstdc++-devel
BuildRequires: libtool >= 2:2.0
-%{?with_lua:BuildRequires: lua51-devel >= 5.1}
+%{?with_lua:BuildRequires: %{lua_pkg}-devel >= %{lua_ver}}
%{?with_perl:BuildRequires: perl-devel}
-%{?with_python:BuildRequires: python-devel >= 1:2.5}
+%{?with_python2:BuildRequires: python-devel >= 1:2.5}
+%{?with_python3:BuildRequires: python3-devel >= 1:3.2}
BuildRequires: rpm-perlprov
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.219
%description c++-static -l pl.UTF-8
Statyczna biblioteka libpreludecpp.
+%package swig
+Summary: SWIG development files for libprelude
+Summary(pl.UTF-8): Pliki programistyczne SWIG-a dla libprelude
+Group: Development/Libraries
+Requires: %{name}-c++-devel = %{version}-%{release}
+Requires: swig
+
+%description swig
+SWIG development files for libprelude.
+
+%description swig -l pl.UTF-8
+Pliki programistyczne SWIG-a dla libprelude.
+
%package -n lua-prelude
Summary: PreludeEasy - libprelude Lua bindings
Summary(pl.UTF-8): PreludeEasy - dowiązania języka Lua do libprelude
Group: Development/Languages
Requires: %{name}-c++ = %{version}-%{release}
+Requires: %{lua_pkg} >= %{lua_ver}
%description -n lua-prelude
PreludeEasy - libprelude Lua bindings.
PreludeEasy - dowiązania języka Lua do libprelude.
%package -n perl-libprelude
-Summary: Prelude Perl module - low-level Perl binding for libprelude
-Summary(pl.UTF-8): Moduł Perla Prelude - niskopoziomowe wiązanie Perla do libprelude
+Summary: Prelude Perl module - Perl binding for libprelude
+Summary(pl.UTF-8): Moduł Perla Prelude - wiązanie Perla do libprelude
Group: Development/Languages/Perl
-Requires: %{name}-libs = %{version}-%{release}
+Requires: %{name}-c++ = %{version}-%{release}
+Obsoletes: perl-PreludeEasy
%description -n perl-libprelude
-Prelude Perl module - low-level Perl binding for libprelude.
+Prelude Perl module - Perl binding for libprelude.
%description -n perl-libprelude -l pl.UTF-8
-Moduł Perla Prelude - niskopoziomowe wiązanie Perla do libprelude.
-
-%package -n perl-PreludeEasy
-Summary: PreludeEasy - high-level Perl binding for libprelude
-Summary(pl.UTF-8): PreludeEasy - wysokopoziomowe wiązanie Perla do libprelude
-Group: Development/Languages/Perl
-Requires: %{name}-c++ = %{version}-%{release}
-
-%description -n perl-PreludeEasy
-PreludeEasy - high-level Perl binding for libprelude.
-
-%description -n perl-PreludeEasy -l pl.UTF-8
-PreludeEasy - wysokopoziomowe wiązanie Perla do libprelude.
+Moduł Perla Prelude - wiązanie Perla do libprelude.
%package -n python-libprelude
-Summary: Low-level Python binding for libprelude
-Summary(pl.UTF-8): Niskopoziomowe wiązanie Pythona do libprelude
+Summary: Python 2.x binding for libprelude
+Summary(pl.UTF-8): Wiązanie Pythona 2.x do libprelude
Group: Development/Languages/Python
-Requires: %{name}-libs = %{version}-%{release}
+Requires: %{name}-c++ = %{version}-%{release}
+Obsoletes: python-PreludeEasy
%description -n python-libprelude
-Low-level Python binding for libprelude.
+Python 2.x binding for libprelude.
%description -n python-libprelude -l pl.UTF-8
-Niskopoziomowe wiązanie Pythona do libprelude.
+Wiązanie Pythona 2.x do libprelude.
-%package -n python-PreludeEasy
-Summary: PreludeEasy - high-level Python binding for libprelude
-Summary(pl.UTF-8): PreludeEasy - wysokopoziomowe wiązanie Pythona do libprelude
+%package -n python3-libprelude
+Summary: Python 3.x binding for libprelude
+Summary(pl.UTF-8): Wiązanie Pythona 3.x do libprelude
Group: Development/Languages/Python
Requires: %{name}-c++ = %{version}-%{release}
-%description -n python-PreludeEasy
-PreludeEasy - high-level Python binding for libprelude.
+%description -n python3-libprelude
+Python 3.x binding for libprelude.
-%description -n python-PreludeEasy -l pl.UTF-8
-PreludeEasy - wysokopoziomowe wiązanie Pythona do libprelude.
+%description -n python3-libprelude -l pl.UTF-8
+Wiązanie Pythona 3.x do libprelude.
%package -n ruby-prelude
-Summary: PreludeEasy - libprelude Ruby bindings
-Summary(pl.UTF-8): PreludeEasy - dowiązania języka Ruby do libprelude
+Summary: Ruby bindings for libprelude
+Summary(pl.UTF-8): Wiązania języka Ruby do libprelude
Group: Development/Languages
Requires: %{name}-c++ = %{version}-%{release}
%description -n ruby-prelude
-PreludeEasy - libprelude Ruby bindings.
+Ruby bindings for libprelude.
%description -n ruby-prelude -l pl.UTF-8
-PreludeEasy - dowiązania języka Ruby do libprelude.
+Wiązania języka Ruby do libprelude.
%prep
%setup -q
%patch0 -p1
-
-%if %{with python}
-# regenerate with fresh swig for gcc 4.6+
-%{__rm} bindings/python/{_PreludeEasy.cxx,PreludeEasy.py}
-%endif
-%if %{with ruby}
-# same for ruby 1.9
-%{__rm} bindings/ruby/PreludeEasy.cxx
%patch1 -p1
-%endif
-
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-sed -i -e 's/lua >= 5.1/lua51 >= 5.1/' configure.in
+%if %{with python3}
+# regenerate with fresh swig for python 3.5+
+%{__rm} bindings/python/{_prelude.cxx,prelude.py}
+%endif
%build
%{__libtoolize}
%configure \
am_cv_ruby_rbexecdir=%{ruby_vendorarchdir} \
--enable-gtk-doc \
- --enable-static \
- --with%{!?with_lua:out}-lua \
- --with%{!?with_perl:out}-perl \
- --with%{!?with_python:out}-python \
+ %{?with_static_libs:--enable-static} \
--with-html-dir=%{_gtkdocdir}/libprelude \
- --with-perl-installdirs=vendor
-
-%{__make}
+ --with-lua%{!?with_lua:=no} \
+ --with-perl%{!?with_perl:=no} \
+ --with-perl-installdirs=vendor \
+ --with-python2%{!?with_python2:=no} \
+ --with-python3%{!?with_python3:=no} \
+ --with-swig
-cd bindings/perl
-%{__make} clean
-%{__perl} Makefile.PL \
- INSTALLDIRS=vendor \
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
%{__make} install \
- DESTDIR=$RPM_BUILD_ROOT
-
-%{__make} -C bindings/perl install \
- DESTDIR=$RPM_BUILD_ROOT
+ DESTDIR=$RPM_BUILD_ROOT \
+ pythondir=%{py_sitescriptdir} \
+ pyexecdir=%{py_sitedir} \
+ python3dir=%{py3_sitescriptdir} \
+ py3execdir=%{py3_sitedir}
%if %{with lua}
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/PreludeEasy.{la,a}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/lua/%{lua_ver}/prelude.la \
+ %{?with_static_libs:$RPM_BUILD_ROOT%{_libdir}/lua/%{lua_ver}/prelude.a}
%endif
-%if %{with python}
-%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
-%py_comp $RPM_BUILD_ROOT%{py_sitedir}
+%if %{with python2}
%py_postclean
%endif
%if %{with ruby}
-%{__rm} $RPM_BUILD_ROOT%{ruby_vendorarchdir}/PreludeEasy.{la,a}
+%{__rm} $RPM_BUILD_ROOT%{ruby_vendorarchdir}/Prelude.la \
+ %{?with_static_libs:$RPM_BUILD_ROOT%{ruby_vendorarchdir}/Prelude.a}
%endif
%clean
%files libs
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libprelude.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libprelude.so.2
+%attr(755,root,root) %ghost %{_libdir}/libprelude.so.23
%files devel
%defattr(644,root,root,755)
%{_aclocaldir}/libprelude.m4
%{_gtkdocdir}/libprelude
%{_pkgconfigdir}/libprelude.pc
+%{_mandir}/man1/libprelude-config.1*
+%if %{with static_libs}
%files static
%defattr(644,root,root,755)
%{_libdir}/libprelude.a
+%endif
%files c++
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libpreludecpp.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libpreludecpp.so.0
+%attr(755,root,root) %ghost %{_libdir}/libpreludecpp.so.8
%files c++-devel
%defattr(644,root,root,755)
%{_includedir}/libprelude/idmef*.hxx
%{_includedir}/libprelude/prelude*.hxx
+%if %{with static_libs}
%files c++-static
%defattr(644,root,root,755)
%{_libdir}/libpreludecpp.a
+%endif
+
+%files swig
+%defattr(644,root,root,755)
+%dir %{_datadir}/libprelude
+%{_datadir}/libprelude/swig
%if %{with lua}
%files -n lua-prelude
%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/PreludeEasy.so
+%attr(755,root,root) %{_libdir}/lua/%{lua_ver}/prelude.so
%endif
%if %{with perl}
%defattr(644,root,root,755)
%{perl_vendorarch}/Prelude.pm
%dir %{perl_vendorarch}/auto/Prelude
-%{perl_vendorarch}/auto/Prelude/Prelude.bs
%attr(755,root,root) %{perl_vendorarch}/auto/Prelude/Prelude.so
-
-%files -n perl-PreludeEasy
-%defattr(644,root,root,755)
-%{perl_vendorarch}/PreludeEasy.pm
-%dir %{perl_vendorarch}/auto/PreludeEasy
-%{perl_vendorarch}/auto/PreludeEasy/PreludeEasy.bs
-%attr(755,root,root) %{perl_vendorarch}/auto/PreludeEasy/PreludeEasy.so
%endif
-%if %{with python}
+%if %{with python2}
%files -n python-libprelude
%defattr(644,root,root,755)
%attr(755,root,root) %{py_sitedir}/_prelude.so
%{py_sitedir}/prelude.py[co]
%{py_sitedir}/prelude-%{version}-py*.egg-info
+%endif
-%files -n python-PreludeEasy
+%if %{with python3}
+%files -n python3-libprelude
%defattr(644,root,root,755)
-%attr(755,root,root) %{py_sitedir}/_PreludeEasy.so
-%{py_sitedir}/PreludeEasy.py[co]
-%{py_sitedir}/PreludeEasy-%{version}-py*.egg-info
+%attr(755,root,root) %{py3_sitedir}/_prelude.cpython-*.so
+%{py3_sitedir}/prelude.py
+%{py3_sitedir}/__pycache__/prelude.cpython-*.py[co]
+%{py3_sitedir}/prelude-%{version}-py*.egg-info
%endif
%if %{with ruby}
%files -n ruby-prelude
%defattr(644,root,root,755)
-%attr(755,root,root) %{ruby_vendorarchdir}/PreludeEasy.so
+%attr(755,root,root) %{ruby_vendorarchdir}/Prelude.so
%endif