File olifer.spec of Package olifer

%def_disable check

%define bname olifer
Name: %bname
Version: 2.0.2
Release: 3
Summary: An Erlang LIVR implementation library
License: MPL-2.0
Group: Development/Tools/Other
URL: https://github.com/Prots/%bname
Source: %bname-%version.tar.xz
Patch1: 0001-remove-parselib-bstring-dependency.patch
Patch2: 0002-add-.gitignore.patch
Patch3: 0003-Update-README.md.patch
Patch4: 0004-add-rebar.config.patch
Patch5: 0005-update-.travis.yml.patch
Patch6: 0006-require-Erlang-OTP-R16-remove-R15B03-from-.travis.ym.patch
Patch7: 0007-Makefile-update-jsx-dependency.patch
Patch8: 0008-update-erlang.mk.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: erlang
# docs
BuildRequires: erlang-edoc
%if_enabled check
# check
BuildRequires: ct_run erlang-eunit epmd
BuildRequires: LIVR >= 2.0
BuildRequires: erlang-jsx >= 2.6.2
%endif

%description
Olifer is lightweight validator supporting
Language Independent Validation Rules Specification (LIVR) for Erlang.


%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
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
sed -i -r \
	-e '/^-define\(LIVR_TEST_PATH,/s|".*"|"%_datadir/LIVR/test_suite/"|' \
	-e '/\?LIVR_TEST_PATH/s/(=[[:blank:]]*).*(\?LIVR_TEST_PATH)/\1\2/' \
	test/main_SUITE.erl


%build
make %{?_smp_mflags} DEPS= ERL_COMPILER_OPTIONS="[inline,verbose]" V=1 all edoc


%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/*.hrl %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/


%if_enabled check
%check
make DEPS= TEST_DEPS= ERL_COMPILER_OPTIONS="[inline,verbose]" 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
* Mon Jun 24 2019 Led <ledest@gmail.com> 2.0.2-3
- disable check

* Sun Nov 19 2017 Led <ledest@gmail.com> 2.0.2-2
- remove patches:
  + 0001-Update-README.md.patch
- add patches:
  + 0001-remove-parselib-bstring-dependency.patch
  + 0002-add-.gitignore.patch
  + 0003-Update-README.md.patch
  + 0004-add-rebar.config.patch
  + 0005-update-.travis.yml.patch
  + 0006-require-Erlang-OTP-R16-remove-R15B03-from-.travis.ym.patch
  + 0007-Makefile-update-jsx-dependency.patch
  + 0008-update-erlang.mk.patch
- enable %%check

* Thu Nov 16 2017 Led <ledest@gmail.com> 2.0.2-1
- initial build