File erlang-idna.spec of Package erlang-idna

%define bname idna
Name: erlang-%bname
Version: 4.0.0
Release: 3
Summary: A pure Erlang IDNA implementation
License: MIT
Group: Development/Tools/Other
URL: https://github.com/benoitc/erlang-%bname
Source: %bname-%version.tar.xz
BuildArch: noarch

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

%description
A pure Erlang IDNA implementation.


%prep
%setup -q -n %bname-%version


%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, lists:foldl(fun proplists:delete/2, L, [deps, cover_enabled]),
                                         {erl_opts, [slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]}))),
halt().'
rebar -C %bname.rebar.config compile -v
rebar -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%_otplibdir/%bname-%version/doc
install -p -m 0644 doc/*.{css,html,png} %buildroot%_otplibdir/%bname-%version/doc/
install -d -m 0755 %buildroot%_docdir/%name
install -p -m 0644 *.md %buildroot%_docdir/%name/
ln -sf %_otplibdir/%bname-%version/doc %buildroot%_docdir/%name/html


%check
rebar -C %bname.rebar.config eunit -v


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


%changelog
* Sun Mar 12 2017 Led <ledest@gmail.com> 4.0.0-3
- fix License

* Sun Mar 12 2017 Led <ledest@gmail.com> 4.0.0-2
- add README.md

* Sun Mar 12 2017 Led <ledest@gmail.com> 4.0.0-1
- initial build