|
|
Line 10: |
Line 10: |
| = Actual Guidelines = | | = Actual Guidelines = |
|
| |
|
| == File Placement == | | == Macros and scriptlets == |
|
| |
|
| Non-PEAR PHP extensions should put their Class files in /usr/share/php.
| | No information on macro provided by php-devel |
|
| |
|
| | = Change proposal = |
|
| |
|
| = Change proposal (subfolder) = | | == Macros and scriptlets == |
| | |
| == File Placement ==
| |
| | |
| Non-PEAR PHP software which provides shared libraries should put its PHP source files for such shared libraries in a subfolder of /usr/share/php, named according to the name of the software. For example, a library called "Whizz_Bang" (with a RPM called php-something-Whizz-Bang) would put the PHP source files for its shared libraries in /usr/share/php/Whizz_Bang.
| |
| | |
| = Actual Guidelines =
| |
| | |
| == Requires and Provides ==
| |
| === PECL Packages ===
| |
| | |
| A PECL package '''MUST''' have:
| |
| | |
| <pre>
| |
| BuildRequires: php-devel, php-pear
| |
| Requires(post): %{__pecl}
| |
| Requires(postun): %{__pecl}
| |
| | |
| %if 0%{?php_zend_api}
| |
| Requires: php(zend-abi) = %{php_zend_api}
| |
| Requires: php(api) = %{php_core_api}
| |
| %else
| |
| Requires: php-api = %{php_apiver}
| |
| %endif
| |
| | |
| Provides: php-pecl(foo) = %{version}
| |
| </pre>
| |
| | |
| = Change proposal (ABI Check) =
| |
| | |
| == Requires and Provides ==
| |
| === C extensions (PECL and others) ===
| |
| | |
| To be certain that a binary extension will run correctly with a particular version of PHP, it is necessary to check that a particular package has both API and ABIs matching the installed version of PHP. The mechanism for doing this has evolved over time and is as follows:
| |
| | |
| For '''Fedora''' (all current versions):
| |
| <pre>
| |
| BuildRequires: php-devel
| |
| Requires: php(zend-abi) = %{php_zend_api}
| |
| Requires: php(api) = %{php_core_api}
| |
| </pre>
| |
| | |
| For Fedora '''EPEL 5''':
| |
| <pre>
| |
| %global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
| |
| | |
| BuildRequires: php-devel
| |
| Requires: php-api = %{php_apiver}
| |
| </pre>
| |
| There is no way of checking the ABI with packages for Fedora EPEL 5.
| |
| | |
| For a spec file which is compatible with both Fedora and EPEL 5:
| |
| <pre>
| |
| %global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
| |
| | |
| %if 0%{?php_zend_api}
| |
| Requires: php(zend-abi) = %{php_zend_api}
| |
| Requires: php(api) = %{php_core_api}
| |
| %else
| |
| Requires: php-api = %{php_apiver}
| |
| %endif
| |
| </pre>
| |
| | |
| No API/ABI dependencies are available for Fedora '''EPEL 4''' packages.
| |
| | |
| === PECL Packages ===
| |
| | |
| PECL extension '''MUST''' have ABI check (see previous)
| |
| | |
| A PECL package '''MUST''' also have:
| |
| | |
| <pre>
| |
| BuildRequires: php-pear
| |
| Requires(post): %{__pecl}
| |
| Requires(postun): %{__pecl}
| |
| | |
| Provides: php-pecl(foo) = %{version}
| |
| </pre>
| |
| | |
| | |
| = Actual Guidelines = | |
|
| |
|
| == Macros and scriptlets == | | === PHP extension === |
| === PECL Modules ===
| |
|
| |
|
| The php-pear package in Fedora Core 5 and above (version 1:1.4.9-1.2) provides several useful macros: | | The php-devel package in fedora >= 17 (5.4.0) provides needed stuff to build ZTS macro and provides several new macros: |
| * %{pecl_phpdir}
| |
| * %{pecl_docdir}
| |
| * %{pecl_testdir}
| |
| * %{pecl_datadir}
| |
| * %{pecl_xmldir}
| |
|
| |
|
| You may need to define a few additional macros to extract some information from PHP. It is recommended that you use the following:
| | For standard (NTS) extensions |
| <pre> | | <pre> |
| %global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1) | | %{__php} %{_bindir}/php |
| %{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} | | %{php_extdir} %{_libdir}/php/modules |
| %{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}} | | %{php_inidir} %{_sysconfdir}/php.d |
| | %{php_incldir %{_includedir}/php |
| | %{php_bindir} %{_bindir} |
| </pre> | | </pre> |
|
| |
|
| And here are some recommended scriptlets for properly registering and unregistering the module:
| | For ZTS extensions |
| <pre> | | <pre> |
| %if 0%{?pecl_install:1} | | %{php_ztsextdir} %{_libdir}/php-zts/modules |
| %post
| | %{php_ztsinidir} %{_sysconfdir}/php-zts.d |
| %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : | | %{php_ztsincldir %{_includedir}/php-zts/php |
| %endif | | %{php_ztsbindir} %{_bindir}/php-zts |
| | |
| | |
| %if 0%{?pecl_uninstall:1}
| |
| %postun
| |
| if [ $1 -eq 0 ] ; then
| |
| %{pecl_uninstall} %{pecl_name} >/dev/null || : | |
| fi
| |
| %endif
| |
| </pre> | | </pre> |
|
| |
|
| = Change proposal (just a additional comment) =
| | %{php_ztsbindir} contains the executables needed during the build of ZTS extension |
| | | * phpize |
| Conditions around the post/postun scriplets can be removed if the extension requires php >= 5.2.0, where ''pecl_install'' always defined. So it is only mandatory for EPEL packages.
| | * php-config |
| | * php (which is only useful to run test suite during build) |
|
| |
|
|
| |
|
| [[Category:Packaging guidelines drafts]] | | [[Category:Packaging guidelines drafts]] |
[[TableOfContents(3)]
Proposed Changes to PHP Guidelines
Synopsis
This page describes items that need to be changed in the PHP Guidelines or other items that need to be reviewed or ratified by the Fedora Packaging Comittee and FESCo .
Actual Guidelines
Macros and scriptlets
No information on macro provided by php-devel
Change proposal
Macros and scriptlets
PHP extension
The php-devel package in fedora >= 17 (5.4.0) provides needed stuff to build ZTS macro and provides several new macros:
For standard (NTS) extensions
%{__php} %{_bindir}/php
%{php_extdir} %{_libdir}/php/modules
%{php_inidir} %{_sysconfdir}/php.d
%{php_incldir %{_includedir}/php
%{php_bindir} %{_bindir}
For ZTS extensions
%{php_ztsextdir} %{_libdir}/php-zts/modules
%{php_ztsinidir} %{_sysconfdir}/php-zts.d
%{php_ztsincldir %{_includedir}/php-zts/php
%{php_ztsbindir} %{_bindir}/php-zts
%{php_ztsbindir} contains the executables needed during the build of ZTS extension
- phpize
- php-config
- php (which is only useful to run test suite during build)