File pgapp.spec of Package pgapp

%define bname pgapp
Name: %bname
Epoch: 1
Version: 0.0.1
Release: 3
Summary: Erlang Postgres application that uses Poolboy and deals with the database being unavailable
License: MIT
Group: Development/Tools/Other
URL: https://github.com/epgsql/%bname
Source: %bname.tar.xz
Patch1: %bname-doc.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

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

%description
This code is a front end for epgsql that adds a pool (poolboy, for the moment),
and code to isolate crashes in the epgsql library: if your database goes down,
you probably don't want the rest of the application to fail as well.


%prep
%setup -q -n %bname
%patch1 -p1


%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:keydelete(deps, 1, L), {erl_opts, [slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]}))),
halt().'
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/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* %bname.config* %buildroot%_docdir/%name/


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


%changelog
* Sat May 14 2016 Led <ledest@gmail.com> 1:0.0.1-3
- git 7183895
- use %%__rebar macro

* Mon Mar 21 2016 Led <ledest@gmail.com> 1:0.0.1-2
- clean up BuildRequires

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

* Tue Dec 01 2015 Led <ledest@gmail.com> 1-3
- git 94133b1
- updated patches:
  + pgapp-doc.patch

* Sat Jul 04 2015 Led <ledest@gmail.com> 1-2
- git 7c59760

* Sat Jun 06 2015 Led <ledest@gmail.com> 1-1
- initial build