From fe7c3c8dcb8678710711020a7592e9050ed4783a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 14 Jul 2015 08:31:13 +0200 Subject: php-PhpOption: backport fedora changes --- php-PhpOption.spec | 121 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 92 insertions(+), 29 deletions(-) diff --git a/php-PhpOption.spec b/php-PhpOption.spec index b6905ac..747dd9a 100644 --- a/php-PhpOption.spec +++ b/php-PhpOption.spec @@ -1,14 +1,34 @@ -%global github_owner schmittjoh -%global github_name php-option -%global github_version 1.4.0 -%global github_commit 5d099bcf0393908bf4ad69cc47dafb785d51f7f5 - -%global lib_name PhpOption -%global php_min_ver 5.3.0 - -Name: php-%{lib_name} +# remirepo spec file for php-PhpOption, from Fedora: +# +# RPM spec file for php-PhpOption +# +# Copyright (c) 2013-2015 Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner schmittjoh +%global github_name php-option +%global github_version 1.4.0 +%global github_commit 5d099bcf0393908bf4ad69cc47dafb785d51f7f5 + +%global composer_vendor phpoption +%global composer_project phpoption + +# "php": ">=5.3.0" +%global php_min_ver 5.3.0 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-PhpOption Version: %{github_version} -Release: 1%{?dist} +Release: 4%{?dist} Summary: Option type for PHP Group: Development/Libraries @@ -18,15 +38,29 @@ Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -# For tests +# Tests +%if %{with_tests} +BuildRequires: %{_bindir}/phpunit +## composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-pear(pear.phpunit.de/PHPUnit) -# For tests: phpcompatinfo (computed from 1.4.0) +## phpcompatinfo (computed from version 1.4.0) BuildRequires: php-spl +## Autoloader +BuildRequires: php-composer(symfony/class-loader) +%endif +# composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from 1.4.0) +# phpcompatinfo (computed from version 1.4.0) Requires: php-spl +# Autoloader +Requires: php-composer(symfony/class-loader) + +# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming +Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} +Provides: php-%{composer_vendor} = %{version}-%{release} +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description This package adds an Option type for PHP. @@ -53,38 +87,67 @@ how he consumes these methods. %prep %setup -qn %{github_name}-%{github_commit} +: Create autoloader +cat <<'AUTOLOAD' | tee src/PhpOption/autoload.php +register(); +} + +$fedoraClassLoader->addPrefix('PhpOption\\', dirname(__DIR__)); + +return $fedoraClassLoader; +AUTOLOAD + %build # Empty build section, nothing to build %install -mkdir -pm 0755 %{buildroot}%{_datadir}/php -cp -rp src/%{lib_name} %{buildroot}%{_datadir}/php/ +rm -rf %{buildroot} +mkdir -p %{buildroot}%{phpdir} +cp -rp src/* %{buildroot}%{phpdir}/ %check -# Rewrite tests' bootstrap -cat > tests/bootstrap.php <<'BOOTSTRAP' - phpunit.xml -%{_bindir}/phpunit --include-path ./src:./tests -d date.timezone="UTC" +%clean +rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc LICENSE README.md composer.json -%{_datadir}/php/%{lib_name} +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%{phpdir}/PhpOption + %changelog +* Sat Jul 11 2015 Shawn Iwinski - 1.4.0-4 +- Added spec license +- Added autoloader +- Added standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming provides +- Added php-composer(phpoption/phpoption) provide +- %%license usage + * Mon Feb 17 2014 Remi Collet 1.4.0-1 - backport 1.4.0 for remi repo -- cgit