File gun.spec of Package gun
%define bname gun
Name: %bname
Version: 1.0.0
%define prerel -pre.3
Release: 0.6
Summary: Erlang HTTP client with support for HTTP/1.1, SPDY and Websocket
License: BSD-3-Clause
Group: Development/Tools/Other
URL: https://github.com/ninenines/%bname
Source: %bname-%version%prerel.tar.xz
Patch: %bname-%version%prerel-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release
BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
# docs
BuildRequires: asciidoc
# check
BuildRequires: epmd erlang-ct_helper ct_run erlang-ranch erlang-cowlib
%description
Gun aims to provide an easy to use client compatible with HTTP, SPDY and
Websocket. Gun is always connected. It will maintain a permanent connection to
the server, reopening it as soon as the server closes it, saving time for the
requests that come in.
All connections are supervised automatically, allowing developers to focus on
writing their code without worrying.
%prep
%setup -q -n %bname-%version%prerel
%patch -p1
sed -i '/^ERLC_OPTS/s/+debug_info/+slim +inline/' erlang.mk
sed -i -r '/^PROJECT_VERSION[[:space:]]*=/s/(=[[:space:]]*).*/\1%version/' Makefile
rm -f ebin/*
%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config",
lists:map(fun(E) -> [io_lib:print(E), ".\n"] end,
lists:keystore(erl_opts, 1, proplists:delete(deps, L),
{erl_opts,
[slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]})),
[raw]),
init:stop().'
make %{?_smp_mflags} DEPS= V=1 all docs
for i in doc/src/*/*.asciidoc; do
asciidoc -s $i
done
erl -noshell -eval '
A = "ebin/%bname.app",
{ok, [{application, %bname, L}]} = file:consult("ebin/%bname.app"),
file:write_file("ebin/%bname.app",
io_lib:format("{application, %bname, ~p}.~n", [lists:keystore(vsn, 1, L, {vsn, "%version"})]),
[raw]),
init:stop().'
%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
install -p -m 0644 README.* %buildroot%_docdir/%name/README.md
for d in doc/src/*; do
d=$(basename $d)
install -d -m 0755 %buildroot%_docdir/%name/html/$d
install -p -m 0644 doc/src/$d/*.html %buildroot%_docdir/%name/html/$d/
done
# gun_http2 requre cow_http2 (cowlib >= 1.3.0)
%add_erlang_req_beam_skiplist cow_http2
# gun_sse requre cow_sse (cowlib >= 2.0.0)
%add_erlang_req_beam_skiplist cow_sse
# gun_ws requre cow_ws (cowlib >= 1.1.0)
%add_erlang_req_beam_skiplist cow_ws
%check
make DEPS= TEST_DEPS= CT_SUITES=ws tests
%files
%defattr(-,root,root)
%doc %_docdir/%name
%_otplibdir/*
%changelog
* Tue Jul 25 2017 Led <ledest@gmail.com> 1.0.0-0.6
- ignore requires cow_http2, cow_sse, cow_ws
* Mon Jul 24 2017 Led <ledest@gmail.com> 1.0.0-0.5
- fix build
- build docs
* Mon Jul 24 2017 Led <ledest@gmail.com> 1.0.0-0.4
- 1.0.0-pre.3
- git 02fa5f3
* Sun Jan 31 2016 Led <ledest@gmail.com> 1.0.0-0.3
- add epmd to BuildRequires
* Sun Jul 26 2015 Led <ledest@gmail.com> 1.0.0-0.2
- add patches:
+ gun-1.0.0-pre.1-git.patch
- replcae deprecated functions
- build with erlang.mk
- add %%check
- disable build docs
- update BuildRequires
* Sun Jul 26 2015 Led <ledest@gmail.com> 1.0.0-0.1
- initial build