File elixir.spec of Package elixir

%def_enable check

Name: elixir
Version: 1.12.3
Release: 3
License: Apache-2.0
Summary: Functional meta-programming aware language built on top of the Erlang
Url: http://%name-lang.org
Group: Development/Languages/Other
Source: %name-%version.tar.xz
Patch0: %name-%version-git.patch
Patch1: %name-1.12.3-protocol-debug_info.patch
BuildArch: noarch
Provides: %name-logger = %version-%release
Requires: erlang >= 1:21.2
Requires: erlang-otp-base >= 1:21.2

BuildRequires: rpm-build-erlang >= 0.9.8
BuildRequires: erlang >= 1:21.2
BuildRequires: erl_interface >= 1:21.2
BuildRequires: erlang-syntax_tools >= 1:21.2
BuildRequires: erlang-inets >= 1:21.2
BuildRequires: erlang-otp-devel >= 1:21.2
BuildRequires: erlang-parsetools >= 1:21.2
BuildRequires: erlang-eunit >= 1:21.2
BuildRequires: erlang-tools >= 1:21.2
BuildRequires: git-core >= 1.7
BuildRequires: rebar >= 2.6.1-7
%if_enabled check
# check
BuildRequires: epmd
#BuildRequires: erlang-dialyzer
%endif

%define elixirdir %_otpdir

%description
Elixir is a functional meta-programming aware language built on top of the Erlang
VM. It is a dynamic language with flexible syntax with macros support that
leverages Erlang's abilities to build concurrent, distributed, fault-tolerant
applications with hot code upgrades.
Elixir also provides first-class support for pattern matching, polymorphism via
protocols (similar to Clojure's), aliases and associative data structures
(usually known as dicts or hashes in other programming languages).
Finally, Elixir and Erlang share the same bytecode and data types. This means you
can invoke Erlang code from Elixir (and vice-versa) without any conversion or
performance hit. This allows a developer to mix the expressiveness of Elixir with
the robustness and performance of Erlang.


%package iex
Summary: Elixir’s interactive shell
Group: Development/Languages/Other
BuildArch: noarch
Provides: iex = %version-%release
Requires: %name = %version-%release

%description iex
IEx is the main entry point for Interactive Elixir.


%package mix
Summary: Build tool for creating, compiling and testing Elixir projects
Group: Development/Languages/Other
BuildArch: noarch
Provides: mix = %version-%release
Requires: %name = %version-%release
# required by Mix.SCM.Git see also (https://github.com/elixir-lang/elixir/issues/1386)
Requires: git-core >= 1.7

%description mix
Mix is a build tool that provides tasks for creating, compiling, testing (and
soon deploying) Elixir projects. Mix is inspired by the Leiningen build tool for
Clojure and was written by one of its contributors.
This module works as a facade for accessing the most common functionality in
Elixir, as the shell and the current project configuration.


%package eex
Summary: Embedded Elixir for embed Elixir code inside a string
Group: Development/Languages/Other
BuildArch: noarch
Requires: %name = %version-%release

%description eex
EEx stands for Embedded Elixir. It allows you to embed Elixir code inside a
string in a robust way.
EEx has the concept of engines which allows you to modify or transform the code
extracted from the given string or file.


%package ex_unit
Summary: Unit test for Elixir
Group: Development/Languages/Other
BuildArch: noarch
Requires: %name = %version-%release

%description ex_unit
ExUnit is a unit test for Elixir.


%prep
%setup -q
%patch0 -p1
%patch1 -p1
sed -i '1s|.*|#!%_bindir/%name|' bin/mix
sed -i \
	-e 's|\$(PREFIX)\("\?\)/\$(LIBDIR)/%name|%elixirdir\1|g' \
	-e 's|"\.\./\$(LIBDIR)/%name/bin/[^"]*"|"$$file"|g' \
	Makefile
erl -noshell -eval '
{ok, L} = file:consult("lib/%name/Emakefile"),
file:write_file("lib/%name/Emakefile",
                lists:map(fun(E) -> [io_lib:print(E), ".\n"] end,
                          '"lists:keystore('src/*', 1, L, {'src/*', [inline|proplists:get_value('src/*', L, [])]})),"'
                [raw]),
init:stop().'

%if_enabled check
# FIXME
sed -i \
	-e '246,247 s/^      /&# /' \
	-e '249,250 s/^      /&# /' \
	-e '260,261 s/^      /&# /' \
	-e '263,264 s/^      /&# /' \
	-e '328,331 s/^    /&# /' \
	-e '696,702 s/^    /&# /' \
	-e '782,783 s/^      /&# /' \
	-e '907 s/^      /&# /' \
	lib/iex/test/iex/helpers_test.exs
sed -i \
	-e '61,62 s/^    /&# /' \
	-e '72 s/^    /&# /' \
	lib/iex/test/iex/autocomplete_test.exs
sed -i \
	-e '378,412 s/^    /&# /' \
	lib/mix/test/mix/tasks/test_test.exs
sed -i \
	-e '499,500 s/^        /&# /' \
	lib/mix/test/mix/dep_test.exs
rm -f lib/elixir/test/elixir/kernel/dialyzer_test.exs
%endif


%build
LANG=en_US.UTF-8 make %{?_smp_mflags} PREFIX=%_prefix REBAR="%__rebar -v"


%install
%make_install DESTDIR=%buildroot PREFIX=%_prefix
for i in %buildroot%elixirdir/bin/*; do
	f=$(basename $i)
	ln -sf %elixirdir/bin/$f %buildroot%_bindir/$f
done
[ "%_otpdir" != "%elixirdir" ] || ln -sf start.boot %buildroot%_otpdir/bin/%name.boot
for i in %buildroot%elixirdir/lib/*; do
	mv $i $i-%version
done

%add_erlang_req_beam_skiplist Elixir.IEx
%if %_otp_release < 22
%add_erlang_req_beam_skiplist persistent_term
%endif
%add_erlang_req_beam_skiplist %(echo Elixir.{Collectable,Enumerable}.{Atom,Float,Integer,PID,Port,Reference,Tuple})
%add_erlang_req_beam_skiplist Elixir.Enumerable.BitString Elixir.Collectable.Function
%add_erlang_req_beam_skiplist %(echo Elixir.{List,String}.Chars.{Function,Map,PID,Port,Reference,Tuple})
%add_erlang_req_beam_skiplist Elixir.Hex


%if_enabled check
%check
LANG=en_US.UTF-8 make %{?_smp_mflags} test
%endif


%files
%defattr(-,root,root)
%doc *.md NOTICE
%_bindir/%{name}*
%dir %elixirdir
%dir %elixirdir/bin
%dir %elixirdir/lib
%elixirdir/bin/%{name}*
%elixirdir/lib/%{name}*
%elixirdir/lib/logger-*
%_mandir/man1/%{name}*


%files iex
%defattr(-,root,root)
%_bindir/iex
%elixirdir/bin/iex
%elixirdir/bin/%name.boot
%elixirdir/lib/iex*
%_mandir/man1/iex.*


%files mix
%defattr(-,root,root)
%_bindir/mix
%elixirdir/bin/mix
%elixirdir/lib/mix*
%_mandir/man1/mix.*


%files eex
%defattr(-,root,root)
%elixirdir/lib/eex*


%files ex_unit
%defattr(-,root,root)
%elixirdir/lib/ex_unit*


%changelog
openSUSE Build Service is sponsored by