Shawn Iwinski 1584e9f
#
Shawn Iwinski 1584e9f
# Fedora spec file for php-symfony-polyfill
Shawn Iwinski 1584e9f
#
Shawn Iwinski ed3b92d
# Copyright (c) 2015-2016 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
1550662
%global github_version   1.1.1
1550662
%global github_commit    3dc21aeff3e1f8cb708421ed02cf1a8901d7b535
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
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}
1550662
Release:       1%{?github_release}%{?dist}
Shawn Iwinski 1584e9f
Summary:       Symfony polyfills backporting features to lower PHP versions
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
Group:         Development/Libraries
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
Shawn Iwinski 1584e9f
BuildRequires: php-composer(theseer/autoload)
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}
Shawn Iwinski 1584e9f
BuildRequires: php-composer(ircmaxell/password-compat)
Shawn Iwinski 1584e9f
BuildRequires: php-composer(paragonie/random_compat)
1550662
## phpcompatinfo (computed from version 1.1.1)
Shawn Iwinski 1584e9f
BuildRequires: php-hash
Shawn Iwinski 1584e9f
BuildRequires: php-json
Shawn Iwinski 1584e9f
BuildRequires: php-ldap
Shawn Iwinski 1584e9f
BuildRequires: php-mbstring
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}
Shawn Iwinski 1584e9f
Requires:      php-composer(ircmaxell/password-compat)
Shawn Iwinski 1584e9f
Requires:      php-composer(paragonie/random_compat)
1550662
# phpcompatinfo (computed from version 1.1.1)
Shawn Iwinski 1584e9f
Requires:      php-hash
Shawn Iwinski 1584e9f
Requires:      php-json
Shawn Iwinski 1584e9f
Requires:      php-mbstring
Shawn Iwinski 1584e9f
Requires:      php-pcre
Shawn Iwinski 1584e9f
Requires:      php-reflection
Shawn Iwinski 1584e9f
Requires:      php-spl
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
# Composer
Shawn Iwinski 1584e9f
Provides:      php-composer(%{composer_vendor}/%{composer_project})       = %{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}
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
Shawn Iwinski 1584e9f
mkdir -p docs/{Php54,Php55,Php56,Php70,Util}
Shawn Iwinski 1584e9f
mv *.md composer.json docs/
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/
Shawn Iwinski 1584e9f
mv src/Util/{*.md,composer.json}  docs/Util/
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
: Remove unneeded polyfills
1550662
rm -rf {src,tests}/{Apcu,Iconv,Intl,Mbstring,Xml}
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
%build
Shawn Iwinski 1584e9f
: Create autoloader classmap
Shawn Iwinski 1584e9f
%{_bindir}/phpab --nolower --tolerant --output src/autoload.classmap.php src/
Shawn Iwinski 1584e9f
cat src/autoload.classmap.php
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
: Create autoloader
Shawn Iwinski 1584e9f
cat <<'AUTOLOAD' | tee src/autoload.php
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
/**
Shawn Iwinski 1584e9f
 * Autoloader for %{name} and its' dependencies
Shawn Iwinski 1584e9f
 * (created by %{name}-%{version}-%{release}).
Shawn Iwinski 1584e9f
 */
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
// Classmap
Shawn Iwinski 1584e9f
require_once __DIR__ . '/autoload.classmap.php';
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
// Php54
Shawn Iwinski 1584e9f
require_once __DIR__ . '/Php54/bootstrap.php';
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
// Php55
Shawn Iwinski 1584e9f
require_once '%{phpdir}/password_compat/password.php';
Shawn Iwinski 1584e9f
require_once __DIR__ . '/Php55/bootstrap.php';
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
// Php56
Shawn Iwinski 1584e9f
require_once __DIR__ . '/Php56/bootstrap.php';
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
// Php70
Shawn Iwinski 1584e9f
require_once '%{phpdir}/random_compat/autoload.php';
Shawn Iwinski 1584e9f
require_once __DIR__ . '/Php70/bootstrap.php';
Shawn Iwinski 1584e9f
AUTOLOAD
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
Shawn Iwinski 1584e9f
%install
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}
Shawn Iwinski 1584e9f
%{_bindir}/phpunit --verbose \
Shawn Iwinski 1584e9f
    --bootstrap %{buildroot}%{phpdir}/Symfony/Polyfill/autoload.php
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
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