LogoopenSUSE Build Service > Projects
Sign Up | Log In

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

%define bname setup
Name: erlang-%bname
Version: 1.8.1
Release: 1
Summary: Generic setup utility for Erlang-based systems
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/processone/%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 >= 2.6.1-7

%description
%summary.
This utility offers a framework for initializing and configuring a system, with a
set of conventions allowing each component to provide callbacks for different
steps in the installation procedure.


%prep
%setup -q -n %bname-%version
#patch -p1
rm -f doc/edoc-info
erl -noshell -eval '
A = "src/%bname.app.src",
{ok, [{application, %bname, L}]} = file:consult(A),
file:write_file(A, io_lib:format("{application, %bname, ~81p}.~n", [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,
                          [{erl_opts, [slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]},
                           {edoc_opts, proplists:delete(doclet, lists:foldl(fun(E, A) -> proplists:get_value(E, A, []) end, L, [profiles, docs, edoc_opts]))}
                           |lists:foldl(fun proplists:delete/2, L, [erl_opts, deps, post_hooks, profiles])])),
halt().'
ln -s rebar.config.script %bname.rebar.config.script
MAKE=rebar \
rebar -C %bname.rebar.config compile -v
rebar -C %bname.rebar.config doc -v
cat > setup_gen.escript <<__EOF__
#!/usr/bin/escript
%%%%
%%%%
main(A) -> setup_gen:main(A).
__EOF__


%install
install -pD -m 0755 setup_gen.escript %buildroot%_bindir/setup_gen
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/examples
install -p -m 0644 examples/* %buildroot%_otplibdir/%bname-%version/examples/
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
ln -sf %_otplibdir/%bname-%version/examples %buildroot%_docdir/%name/examples
install -p -m 0644 *.md %buildroot%_docdir/%name/


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


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


%changelog
* Sun Feb 12 2017 Led <ledest@gmail.com> 1.0.3-1
- initial build