File euneus.spec of Package euneus

%define bname euneus
Name: %bname
Version: 1.2.2
Release: 1
Summary: An flexible and performant JSON parser, generator and formatter in pure Erlang
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/williamthome/%bname
Source: %bname-%version.tar.xz
#Patch0: %bname-%version-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
BuildRequires: erlang-otpbp-devel >= 0.37.0

%description
An incredibly flexible and performant JSON parser, generator and formatter
in pure Erlang.
Euneus is a rewrite of Thoas.
Like Thoas, both the parser and generator fully conform to RFC 8259
(https://tools.ietf.org/html/rfc8259) and ECMA 404
(http://www.ecma-international.org/publications/standards/Ecma-404.htm).


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

%description doc
An incredibly flexible and performant JSON parser, generator and formatter
in pure Erlang.
This package contains socumentation of %bname.


%prep
%setup -q -n %bname-%version
#patch -p1 -P0


%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().'
ln -sf rebar.config.script %bname.rebar.config.script
%if %_otp_release < 21
ERL_COMPILER_OPTIONS="[inline,verbose,{parse_transform,otpbp_pt}]" \
%else
ERL_COMPILER_OPTIONS="[inline,verbose]" \
%endif
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 *.md %buildroot%_docdir/%name/


%check
%if %_otp_release < 21
ERL_COMPILER_OPTIONS="[inline,verbose,{parse_transform,otpbp_pt}]" \
%else
ERL_COMPILER_OPTIONS="[inline,verbose]" \
%endif
rebar -C %bname.rebar.config eunit -v


%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
* Sun Apr 27 2025 Led <ledest@gmail.com> 1.2.2-1
- 1.2.2
openSUSE Build Service is sponsored by