Re: includeing c (BLADE)

From: Date: Tue, 04 Jan 2000 00:05:17 +0000
Subject: Re: includeing c (BLADE)
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-14242@lists.php.net to get a copy of this message
On Mon, Jan 03, 2000 at 05:46:51PM -0600, bob@cs.csoft.net wrote: > Ok. I was not on the list for very long. If it was posted to the list, can > I get a copy? If not, I dont see it on the php or zend sites. Where is it > located? You should subscribe to php4beta@lists.php.net. I've attached the howto. -- 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.dev (#14242) next »