Blob Blame History Raw
%global gh_commit    0540c37d9ba554ef8fc240123cb3ee8df222e3b9
%global gh_short     %(c=%{gh_commit}; echo ${c:0:8})
%global gh_owner     mlocati
%global gh_project   cldr-to-gettext-plural-rules


Name:       php-gettext-languages
Version:    2.1.3
Release:    3%{?dist}
BuildArch:  noarch

License:    MIT and Unicode
Summary:    Generate gettext language lists with plural rules
URL:        https://github.com/mlocati/cldr-to-gettext-plural-rules
Source0:    %{name}-%{version}-%{gh_short}.tgz
# https://github.com/mlocati/cldr-to-gettext-plural-rules/pull/13 was sent upstream, but this patch
# uses /usr/bin/php instead of /usr/bin/env php.
Patch0:     0000-Add-a-shebang-to-bin-export.php.patch

BuildRequires: php-composer(fedora/autoloader)
BuildRequires: phpunit 

Requires:   php(language) >= 5.4.0
Requires:   php-cli
Requires:   php-dom
Requires:   php-iconv
Requires:   php-json
Requires:   php-pcre
Requires:   php-spl

Provides:   php-composer(gettext/languages) = %{version}


%description
A library that can generate gettext language lists automatically
generated from CLDR data.


%prep
%setup -q -n cldr-to-gettext-plural-rules-%{gh_commit}

%patch0 -p1

sed -i "s:require_once.*:require_once '%{buildroot}/%{_datadir}/php/Gettext/Languages/autoloader.php';:" tests/bootstrap.php
sed -i "s:require_once.*:require_once '%{_datadir}/php/Gettext/Languages/autoloader.php';:" bin/export.php


%install
install -d -p -m 0755 %{buildroot}/%{_bindir}
install -d -p -m 0755 %{buildroot}/%{_datadir}/php
install -d -p -m 0755 %{buildroot}/%{_datadir}/php/Gettext
install -d -p -m 0755 %{buildroot}/%{_datadir}/php/Gettext/Languages

cp -a bin/export.php %{buildroot}/%{_bindir}/%{name}-export
chmod 755 %{buildroot}/%{_bindir}/%{name}-export

cp -ar src/* %{buildroot}/%{_datadir}/php/Gettext/Languages/


%check
sed -i "s:require_once.*:require_once '%{buildroot}/%{_datadir}/php/Gettext/Languages/autoloader.php';:" bin/export.php
phpunit --bootstrap tests/bootstrap.php


%files
%license LICENSE
%license UNICODE-LICENSE.txt
%doc composer.json
%doc README.md
%{_bindir}/%{name}-export
%{_datadir}/php/Gettext


%changelog
* Wed Feb 01 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.1.3-3
- Add an export cli.
- Include a patch that adds a shebang to the export CLI.

* Sat Jan 21 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.1.3-2
- Use a git snapshot instead of the version tag so that we get the
  tests and the docs (See
  https://github.com/mlocati/cldr-to-gettext-plural-rules/issues/11 )
- Run the tests.
- Modify the test bootstrap and export.php to use the library
  installation location instead of the local path.

* Sun Jan 15 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.1.3-1
- Initial release.