php-src/ext/ext_skel

103 lines
1.8 KiB
Plaintext
Raw Normal View History

#!/bin/sh
1999-04-21 16:23:47 +00:00
extname="$1"
EXTNAME=`echo $1|tr a-z A-Z`
1999-09-27 14:05:18 +00:00
givup() {
echo $*
exit 1
}
1999-04-21 16:23:47 +00:00
if test "$extname" = ""; then
givup "usage: $0 extension-name"
fi
1999-04-21 16:23:47 +00:00
if test -d "$extname" ; then
givup "Directory $extname already exists."
fi
1999-10-07 19:53:20 +00:00
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"
1999-04-21 16:23:47 +00:00
mkdir $extname || givup "Cannot create directory $extname"
1999-04-21 16:23:47 +00:00
cd $extname
chmod 755 .
$ECHO_N "Creating basic files:$ECHO_C"
$ECHO_N " config.m4$ECHO_C"
cat >config.m4 <<eof
dnl \$Id\$
1999-04-21 16:23:47 +00:00
dnl config.m4 for extension $extname
dnl don't forget to call PHP_EXTENSION($extname)
2000-03-27 22:52:48 +00:00
dnl If your extension references something external, use with:
PHP_ARG_WITH($extname, for $extname support,
2000-03-27 22:52:48 +00:00
dnl Make sure that the comment is aligned:
[ --with-$extname Include $extname support])
2000-03-27 22:52:48 +00:00
dnl Otherwise use enable:
PHP_ARG_ENABLE($extname, whether to enable $extname support,
2000-03-27 22:52:48 +00:00
dnl Make sure that the comment is aligned:
[ --enable-$extname Enable $extname support])
2000-03-27 22:52:48 +00:00
if test "\$PHP_$EXTNAME" != "no"; then
dnl Action..
PHP_EXTENSION($extname, \$ext_shared)
2000-03-27 22:52:48 +00:00
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
1999-10-07 19:53:20 +00:00
*.o
1999-10-07 13:53:35 +00:00
*.lo
*.la
.libs
libs.mk
eof
chmod 644 *
echo " [done]."
1999-04-21 20:39:22 +00:00
1999-10-07 19:53:20 +00: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