LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File rebar.spec of Package rebar (Project home:Ledest:erlang:17)

%define bname rebar
Name: %bname
Version: 2.6.0
Release: 4
Summary: A sophisticated build-tool for Erlang projects that follows OTP principles
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/basho/%bname
Source: %bname-%version.tar.xz
Source9: %name-rpmlintrc
Patch1: %bname-2.6.0-fix-link-drv.patch
BuildArch: noarch
Requires: erlang
Provides: erlang-rebar = %version-%release
Requires: update-alternatives

BuildRequires: rpm-macros-erlang >= 0.9.1 rpm-build-erlang >= 0.10.0
BuildRequires: erlang erlang-tools erlang-otp-devel erl_interface erlang-syntax_tools
BuildRequires: erlang-edoc
BuildRequires: update-alternatives
BuildRequires: erlang-crypto erlang-eunit

%description
%bname is an Erlang build tool that makes it easy to compile and test Erlang
applications, port drivers and releases. %bname is a self-contained Erlang script,
so it's easy to distribute or even embed directly in a project. Where possible,
%bname uses standard Erlang/OTP conventions for project structures, thus
minimizing the amount of build configuration work. %bname also provides dependency
management, enabling application writers to easily re-use common libraries from a
variety of locations (git, hg, etc).


%package static
Summary: A sophisticated build-tool for Erlang projects that follows OTP principles
Group: Development/Tools/Other
Provides: %name-bundle = %version-%release
Requires: erlang
Requires: erlang-otp-base erlang-syntax_tools

%description static
%bname is an Erlang build tool that makes it easy to compile and test Erlang
applications, port drivers and releases. %bname is a self-contained Erlang script,
so it's easy to distribute or even embed directly in a project. Where possible,
%bname uses standard Erlang/OTP conventions for project structures, thus
minimizing the amount of build configuration work. %bname also provides dependency
management, enabling application writers to easily re-use common libraries from a
variety of locations (git, hg, etc).


%package reltool
Summary: reltool support for rebar
Group: Development/Tools/Other
Requires: %name = %version-%release

%description reltool
%summary.


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

sed -i 's/0\.\.?LINE_LENGTH/integer()/' src/rebar_getopt.erl
sed -i 's/\(assertEqual\)_failed/\1/g' test/rebar_eunit_tests.erl


%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("rebar.config",
                lists:map(fun(E) -> io_lib:format("~p.~n", [E]) end,
                          [{erl_opts, proplists:delete(debug_info, [inline,slim|proplists:get_value(erl_opts, L)])},
                           {escript_shebang, "#!%_bindir/escript\n"}, {escript_comment, ""}, {escript_emu_args, ""}
                          |proplists:delete(erl_opts, L)])),
halt().'

./bootstrap

sed -i '/%{bname}_reltool/d' ebin/%bname.app

./rebar doc

cat > %bname.escript <<__EOF__
#!/usr/bin/escript
%%%%
main(A) -> rebar:main(A).
__EOF__


%install
install -pD -m 0755 %bname %buildroot%_bindir/%bname-bundle
ln -sf %bname-bundle %buildroot%_bindir/%bname-static
for d in ebin priv/templates; do
	install -d -m 0755 %buildroot%_otplibdir/%bname-%version/$d
	install -p -m 0644 $d/* %buildroot%_otplibdir/%bname-%version/$d/
done
install -pD %bname.escript -m 0755 %buildroot%_bindir/%bname-otp
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 CONTRIBUTING* README* RELEASE-NOTES* THANKS* %buildroot%_docdir/%name/

# alternatives
install -d -m 0755 %buildroot%_sysconfdir/alternatives
touch %buildroot%_sysconfdir/alternatives/%bname
ln -sf %_sysconfdir/alternatives/%bname %buildroot%_bindir/%bname

%add_erlang_req_beam_skiplist abnfc erlydtl lfe_comp neotoma protobuffs_compile eflame gpb_compile
%add_erlang_req_app_skiplist reltool


%post
%_sbindir/update-alternatives --quiet --install %_bindir/%bname %bname %_bindir/%bname-otp 10

%preun
[ "$1" != 0 ] || %_sbindir/update-alternatives --quiet --remove %bname %_bindir/%bname-otp


%post static
%_sbindir/update-alternatives --quiet --install %_bindir/%bname %bname %_bindir/%bname-bundle 5

%preun static
[ "$1" != 0 ] || %_sbindir/update-alternatives --quiet --remove %bname %_bindir/%bname-bundle


%check
./rebar eunit


%files
%defattr(-,root,root)
%doc %_docdir/%name
%_bindir/%bname-otp
%_otplibdir/*
%ghost %_bindir/%bname
%ghost %_sysconfdir/alternatives/*
%exclude %_otplibdir/%bname-*/ebin/%{name}_reltool*


