File teleport.spec of Package teleport

%def_disable check

%define bname teleport
Name: %bname
Version: 0.6.2
Release: 4
Summary: A replacement for native Erlang RPC
License: MPL-2.0
Group: Development/Tools/Other
URL: https://gitlab.com/barrel-db/%bname
Source: %bname-%version.tar.xz
Patch0: %bname-%version-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release
Requires: erlang-otp-base >= 1:18

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
BuildRequires: erlang >= 1:18
BuildRequires: erlang-otp-base >= 1:18
BuildRequires: erlang-public_key-devel >= 1:18
# behaviour
BuildRequires: erlang_beam(ranch_protocol)
BuildRequires: erlang-otpbp-devel >= 4.26.0
BuildRequires: erlang-otpbp >= 4.26.0
%if_enabled check
BuildRequires: erlang-common_test erlang-common_test-devel
BuildRequires: epmd erlang-ranch erlang-public_key
%endif

%description
Teleport is a replacement for native Erlang RPC.
It create direct links between servers.


%package devel
Summary: Headers of %name
Group: Development/Tools/Other

%description devel
Headers of %name.


%package doc
Summary: Documentation of %name
Group: Documentation/HTML

%description doc
Documentation of %name.


%prep
%setup -q -n %bname-%version
%patch -p1 -P0
%if "%_otp_release" == "18"
sed -i '/host := /s/:=/=>/' src/teleport.erl
%endif

%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config", [[io_lib:print(E), ".\n"] || E <- lists:keydelete(deps, 1, L)], [raw]),
init:stop().'
%if %_otp_release >= 19
ERL_COMPILER_OPTIONS="[inline,verbose]" \
%else
ERL_COMPILER_OPTIONS="[inline,verbose,{parse_transform,otpbp_pt}]" \
%endif
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 AUTHORS *.md %buildroot%_docdir/%name/


%if_enabled check
%check
%if %_otp_release >= 19
ERL_COMPILER_OPTIONS="[inline,verbose]" \
%else
ERL_COMPILER_OPTIONS="[inline,verbose,{parse_transform,otpbp_pt}]" \
%endif
rebar -C %bname.rebar.config ct
%endif


%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
* Fri May 31 2024 Led <ledest@gmail.com> 0.6.2-4
- fix patches applying

* Sat Aug 06 2022 Led <ledest@gmail.com> 0.6.2-3
- update BuildRequires

* Mon Jul 23 2018 Led <ledest@gmail.com> 0.6.2-2
- update BuildRequires
- fix build on Erlang/OTP 18

* Wed Jul 04 2018 Led <ledest@gmail.com> 0.6.2-1
- initial build
- git f585c7f
openSUSE Build Service is sponsored by