1999-04-21 18:24:41 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
1999-04-22 00:23:47 +08:00
|
|
|
extname="$1"
|
|
|
|
EXTNAME=`echo $1|tr a-z A-Z`
|
1999-04-21 18:24:41 +08:00
|
|
|
|
1999-09-27 22:05:18 +08:00
|
|
|
givup() {
|
1999-04-21 18:24:41 +08:00
|
|
|
echo $*
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
1999-04-22 00:23:47 +08:00
|
|
|
if test "$extname" = ""; then
|
1999-04-21 18:24:41 +08:00
|
|
|
givup "usage: $0 extension-name"
|
|
|
|
fi
|
|
|
|
|
1999-04-22 00:23:47 +08:00
|
|
|
if test -d "$extname" ; then
|
|
|
|
givup "Directory $extname already exists."
|
1999-04-21 18:24:41 +08:00
|
|
|
fi
|
|
|
|
|
1999-10-08 03:53:20 +08:00
|
|
|
test -f ext_skel || givup "ext_skel must be in the current directory"
|
|
|
|
|
1999-09-27 22:15:15 +08:00
|
|
|
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
|
|
|
|
|
1999-04-21 18:24:41 +08:00
|
|
|
echo "Creating directory"
|
|
|
|
|
1999-04-22 00:23:47 +08:00
|
|
|
mkdir $extname || givup "Cannot create directory $extname"
|
1999-04-21 18:24:41 +08:00
|
|
|
|
1999-04-22 00:23:47 +08:00
|
|
|
cd $extname
|
1999-04-21 18:24:41 +08:00
|
|
|
chmod 755 .
|
|
|
|
|
1999-09-27 22:15:15 +08:00
|
|
|
$ECHO_N "Creating basic files:$ECHO_C"
|
1999-04-21 18:24:41 +08:00
|
|
|
|
1999-09-27 22:15:15 +08:00
|
|
|
$ECHO_N " config.m4$ECHO_C"
|
1999-04-21 18:24:41 +08:00
|
|
|
cat >config.m4 <<eof
|
|
|
|
dnl \$Id\$
|
1999-04-22 00:23:47 +08:00
|
|
|
dnl config.m4 for extension $extname
|
|
|
|
dnl don't forget to call PHP_EXTENSION($extname)
|
1999-04-21 18:24:41 +08:00
|
|
|
|
1999-10-08 03:53:20 +08:00
|
|
|
PHP_EXTENSION($extname)
|
|
|
|
|
1999-04-21 18:24:41 +08:00
|
|
|
eof
|
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
$ECHO_N " Makefile.in$ECHO_C"
|
|
|
|
cat >Makefile.in <<eof
|
1999-04-21 18:24:41 +08:00
|
|
|
# \$Id\$
|
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
DEPTH = ../..
|
|
|
|
topsrcdir = @topsrcdir@
|
|
|
|
srcdir = @srcdir@
|
|
|
|
VPATH = @srcdir@
|
1999-04-21 18:24:41 +08:00
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
LTLIBRARY_NAME = lib$extname.la
|
|
|
|
LTLIBRARY_SOURCES = $extname.c
|
|
|
|
|
|
|
|
include \$(topsrcdir)/build/ltlib.mk
|
1999-04-21 18:24:41 +08:00
|
|
|
eof
|
|
|
|
|
|
|
|
|
1999-09-27 22:15:15 +08:00
|
|
|
$ECHO_N " .cvsignore$ECHO_C"
|
1999-04-21 18:24:41 +08:00
|
|
|
cat >.cvsignore <<eof
|
|
|
|
.deps
|
|
|
|
Makefile
|
1999-10-08 03:53:20 +08:00
|
|
|
*.o
|
1999-10-07 21:53:35 +08:00
|
|
|
*.lo
|
|
|
|
*.la
|
|
|
|
.libs
|
1999-04-21 18:24:41 +08:00
|
|
|
eof
|
|
|
|
|
|
|
|
chmod 644 *
|
|
|
|
|
|
|
|
echo " [done]."
|
1999-04-22 04:39:22 +08:00
|
|
|
|
1999-10-08 03:53:20 +08:00
|
|
|
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
|