diff --git a/manage.sh b/manage.sh
index 2bb9cec..26c0ae0 100755
--- a/manage.sh
+++ b/manage.sh
@@ -11,6 +11,26 @@ usage () {
exit 1
}
+normal="$( tput sgr0 )"
+bold="$( tput bold )"
+black="$( tput setaf 0 )"
+red="$( tput setaf 1 )"
+green="$( tput setaf 2 )"
+yellow="$( tput setaf 3 )"
+blue="$( tput setaf 4 )"
+megenta="$( tput setaf 5 )"
+cyan="$( tput setaf 6 )"
+white="$( tput setaf 7 )"
+bblack="${bold}${black}"
+bred="${bold}${red}"
+bgreen="${bold}${green}"
+byellow="${bold}${yellow}"
+bblue="${bold}${blue}"
+bmegenta="${bold}${megenta}"
+bcyan="${bold}${cyan}"
+bwhite="${bold}${white}"
+tcolor="${bblack}$( tput setab 7 )"
+
opts=$(getopt -u -o h -l help -- "$@")
[ $? != 0 ] && usage
@@ -34,7 +54,7 @@ mode="${1}"
case "${mode}" in
clean)
cat <<-EOL
- [ -f Makefile ] && make distclean
+ ${bwhite}[ -f Makefile ] && make distclean
rm -rf autom4te.cache build include modules
rm -f .deps Makefile* ac*.m4 compile
rm -f config.h* config.nice configure* config.sub config.guess
@@ -42,7 +62,7 @@ case "${mode}" in
rm -f package.xml
find ./tests ! -name '*.phpt' -a ! -name '*.txt' -a -type f
- rm -f magic_arginfo.h && git checkout -- magic_arginfo.h
+ rm -f magic_arginfo.h && git checkout -- magic_arginfo.h${normal}
----->
EOL
@@ -74,21 +94,53 @@ case "${mode}" in
rm -f package.xml
;;
test)
+ PHPBIN=/opt/php-qa/php${2}/bin/php
+ PHPIZE=/opt/php-qa/php${2}/bin/phpize
+ PHPCONFIG=/opt/php-qa/php${2}/bin/php-config
+ PHP_OPT=""
+
+ if [[ $# == 2 ]]; then
+ ./manage.sh clean
+ echo "${PHPIZE} && ./configure"
+ ${PHPIZE} && ./configure && make -j8 || exit 0
+ fi
+
+ PHP_OPT+=" -d 'track_errors=1' -d 'extension_dir=./modules/' -d 'extension=magic.so'"
+
if [[ -f tests/${3}.php ]]; then
- /usr/bin/php${2} -d "extension_dir=./modules/" -d "extension=magic" tests/${3}.php
+ cat <<-EOL
+ ${bgreen}------------------------------------------------------------------------
+ Sample code execution:
+
+ ${bcyan}${PHPBIN} ${PHP_OPT} test/${3}.php
+ ${bgreen}------------------------------------------------------------------------${normal}
+
+ EOL
+ ${PHPBIN} ${PHP_OPT} test/${3}.php
exit $?
elif [[ -f ${3} ]]; then
- /usr/bin/php${2} -d "extension_dir=./modules/" -d "extension=magic" ${3}
+ cat <<-EOL
+ ${bgreen}------------------------------------------------------------------------
+ Sample code execution:
+
+ ${bcyan}${PHPBIN} ${PHP_OPT} ${3}
+ ${bgreen}------------------------------------------------------------------------${normal}
+
+ EOL
+ eval "${PHPBIN} ${PHP_OPT} ${3}"
exit $?
fi
- if [[ -z $3 ]]; then
- ./manage.sh clean
- echo "phpize${2} ./configure"
- phpize${2} && ./configure && make -j8 || exit 0
- fi
- echo "make test PHP_EXECUTABLE=/usr/bin/php${2}"
- make test PHP_EXECUTABLE=/usr/bin/php${2} <<< n
+ cat <<-EOL
+ ${bwhite}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ${tcolor}** MAKE test:: ${normal}
+ ${bwhite}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ ${bcyan}make test PHP_EXECUTABLE=${PHPBIN}
+ ${bwhite}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~${normal}
+
+ EOL
+ make test PHP_EXECUTABLE=${PHPBIN} <<< n
;;
stub)
# stub tagging
diff --git a/package.xml.tmpl b/package.xml.tmpl
index 63f30a2..cf125e5 100644
--- a/package.xml.tmpl
+++ b/package.xml.tmpl
@@ -39,6 +39,7 @@