File libprelude.spec of Package libprelude
#
# spec file for package libprelude
#
# Copyright (c) 2013 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/
#
%define soname 2
%define soname_cpp 0
Name: libprelude
Version: 1.0.1
Release: 0
# the primary code is GPL-2.0+, but libmissing and libmissing/tests are LGPL3.0+ and GPL3.0+ respectively
Summary: Secure Connections between all Sensors and the Prelude Manager
License: GPL-3.0+
Group: Productivity/Networking/Security
Url: http://www.prelude-technologies.com
Source: https://www.prelude-ids.org/attachments/download/241/%{name}-%{version}.tar.gz
BuildRequires: gcc-c++
BuildRequires: gnutls-devel
BuildRequires: libgcrypt-devel
BuildRequires: pkg-config
BuildRequires: chrpath
BuildRequires: gcc-c++
BuildRequires: lua-devel
BuildRequires: python-devel
BuildRequires: ruby
BuildRequires: ruby-devel
BuildRequires: swig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# add SLE support
%if 0%suse_version <= 1110
# macro: perl_gen_filelist (from Christian <chris@computersalat.de>)
# do the rpmlint happy filelist generation
# with %dir in front of directories
#
%define perl_gen_filelist(n) \
FILES=%{name}.files\
# fgen_dir func\
# IN: dir\
fgen_dir(){\
%{__cat} >> $FILES << EOF\
%dir ${1}\
EOF\
}\
# fgen_file func\
# IN: file\
fgen_file(){\
%{__cat} >> $FILES << EOF\
${1}\
EOF\
}\
# check for files in %{perl_vendorlib}\
RES=`find ${RPM_BUILD_ROOT}%{perl_vendorlib} -maxdepth 1 -type f`\
if [ -n "$RES" ]; then\
for file in $RES; do\
fgen_file "%{perl_vendorlib}/$(basename ${file})"\
done\
fi\
\
# get all dirs into array\
base_dir="${RPM_BUILD_ROOT}%{perl_vendorlib}/"\
for dir in `find ${base_dir} -type d | sort`; do\
if [ "$dir" = "${base_dir}" ]; then\
continue\
else\
el=`echo $dir | %{__awk} -F"${base_dir}" '{print $2}'`\
all_dir=(${all_dir[@]} $el)\
fi\
done\
\
# build filelist\
for i in ${all_dir[@]}; do\
# do not add "dir {perl_vendorlib/arch}/auto", included in perl package\
if [ "${i}" = "auto" ]; then\
continue\
fi\
if [ "%{perl_vendorlib}/${i}" = "%{perl_vendorarch}/auto" ]; then\
continue\
else\
if [ -d ${base_dir}/${i} ]; then\
RES=`find "${base_dir}/${i}" -maxdepth 1 -type f`\
if [ -n "$RES" ]; then\
fgen_dir "%{perl_vendorlib}/${i}"\
for file in $RES; do\
fgen_file "%{perl_vendorlib}/${i}/$(basename ${file})"\
done\
else\
fgen_dir "%{perl_vendorlib}/${i}"\
fi\
fi\
fi\
done\
# add man pages\
# if exist :)\
if [ -d "${RPM_BUILD_ROOT}%{_mandir}" ]; then\
fgen_file "%{_mandir}/man?/*"\
fi\
\
# add packlist file\
# generated fom perllocal.pod\
if [ -f "${RPM_BUILD_ROOT}/var/adm/perl-modules/%{name}" ]; then\
fgen_file "/var/adm/perl-modules/%{name}"\
fi\
\
# check for files in %{_bindir}\
if [ -d ${RPM_BUILD_ROOT}%{_bindir} ]; then\
RES=`find "${RPM_BUILD_ROOT}%{_bindir}" -maxdepth 1 -type f`\
if [ -n "$RES" ]; then\
for file in $RES; do\
fgen_file "%{_bindir}/$(basename ${file})"\
done\
fi\
fi
%endif
Patch1: opensuse12_compile.patch
# PATCH-FIX-UPSTREAM libprelude-1.0.1-fixgnulib.patch [https://bugzilla.redhat.com/show_bug.cgi?id=839602]
Patch2: libprelude-1.0.1-fixgnulib.patch
# PATCH-FIX-UPSTREAM libprelude-1.0.0-gcc46.patch [https://dev.prelude-ids.com/issues/515]
Patch3: libprelude-1.0.0-gcc46.patch
Patch4: libprelude-sles12sp2.patch
# PATCH-FIX-UPSTREAM libprelude-fixlibgnutls3.0.5.patch [https://dev.prelude-ids.com/issues/514]
Patch5: libprelude-fixlibgnutls3.0.5.patch
# PATCH-FIX-UPSTREAM libprelude-ruby1.9.patch [https://dev.prelude-ids.com/issues/513]
Patch6: libprelude-ruby1.9.patch
# PATCH-FIX-UPSTREAM libprelude-fsf-address.patch [https://dev.prelude-ids.com/issues/516]
Patch7: libprelude-fsf-address.patch
%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 libprelude%{soname}
Summary: Prelude Libraries
Group: System/Libraries
%description -n libprelude%{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 libpreludecpp%{soname_cpp}
Summary: Prelude Libraries
Group: System/Libraries
%description -n libpreludecpp%{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 libprelude-devel
Summary: Development files for libprelude
Group: Development/Libraries/C and C++
Requires: libprelude%{soname} = %{version}
%description -n libprelude-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 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 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 doc
Summary: Libprelude documentation
Group: System/Libraries
%description doc
Libprelude documentation files.
%prep
%setup -q
%if 0%{?suse_version} >= 1210
%patch1 -p1
%endif
%patch2 -p1
%patch3 -p1
%if 0%{?sles_version} == 11
%patch4 -p1
%endif
%if 0%{?suse_version} > 1210
%patch4 -p1
%patch5 -p1
%patch6 -p1
%endif
%patch7 -p1
%build
%configure --disable-static \
--with-html-dir=%{_defaultdocdir}/%{name}-%{version}/html \
--with-perl-installdirs=vendor \
--enable-easy-bindings \
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
%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
%clean
test %{buildroot} != "/" && rm -rf %{buildroot}
%files -n libprelude%{soname}
%defattr(-,root,root)
%doc AUTHORS ChangeLog README NEWS COPYING LICENSE.README HACKING.README
%config(noreplace) %{_sysconfdir}/prelude
%{_bindir}/prelude-adduser
%{_bindir}/prelude-admin
%{_libdir}/libprelude.so.%{soname}*
%{_mandir}/man1/prelude-admin.1.*
%files -n libpreludecpp%{soname_cpp}
%defattr(-,root,root)
%{_libdir}/libpreludecpp.so.%{soname_cpp}*
%files -n libprelude-devel
%defattr(-,root,root)
%{_bindir}/libprelude-config
%{_includedir}/libprelude
%{_libdir}/libprelude.so
%{_libdir}/libpreludecpp.so
%{_libdir}/pkgconfig/libprelude.pc
%{_datadir}/aclocal/libprelude.m4
# %%dir %%{_datadir}/gtk-doc
# %%dir %%{_datadir}/gtk-doc/html
# %%{_datadir}/gtk-doc/html/libprelude
%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 ruby-%{name}
%defattr(-,root,root)
# SLES 11, opensuse 12.1 and newer put PreludeEasy in the libdir
%if 0%{?suse_version} >= 1210 || 0%suse_version <= 1110
%{_libdir}/PreludeEasy.so
%endif
# opensuse 12.1 and older put PreludeEasy in the ruby dir, note that 12.1 has it both places
%if 0%{?suse_version} <= 1210
%{rb_sitearch}/PreludeEasy.so
%endif
%files doc
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog README NEWS COPYING LICENSE.README HACKING.README
%{_docdir}/%{name}-%{version}
%changelog