Shawn Iwinski 1584e9
#
Shawn Iwinski 1584e9
# Fedora spec file for php-symfony-polyfill
Shawn Iwinski 1584e9
#
19cf71
# Copyright (c) 2015-2018 Shawn Iwinski <shawn@iwin.ski>
Shawn Iwinski 1584e9
#
Shawn Iwinski 1584e9
# License: MIT
Shawn Iwinski 1584e9
# http://opensource.org/licenses/MIT
Shawn Iwinski 1584e9
#
Shawn Iwinski 1584e9
# Please preserve changelog entries
Shawn Iwinski 1584e9
#
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%global github_owner     symfony
Shawn Iwinski 1584e9
%global github_name      polyfill
dfa4c7
%global github_version   1.9.0
dfa4c7
%global github_commit    a63d064ac1ce21a851e4d6af6169a9bfb4037915
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%global composer_vendor  symfony
Shawn Iwinski 1584e9
%global composer_project polyfill
Shawn Iwinski 1584e9
dc9f5a
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
dc9f5a
# raise dependency on PHP 7 and ignore *_compat
dc9f5a
%global php_min_ver 7.0
dc9f5a
%else
Shawn Iwinski 1584e9
# "php": ">=5.3.3"
Shawn Iwinski 1584e9
%global php_min_ver 5.3.3
a85d53
# "ircmaxell/password-compat": "~1.0"
a85d53
%global ircmaxell_password_compat_min_ver 1.0
a85d53
%global ircmaxell_password_compat_max_ver 2.0
dfa4c7
# "paragonie/random_compat": "~1.0|~2.0|~9.99"
aeb62b
%global paragonie_random_compat_min_ver 1.0
aeb62b
%global paragonie_random_compat_max_ver 3.0
dc9f5a
%endif
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
# Build using "--without tests" to disable tests
Shawn Iwinski 1584e9
%global with_tests 0%{!?_without_tests:1}
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%{!?phpdir:  %global phpdir  %{_datadir}/php}
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Name:          php-%{composer_vendor}-%{composer_project}
Shawn Iwinski 1584e9
Version:       %{github_version}
dfa4c7
Release:       1%{?github_release}%{?dist}
Shawn Iwinski 1584e9
Summary:       Symfony polyfills backporting features to lower PHP versions
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
License:       MIT
Shawn Iwinski 1584e9
URL:           https://github.com/%{github_owner}/%{github_name}
Shawn Iwinski 1584e9
Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
BuildArch:     noarch
Shawn Iwinski 1584e9
# Autoloader
058913
BuildRequires: php-fedora-autoloader-devel
Shawn Iwinski 1584e9
# Tests
Shawn Iwinski 1584e9
%if %{with_tests}
Shawn Iwinski 1584e9
BuildRequires: php-composer(phpunit/phpunit)
Shawn Iwinski 1584e9
## composer.json
Shawn Iwinski 1584e9
BuildRequires: php(language) >= %{php_min_ver}
dc9f5a
%if 0%{?fedora} < 27 && 0%{?rhel} < 8
a85d53
BuildRequires: php-composer(ircmaxell/password-compat) <  %{ircmaxell_password_compat_max_ver}
a85d53
BuildRequires: php-composer(ircmaxell/password-compat) >= %{ircmaxell_password_compat_min_ver}
a85d53
BuildRequires: php-composer(paragonie/random_compat) <  %{paragonie_random_compat_max_ver}
aeb62b
BuildRequires: php-composer(paragonie/random_compat) >= %{paragonie_random_compat_min_ver}
6fd427
%endif
6fd427
## phpcompatinfo (computed from version 1.8.0)
Shawn Iwinski 1584e9
BuildRequires: php-hash
a34c14
BuildRequires: php-iconv
a34c14
BuildRequires: php-intl
Shawn Iwinski 1584e9
BuildRequires: php-json
Shawn Iwinski 1584e9
BuildRequires: php-ldap
Shawn Iwinski 1584e9
BuildRequires: php-pcre
Shawn Iwinski 1584e9
BuildRequires: php-reflection
Shawn Iwinski 1584e9
BuildRequires: php-spl
Shawn Iwinski 1584e9
%endif
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
# composer.json
Shawn Iwinski 1584e9
Requires:      php(language) >= %{php_min_ver}
dc9f5a
%if 0%{?fedora} < 27 && 0%{?rhel} < 8
a85d53
Requires:      php-composer(ircmaxell/password-compat) <  %{ircmaxell_password_compat_max_ver}
a85d53
Requires:      php-composer(ircmaxell/password-compat) >= %{ircmaxell_password_compat_min_ver}
aeb62b
Requires:      php-composer(paragonie/random_compat) <  %{paragonie_random_compat_max_ver}
a85d53
Requires:      php-composer(paragonie/random_compat) >= %{paragonie_random_compat_min_ver}
6fd427
%endif
6fd427
# phpcompatinfo (computed from version 1.8.0)
Shawn Iwinski 1584e9
Requires:      php-hash
a34c14
Requires:      php-iconv
a34c14
Requires:      php-intl
Shawn Iwinski 1584e9
Requires:      php-json
Shawn Iwinski 1584e9
Requires:      php-pcre
Shawn Iwinski 1584e9
Requires:      php-reflection
Shawn Iwinski 1584e9
Requires:      php-spl
058913
# Autoloader
058913
Requires:      php-composer(fedora/autoloader)
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
# Composer
Shawn Iwinski 1584e9
Provides:      php-composer(%{composer_vendor}/%{composer_project})       = %{version}
a34c14
Provides:      php-composer(%{composer_vendor}/%{composer_project}-mbstring) = %{version}
Shawn Iwinski 1584e9
Provides:      php-composer(%{composer_vendor}/%{composer_project}-util)  = %{version}
Shawn Iwinski 1584e9
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php54) = %{version}
Shawn Iwinski 1584e9
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php55) = %{version}
Shawn Iwinski 1584e9
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php56) = %{version}
Shawn Iwinski 1584e9
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php70) = %{version}
058913
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php71) = %{version}
4d500b
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php72) = %{version}
6fd427
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php73) = %{version}
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%description
Shawn Iwinski 1584e9
%{summary}.
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Autoloader: %{phpdir}/Symfony/Polyfill/autoload.php
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%prep
Shawn Iwinski 1584e9
%setup -qn %{github_name}-%{github_commit}
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
: Docs
6fd427
mkdir -p docs/{Mbstring,Php54,Php55,Php56,Php70,Php71,Php72,Php73,Util}
Shawn Iwinski 1584e9
mv *.md composer.json docs/
a34c14
mv src/Mbstring/{*.md,composer.json}  docs/Mbstring/
Shawn Iwinski 1584e9
mv src/Php54/{*.md,composer.json} docs/Php54/
Shawn Iwinski 1584e9
mv src/Php55/{*.md,composer.json} docs/Php55/
Shawn Iwinski 1584e9
mv src/Php56/{*.md,composer.json} docs/Php56/
Shawn Iwinski 1584e9
mv src/Php70/{*.md,composer.json} docs/Php70/
058913
mv src/Php71/{*.md,composer.json} docs/Php71/
4d500b
mv src/Php72/{*.md,composer.json} docs/Php72/
6fd427
mv src/Php73/{*.md,composer.json} docs/Php73/
Shawn Iwinski 1584e9
mv src/Util/{*.md,composer.json}  docs/Util/
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
: Remove unneeded polyfills
6fd427
rm -rf {src,tests}/{Apcu,Ctype,Iconv,Intl,Xml}
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%build
Shawn Iwinski 1584e9
: Create autoloader classmap
058913
%{_bindir}/phpab --template fedora --tolerant --output src/autoload.php src/
058913
cat src/autoload.php
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
: Create autoloader
058913
cat <<'AUTOLOAD' | tee -a src/autoload.php
058913
058913
\Fedora\Autoloader\Dependencies::required(array(
a34c14
    __DIR__ . '/Mbstring/bootstrap.php',
058913
    __DIR__ . '/Php54/bootstrap.php',
058913
    __DIR__ . '/Php55/bootstrap.php',
058913
    __DIR__ . '/Php56/bootstrap.php',
058913
    __DIR__ . '/Php70/bootstrap.php',
058913
    __DIR__ . '/Php71/bootstrap.php',
4d500b
    __DIR__ . '/Php72/bootstrap.php',
6fd427
    __DIR__ . '/Php73/bootstrap.php',
dc9f5a
));
dc9f5a
\Fedora\Autoloader\Dependencies::optional(array(
058913
    '%{phpdir}/password_compat/password.php',
058913
    '%{phpdir}/random_compat/autoload.php',
058913
));
Shawn Iwinski 1584e9
AUTOLOAD
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%install
058913
Shawn Iwinski 1584e9
: Library
Shawn Iwinski 1584e9
mkdir -p %{buildroot}%{phpdir}/Symfony/Polyfill
Shawn Iwinski 1584e9
cp -rp src/* %{buildroot}%{phpdir}/Symfony/Polyfill/
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%check
Shawn Iwinski 1584e9
%if %{with_tests}
4d500b
: Upstream tests
4d500b
RETURN_CODE=0
4d500b
PHPUNIT=$(which phpunit)
dfa4c7
for PHP_EXEC in "" %{?rhel:php54 php55 php56} php70 php71 php72 php73; do
4d500b
    if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
4d500b
        $PHP_EXEC $PHPUNIT --verbose \
4d500b
            --bootstrap %{buildroot}%{phpdir}/Symfony/Polyfill/autoload.php \
4d500b
            || RETURN_CODE=1
4d500b
    fi
4d500b
done
4d500b
exit $RETURN_CODE
Shawn Iwinski 1584e9
%else
Shawn Iwinski 1584e9
: Tests skipped
Shawn Iwinski 1584e9
%endif
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%files
Shawn Iwinski 1584e9
%{!?_licensedir:%global license %%doc}
Shawn Iwinski 1584e9
%license LICENSE
Shawn Iwinski 1584e9
%doc docs/*
Shawn Iwinski 1584e9
%dir %{phpdir}/Symfony
Shawn Iwinski 1584e9
     %{phpdir}/Symfony/Polyfill
Shawn Iwinski 1584e9
%exclude %{phpdir}/Symfony/Polyfill/*/LICENSE
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
%changelog
dfa4c7
* Mon Aug 27 2018 Remi Collet <remi@remirepo.net> - 1.9.0-1
dfa4c7
- update to 1.9.0
dfa4c7
dc9f5a
* Mon Jul 16 2018 Remi Collet <remi@remirepo.net> - 1.8.0-3
dc9f5a
- raise dependency on PHP 7 and ignore dependencies on
dc9f5a
  ircmaxell/password-compat and paragonie/random_compat
