Blame php-phpmyadmin-motranslator5.spec

458603c
# remirepo/fedora spec file for php-phpmyadmin-motranslator5
458603c
#
99319ae
# Copyright (c) 2017-2021 Remi Collet
458603c
# License: CC-BY-SA
458603c
# http://creativecommons.org/licenses/by-sa/4.0/
458603c
#
458603c
# Please, preserve the changelog entries
458603c
#
458603c
99319ae
%global gh_commit    cea68a8d0abf5e7fabc4179f07ef444223ddff44
458603c
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
458603c
%global gh_owner     phpmyadmin
458603c
%global gh_project   motranslator
458603c
%global with_tests   0%{!?_without_tests:1}
458603c
%global ns_vendor    PhpMyAdmin
458603c
%global ns_project   MoTranslator
458603c
%global major        5
458603c
458603c
%global sym_min_ver 4.0
458603c
%global sym_max_ver 6
458603c
458603c
Name:           php-%{gh_owner}-%{gh_project}%{major}
99319ae
Version:        5.2.0
458603c
Release:        1%{?dist}
458603c
Summary:        Translation API for PHP using Gettext MO files
458603c
458603c
Group:          Development/Libraries
458603c
License:        GPLv2+
458603c
URL:            https://github.com/%{gh_owner}/%{gh_project}
458603c
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{?gh_short}.tar.gz
458603c
458603c
BuildArch:      noarch
458603c
%if %{with_tests}
458603c
BuildRequires:  php(language) >= 7.1
458603c
BuildRequires:  php-pcre
458603c
BuildRequires: (php-composer(symfony/expression-language) >= %{sym_min_ver} with php-composer(symfony/expression-language) < %{sym_max_ver})
458603c
# For tests, from composer.json "require-dev": {
6de8c6a
#        "phpunit/phpunit": "^7.4 || ^8 || ^9",
99319ae
#        "phpmyadmin/coding-standard": "^2.1.1",
99319ae
#        "phpstan/phpstan": "^0.12.56"
6de8c6a
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
6de8c6a
%global phpunit %{_bindir}/phpunit9
6de8c6a
BuildRequires:  %{phpunit}
6de8c6a
%else
458603c
%global phpunit %{_bindir}/phpunit8
458603c
BuildRequires:  %{phpunit}
458603c
%endif
6de8c6a
%endif
458603c
# For autoloader
458603c
BuildRequires:  php-composer(fedora/autoloader)
458603c
458603c
# From composer.json, "require": {
6de8c6a
#        "php": "^7.1 || ^8.0",
458603c
#        "symfony/expression-language": ""^4.0 || ^5.0"
458603c
Requires:      (php-composer(symfony/expression-language) >= %{sym_min_ver} with php-composer(symfony/expression-language) < %{sym_max_ver})
458603c
Requires:       php(language) >= 7.1
458603c
# From phpcompatinfo report for 5.0.0
458603c
Requires:       php-pcre
458603c
# For generated autoloader
458603c
Requires:       php-composer(fedora/autoloader)
458603c
458603c
# Composer
458603c
Provides:       php-composer(%{gh_owner}/%{gh_project}) = %{version}
458603c
458603c
458603c
%description
458603c
Translation API for PHP using Gettext MO files.
458603c
458603c
Features
458603c
458603c
* All strings are stored in memory for fast lookup
458603c
* Fast loading of MO files
458603c
* Low level API for reading MO files
458603c
* Emulation of Gettext API
458603c
* No use of eval() for plural equation
458603c
458603c
Limitations
458603c
458603c
* Not suitable for huge MO files which you don't want to store in memory
458603c
* Input and output encoding has to match (preferably UTF-8)
458603c
458603c
Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
458603c
458603c
458603c
%prep
458603c
%setup -q -n %{gh_project}-%{gh_commit}
458603c
458603c
458603c
%build
458603c
: Create autoloader
458603c
cat <<'AUTOLOAD' | tee src/autoload.php
458603c
458603c
/* Autoloader for %{name} and its dependencies */
458603c
require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
458603c
458603c
\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\', __DIR__);
458603c
\Fedora\Autoloader\Dependencies::required(array(array(
458603c
    '%{_datadir}/php/Symfony5/Component/ExpressionLanguage/autoload.php',
458603c
    '%{_datadir}/php/Symfony4/Component/ExpressionLanguage/autoload.php',
458603c
)));
458603c
AUTOLOAD
458603c
458603c
458603c
%install
458603c
: Library
458603c
mkdir -p   %{buildroot}%{_datadir}/php/%{ns_vendor}
458603c
cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
458603c
458603c
458603c
%check
458603c
%if %{with_tests}
458603c
mkdir vendor
458603c
cat << 'EOF' | tee vendor/autoload.php
458603c
458603c
require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
458603c
EOF
458603c
458603c
ret=0
6de8c6a
for cmd in "php %{phpunit}" "php72 %{_bindir}/phpunit8" php73 "php74" php80; do
458603c
  if which $cmd; then
458603c
    set $cmd
6de8c6a
    $1 ${2:-%{_bindir}/phpunit9} --no-coverage --verbose || ret=1
458603c
  fi
458603c
done
458603c
exit $ret
458603c
%else
458603c
: Test suite disabled
458603c
%endif
458603c
458603c
458603c
%files
458603c
%license LICENSE
458603c
%doc composer.json
458603c
%doc *.md
458603c
%dir %{_datadir}/php/%{ns_vendor}/
458603c
     %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
458603c
458603c
458603c
%changelog
99319ae
* Mon Feb  8 2021 Remi Collet <remi@remirepo.net> - 5.2.0-1
99319ae
- update to 5.2.0
99319ae
6de8c6a
* Mon Nov 16 2020 Remi Collet <remi@remirepo.net> - 5.1.0-1
6de8c6a
- update to 5.1.0
6de8c6a
- switch to phpunit9
6de8c6a
458603c
* Wed Mar  4 2020 Remi Collet <remi@remirepo.net> - 5.0.0-1
458603c
- update to 5.0.0
458603c
- rename to php-phpmyadmin-motranslator5
458603c
- move to /usr/share/php/PhpMyAdmin/MoTranslator5
458603c
- raise dependency on PHP 7.1
458603c
- raise dependency on Symfony 4 and allow Symfony 5
458603c
- switch to phpunit8
458603c
458603c
* Fri Dec  7 2018 Remi Collet <remi@remirepo.net> - 4.0-3
458603c
- use range dependencies
458603c
458603c
* Wed Feb 21 2018 Remi Collet <remi@remirepo.net> - 4.0-1
458603c
- Update to 4.0
458603c
458603c
* Mon Dec 18 2017 Remi Collet <remi@remirepo.net> - 3.4-1
458603c
- Update to 3.4
458603c
- allow Symfony 4 on F27+
458603c
- use phpunit6 on F26+
458603c
458603c
* Fri Jun  2 2017 Remi Collet <remi@remirepo.net> - 3.3-1
458603c
- Update to 3.3
458603c
458603c
* Tue May 23 2017 Remi Collet <remi@remirepo.net> - 3.2-1
458603c
- Update to 3.2
458603c
458603c
* Mon May 15 2017 Remi Collet <remi@remirepo.net> - 3.1-1
458603c
- Update to 3.1 (documentation and cleanup only)
458603c
- allow Symfony 3
458603c
458603c
* Mon Jan 23 2017 Remi Collet <remi@remirepo.net> - 3.0-1
458603c
- update to 3.0 with vendor namespace
458603c
458603c
* Sat Jan 21 2017 Remi Collet <remi@remirepo.net> - 2.2-1
458603c
- initial package
458603c