File msgpack-erlang.spec of Package msgpack-erlang

%define bname msgpack
Name: %bname-erlang
Version: 0.8.1
Release: 1
Summary: MessagePack serializer/deserializer for Erlang
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/%bname/%name
Source: %name-%version.tar.xz
Patch0: %name-%version-git.patch
Patch1: 0001-rebar.config-add-18-19-20-21-26-to-require_otp_vsn.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release
Provides: %name-devel = %version-%release
Provides: erlang-%bname-devel = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
BuildRequires: erlang-eunit
BuildRequires: erlang-proper

%description
MessagePack serializer/deserializer for Erlang.


%package doc
Summary: Documentation of %bname
Group: Documentation/HTML
Provides: erlang-%bname-doc = %version-%release
Conflicts: %bname < 0.7.0-2

%description doc
MessagePack serializer/deserializer for Erlang.
This pacjage contains documentation of %bname.


%prep
%setup -q
%patch0 -p1
%patch1 -p1
sed -i '/^%%%%/s/@doc[[:blank:]]*//' src/msgpack_ext.erl
sed -i '/^%%%%/s/<</\&lt;\&lt;/g;/^%%%%/s/>>/\&gt;\&gt;/g' src/msgpack_packer.erl
sed -i 's|"\(/test/utf8.txt"\)|"/..\1|' test/msgpack_tests.erl
sed -i '/^-include(/s|msgpack\.hrl|../src/&|' test/prop_msgpack.erl


%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(edoc_opts, 1, lists:keydelete(deps, 1, L),
                                         {edoc_opts,
                                          case lists:keyfind(edoc_opts, 1, L) of
                                              {_, [_|_] = O} -> lists:keystore(preprocess, 1, O, {preprocess, true});
                                              _ -> [{preprocess, true}]
                                          end})),
                [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
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
ln -sf %_otplibdir/%bname-%version/doc %buildroot%_docdir/%name/html
install -p -m 0644 AUTHORS README* %buildroot%_docdir/%name/


%check
ERL_COMPILER_OPTIONS="[inline,verbose]" rebar -C %bname.rebar.config eunit


%files
%defattr(-,root,root)
%_otplibdir/*
%exclude %_otplibdir/%bname-*/doc


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


%changelog
* Wed Nov 15 2023 Led <ledest@gmail.com> 0.8.1-1
- 0.8.1
- remove patches:
  + 0001-rebar.config-add-22-to-require_otp_vsn.patch
  + 0002-rebar.config-add-23-to-require_otp_vsn.patch
  + 0003-rebar.config-add-24-to-require_otp_vsn.patch
  + 0004-rebar.config-add-25-to-require_otp_vsn.patch
  + 0005-rebar.config-add-26-to-require_otp_vsn.patch
- add patches:
  + 0001-rebar.config-add-18-19-20-21-26-to-require_otp_vsn.patch

* Sat Sep 02 2023 Led <ledest@gmail.com> 0.7.0-8
- add patches:
  + 0005-rebar.config-add-26-to-require_otp_vsn.patch

* Sun Jun 12 2022 Led <ledest@gmail.com> 0.7.0-7
- add patches:
  + 0004-rebar.config-add-25-to-require_otp_vsn.patch

* Sun Aug 22 2021 Led <ledest@gmail.com> 0.7.0-6
- add patches:
  + 0003-rebar.config-add-24-to-require_otp_vsn.patch

* Tue May 19 2020 Led <ledest@gmail.com> 0.7.0-5
- add patches:
  + 0002-rebar.config-add-23-to-require_otp_vsn.patch

* Sun Jul 07 2019 Led <ledest@gmail.com> 0.7.0-4
- add patches:
  + 0001-rebar.config-add-22-to-require_otp_vsn.patch

* Tue Oct 02 2018 Led <ledest@gmail.com> 0.7.0-3
- cosmetic changes in config generation

* Tue Oct 02 2018 Led <ledest@gmail.com> 0.7.0-2
- git f1e1b98
- move docs to separate subpackage

* Sun May 21 2017 Led <ledest@gmail.com> 0.7.0-1
- 0.7.0
- git 7e3334d

* Sun Nov 06 2016 Led <ledest@gmail.com> 0.6.0-1
- 0.6.0

* Fri Jul 15 2016 Led <ledest@gmail.com> 0.5.0-2
- git 919a69e

* Thu Jun 02 2016 Led <ledest@gmail.com> 0.5.0-1
- 0.5.0

* Fri Mar 18 2016 Led <ledest@gmail.com> 0.3.6-2
- clean up BuildRequires

* Sun Feb 28 2016 Led <ledest@gmail.com> 0.3.6-1
- 0.3.6

* Sun Dec 13 2015 Led <ledest@gmail.com> 0.3.5-1
- 0.3.5

* Fri Sep 04 2015 Led <ledest@gmail.com> 0.3.4-1
- 0.3.4
- update patches:
  + msgpack-erlang-0.3.4-git.patch

* Sat Jul 04 2015 Led <ledest@gmail.com> 0.3.3-3
- add patches:
  + msgpack-erlang-0.3.3-git.patch

* Fri Jun 26 2015 Led <ledest@gmail.com> 0.3.3-2
- fix build with Erlang 18

* Mon Apr 13 2015 Led <ledest@gmail.com> 0.3.3-1
- initial build
openSUSE Build Service is sponsored by