De : Pierre Joye [mailto:pierre.php@gmail.com]
I tend to prefer separate files and add the right source at configure
time.
It is then easier to keep fixes, features, etc. in sync.
However both solutions may work, if we decide to go for one or another
solution. We can add support for the packaging/install in pickle and the
website.
To reply to Pierre's question about the way we choose to keep extensions
compatible with 5 and 7, I see that the choice was already made :), we will
duplicate the code and maintain two distinct code trees :(
As the decision is, hopefully, not official yet, may I suggest another
solution ?
I am currently working on a PHP extension generator. The objective here, is
that the developer writes as few code as possible and that this code uses an
abstraction layer as rich as possible to keep it compatible with as many
different environments as possible. This allows to lower the skills level
and
the workload required to develop & maintain a PHP extension, especially
when the extension must be compatible with different PHP
engines/versions.
The future need to port PECL extensions massively to PHP 7 is the perfect
occasion to convert them to use such a tool. The existing code should be
modified to fit the tool but, once done, the code size is greatly reduced
and
the same source code can be used for every supported target environment
(current scope is PHP 5.x, PHP 7, HHVM). When an extension developer
leaves, thanks to the extension synthetic description and to the reduced
amount of code, the extension is easier to take over. Last, it makes BC
breaks
in the C API easier to manage as there are chances that the BC break is
abstracted (just need to adapt the generator). In this case, the generator
is
modified, not the extension source code.
The developer just describes the extension (in yaml or json) and writes the
function/methods bodies using compatibility macros for as many features as
possible. In order to build the extension, a specialized code generator
generates 'ready-to-compile' code for the PHP engine/version you chose
(code is generated using twig templates, making generator development
easier).
Finally, the tool, even with a limited abstraction scope, can be used for
any
existing and future extension as, for the features which are not
generated/wrapped yet, the user can provide any C code to be included as-
is.
Please, have a look at the flaupretre/php-ext-gen repository in github,
especially
the examples and doc subdirectories, and give me your opinion.
Regards
Fran