Here is some updates proposal for the
Guidelines for packaging PHP addon modules
1 ------ No file in BUILD directory
PEAR & PECL Packages
The source archive contains a package.xml outside any directory, so you
should/must use
%setup -q -c
2 ----- Initial spec.
PEAR Packages
To create your specfile, you could use the default template provided by
rpmdevtools or generate one with the command "pear make-rpm-spec
Sources.tgz" (install php-pear-PEAR-Command-Packaging)
3 ---- API version check
PECL Packages
With php-5.1.6-3.3 on FC6 and php-5.2.0-8 on rawhide php-common now
provide php-zend-api.
This exact version must be require by pecl extension.
The php-common in Fedora Core 7 and above (version 5.2.0-8) provides
several useful macros:
%{php_core_api}
%{php_zend_api}
%{php_pdo_api}
Solution 1 (using the macros, only available on rawhide)
%if %{?php_zend_api}0
Requires: php_zend_api = %{php_zend_api}
%endif
Solution 2 (not using the /etc/rpm/macros.php)
%global php_zendapi %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP
Extension => //p') | tail -1)
%if %{fedora} >= 6
Requires: php_zend_api = %{php_zendapi}
%endif
We can also post a RFE on php to also provide the macros on FC6
---
Some comments.
A load time, PHP check that each extension is compatible.
php_dl.c compare ZEND_MODULE_API_NO value at php build time and at
extension build time.
If this values doesn't match, the extension is not loaded and an error
is displayed :
> PHP Warning: PHP Startup: mailparse: Unable to initialize module
> Module compiled with module API=20060613, debug=0, thread-safety=0
> PHP compiled with module API=20050922, debug=0, thread-safety=0
> These options need to match
>
php-abi (PHP_API_VERSION) is 20041225 for a very long time.
php-zend-abi (ZEND_MODULE_API_NO) is the true API version need to check
extension compatibility
Ex : php-5.1.4, 5.1.5, 5.1.6
PHP Api Version: 20041225
Zend Module Api No: 20050922
php-5.2.0
PHP Api Version: 20041225
Zend Module Api No: 20060613
See Bugzilla #212804
Requires: php-api could be keep, but is not very useful
Thanks for your comments,
I could edit the wiki if this is approved and if you want me to do it.
Remi.
P.S. i hope this is clear ?