summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-04-26 09:22:35 +0200
committerRemi Collet <remi@remirepo.net>2018-04-26 09:22:35 +0200
commit55352cec351cdf50b35d9b707c3fe1d71b4c60f9 (patch)
tree8b3c0f3f738098ae8a7846e7d5c4049d658eb644
parent715e20c523e3dc7395961896fa4d2beb99dc1b98 (diff)
switch from zend-loader to fedora/autoloader
-rw-r--r--php-zendframework-zend-json-server.spec47
1 files changed, 26 insertions, 21 deletions
diff --git a/php-zendframework-zend-json-server.spec b/php-zendframework-zend-json-server.spec
index 02c55f6..c9d93de 100644
--- a/php-zendframework-zend-json-server.spec
+++ b/php-zendframework-zend-json-server.spec
@@ -1,6 +1,6 @@
# remirepo/Fedora spec file for php-zendframework-zend-json-server
#
-# Copyright (c) 2015-2017 Remi Collet
+# Copyright (c) 2015-2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -37,16 +37,16 @@ BuildRequires: php(language) >= 5.5
BuildRequires: php-pcre
BuildRequires: php-reflection
BuildRequires: php-spl
-BuildRequires: php-composer(%{gh_owner}/zend-json) >= 2.6.1
-BuildRequires: php-composer(%{gh_owner}/zend-http) >= 2.5.4
-BuildRequires: php-composer(%{gh_owner}/zend-server) >= 2.6.1
+BuildRequires: php-autoloader(%{gh_owner}/zend-json) >= 2.6.1
+BuildRequires: php-autoloader(%{gh_owner}/zend-http) >= 2.5.4
+BuildRequires: php-autoloader(%{gh_owner}/zend-server) >= 2.6.1
# From composer, "require-dev": {
# "squizlabs/php_codesniffer": "^2.3",
# "phpunit/PHPUnit": "~4.0"
BuildRequires: php-composer(phpunit/phpunit) >= 4.0
-# Autoloader
-BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5
%endif
+# Autoloader
+BuildRequires: php-fedora-autoloader-devel
# From composer, "require": {
# "php": "^5.5 || ^7.0",
@@ -55,18 +55,21 @@ BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5
# "zendframework/zend-server": "^2.6.1"
Requires: php(language) >= 5.5
# Require zend-json 3.0.0 as conflicts with previous
-Requires: php-composer(%{gh_owner}/zend-json) >= 3.0.0
-Requires: php-composer(%{gh_owner}/zend-json) < 4
-Requires: php-composer(%{gh_owner}/zend-http) >= 2.5.4
-Requires: php-composer(%{gh_owner}/zend-http) < 3
-Requires: php-composer(%{gh_owner}/zend-server) >= 2.6.1
-Requires: php-composer(%{gh_owner}/zend-server) < 4
+Requires: php-autoloader(%{gh_owner}/zend-json) >= 3.0.0
+Requires: php-autoloader(%{gh_owner}/zend-json) < 4
+Requires: php-autoloader(%{gh_owner}/zend-http) >= 2.5.4
+Requires: php-autoloader(%{gh_owner}/zend-http) < 3
+Requires: php-autoloader(%{gh_owner}/zend-server) >= 2.6.1
+Requires: php-autoloader(%{gh_owner}/zend-server) < 4
+# Autoloader
+Requires: php-composer(fedora/autoloader)
# From phpcompatinfo report for version 3.0.0
Requires: php-pcre
Requires: php-reflection
Requires: php-spl
Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+Provides: php-autoloader(%{gh_owner}/%{gh_project}) = %{version}
%description
@@ -83,7 +86,15 @@ mv LICENSE.md LICENSE
%build
-# Empty build section, nothing required
+: Create autoloader
+phpab --template fedora --output src/autoload.php src
+cat << 'EOF' | tee -a src/autoload.php
+\Fedora\Autoloader\Dependencies::required([
+ '%{php_home}/Zend/Json/autoload.php',
+ '%{php_home}/Zend/Http/autoload.php',
+ '%{php_home}/Zend/Server/autoload.php',
+]);
+EOF
%install
@@ -96,14 +107,8 @@ cp -pr src %{buildroot}%{php_home}/Zend/Json/%{library}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
-require_once '%{php_home}/Zend/Loader/AutoloaderFactory.php';
-Zend\Loader\AutoloaderFactory::factory(array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- 'ZendTest\\Json\\%{library}' => dirname(__DIR__).'/test/',
- 'Zend\\Json\\%{library}' => '%{buildroot}%{php_home}/Zend/Json/%{library}'
-))));
-require_once '%{php_home}/Zend/autoload.php';
+require_once '%{buildroot}%{php_home}/Zend/Json/%{library}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\Json\\%{library}\\', dirname(__DIR__) . '/test');
require_once __DIR__ . '/../test/TestAsset/FooFunc.php';
EOF