File shotgun.spec of Package shotgun

%define bname shotgun
Name: %bname
Version: 0.3.0
Release: 2
Summary: Erlang HTTP client with support for HTTP/1.1, SPDY and Websocket
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/inaka/%bname
Source: %bname-%version.tar.xz
Patch0: %bname-%version-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: erlang >= 1:17
BuildRequires: rebar >= 2.6.1-7

%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.


%package doc
Summary: %bname documentation
Group: Documentation/HTML
Provides: erlang-%bname-doc = %version-%release
Conflicts: %name < 0.3.0-1

%description doc
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.
This package contains documentation in HTML format.


%prep
%setup -q -n %bname-%version
%patch -p1 -P0


%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config", [[io_lib:print(E), ".\n"] || E <- lists:keydelete(deps, 1, L)], [raw]),
init:stop().'
ERL_COMPILER_OPTIONS="[inline,verbose]" rebar %{?_smp_mflags} -C %bname.rebar.config compile -v
rebar %{?_smp_mflags} -C %bname.rebar.config doc -v


%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
install -p -m 0644 *.md %buildroot%_docdir/%name/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/doc
install -p -m 0644 doc/*.{css,html,png} %buildroot%_otplibdir/%bname-%version/doc/
ln -sf %_otplibdir/%name-%version/doc %buildroot%_docdir/%name/html


%files
%defattr(-,root,root)
%_otplibdir/*
%exclude %_otplibdir/%bname-*/doc


%files doc
%defattr(-,root,root)
%doc %_docdir/%name
%doc %dir %_otplibdir/%bname-*
%doc %_otplibdir/%bname-*/doc


%changelog
* Fri May 31 2024 Led <ledest@gmail.com> 0.3.0-2
- fix patches applying

* Sat Aug 03 2019 Led <ledest@gmail.com> 0.3.0-1
- 0.3.0
- git 6e5174d

* Sun May 21 2017 Led <ledest@gmail.com> 0.2.3-2
- update BuildRequires

* Mon Feb 15 2016 Led <ledest@gmail.com> 0.2.3-1
- 0.2.3

* Mon Feb 15 2016 Led <ledest@gmail.com> 0.1.15-1
- 0.1.15

* Mon Nov 30 2015 Led <ledest@gmail.com> 0.1.14-1
- 0.1.14

* Sun Jul 26 2015 Led <ledest@gmail.com> 0.1.12-2
- fix URL

* Sun Jul 26 2015 Led <ledest@gmail.com> 0.1.12-1
- initial build
openSUSE Build Service is sponsored by