php-src/ext/ext_skel
Sascha Schumann a481fddfb3 Improved in-tree shared libraries build system
The following new/revived shared modules are available now:

  ... MySQL (*)
  ... PCRE (*)
  ... Session
  ... SWF

  (*) capable of using bundled library or external library

All changes:

  The m4 macro PHP_EXTENSION was revamped. Uses LIB_BUILD now.
  This effectively means that all extensions have to use dynlib.

  ext/mysql/config.m4 was revamped.
  Uses LIB_BUILD for building bundled library.

  ext/pcre/config.m4 was revamped.
  Uses LIB_BUILD for building bundled library.

  ext/ext_skel was changed to reflect that more modules should be
  compileable as shared module.

  ext/Makefile.in has been simplified enormously.

  Dependencies are now stored in the build tree.

  Empty dependencies are not generated by buildconf anymore. They
  are now dynamically created during the build process.

  Implicit rules for .S were removed.

  The NO_RECURSION feature was removed.

  "libs.mk" has been added to all cvsignore files in ext.
2000-05-01 02:42:55 +00:00

103 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
extname="$1"
EXTNAME=`echo $1|tr a-z A-Z`
givup() {
echo $*
exit 1
}
if test "$extname" = ""; then
givup "usage: $0 extension-name"
fi
if test -d "$extname" ; then
givup "Directory $extname already exists."
fi
test -f ext_skel || givup "ext_skel must be in the current directory"
if echo '\c' | grep -s c >/dev/null 2>&1
then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi
echo "Creating directory"
mkdir $extname || givup "Cannot create directory $extname"
cd $extname
chmod 755 .
$ECHO_N "Creating basic files:$ECHO_C"
$ECHO_N " config.m4$ECHO_C"
cat >config.m4 <<eof
dnl \$Id\$
dnl config.m4 for extension $extname
dnl don't forget to call PHP_EXTENSION($extname)
dnl If your extension references something external, use with:
PHP_ARG_WITH($extname, for $extname support,
dnl Make sure that the comment is aligned:
[ --with-$extname Include $extname support])
dnl Otherwise use enable:
PHP_ARG_ENABLE($extname, whether to enable $extname support,
dnl Make sure that the comment is aligned:
[ --enable-$extname Enable $extname support])
if test "\$PHP_$EXTNAME" != "no"; then
dnl Action..
PHP_EXTENSION($extname, \$ext_shared)
fi
eof
$ECHO_N " Makefile.in$ECHO_C"
cat >Makefile.in <<eof
# \$Id\$
LTLIBRARY_NAME = lib$extname.la
LTLIBRARY_SOURCES = $extname.c
LTLIBRARY_SHARED_NAME = $extname.la
include \$(top_srcdir)/build/dynlib.mk
eof
$ECHO_N " .cvsignore$ECHO_C"
cat >.cvsignore <<eof
.deps
Makefile
*.o
*.lo
*.la
.libs
libs.mk
eof
chmod 644 *
echo " [done]."
cat <<eof
To use your new extension, you will have to execute the following steps:
$ cd ..
$ ./buildconf
$ ./configure (your extension is automatically enabled)
$ vi ext/$extname/$extname.c
$ make
Repeat the last two steps as often as necessary.
eof