%bcond_with test
Name: po4a
Summary: A translation tool
Version: 0.66
Release: 1
License: GPL+
URL: https://po4a.org/
Source0: https://github.com/mquinson/po4a/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires: %{_bindir}/xsltproc %{_bindir}/nsgmls
BuildRequires: coreutils grep docbook-style-xsl findutils perl-generators  perl(Pod::Man)
BuildRequires: perl-interpreter >= 4:5.10.1 perl(File::Basename) perl(Module::Build)
BuildRequires: perl(lib) perl(Encode) perl(ExtUtils::Install) perl(File::stat)
BuildRequires: perl(File::Path) perl(File::Copy) perl(File::Spec) perl(Term::ReadKey)
BuildRequires: perl(Carp) gettext perl(Exporter) perl(Fcntl) perl(File::Temp) perl(Text::WrapI18N)
BuildRequires: perl(Cwd) perl(Config) perl(DynaLoader) perl(Encode::Guess) perl(subs)
BuildRequires: perl(Getopt::Std) perl(Getopt::Long) perl(IO::File) perl(Pod::Parser)
BuildRequires: perl(Pod::Usage) perl(POSIX) perl(SGMLS) >= 1.03ii perl(strict) perl(Test::More)
BuildRequires: perl(vars) perl(Time::Local) perl(warnings) perl(I18N::Langinfo)
BuildRequires: texlive-kpathsea-bin texlive-kpathsea perl(Locale::gettext) >= 1.01

Requires: gettext  perl(Locale::gettext) >= 1.01 %{_bindir}/xsltproc %{_bindir}/nsgmls
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: texlive-kpathsea texlive-kpathsea-bin
Requires: perl(I18N::Langinfo) perl(Term::ReadKey) perl(Text::WrapI18N)

BuildArch: noarch

%description
The goal of po4a (PO for anything) project is to ease translations
(and more interestingly, the maintenance of translations) using gettext
tools on areas where they were not expected like documentation.

%package_help

%prep
%autosetup -p1

chmod +x scripts/*

%{__perl} -p -i -e 's,#!\s*/usr/bin/env perl,#!%{_bindir}/perl,' \
  $(find . -type f -executable |
    xargs grep -l "/usr/bin/env perl")

%build
export PO4AFLAGS="-v -v -v"
LANG=en_US.utf8
%{__perl} ./Build.PL installdirs=vendor
./Build

%install
LANG=en_US.utf8
./Build install destdir=%{buildroot} create_packlist=0
find %{buildroot} -type d -depth -exec rmdir {} 2>/dev/null ';'

%{_fixperms} %{buildroot}/*

%find_lang %{name}

%check
%if %{with test}
LANG=en_US.utf8
./Build test
%endif

%files -f %{name}.lang
%license COPYING
%{_bindir}/%{name}*
%{_bindir}/msguntypot
%{perl_vendorlib}/Locale

%files help
%doc README* TODO
%{_mandir}/man1/%{name}*.1*
%{_mandir}/man1/msguntypot.1*
%{_mandir}/man3/Locale::Po4a::*.3*
%{_mandir}/man7/%{name}.7*
%{_mandir}/*/man1/%{name}*.1*
%{_mandir}/*/man1/msguntypot.1*
%{_mandir}/*/man3/Locale::Po4a::*.3*
%{_mandir}/*/man7/%{name}.7*

%changelog
* Fri Aug 12 2022 tianlijing <tianlijing@kylinos.cn> - 0.66-1
- update to 0.66

* Fri Dec 6 2019 caomeng<caomeng5@huawei.com> - 0.54-2
- Package init
