Summary:	High-performance event loop/event model
Name:		libev
Epoch:		1
Version:	4.33
Release:	2
License:	BSD
Group:		System/Libraries
Url:		http://software.schmorp.de/pkg/libev.html
Source0:	http://dist.schmorp.de/libev/%{name}-%{version}.tar.gz
Source1:	%{name}.pc.in
BuildRequires: gcc gcc-c++ make autoconf automake libtool pkgconfig
%if %{defined centos_version}
BuildRequires: chkconfig
%endif
BuildRequires: pkgconfig

%description
libev is a high-performance event loop/event model with lots of features.
(see benchmark at http://libev.schmorp.de/bench.html)

It is modelled (very losely) after libevent and the Event perl module,
but aims to be faster and more correct, and also more featureful.

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

%define library_name libev4
%package -n %{library_name}
Summary: High-performance event loop/event model
Group:	 System/Libraries
AutoReqProv: Yes
Provides: %{library_name} = %{version}

%description -n %{library_name}
libev is a high-performance event loop/event model with lots of features.
(see benchmark at http://libev.schmorp.de/bench.html)

It is modelled (very losely) after libevent and the Event perl module,
but aims to be faster and more correct, and also more featureful.

%files -n %{library_name}
%{_libdir}/libev.so.4*

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

%package devel
Summary:	High-performance event loop/event model
Group:      Development/Libraries/C and C++
Provides:	%{name}-devel = %{version}
Requires:   %{library_name} = %{version}

%description devel
This is the development files needed in order to develop applications using
libev.

%files devel
%doc README
%{_includedir}/%{name}/ev*.h
%{_libdir}/libev*.so
%{_libdir}/pkgconfig/%{name}.pc 
%{_mandir}/man3/ev*

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

%prep
%autosetup -p1
sed -i -e "/^AM_INIT_AUTOMAKE/a\ " configure.ac

# Add pkgconfig support
cp -p %{SOURCE1} .
sed -i -e 's|Makefile|Makefile libev.pc|' configure.ac configure
sed -i -e 's|lib_LTLIBRARIES|pkgconfigdir = $(libdir)/pkgconfig\n\npkgconfig_DATA = libev.pc\n\nlib_LTLIBRARIES|' \
    Makefile.am Makefile.in

%build
export CC=gcc
autoreconf -fiv
%configure \
	--disable-static \
	--includedir=%{_includedir}/%{name}

%make_build

%install
%make_install
rm -f %{buildroot}%{_libdir}/libev.la
#mkdir -p %{buildroot}%{_libdir}/pkgconfig
#cp %{SOURCE1} %{buildroot}%{_libdir}/pkgconfig/libev.pc

%changelog
* Thu Dec 24 2015 mpluskal@suse.com
- Update to 4.22
  * when epoll detects unremovable fds in the fd set, rebuild only
    the epoll descriptor, not the signal pipe, to avoid SIGPIPE in
    ev_async_send. This doesn't solve it on fork, so document what
    needs to be done in ev_loop_fork (analyzed by Benjamin Mahler).
  * remove superfluous sys/timeb.h include on win32 (analyzed by
    Jason Madden).
  * updated libecb.