cvs: ZendAPI / Extending_Zend_Build.xml Extending_Zend_IniFileSupport.xml Extending_Zend_Layout.xml

From: Date: Sun, 06 Oct 2002 21:43:02 +0000
Subject: cvs: ZendAPI / Extending_Zend_Build.xml Extending_Zend_IniFileSupport.xml Extending_Zend_Layout.xml
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-472@lists.php.net to get a copy of this message
imajes Sun Oct 6 17:43:02 2002 EDT Modified files: /ZendAPI Extending_Zend_Build.xml Extending_Zend_IniFileSupport.xml Extending_Zend_Layout.xml Log: some general updates plus more realistic build info.

Index: ZendAPI/Extending_Zend_Build.xml diff -u ZendAPI/Extending_Zend_Build.xml:1.6 ZendAPI/Extending_Zend_Build.xml:1.7 --- ZendAPI/Extending_Zend_Build.xml:1.6 Mon Mar 25 03:13:46 2002 +++ ZendAPI/Extending_Zend_Build.xml Sun Oct 6 17:43:02 2002 @@ -1,42 +1,45 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> - <!-- $Revision: 1.6 $ --> + <!-- $Revision: 1.7 $ --> <chapter id="zend.build"> <title>PHP's Automatic Build System</title> <para> PHP 4 features an automatic build system that's very flexible. All modules reside in a subdirectory of the <filename>ext</filename> directory. In addition to its own sources, - each module consists of an M4 file (for example, see + each module consists of a config.m4 file, for extension configuration. (for example, see <ulink url="http://www.gnu.org/manual/m4/html_mono/m4.html">http://www.gnu.org/manual/m4/html_mono/m4.html</ulink>) - for configuration and a Makefile.in file, which is responsible for compilation - (the results of autoconf and automake; for example, see - <ulink url="http://sourceware.cygnus.com/autoconf/autoconf.html">http://sourceware.cygnus.com/autoconf/autoconf.html</ulink> - and <ulink url="http://sourceware.cygnus.com/automake/automake.html">http://sourceware.cygnus.com/automake/automake.html</ulink>). </para> <para> - Both files are generated automatically, along with + All these stub files are generated automatically, along with <filename>.cvsignore</filename>, by a little shell script named <filename>ext_skel</filename> that resides in the <filename>ext</filename> directory. As argument it takes the name of the module that you want to create. The shell script then creates a directory of the same name, along with the appropriate - <filename>config.m4</filename> and <filename>Makefile.in</filename> - files. + stub files. </para> <para> Step by step, the process looks like this: <screen> -root@dev:/usr/local/src/php4/ext > ./ext_skel my_module -Creating directory -Creating basic files: config.m4 Makefile.in .cvsignore [done]. -To use your new extension, you will have to execute the following steps: - $ cd .. - $ ./buildconf - $ ./configure # (your extension is automatically enabled) - $ vi ext/my_module/my_module.c - $ make -Repeat the last two steps as often as necessary. +:~/cvs/php4/ext:> ./ext_skel --extname=my_module +Creating directory my_module +Creating basic files: config.m4 .cvsignore my_module.c php_my_module.h CREDITS EXPERIMENTAL tests/001.phpt my_module.php [done]. + +To use your new extension, you will have to execute the following steps: + +1. $ cd .. +2. $ vi ext/my_module/config.m4 +3. $ ./buildconf +4. $ ./configure --[with|enable]-my_module +5. $ make +6. $ ./php -f ext/my_module/my_module.php +7. $ vi ext/my_module/my_module.c +8. $ make + +Repeat steps 3-6 until you are satisfied with ext/my_module/config.m4 and +step 6 confirms that your module is compiled into PHP. Then, start writing +code and repeat the last two steps as often as necessary. </screen> This instruction creates the aforementioned files. To include the new module in the automatic @@ -47,52 +50,74 @@ <filename>config.m4</filename> files. </para> <para> - Finally, running <filename>configure</filename> parses all - configuration options and generates a makefile based on those - options and the options you specify in - <filename>Makefile.in</filename>. - </para> - <para> - <xref linkend='example.makefile.in'/>shows the previously generated - <filename>Makefile.in</filename>: - </para> - <example id='example.makefile.in'> - <title>The default <filename>Makefile.in</filename>.</title> - <programlisting> -# $Id: Extending_Zend_Build.xml,v 1.6 2002/03/25 08:13:46 hholzgra Exp $ -LTLIBRARY_NAME = libmy_module.la -LTLIBRARY_SOURCES = my_module.c -LTLIBRARY_SHARED_NAME = my_module.la include -$(top_srcdir)/build/dynlib.mk - </programlisting> - </example> - <para> - There's not much to tell about this one: It contains the names - of the input and output files. You could also specify build - instructions for other files if your module is built from multiple - source files. - </para> - <para> The default <filename>config.m4</filename> shown in <xref linkend='example.config.m4'/>'/> is a bit more complex: </para> <example id='example.config.m4'> <title>The default <filename>config.m4</filename>.</title> <programlisting> -dnl $Id: Extending_Zend_Build.xml,v 1.6 2002/03/25 08:13:46 hholzgra Exp $ -dnl config.m4 for extension my_module -dnl don't forget to call PHP_EXTENSION(my_module) +dnl $Id: Extending_Zend_Build.xml,v 1.7 2002/10/06 21:43:02 imajes Exp $ +dnl config.m4 for extension my_module + +dnl Comments in this file start with the string 'dnl'. +dnl Remove where necessary. This file will not work +dnl without editing. + dnl If your extension references something external, use with: -PHP_ARG_WITH(my_module, for my_module support, -dnl Make sure that the comment is aligned: - [ --with-my_module Include my_module support]) + +dnl PHP_ARG_WITH(my_module, for my_module support, +dnl Make sure that the comment is aligned: +dnl [ --with-my_module Include my_module support]) + dnl Otherwise use enable: -PHP_ARG_ENABLE(my_module, whether to enable my_module support, -dnl Make sure that the comment is aligned: - [ --enable-my_module Enable my_module support]) + +dnl PHP_ARG_ENABLE(my_module, whether to enable my_module support, +dnl Make sure that the comment is aligned: +dnl [ --enable-my_module Enable my_module support]) + if test "$PHP_MY_MODULE" != "no"; then -dnl Action.. -PHP_EXTENSION(my_module, $ext_shared) + dnl Write more examples of tests here... + + dnl # --with-my_module -> check with-path + dnl SEARCH_PATH="/usr/local /usr" # you might want to change this + dnl SEARCH_FOR="/include/my_module.h" # you most likely want to change this + dnl if test -r $PHP_MY_MODULE/; then # path given as parameter + dnl MY_MODULE_DIR=$PHP_MY_MODULE + dnl else # search default path list + dnl AC_MSG_CHECKING([for my_module files in default path]) + dnl for i in $SEARCH_PATH ; do + dnl if test -r $i/$SEARCH_FOR; then + dnl MY_MODULE_DIR=$i + dnl AC_MSG_RESULT(found in $i) + dnl fi + dnl done + dnl fi + dnl + dnl if test -z "$MY_MODULE_DIR"; then + dnl AC_MSG_RESULT([not found]) + dnl AC_MSG_ERROR([Please reinstall the my_module distribution]) + dnl fi + + dnl # --with-my_module -> add include path + dnl PHP_ADD_INCLUDE($MY_MODULE_DIR/include) + + dnl # --with-my_module -> chech for lib and symbol presence + dnl LIBNAME=my_module # you may want to change this + dnl LIBSYMBOL=my_module # you most likely want to change this + + dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, + dnl [ + dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $MY_MODULE_DIR/lib, MY_MODULE_SHARED_LIBADD) + dnl AC_DEFINE(HAVE_MY_MODULELIB,1,[ ]) + dnl ],[ + dnl AC_MSG_ERROR([wrong my_module lib version or lib not found]) + dnl ],[ + dnl -L$MY_MODULE_DIR/lib -lm -ldl + dnl ]) + dnl + dnl PHP_SUBST(MY_MODULE_SHARED_LIBADD) + + PHP_NEW_EXTENSION(my_module, my_module.c, $ext_shared) fi </programlisting> </example> @@ -151,13 +176,7 @@ <para> We'll go into more details on the M4 macros available to your configuration scripts later in this chapter. For now, we'll simply - use the default files. The sample sources on the CD-ROM all have - working <filename>config.m4</filename> files. To include them into - the PHP build process, simply copy the source directories to your - PHP <filename>ext</filename> directory, run - <filename>buildconf</filename>, and then include the sample modules - you want by using the appropriate <literal>--enable-*</literal> - directives with <filename>configure</filename>. + use the default files. </para> </chapter> <!-- Index: ZendAPI/Extending_Zend_IniFileSupport.xml diff -u ZendAPI/Extending_Zend_IniFileSupport.xml:1.6 ZendAPI/Extending_Zend_IniFileSupport.xml:1.7 --- ZendAPI/Extending_Zend_IniFileSupport.xml:1.6 Mon Mar 25 03:27:13 2002 +++ ZendAPI/Extending_Zend_IniFileSupport.xml Sun Oct 6 17:43:02 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> - <!-- $Revision: 1.6 $ --> + <!-- $Id: Extending_Zend_IniFileSupport.xml,v 1.7 2002/10/06 21:43:02 imajes Exp $ --> <chapter id="zend.ini-file-support"> <title>Initialization File Support</title> <para> @@ -29,7 +29,7 @@ <para> The permissions are grouped into three sections:<literal>PHP_INI_SYSTEM</literal> allows a change only directly in - the <filename>php3.ini</filename> file; <literal>PHP_INI_USER</literal> allows + the <filename>php.ini</filename> file; <literal>PHP_INI_USER</literal> allows a change to be overridden by a user at runtime using additional configuration files, such as <filename>.htaccess</filename>; and <literal>PHP_INI_ALL</literal> allows changes to be made without restrictions. There's also a fourth level, Index: ZendAPI/Extending_Zend_Layout.xml diff -u ZendAPI/Extending_Zend_Layout.xml:1.7 ZendAPI/Extending_Zend_Layout.xml:1.8 --- ZendAPI/Extending_Zend_Layout.xml:1.7 Sun Mar 24 21:23:50 2002 +++ ZendAPI/Extending_Zend_Layout.xml Sun Oct 6 17:43:02 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> - <!-- $Revision: 1.7 $ --> + <!-- $Revision: 1.8 $ --> <chapter id="zend.layout"> <title>Source Layout</title> @@ -25,13 +25,13 @@ through PHP's files. This is a must-have ability to implement and debug extensions. </para> - <para> +<!-- <para> After extracting the PHP archive, you'll see a directory layout similar to that in <xref linkend='fig.dir-layout'/>. </para> <figure id='fig.dir-layout'> <title>Main directory layout of the PHP source tree.</title> <graphic fileref="figures/Extending_Zend_1a_Directory_Layout.png"/> - </figure> + </figure> --> <para> The following table describes the contents of the major directories. </para> @@ -45,47 +45,53 @@ <entry colname="col2">Contents</entry> </row> <row> - <entry colname="col1"><filename>php-4</filename></entry> + <entry colname="col1"><filename>php4</filename></entry> <entry colname="col2"> Main PHP source files and main header files; here you'll find - all of PHP's API definitions, macros, etc. (important). + all of PHP's API definitions, macros, etc. (important). + Everything else is below this directory. </entry> </row> <row> - <entry colname="col1"><filename>ext</filename></entry> + <entry colname="col1"><filename>php4/ext</filename></entry> <entry colname="col2"> Repository for dynamic and built-in modules; by default, these are the "official" PHP modules that have been integrated into - the main source tree. In PHP 4.0, it's possible to compile + the main source tree. From PHP 4.0, it's possible to compile these standard extensions as dynamic loadable modules (at least, those that support it). </entry> </row> + <row> + <entry colname="col1"><filename>php4/main</filename></entry> + <entry colname="col2"> + This directory contains the main php macros and definitions. (important) + </entry> + </row> <row> - <entry colname="col1"><filename>pear</filename></entry> + <entry colname="col1"><filename>php4/pear</filename></entry> <entry colname="col2"> - Directory for the PHP class repository. - At the time of this writing, this is still in the design phase, but it's being - tried to establish something similar to CPAN for Perl here. + Directory for the PHP Extension and Application Repository. This directory contains + core PEAR files. </entry> </row> <row> - <entry colname="col1"><filename>sapi</filename></entry> + <entry colname="col1"><filename>php4/sapi</filename></entry> <entry colname="col2"> Contains the code for the different server abstraction layers. </entry> </row> <row> - <entry colname="col1"><filename>TSRM</filename></entry> + <entry colname="col1"><filename>php4/TSRM</filename></entry> <entry colname="col2"> Location of the "Thread Safe Resource Manager" (TSRM) for Zend and PHP. </entry> </row> <row> - <entry colname="col1"><filename>Zend</filename></entry> + <entry colname="col1"><filename>php4/Zend</filename></entry> <entry colname="col2"> - Location of Zend's file; here you'll + Location of the Zend Engine files; here you'll find all of Zend's API definitions, macros, etc. (important). </entry> </row> @@ -98,19 +104,19 @@ following files:<itemizedlist> <listitem> <para> - <filename>php.h</filename>, located in the main PHP directory. + <filename>php4/main/php.h</filename>, located in the main PHP directory. This file contains most of PHP's macro and API definitions. </para> </listitem> <listitem> <para> - <filename>zend.h</filename>, located in the main Zend directory. + <filename>php4/Zend/zend.h</filename>, located in the main Zend directory. This file contains most of Zend's macros and definitions. </para> </listitem> <listitem> <para> - <filename>zend_API.h</filename>, also located in the Zend + <filename>php4/Zend/zend_API.h</filename>, also located in the Zend directory, which defines Zend's API. </para> </listitem>
« previous php.zend-engine.cvs (#472) next »