File libuv.spec of Package libuv

%define realname libuv
%define realver  1.33.1
%define srcext   tar.gz

%define so_ver   1

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}%{?so_ver}
%if 0%{?rhel}
Epoch:         1
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/Libraries
Summary:       Cross-platform asynchronous I/O

# Install-time parameters
Provides:      %{realname} = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes:     %{realname} < %{?epoch:%{epoch}:}%{version}-%{release}

# Build-time parameters
BuildRequires: cmake >= 3.4
BuildRequires: pkgconfig
BuildRoot:     %{_tmppath}/%{name}-root

libuv is a multi-platform support library with a focus on asynchronous I/O.
It was primarily developed for use by Node.js, but it's also used by Luvit,
Julia, pyuv, and others.

Feature highlights:

  * Full-featured event loop backed by epoll, kqueue, IOCP, event ports.
  * Asynchronous TCP and UDP sockets
  * Asynchronous DNS resolution
  * Asynchronous file and file system operations
  * File system events
  * ANSI escape code controlled TTY
  * IPC with socket sharing, using Unix domain sockets or named pipes (Windows)
  * Child processes
  * Thread pool
  * Signal handling
  * High resolution clock
  * Threading and synchronization primitives

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides:      %{name}-devel = %{?epoch:%{epoch}:}%{version}-%{release}

%description -n %{realname}-devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%setup -q -n %{realname}-v%{version}%{?extraver}

_CFLAGS='%{optflags} %{?gcc_lto}'
_CXXFLAGS='%{optflags} %{?gcc_lto} %{?cxx11abi}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}'
mkdir build
cd build
cmake .. \
%{__make} %{?_smp_mflags}
cd -

%{__make} install DESTDIR=%{buildroot} -C build
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc/libuv/LICENSE

[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}


# Development stuff
%files -n %{realname}-devel
%exclude %{_libdir}/*.a

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig