%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')

Name:           liblouis
Version:        3.7.0
Release:        3
Summary:        Braille translation and back-translation library
License:        LGPLv3+ and GPLv3+
URL:            http://liblouis.org
Source0:        https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Recommends:	%{name}-help = %{version}-%{release}
BuildRequires:  chrpath gcc help2man texinfo texinfo-tex texlive-eurosym
BuildRequires:  texlive-xetex python2-devel python3-devel
Provides:       bundled(gnulib) = 20130621

%description
The Liblouis software suite provides an open-source braille translator,
back-translator and formatter for a large number of languages and braille codes.
It is a set of libraries designed for use in any of a number of applications,
both free and commercial. It is written in C so that it does not require a runtime environment
and hence can be used in applications written in high-level languages such as Java and Python.

%package        devel
Summary:        Development files for liblouis
Requires:       %{name} = %{version}-%{release} pkgconfig

%description    devel
The liblouis-devel package contains libraries and header files for developing applications that use liblouis.

%package        utils
Summary:        Command-line utilities to test liblouis
Requires:       %{name} = %{version}-%{release}
Requires:       python2-louis = %{version}-%{release}
License:        GPLv3+

%description    utils
Six test programs are provided as part of the liblouis package.They are intended for testing liblouis and for debugging tables.
None of them is suitable for braille transcription.

%package        help
Summary:        Help documents for liblouis
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}
Provides:       liblouis-doc = %{version}-%{release}
Obsoletes:      liblouis-doc < %{version}-%{release}


%description    help
The liblouis-help package conatins manual pages and documents for liblouis.

%package -n     python2-louis
Summary:        Python 2 language bindings for liblouis
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}
Obsoletes:      %{name}-python < 2.6.2-3
Provides:       %{name}-python = %{version}-%{release}
%{?python_provide:%python_provide python2-louis}

%description -n python2-louis
This package provides Python 2 language bindings for liblouis.

%package -n     python3-louis
Summary:        Python 3 language bindings for %{name}
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}
Obsoletes:      %{name}-python3 < 2.6.2-3
Provides:       %{name}-python3 = %{version}-%{release}
%{?python_provide:%python_provide python3-louis}

%description -n python3-louis
This package provides Python 3 language bindings for %{name}.

%prep
%autosetup -p1

%build
%configure  --disable-static --enable-ucs4
make
cd doc; xetex %{name}.texi

%check
make check

%install
%make_install
%delete_la
rm -rf  %{buildroot}/%{_bindir}/lou_maketable*
rm -rf  %{buildroot}/%{_defaultdocdir}/%{name}/
cd python/louis

install -d %{buildroot}%{python2_sitelib}/louis
install -pm 0644 __init__.py %{buildroot}%{python2_sitelib}/louis/
%py_byte_compile %{__python2} %{buildroot}%{python2_sitelib}/louis

install -d %{buildroot}%{python3_sitelib}/louis
install -pm 0644 __init__.py %{buildroot}%{python3_sitelib}/louis/
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/louis/

for f in %{buildroot}%{_bindir}/lou_* ; do
  chrpath --delete $f
done

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%files
%doc COPYING.LESSER AUTHORS
%{_libdir}/%{name}.so.*
%{_datadir}/%{name}/
%{_infodir}/%{name}.info*
%exclude %{_infodir}/dir

%files devel
%doc HACKING
%{_includedir}/%{name}/
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/%{name}.so

%files utils
%doc COPYING
%{_bindir}/lou_*

%files help
%doc README NEWS ChangeLog TODO doc/%{name}.{html,txt,pdf}
%{_mandir}/man1/lou_*.1*

%files -n python2-louis
%doc python/README
%{python2_sitelib}/louis/

%files -n python3-louis
%{python3_sitelib}/louis/

%changelog
* Thu Nov 12 2020 xinghe <xinghe1@huawei.com> - 3.7.0-3
- add help for Recommends

* Thu Nov 28 2019 liujing<liujing144@huawei.com> - 3.7.0-2
- Package init
