File exmlrpc.spec of Package exmlrpc

%define bname xmlrpc
Name: e%bname
Version: 0.1.0
Release: 0.2
Summary: Erlang XML-RPC library
License: BSD-2-Clause
Group: Development/Tools/Other
URL: https://github.com/rwbr/%bname
Source: %name.tar.xz
BuildArch: noarch
Provides: erlang-%bname = %version-%release

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

%description
This is an Erlang implementation of an HTTP 1.1 compliant XML-RPC library.
The library is compliant with the XML-RPC specification published by
http://www.xmlrpc.org/.


%prep
%setup -q -n %name
sed -i 's/errro/error/' src/xmlrpc_http.erl
sed -i 's/\(error_msg\):\(error_logger\)(/\2:\1(/' src/xmlrpc.erl
sed -i '1i%%%% coding: latin-1' src/*.[eh]rl


%build
erl -noshell -eval '
file:write_file("%name.rebar.config",
                lists:map(fun(E) -> io_lib:format("~p.~n", [E]) end,
                          [{erl_opts, [slim, inline, no_debug_info, warnings_as_errors]}])),
halt().'
for c in compile doc; do
	rebar -C %name.rebar.config $c -v
done


%install
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/ebin
install -p -m 0644 ebin/{xmlrpc,tcp}* %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 README %buildroot%_docdir/%name/
ln -sf %_otplibdir/%bname-%version/doc %buildroot%_docdir/%name/html



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


%changelog
* Mon Apr 18 2016 Led <ledest@gmail.com> 0.1.0-0.2
- fix lib dir name

* Mon Apr 18 2016 Led <ledest@gmail.com> 0.1.0-0.1
- initial build
openSUSE Build Service is sponsored by