php4-ngX

From: Date: Wed, 29 Dec 1999 04:57:21 +0000
Subject: php4-ngX
Groups: php.version4 
Request: Send a blank email to php-version4+get-8634@lists.php.net to get a copy of this message
Hi, I've just uploaded php4-ngX to http://va.php.net/~sas/php4-ng/ Changes against the current CVS: - added support for externally built modules - improved support for in-tree shared modules - faster static build (libtool isn't used anymore for compiling non-PIC objects) - dependencies comparable to automake's, without requiring GNU make or GCC - working make clean for non-GNU makes I'll commit these changes within the next 48 hours, if noone finds a bug in the conception or the implementation. Appended is a short howto-create-a-module. -- Regards, Sascha Schumann Consultant

HOW TO CREATE A PHP MODULE Imagine you want to create a new module for PHP. This module could be named fooext. How do you get from the idea to a self-contained distribution which people can download and install? FIRST STEP: Get familiar with how PHP modules work <Insert extensive tutorial about PHP modules> SECOND STEP: Create the distribution framework Create a Makefile.in template. This should contain at least: ==============================================Makefile.in==== DEPTH = . topsrcdir = @topsrcdir@ srcdir = @srcdir@ VPATH = @srcdir@ LTLIBRARY_SHARED_NAME = fooext.la LTLIBRARY_SOURCES = fooext.c include $(topsrcdir)/build/ltlib.mk ==============================================Makefile.in==== Where fooext is the name of your module. No other changes are necessary. The second file is config.m4. You can put autoconf tests there. The following example assumes that your fooext extension requires an external library foo. =============================================config.m4======= AC_ARG_WITH(fooext, [ --with-foo[=DIR] Include FOO support. DIR is the FOO install directory.],[ # check for additional arguments PHP_WITH_SHARED # check for header file in various locations for i in /usr/local /usr $withval; do if test -f $i/include/foo.h; then FOO_PREFIX=$i fi done # Stop, if header file was not found if test -z "$FOO_PREFIX"; then AC_MSG_ERROR(Cannot find header file for foo extension.) fi # Add include dir path, library directory path and library AC_ADD_INCLUDE($FOO_PREFIX/include) AC_ADD_LIBRARY_WITH_PATH(foo, $FOO_PREFIX/lib) # build foo extension PHP_EXTENSION(foo, $shared) PHP_FOO="yes, foo installed in $FOO_PREFIX" ],[ PHP_FOO="no" ]) # inform the user what we are doing AC_MSG_CHECKING(for foo support) AC_MSG_RESULT($PHP_FOO) =============================================config.m4======= Now create a new directory, put Makefile.in, config.m4, and your source files there, and run the following script: ==============================================dist.sh======== #! /bin/sh #################################### # configure this part appropiately: phpize=/path/to/bin/phpize distname=fooext-1.0 #################################### if ! test -e Makefile.in || ! test -e config.m4; then echo "Did not find required files in current directory" exit 1 fi rm -rf modules *.lo *.o *.la config.status config.cache \ config.log libtool php_config.h config_vars.mk Makefile myname=`basename \`pwd\`` cd .. cp -rp $myname $distname cd $distname $phpize cd .. tar cf $distname.tar $distname rm -rf $distname $distname.tar.* gzip --best $distname.tar mv $distname.tar $myname ==============================================dist.sh======== If this script did not output any errors, you should have now a file called fooext-1.0.tar.gz in the current directory.
« previous php.version4 (#8634) next »