File hut.spec of Package hut

%define bname hut
Name: %bname
Version: 1.2.0
Release: 1
Summary: Helper library for making Erlang libraries logging framework agnostic
License: MIT
Group: Development/Tools/Other
URL: https://github.com/tolbrino/%bname
Source: %bname-%version.tar.xz
#Patch: %bname-%version-git.patch
Provides: erlang-%bname = %version-%release
Provides: %bname-devel = %version-%release
Provides: erlang-%bname-devel = %version-%release
BuildArch: noarch

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

%description
Hut is a header-only library for Erlang libraries and small applications to stay
agnostic to the logging framework in use. Its purpose is to allow the developers
of umbrella applications to use their logging framework of choice and ensure that
dependency stick to that choice as well.


%prep
%setup -q -n %bname-%version
#patch -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,
                          [{erl_opts, [slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]}|lists:foldl(fun proplists:delete/2, L, [deps, erl_opts])])),
halt().'
rebar -C %bname.rebar.config compile -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/include
install -p -m 0644 include/* %buildroot%_otplibdir/%bname-%version/include/
find examples -type f -not -name '.git*' -exec install -pD -m 0644 '{}' %buildroot%_otplibdir/%bname-%version/'{}' ';'


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


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


%changelog
* Fri Dec 23 2016 Led <ledest@gmail.com> 1.2.0-1
- initial build
openSUSE Build Service is sponsored by