mirror of
https://github.com/php/php-src.git
synced 2024-11-26 19:33:55 +08:00
93 lines
1.4 KiB
Bash
Executable File
93 lines
1.4 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)
|
|
|
|
PHP_EXTENSION($extname)
|
|
|
|
eof
|
|
|
|
$ECHO_N " Makefile.am$ECHO_C"
|
|
cat >Makefile.am <<eof
|
|
# \$Id\$
|
|
|
|
noinst_LTLIBRARIES=libphpext_$extname.la
|
|
libphpext_${extname}_la_SOURCES=$extname.c
|
|
|
|
eof
|
|
|
|
|
|
$ECHO_N " .cvsignore$ECHO_C"
|
|
cat >.cvsignore <<eof
|
|
.deps
|
|
Makefile.in
|
|
Makefile
|
|
*.o
|
|
*.lo
|
|
*.la
|
|
.libs
|
|
eof
|
|
|
|
$ECHO_N " config.h.stub$ECHO_C"
|
|
cat >config.h.stub<<eof
|
|
/* define if you want to use the $extname extension */
|
|
/* #undef HAVE_LIB$EXTNAME */
|
|
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
|