Custom build rule
| From: | Ingwie Phoenix | Date: | Sun, 03 Aug 2014 00:24:26 +0000 |
| Subject: | Custom build rule | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-76314@lists.php.net to get a copy of this message | ||
Hello internals!
I have almost completed a SAPI, that allows NodeJS scripters to enable PHP from within their HTTP
servers.
Originally, I wanted to write this extension just for my own use, but as I see the many „dirty“
hacks that people use to run PHP inside their http server, I decided to make this extension more
available, once its done and working.
However, the build process is a bit complicated, as it plays between worlds; the autoconf based PHP
build system and the GYP driven node extension build system. So far, I am working on the first
solution: Building the extension using PHP’s build mechanism.
As I know the procedure for building nodejs addons by their commands, I’d just need to add a
custom action/rule to the build, that builds a static library/bundle with .node as file extension
isntead of the usual ..so/.dll.
How do I do that? Its two C++ files (tinythread.cpp, v8php.cc) that need to be compiled. v8php.cc
houses the entire SAPI code as well as the nodejs bindings.
And as a side note: When the user has previously built PHP with ZTS and Embed-SAPI, so that libphp5
is built, can they just link a SAPI against that? I see that php-config lists the SAPIs, and I
wondered if there is a generated file that lists/depends on all the SAPIs.
Kind regards,
Ingwie