%files reltool
%defattr(-,root,root)
%_otplibdir/%bname-*/ebin/%{name}_reltool*


%files static
%defattr(-,root,root)
%doc CONTRIBUTING* README* RELEASE-NOTES* THANKS*
%_bindir/%bname-bundle
%_bindir/%bname-static
%ghost %_bindir/%bname
%ghost %_sysconfdir/alternatives/*


%changelog
* Sat Jul 04 2015 Led <ledest@gmail.com> 2.6.0-4
- ignore requires of reltool app

* Fri Jun 26 2015 Led <ledest@gmail.com> 2.6.0-3
- fix test on Erlang 18

* Sun Jun 21 2015 Led <ledest@gmail.com> 2.6.0-2
- build docs
- ignore requires of eflame and gpb_compile modules

* Sat Jun 20 2015 Led <ledest@gmail.com> 2.6.0-1
- 2.6.0

* Sun May 31 2015 Led <ledest@gmail.com> 2.5.1-14
- remove rebar_reltool entry in rebar.app

* Sun Apr 12 2015 Led <ledest@gmail.com> 2.5.1-13
- update patches:
  + rebar-2.5.1-fix-link-drv.patch

* Sun Apr 12 2015 Led <ledest@gmail.com> 2.5.1-12
- cosmetic fixes

* Sun Apr 12 2015 Led <ledest@gmail.com> 2.5.1-11
- add patches:
  + rebar-2.5.1-fix-link-drv.patch

* Sun Apr 05 2015 Led <ledest@gmail.com> 2.5.1-10
- add erl_opts
- add %%check

* Sun Mar 22 2015 Led <ledest@gmail.com> 2.5.1-9
- use alternatives

* Sat Feb 21 2015 Led  <ledest@gmail.com> 2.5.1-8
- add rebar-reltool subpackage

* Thu Jan 29 2015 Led <ledest@gmail.com> 2.5.1-7
- ignore requires of protobuffs_compile module

* Thu Jan 29 2015 Led <ledest@gmail.com> 2.5.1-6
- ignore requires of neotoma module

* Thu Jan 29 2015 Led <ledest@gmail.com> 2.5.1-5
- ignore requires of lfe_comp module

* Thu Jan 29 2015 Led <ledest@gmail.com> 2.5.1-4
- ignore requires of erlydtl module

* Thu Jan 29 2015 Led <ledest@gmail.com> 2.5.1-3
- ignore requires of abnfc module

* Thu Jan 29 2015 Led <ledest@gmail.com> 2.5.1-2
- add %%name-static subpackage

* Fri Jan 16 2015 Led <ledest@gmail.com> 2.5.1-1
- 2.5.1
- fixed License
- updated BuildRequires
- updated Requires
- updated Provides

* Sat Mar 03 2012 Led <led@massivesolutions.co.uk> 2-2
- spec:
  + added Buildroot
  + updated BuildRequires

* Mon Feb 13 2012 Led <led@massivesolutions.co.uk> 2-1
- removed erlang-common_test from Requires

* Mon Feb 06 2012 Led <led@massivesolutions.co.uk> 2-0
- initial build for openSUSE