LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File eini.spec of Package eini (Project home:Ledest:erlang:18)

%define bname eini
Name: %bname
Version: 1.2.4
Release: 1
Summary: Erlang INI parser
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/goj/%bname
Source: %bname-%version.tar.xz
BuildArch: noarch
Provides: erlang-%bname = %version-%release

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

%description
Eini is an Erlang INI parser.


%prep
%setup -q -n %bname-%version
sed -i '1s|^.*$|#!%__escript|' examples/*.escript
erl -noshell -eval '
{ok, [{application, Name, L}]} = file:consult("src/%bname.app.src"),
lists:keyfind(vsn, 1, L) =:= {vsn, "%version"} orelse
    file:write_file("src/%bname.app.src",
                    io_lib:format("{application, ~s, ~p}.~n", [Name, lists:keystore(vsn, 1, L, {vsn, "%version"})])),
halt().'


%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, proplists:delete(deps, L),
                                         {erl_opts, [slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]}))),
halt().'
rebar -C %bname.rebar.config compile -v
rebar -C %bname.rebar.config doc -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/doc
install -p -m 0644 doc/*.{css,html,png} %buildroot%_otplibdir/%bname-%version/doc/
install -d -m 0755 %buildroot%_docdir/%name/examples
install -p -m 0644 README.* %buildroot%_docdir/%name/
install -p -m 0644 examples/* %buildroot%_docdir/%name/examples/
ln -sf %_otplibdir/%bname-%version/doc %buildroot%_docdir/%name/html


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


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


%changelog
* Tue Mar 07 2017 Led <ledest@gmail.com> 1.2.4-1
- initial build