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