File bitcask.spec of Package bitcask

%define bname bitcask
Name: %bname
Version: 2.0.8
Release: 2
Summary: A Log-Structured Hash Table for Fast Key/Value Data
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/basho/%bname
Source: %bname-%version.tar.xz
#Patch: %bname-%version-git.patch
Provides: erlang-%bname = %version-%release
Requires: erlang >= R14B04
Requires: erlang-otp-base >= R14B04

BuildRequires: erlang >= R14B04
BuildRequires: erlang-otp-base >= R14B04
BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
BuildRequires: erts-devel

%description
Bitcask is a log-structured hash table for fast key/value data.


%prep
%setup -q -n %bname-%version
#patch -p1
echo '-compile([no_inline]).' >> src/bitcask_nifs.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,
                          [{erl_opts, [slim, inline, no_debug_info, nowarn_deprecated_function, nowarn_export_all|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]}|lists:foldl(fun proplists:delete/2, L, [deps, erl_opts])])),
halt().'
CC=%__cc LINKER=%__cc CFLAGS="%optflags" \
rebar -C %bname.rebar.config compile -v
rebar -C %bname.rebar.config doc


%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/
cp -a priv %buildroot%_otplibdir/%bname-%version/
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 THANKS doc/*.pdf %buildroot%_docdir/%name/


%if 0
%check
rebar -C %bname.rebar.config eunit
%endif


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


%changelog
* Fri May 05 2017 Led <ledest@gmail.com> 2.0.8-2
- add no_inline option for bitcask_nifs module

* Sun Mar 19 2017 Led <ledest@gmail.com> 2.0.8-1
- 2.0.8

* Tue Feb 07 2017 Led <ledest@gmail.com> 2.0.7-1
- 2.0.7

* Mon Dec 12 2016 Led <ledest@gmail.com> 2.0.6-1
- 2.0.6
- add nowarn_export_all compile option

* Mon Jun 27 2016 Led <ledest@gmail.com> 2.0.2-2
- add bitcask-intro.pdf

* Sun Jun 26 2016 Led <ledest@gmail.com> 2.0.2-1
- 2.0.2

* Mon Jan 18 2016 Led <ledest@gmail.com> 2.0.1-1
- initial build
openSUSE Build Service is sponsored by