File bson-erlang.spec of Package bson-erlang

%define bname bson
Name: %bname-erlang
Version: 0.2.4
Release: 2
Summary: BSON implementation for Erlang
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/comtihon/%name
Source: %name-%version.tar.xz
#Patch0: %name-%version-git.patch
Patch1: %name-0.2.4-test.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
Provides: erlang-%bname-doc = %version-%release

%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
Provides: erlang-%bname-devel = %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
#patch0 -p1
%patch1 -p1
erl -noshell -eval '
{ok, [{application, %bname, L}]} = file:consult("src/%bname.app.src"),
file:write_file("src/%bname.app.src",
                io_lib:format("{application, %bname, ~81p}.~n",
                              [lists:foldl(fun({K, _} = E, A) -> lists:keystore(K, 1, A, E) end,
                                           L, [{vsn, "%version"}, {description, "%summary"}])]),
                [raw]),
init:stop().'


%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config", [[io_lib:print(E), ".\n"] || E <- lists:keydelete(deps, 1, L)], [raw]),
init:stop().'
ERL_COMPILER_OPTIONS="[inline,verbose]" rebar %{?_smp_mflags} -C %bname.rebar.config compile -v
rebar %{?_smp_mflags} -C %bname.rebar.config doc -v


%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
ERL_COMPILER_OPTIONS="[inline,verbose]" 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
* Fri Dec 29 2023 Led <ledest@gmail.com> 0.2.4-2
- add patches:
  + bson-erlang-0.2.4-test.patch

* Sun Mar 05 2023 Led <ledest@gmail.com> 0.2.4-1
- 0.2.4

* Sun Mar 05 2023 Led <ledest@gmail.com> 0.2.3-1
- 0.2.3
- fix Summary
- fix app description

* Mon Mar 15 2021 Led <ledest@gmail.com> 0.2.2-8
- update License

* Sun May 21 2017 Led <ledest@gmail.com> 0.2.2-7
- revert BuildRequires

* Sat May 20 2017 Led <ledest@gmail.com> 0.2.2-6
- update BuildRequires

* Thu Apr 06 2017 Led <ledest@gmail.com> 0.2.2-5
- update URL

* Wed Apr 05 2017 Led <ledest@gmail.com> 0.2.2-4
- add Provides

* 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