File exmlrpc.spec of Package exmlrpc

%def_disable debug

%define bname exmlrpc
Name: %bname
Version: 0.1.0
%define Release 0.1
Release: %Release
Summary: Erlang XML-RPC library
License: BSD
Group: Development/Libraries/Other
URL: https://github.com/rwbr/%bname/
Source: %name.tar.gz
BuildArch: noarch
Requires: erlang-otp
Buildroot: %buildroot

%define __find_provides %erlang_provides
%define __find_requires %erlang_requires
BuildRequires: rpm-build-erlang
BuildRequires: erlang-otp-devel rebar erlang-devel symlinks

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


%package doc
Summary: Documentation for %name
Group: Documentation/HTML

%description doc
This is an Erlang implementation of an HTTP 1.1 compliant XML-RPC library.
This package contains HTML documentation for %name and examples.


%prep
%setup -q -n %name
sed -i 's/errro/error/g' src/xmlrpc_http.erl
sed -i -r 's/(error_msg):(error_logger)/\2:\1/g' src/xmlrpc.erl
sed -i 's/ test\.erl//' src/Makefile


%build
cat > rebar.config <<__EOF__
{erl_opts, [
%if_enabled debug
	debug_info,
%else
	no_debug_info,slim,compressed,
%endif
	inline]}.
__EOF__

rebar %{?_smp_mflags} -v compile doc


%install
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/ebin
install -m 0644 ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -d -m 0755 %buildroot{%_otplibdir/%bname-%version/doc,%_docdir/%name-%version}
install -m 0644 doc/*.{css,html,png,txt} %buildroot%_otplibdir/%bname-%version/doc/
ln -s %buildroot%_otplibdir/%bname-%version/doc %buildroot%_docdir/%name-%version/html
symlinks -csd %buildroot%_docdir/%name-%version


%files
%defattr(-,root,root)
%dir %_otplibdir/*
%_otplibdir/*/ebin


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


%changelog
* Thu Apr 05 2012 Led <led@massivesolutions.co.uk> 0.1.0-0.1
- initial build