File ranch.spec of Package ranch

%def_enable check
%def_with docs

%define bname ranch
Name: %bname
Version: 1.3.2
Release: 6
Summary: Erlang socket acceptor pool for TCP protocols
License: ISC
Group: Development/Tools/Other
URL: https://github.com/extend/%bname
Source: %bname-%version.tar.xz
#Patch: %bname-%version-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang >= 0.9.9
BuildRequires: erlang erlang.mk
%{?_with_docs:BuildRequires: asciidoc libxslt dblatex}
%if_enabled check
# For tests
BuildRequires: epmd erlang-ct_helper ct_run eunit
%endif

%description
Ranch is a Erlang socket acceptor pool for TCP protocols.
Ranch aims to provide everything you need to accept TCP connections with a small
code base and low latency while being easy to use directly as an application or
to embed into your own.
Ranch provides a modular design, letting you choose which transport and protocol
are going to be used for a particular listener. Listeners accept and manage
connections on one port, and include facilities to limit the number of concurrent
connections. Connections are sorted into pools, each pool having a different
configurable limit.
Ranch also allows you to upgrade the acceptor pool without having to close any of
the currently opened sockets.


%package doc
Summary: Ranch documemtation
Group: Documentation

%description doc
Ranch is a Erlang socket acceptor pool for TCP protocols.
Ranch aims to provide everything you need to accept TCP connections with a small
code base and low latency while being easy to use directly as an application or
to embed into your own.
Ranch provides a modular design, letting you choose which transport and protocol
are going to be used for a particular listener. Listeners accept and manage
connections on one port, and include facilities to limit the number of concurrent
connections. Connections are sorted into pools, each pool having a different
configurable limit.
Ranch also allows you to upgrade the acceptor pool without having to close any of
the currently opened sockets.
This package contains Ranch documemtation.


%prep
%setup -q -n %bname-%version
#patch -p1
sed -i '/^DOC_DEPS/s/^/#/' Makefile
rm -rf ebin
ln -sf %_datadir/erlang.mk/erlang.mk ./


%build
make %{?_smp_mflags} \
	ERLC_OPTS="-Werror +inline +slim +warn_export_vars +warn_shadow_vars +warn_obsolete_guard +warn_export_all" \
	all %{?_with_docs:docs}


%install
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/ebin
install -p -m 0644 ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -d -m 0755 %buildroot%_docdir/%name/html
cp -r examples %buildroot%_docdir/%name/html/
%if_with docs
for i in 3 7; do
	install -d -m 0755 %buildroot%_mandir/man$i
	install -p -m 0644 doc/man$i/* %buildroot%_mandir/man$i/
done
install -p -m 0644 doc/html/* %buildroot%_docdir/%name/html/
install -p -m 0644 doc/*.pdf %buildroot%_docdir/%name/
%endif


%if_enabled check
%check
make %{?_smp_mflags} TEST_DEPS= tests
%endif


%files
%defattr(-,root,root)
%_otplibdir/*
%if_with docs
%_mandir/man3/*
%_mandir/man7/*
%endif


%files doc
%defattr(-,root,root)
%doc %_docdir/%name


%changelog
* Thu Apr 20 2017 Led <ledest@gmail.com> 1.3.2-6
- remove uniq node name for tests in erlang.mk

* Sun Apr 02 2017 Led <ledest@gmail.com> 1.3.2-5
- uniq node name for tests in erlang.mk

* Wed Mar 29 2017 Led <ledest@gmail.com> 1.3.2-4
- update BuildRequires

* Thu Feb 09 2017 Led <ledest@gmail.com> 1.3.2-3
- update BuildRequires

* Wed Feb 08 2017 Led <ledest@gmail.com> 1.3.2-2
- add doc subpackage
- fix License

* Wed Feb 08 2017 Led <ledest@gmail.com> 1.3.2-1
- 1.3.2

* Mon Dec 12 2016 Led <ledest@gmail.com> 1.3.0-2
- fix build

* Sun Dec 11 2016 Led <ledest@gmail.com> 1.3.0-1
- 1.3.0
- git f4f297c

* Fri Jul 15 2016 Led <ledest@gmail.com> 1.2.1-5
- fix BuildRequires

* Sat Jun 18 2016 Led <ledest@gmail.com> 1.2.1-4
- update ERLC_OPTS

* Sat Jun 18 2016 Led <ledest@gmail.com> 1.2.1-3
- use system erlang.mk

* Sun Jan 31 2016 Led <ledest@gmail.com> 1.2.1-2
- add epmd to BuildRequires

* Sun Jan 10 2016 Led <ledest@gmail.com> 1.2.1-1
- 1.2.1

* Sun Nov 29 2015 Led <ledest@gmail.com> 1.2.0-1
- 1.2.0
- remove patches:
  + ranch-1.1.0-git.patch

* Mon Apr 13 2015 Led <ledest@gmail.com> 1.1.0-6
- update BuildRequires

* Sun Apr 12 2015 Led <ledest@gmail.com> 1.1.0-5
- enable check
- clean up BuildRequires

* Sun Apr 05 2015 Led <ledest@gmail.com> 1.1.0-4
- clean up BuildRequires

* Wed Apr 01 2015 Led <ledest@gmail.com> 1.1.0-3
- disable check

* Wed Apr 01 2015 Led <ledest@gmail.com> 1.1.0-2
- add %%check section

* Wed Apr 01 2015 Led <ledest@gmail.com> 1.1.0-1
- initial build