File stringprep.spec of Package stringprep

%define bname stringprep
Name: %bname
Version: 1.0.9
Release: 1
Summary: Fast Stringprep implementation for Erlang / Elixir
License: Apache-2.0
Group: Development/Tools/Other
Source: %bname-%version.tar.xz
#Patch: %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: c++_compiler
# check
BuildRequires: erlang-p1_utils >= 1.0.9

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.

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

erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
                lists:map(fun(E) -> [io_lib:print(E), ".\n"] end,
                          [{erl_opts, [slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L))]}|lists:foldl(fun proplists:delete/2, L, [erl_opts, deps, cover_enabled, port_env])]),
CFLAGS="%optflags" CXXFLAGS="%optflags" CC="%__cc" CXX="%__cxx" \
rebar -C %bname.rebar.config compile -v
rebar -C %bname.rebar.config doc -v

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/

rebar -C %bname.rebar.config eunit

%doc %_docdir/%name

* Sun Jul 16 2017 Led <> 1.0.9-1
- 1.0.9

* Thu Mar 30 2017 Led <> 1.0.8-1
- 1.0.8

* Sun Jan 01 2017 Led <> 1.0.7-1
- initial build