File elixir-bson.spec of Package elixir-bson

%define bname bson
Name: elixir-%bname
Version: 0.4.4
Release: 1
Summary: BSON documents in Elixir language
License: MIT
Group: Development/Tools/Other
Source: %name-%version.tar.xz
BuildArch: noarch
Requires: elixir >= 1.0

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: mix ex_doc earmark

BSON implementation for Elixir Language.
BSON is a binary format in which zero or more key/value pairs are stored as a
single entity, called a document. It is a data type with a standard binary
representation defined at
This implements version 1.0 of that spec.

%setup -q -n %name-%version

sed -i '/elixir:/s/\.0"/"/' mix.exs

for c in compile docs; do
	LANG=en_US.UTF-8 mix $c --force --no-deps-check

install -d -m 0755 %buildroot%_otplibdir/%bname-%version/ebin
install -p -m 0644 _build/dev/lib/%bname/ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/doc
install -p -m 0644 doc/*.html %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/

%add_erlang_req_beam_skiplist Elixir.Bson.Encoder.Protocol.Function
%add_erlang_req_beam_skiplist Elixir.Bson.Encoder.Protocol.PID Elixir.Bson.Encoder.Protocol.Port
%add_erlang_req_beam_skiplist Elixir.Bson.Encoder.Protocol.Reference Elixir.Bson.Encoder.Protocol.Tuple

mix test --force --no-deps-check

%doc %_docdir/%name