-%define git_snapshot 5462dab
-Summary: Platform layer for node.js
+#
+# Conditional build:
+%bcond_without static_libs # static library
+%bcond_with tests # build with tests (require network access)
+
+Summary: Multi-platform support library with a focus on asynchronous I/O
+Summary(pl.UTF-8): Wieloplatformowa biblioteka wspierająca skupiająca się na asynchronicznym we/wy
Name: libuv
-Version: 0.10.3
+Version: 1.18.0
Release: 1
-License: MIT
-Group: Development/Tools
-URL: http://nodejs.org/
-Source0: http://libuv.org/dist/v%{version}/%{name}-v%{version}.tar.gz
-# Source0-md5: fb20265511ebb7f0785f83c60a650324
-Source2: %{name}.pc.in
-# backport fix to FTBFS in nodejs-0.10.3
-# https://github.com/joyent/node/issues/5213
-Patch0001: 0001-unix-include-uv.h-in-src-version.c.patch
-BuildRequires: gyp
-BuildRequires: libstdc++-devel
+# the licensing breakdown is described in detail in the LICENSE file
+License: MIT and BSD and ISC
+Group: Libraries
+Source0: https://dist.libuv.org/dist/v%{version}/%{name}-v%{version}.tar.gz
+# Source0-md5: dc51c45ac5baab37e1abc87906ac7af1
+URL: http://libuv.org/
+BuildRequires: autoconf >= 2.57
+BuildRequires: automake >= 1:1.12
+BuildRequires: libtool >= 2:2
BuildRequires: pkgconfig
-# Bundling exception request:
-# https://fedorahosted.org/fpc/ticket/231
-Provides: bundled(libev) = 4.04
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-# we only need major.minor in the SONAME in the stable (even numbered) series
-# this should be changed to %%{version} in unstable (odd numbered) releases
-%define sover 0.10
-
%description
-libuv is a new platform layer for Node. Its purpose is to abstract
-IOCP on Windows and libev on Unix systems. We intend to eventually
-contain all platform differences in this library.
+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.
+
+%description -l pl.UTF-8
+libuv to wieloplatformowa biblioteka wspierająca, skupiająca się na
+asynchronicznych operacjach wejścia-wyjścia. Była rozwijana głównie z
+myślą o wykorzystaniu w Node.js, ale obecnie jest używana także przez
+projekty takie jak Luvit, Julia, pyuv i inne.
%package devel
-Summary: Development libraries for libuv
-Group: Development/Tools
+Summary: Header files for libuv library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki libuv
+Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
-Development libraries for libuv
+Development libraries for libuv.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki libuv.
+
+%package static
+Summary: Static libuv library
+Summary(pl.UTF-8): Statyczna biblioteka libuv
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static libuv library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka libuv.
%prep
%setup -q -n %{name}-v%{version}
-%patch0001 -p1
+
+# serial-tests is available in v1.12 and newer.
+echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [serial-tests])" > m4/libuv-extra-automake-flags.m4
%build
-CC="%{__cc}" \
-CXX="%{__cxx}" \
-LDFLAGS="%{rpmldflags}" \
-CFLAGS="%{rpmcflags} %{rpmcppflags}" \
-CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
-./gyp_uv \
- -Dcomponent=shared_library \
- -Dlibrary=shared_library
-
-# Modify the build so it produces a versioned shared library
-sed -i -e "s/libuv.so/libuv.so.%{sover}/g" out/{libuv,run-benchmarks,run-tests}.target.mk
-
-%{__make} V=1 -C out \
- CC="%{__cc}" \
- CXX="%{__cxx}" \
- BUILDTYPE=Release \
- CC.host="%{__cc}" \
- CXX.host="%{__cxx}" \
- LDFLAGS.host="%{rpmldflags}"
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__automake}
+%configure \
+ ac_cv_lib_nsl_gethostbyname=no \
+ --disable-silent-rules \
+ %{!?with_static_libs:--disable-static}
+%{__make}
%if %{with tests}
-# Tests are currently disabled because some require network access
-#./run-tests
-#./run-benchmarks
+./run-tests
+./run-benchmarks
%endif
%install
rm -rf $RPM_BUILD_ROOT
-# Copy the shared lib into the libdir
-install -d $RPM_BUILD_ROOT%{_libdir}
-cp -p out/Release/obj.target/libuv.so.%{sover} $RPM_BUILD_ROOT%{_libdir}/libuv.so.%{version}
-lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libuv.so.*.*.*)
-ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libuv.so.%{sover}
-ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libuv.so
-
-# Copy the headers into the include path
-install -d $RPM_BUILD_ROOT/%{_includedir}/uv-private
-cp -p include/uv.h $RPM_BUILD_ROOT/%{_includedir}
-cp -p \
- include/uv-private/ngx-queue.h \
- include/uv-private/tree.h \
- include/uv-private/uv-linux.h \
- include/uv-private/uv-unix.h \
- $RPM_BUILD_ROOT/%{_includedir}/uv-private
-
-# Create the pkgconfig file
-install -d $RPM_BUILD_ROOT/%{_pkgconfigdir}
-sed -e "s#@prefix@#%{_prefix}#g" \
- -e "s#@exec_prefix@#%{_exec_prefix}#g" \
- -e "s#@libdir@#%{_libdir}#g" \
- -e "s#@includedir@#%{_includedir}#g" \
- -e "s#@version@#%{version}.git%{git_snapshot}#g" \
- %{SOURCE2} > $RPM_BUILD_ROOT%{_pkgconfigdir}/libuv.pc
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+# obsoleted by .pc file
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libuv.la
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc README.md AUTHORS LICENSE
+%doc AUTHORS ChangeLog LICENSE README.md
%attr(755,root,root) %{_libdir}/libuv.so.*.*.*
-%ghost %{_libdir}/libuv.so.%{sover}
+%attr(755,root,root) %ghost %{_libdir}/libuv.so.1
%files devel
%defattr(644,root,root,755)
-%doc README.md AUTHORS LICENSE
-%{_libdir}/libuv.so
+%attr(755,root,root) %{_libdir}/libuv.so
%{_pkgconfigdir}/libuv.pc
%{_includedir}/uv.h
-%{_includedir}/uv-private
+%{_includedir}/uv-errno.h
+%{_includedir}/uv-linux.h
+%{_includedir}/uv-threadpool.h
+%{_includedir}/uv-unix.h
+%{_includedir}/uv-version.h
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libuv.a
+%endif