File bson-erlang.spec of Package bson-erlang

%define bname bson
Name: %bname-erlang
Version: 0.2.2
Release: 3
Summary: Bson implementation for Erlang
License: Public domain
Group: Development/Tools/Other
URL: https://github.com/soundrop/%name
Source: %name-%version.tar.xz
#Patch: %name-%version-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release
Requires: erlang >= 1:18

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

%description
BSON implementation for Erlang.
BSON is a record-like data type with a standard binary representation defined at
<http://www.bsonspec.org>. This implements version 1.0 of that spec. The standard
binary form allows for easy data interchange between systems.


%package doc
Summary: BSON implementation for Erlang documentation
Group: Development/Tools/Other

%description doc
BSON implementation for Erlang.
BSON is a record-like data type with a standard binary representation defined at
<http://www.bsonspec.org>. This implements version 1.0 of that spec. The standard
binary form allows for easy data interchange between systems.
This package contains documentation for %name.


%package devel
Summary: BSON implementation for Erlang headers
Group: Development/Tools/Other
Requires: %name = %version-%release

%description devel
BSON implementation for Erlang.
BSON is a record-like data type with a standard binary representation defined at
<http://www.bsonspec.org>. This implements version 1.0 of that spec. The standard
binary form allows for easy data interchange between systems.
This package contains headers for %name.


%prep
%setup -q
#patch -p1

erl -noshell -eval '
A = "src/%bname.app.src",
{ok, [{application, %bname, L}]} = file:consult(A),
file:write_file(A, io_lib:format("{application, %bname, ~p}.~n", [lists:keyreplace(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:format("~p.~n", [E]) end,
                          lists:keystore(erl_opts, 1, proplists:delete(cover_enabled, 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,include,doc},%_docdir/%name}
install -p -m 0644 ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -p -m 0644 include/* %buildroot%_otplibdir/%bname-%version/include/
install -p -m 0644 doc/*.{css,html,png} %buildroot%_otplibdir/%bname-%version/doc/
ln -sf %_otplibdir/%bname-%version/doc %buildroot%_docdir/%name/html
install -p -m 0644 README* %buildroot%_docdir/%name/


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


%files
%defattr(-,root,root)
%dir %_otplibdir/*
%_otplibdir/*/ebin


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


%files devel
%defattr(-,root,root)
%_otplibdir/*/include


%changelog
* Wed Mar 23 2016 Led <ledest@gmail.com> 0.2.2-3
- clean up BuildRequires

* Sun Aug 09 2015 Led <ledest@gmail.com> 0.2.2-2
- update Requires and BuildRequires

* Sun Aug 09 2015 Led <ledest@gmail.com> 0.2.2-1
- 0.2.2

* Thu Aug 06 2015 Led <ledest@gmail.com> 0.2.1-1
- 0.2.1
- remove patches:
  + bson-erlang-0.1.3-git.patch

* Sun Apr 05 2015 Led <ledest@gmail.com> 0.1.3-7
- add 'inline' to erl_opts
- add %%check

* Mon Mar 30 2015 Led <ledest@gmail.com> 0.1.3-6
- spec: cosmetic fixes

* Mon Mar 30 2015 Led <ledest@gmail.com> 0.1.3-5
- spec: cosmetic fixes

* Sat Feb 28 2015 Led <ledest@gmail.com> 0.1.3-4
- added provides

* Wed Feb 25 2015 Led <ledest@gmail.com> 0.1.3-3
- fixed URL

* Wed Feb 25 2015 Led <ledest@gmail.com> 0.1.3-2
- fixed spec file name

* Wed Feb 25 2015 Led <ledest@gmail.com> 0.1.3-1
- initial build
openSUSE Build Service is sponsored by