File stringprep.spec of Package stringprep

%define bname stringprep
Name: %bname
Version: 1.0.30
Release: 1
Summary: Fast Stringprep implementation for Erlang / Elixir
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/processone/%bname
Source: %bname-%version.tar.xz
#Patch0: %bname-%version-git.patch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar > 2.6.1-7
BuildRequires: erts-devel
BuildRequires: gcc-c++
# check
BuildRequires: erlang-p1_utils >= 1.0.25

%description
Stringprep is a framework for preparing Unicode test strings in order to increase
the likelihood that string input and string comparison work.
The principle are defined in RFC-3454: Preparation of Internationalized Strings.
This library is leverage Erlang native NIF mechanism to provide extremely fast
and efficient processing.


%package doc
Summary: Documentation of %bname
Group: Documentation/HTML
Provides: erlang-%bname-doc = %version-%release
BuildArch: noarch
Conflicts: %name < 1.0.10

%description doc
Documentation 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",
                lists:map(fun(E) -> [io_lib:print(E), ".\n"] end,
                          lists:foldl(fun(K, A) -> lists:keydelete(K, 1, A) end, L, [deps, port_env])),
                [raw]),
init:stop().'
CFLAGS="%optflags" CXXFLAGS="%optflags" CC="%__cc" CXX="%__cxx" \
ERL_COMPILER_OPTIONS="[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/tools
install -p -m 0644 tools/* %buildroot%_otplibdir/%bname-%version/tools/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/priv/lib
install -p -m 0755 priv/lib/* %buildroot%_otplibdir/%bname-%version/priv/lib/
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/%name-%version/doc %buildroot%_docdir/%name/html
install -p -m 0644 *.md %buildroot%_docdir/%name/


%check
ERL_COMPILER_OPTIONS="[verbose]" rebar %{?_smp_mflags} -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
* Wed Jan 15 2025 Led <ledest@gmail.com> 1.0.30-1
- 1.0.30
- remove patches:
  + stringprep-1.0.28-test.patch

* Tue Jan 14 2025 Led <ledest@gmail.com> 1.0.28-3
- fix doc sybpackage arch
- fix patches applying

* Sat Aug 06 2022 Led <ledest@gmail.com> 1.0.28-2
- remove inline from erl_opts

* Sun Jun 12 2022 Led <ledest@gmail.com> 1.0.28-1
- 1.0.28
- add patches:
  + stringprep-1.0.28-test.patch

* Sun Nov 26 2017 Led <ledest@gmail.com> 1.0.10-1
- 1.0.10
- move docs to separate subpackage

* Sun Aug 13 2017 Led <ledest@gmail.com> 1.0.9-2
- update BuildRequires

* Sun Jul 16 2017 Led <ledest@gmail.com> 1.0.9-1
- 1.0.9

* Thu Mar 30 2017 Led <ledest@gmail.com> 1.0.8-1
- 1.0.8

* Sun Jan 01 2017 Led <ledest@gmail.com> 1.0.7-1
- initial build
openSUSE Build Service is sponsored by