dc9f5a
258c74
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.0-2
258c74
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
258c74
6fd427
* Fri May  4 2018 Remi Collet <remi@remirepo.net> - 1.8.0-1
6fd427
- update to 1.8.0
6fd427
- add symfony/polyfill-php73
6fd427
- use range dependencies
6fd427
a34c14
* Wed Apr 11 2018 Remi Collet <remi@remirepo.net> - 1.7.0-2
a34c14
- add symfony/polyfill-mbstring for mb_chr, mb_ord, mb_scrub
a34c14
- add dependency on iconv and intl extensions
a34c14
19cf71
* Fri Mar  2 2018 Remi Collet <remi@remirepo.net> - 1.7.0-1
19cf71
- Update to 1.7.0
19cf71
2c44be
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2
2c44be
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
2c44be
a85d53
* Wed Aug 30 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-1
a85d53
- Updated to 1.5.0 (RHBZ #1482156)
a85d53
- Added version constraints to ircmaxell/password-compat
a85d53
- Added max version constraint to paragonie/random_compat BuildeRequires
a85d53
- Removed php-mbstring dependency
a85d53
927866
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-2
927866
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
927866
4d500b
* Sun Jul 09 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.4.0-1
4d500b
- Updated to 1.4.0 (RHBZ #1460473)
4d500b
- Provide php-composer(symfony/polyfill-php72)
4d500b
- Test with SCLs if available
4d500b
79a1b0
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-2
79a1b0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
79a1b0
058913
* Mon Nov 14 2016 Remi Collet <remi@fedoraproject.org> - 1.3.0-1
058913
- Updated to 1.3.0
058913
- provide php-composer(symfony/polyfill-php71)
058913
- switch to fedora/autoloader
058913
aeb62b
* Thu Jun 16 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.0-1
aeb62b
- Updated to 1.2.0 (RHBZ #1301791)
aeb62b
155066
* Tue Apr 12 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.1.1-1
155066
- Updated to 1.1.1 (RHBZ #1301791)
155066
b6b189
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
b6b189
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
b6b189
Shawn Iwinski ed3b92
* Sun Jan 03 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.1-1
Shawn Iwinski ed3b92
- Updated to 1.0.1 (RHBZ #1294916)
Shawn Iwinski ed3b92
Shawn Iwinski 1584e9
* Mon Dec 07 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.0-3
Shawn Iwinski 1584e9
- Fixed Util docs
Shawn Iwinski 1584e9
- Added "%%dir %%{phpdir}/Symfony" to %%files
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
* Sun Dec 06 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.0-2
Shawn Iwinski 1584e9
- Always include ALL polyfills
Shawn Iwinski 1584e9
Shawn Iwinski 1584e9
* Wed Nov 25 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.0-1
Shawn Iwinski 1584e9
- Initial package