From dba486df7291d552530eb39cd83323157bb8cea6 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Tue, 5 Dec 2017 11:19:53 +0100
Subject: switch from zend-loader to fedora/autoloader

---
 php-zendframework-zend-dom.spec | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/php-zendframework-zend-dom.spec b/php-zendframework-zend-dom.spec
index 4a32110..58bfdb8 100644
--- a/php-zendframework-zend-dom.spec
+++ b/php-zendframework-zend-dom.spec
@@ -21,7 +21,7 @@
 
 Name:           php-%{gh_owner}-%{gh_project}
 Version:        2.6.0
-Release:        1%{?dist}
+Release:        5%{?dist}
 Summary:        Zend Framework %{library} component
 
 Group:          Development/Libraries
@@ -42,9 +42,9 @@ BuildRequires:  php-spl
 #        "fabpot/php-cs-fixer": "1.7.*",
 #        "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"
@@ -55,11 +55,12 @@ Requires:       php-libxml
 Requires:       php-pcre
 Requires:       php-spl
 # Autoloader
-Requires:       php-composer(%{gh_owner}/zend-loader)           >= 2.5
+Requires:       php-composer(fedora/autoloader)
 
 Obsoletes:      php-ZendFramework2-%{library} < 2.5
 Provides:       php-ZendFramework2-%{library} = %{version}
 Provides:       php-composer(%{gh_owner}/%{gh_project}) = %{version}
+Provides:       php-autoloader(%{gh_owner}/%{gh_project}) = %{version}
 
 
 %description
@@ -77,7 +78,8 @@ mv LICENSE.md LICENSE
 
 
 %build
-# Empty build section, nothing required
+: Create autoloader
+phpab --template fedora --output src/autoload.php src
 
 
 %install
@@ -90,14 +92,8 @@ cp -pr src %{buildroot}%{php_home}/Zend/%{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\\%{library}' => dirname(__DIR__).'/test/',
-           'Zend\\%{library}'     => '%{buildroot}%{php_home}/Zend/%{library}'
-))));
-require_once '%{php_home}/Zend/autoload.php';
+require_once '%{buildroot}%{php_home}/Zend/%{library}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test');
 EOF
 
 ret=0
@@ -117,10 +113,14 @@ exit $ret
 %license LICENSE
 %doc *.md
 %doc composer.json
-%{php_home}/Zend/%{library}
+%dir %{php_home}/Zend
+     %{php_home}/Zend/%{library}
 
 
 %changelog
+* Tue Dec  5 2017 Remi Collet <remi@remirepo.net> - 2.6.0-5
+- switch from zend-loader to fedora/autoloader
+
 * Thu Jan 28 2016 Remi Collet <remi@fedoraproject.org> - 2.6.0-1
 - update to 2.6.0
 - raise min php version to 5.5
-- 
cgit