File types.spec of Package types

%define bname types
Name: %bname
Version: 0.1.8
Release: 1
Summary: Reference implementation for Conflict-free Replicated Data Types in Erlang
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/lasp-lang/%bname
Source: %bname-%version.tar.xz
#Patch0: %bname-%version-git.patch
Patch1: %bname-0.1.7-doc.patch
Provides: erlang-%bname = %version-%release
BuildArch: noarch

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
# check
BuildRequires: epmd erlang-common_test erlang-proper

%description
%summary.


%package devel
Summary: Headers of %bname
Group: Development/Tools/Other
Provides: erlang-%bname-devel = %version-%release

%description devel
Headers of %bname.


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

%description doc
Documentation of %bname.


%prep
%setup -q -n %bname-%version
#patch0 -p1
%patch1 -p1


%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: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
install -p -m 0644 ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/include
install -p -m 0644 include/* %buildroot%_otplibdir/%bname-%version/include/
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 README* %buildroot%_docdir/%name/


%check
ERL_COMPILER_OPTIONS="[inline,verbose]" rebar eunit -v
ERL_COMPILER_OPTIONS="[inline,verbose]" rebar ct


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


%files devel
%defattr(-,root,root)
%dir %_otplibdir/%bname-*
%_otplibdir/%bname-*/include


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


%changelog
* Tue Dec 12 2017 Led <ledest@gmail.com> 0.1.7-1
- initial build
openSUSE Build Service is sponsored by