Skip to content

Commit 5055547

Browse files
committed
enhanced manage script
1 parent 842bf86 commit 5055547

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

manage.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ usage () {
1313
exit 1
1414
}
1515

16+
mod_name="$( grep "^ZEND_GET_MODULE" *.c | grep -Po '(?<=\()[a-z]+(?=\))' )"
17+
1618
opts=$(getopt -u -o h -l help -- "$@")
1719
[ $? != 0 ] && usage
1820

@@ -44,7 +46,7 @@ case "${mode}" in
4446
4547
rm -f package.xml
4648
find ./tests ! -name '*.phpt' -a ! -name '*.txt' -a -type f
47-
rm -f magic_arginfo.h && git checkout -- magic_arginfo.h
49+
rm -f ${mod_name}_arginfo.h && git checkout -- ${mod_name}_arginfo.h
4850
${normal}----->
4951
EOL
5052

@@ -54,7 +56,7 @@ case "${mode}" in
5456
rm -f config.h* config.nice configure* config.sub config.guess
5557
rm -f install-sh ltmain.sh missing mkinstalldirs run-tests.php
5658
rm -f tests/*.{diff,exp,log,out,php,sh,mem}
57-
rm -f magic_arginfo.h && git checkout -- magic_arginfo.h
59+
rm -f ${mod_name}_arginfo.h && git checkout -- ${mod_name}_arginfo.h
5860
;;
5961
pack)
6062
cp -af package.xml.tmpl package.xml
@@ -88,9 +90,9 @@ case "${mode}" in
8890
fi
8991

9092
if (( $2 > 71 )); then
91-
PHP_OPT+=" -d 'extension_dir=./modules/' -d 'extension=magic.so'"
93+
PHP_OPT+=" -d 'extension_dir=./modules/' -d 'extension=${mod_name}.so'"
9294
else
93-
PHP_OPT+=" -d 'track_errors=1' -d 'extension_dir=./modules/' -d 'extension=magic.so'"
95+
PHP_OPT+=" -d 'track_errors=1' -d 'extension_dir=./modules/' -d 'extension=${mod_name}.so'"
9496
fi
9597

9698
if [[ -f tests/${3}.php ]]; then
@@ -139,7 +141,7 @@ case "${mode}" in
139141
exit 1
140142
fi
141143
phpcmd="/usr/bin/php80"
142-
perl -pi -e 's/ext_functions/magic_functions/g' build/gen_stub.php
144+
perl -pi -e 's/ext_functions/${mod_name}_functions/g' build/gen_stub.php
143145
${phpcmd} build/gen_stub.php -f *.stub.php
144146
;;
145147
*)

0 commit comments

Comments
 (0)