File depcache.spec of Package depcache

%define bname depcache
Name: %bname
Version: 1.2.1
Release: 1
Summary: An in-memory caching server for Erlang 
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/zotonic/%bname
Source: %bname-%version.tar.xz
Patch: %bname-%version-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar erl_interface

%description
depcache is an in-memory caching server for Erlang with dependency checks, cache
expiration and local in process memoization of lookups. It is used by the Zotonic
project for all memory-related caching strategies.


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


%build
echo "{erl_opts, [slim, inline, no_debug_info]}." > %bname.rebar.config
for c in compile doc; do
	rebar -C %bname.rebar.config $c -v
done


%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/include
install -p -m 0644 include/* %buildroot%_otplibdir/%bname-%version/include/
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
ln -sf %_otplibdir/%bname-%version/doc %buildroot%_docdir/%name/html
install -p -m 0644 README* %buildroot%_docdir/%name/


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


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


%changelog
* Sun Jun 26 2016 Led <ledest@gmail.com> 1.2.1-1
- 1.2.1
- git 96b1aea
- remove patches:
  + depcache-1.1-doc.patch

* Sun Jun 07 2015 Led <ledest@gmail.com> 1.1-1
- initial build