Annotation of embedaddon/php/scripts/phpize, revision 1.1.1.1.2.1

1.1       misho       1: #!/bin/sh
                      2: 
                      3: # Variable declaration
1.1.1.1.2.1! misho       4: prefix='/home/misho/work/elwix/build/1.7/arch/i386/pkg'
        !             5: datarootdir='/home/misho/work/elwix/build/1.7/arch/i386/pkg/share'
1.1       misho       6: exec_prefix="`eval echo ${prefix}`"
                      7: phpdir="`eval echo ${exec_prefix}/lib/php`/build"
                      8: includedir="`eval echo ${prefix}/include`/php"
                      9: builddir="`pwd`"
1.1.1.1.2.1! misho      10: SED="/usr/bin/sed"
1.1       misho      11: 
                     12: FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
                     13: FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh run-tests*.php"
                     14: CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
                     15:        mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
                     16:        aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache autom4te.cache/ \
                     17:        config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h \
                     18:        run-tests*.php tests/*.diff tests/*.exp tests/*.log tests/*.out tests/*.php"
                     19: 
                     20: # function declaration
                     21: phpize_usage()
                     22: {
                     23:   echo "Usage: $0 [--clean|--help|--version|-v]"
                     24: }
                     25: 
                     26: phpize_no_configm4()
                     27: {
                     28:   if test $@ -eq 1; then
                     29:     clean=" --clean"
                     30:   fi
                     31: 
                     32:   echo "Cannot find config.m4. "
                     33:   echo "Make sure that you run '$0$clean' in the top level source directory of the module"
                     34:   echo 
                     35: }
                     36: 
                     37: phpize_clean()
                     38: {
                     39:   echo "Cleaning.."
                     40:   for i in $CLEAN_FILES; do
                     41:     if test -f "$i"; then
                     42:       rm -f $i
                     43:     elif test -d "$i"; then
                     44:       rm -rf $i
                     45:     fi
                     46:   done
                     47: }
                     48: 
                     49: phpize_check_configm4()
                     50: {
                     51:   if test ! -r config.m4; then
                     52:      phpize_no_configm4 $@
                     53:     exit 1
                     54:   fi
                     55: 
                     56: }
                     57: 
                     58: phpize_get_api_numbers()
                     59: {
                     60:   # extracting API NOs:
                     61:   PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
                     62:   ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
                     63:   ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
                     64: }
                     65: 
                     66: phpize_print_api_numbers()
                     67: {
                     68:   phpize_get_api_numbers
                     69:   echo "Configuring for:"
                     70:   echo "PHP Api Version:        "$PHP_API_VERSION
                     71:   echo "Zend Module Api No:     "$ZEND_MODULE_API_NO
                     72:   echo "Zend Extension Api No:  "$ZEND_EXTENSION_API_NO
                     73: }
                     74: 
                     75: phpize_check_build_files()
                     76: {
                     77:   if test ! -d "$phpdir"; then
                     78:     cat <<EOF
                     79: Cannot find build files at '$phpdir'. Please check your PHP installation.
                     80: 
                     81: EOF
                     82:     exit 1
                     83:   fi
                     84: 
                     85:   case "$phpdir" in
                     86:   *\ * | *\    *)
                     87:     cat <<EOF
                     88: Invalid source path '$phpdir'. Whitespace is not allowed in source path.
                     89: 
                     90: EOF
                     91:     exit 1;;
                     92:   esac
                     93: 
                     94:   case "$builddir" in
                     95:   *\ * | *\    *)
                     96:     cat <<EOF
                     97: Invalid build path '$builddir'. Whitespace is not allowed in build path.
                     98: 
                     99: EOF
                    100:       exit 1;;
                    101:   esac
                    102: }
                    103: 
                    104: phpize_check_shtool()
                    105: {
                    106:   test -x "$builddir/build/shtool" || chmod +x "$builddir/build/shtool"
                    107: 
                    108:   if test ! -x "$builddir/build/shtool"; then
                    109:     cat <<EOF
                    110: shtool at '$builddir/build/shtool' does not exist or is not executable. 
                    111: Make sure that the file exists and is executable and then rerun this script. 
                    112: 
                    113: EOF
                    114:     exit 1
                    115:   else
                    116:     php_shtool=$builddir/build/shtool
                    117:   fi
                    118: }
                    119: 
                    120: phpize_check_autotools()
                    121: {
                    122:   test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
                    123:   test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
                    124:   
                    125:   if test ! -x "$PHP_AUTOCONF" && test ! -x "`$php_shtool path $PHP_AUTOCONF`"; then
                    126:     cat <<EOF
                    127: Cannot find autoconf. Please check your autoconf installation and the
                    128: \$PHP_AUTOCONF environment variable. Then, rerun this script.
                    129: 
                    130: EOF
                    131:     exit 1
                    132:   fi
                    133:   if test ! -x "$PHP_AUTOHEADER" && test ! -x "`$php_shtool path $PHP_AUTOHEADER`"; then
                    134:     cat <<EOF
                    135: Cannot find autoheader. Please check your autoconf installation and the
                    136: \$PHP_AUTOHEADER environment variable. Then, rerun this script.
                    137: 
                    138: EOF
                    139:     exit 1
                    140:   fi
                    141: }
                    142: 
                    143: phpize_copy_files()
                    144: {
                    145:   test -d build || mkdir build
                    146:  
                    147:   (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build)
                    148:   (cd "$phpdir" && cp $FILES "$builddir")
                    149:   (cd "$builddir" && cat acinclude.m4 ./build/libtool.m4 > aclocal.m4)
                    150: }
                    151: 
                    152: phpize_replace_prefix()
                    153: {
                    154:   $SED \
1.1.1.1.2.1! misho     155:   -e "s#/home/misho/work/elwix/build/1.7/arch/i386/pkg#$prefix#" \
1.1       misho     156:   < "$phpdir/phpize.m4" > configure.in
                    157: }
                    158: 
                    159: phpize_autotools()
                    160: {
                    161:   $PHP_AUTOCONF   || exit 1
                    162:   $PHP_AUTOHEADER || exit 1
                    163: }
                    164: 
                    165: # Main script
                    166: 
                    167: case "$1" in 
                    168:   # Cleanup
                    169:   --clean)
                    170:     phpize_check_configm4 1
                    171:     phpize_clean
                    172:     exit 0
                    173:     ;;
                    174: 
                    175:   # Usage
                    176:   --help)
                    177:     phpize_usage
                    178:     exit 0
                    179:     ;;
                    180: 
                    181:   # Version
                    182:   --version|-v)
                    183:     phpize_print_api_numbers
                    184:     exit 0
                    185:   ;;
                    186: 
                    187:   # Default
                    188:   *)
                    189:      phpize_check_configm4 0
                    190: 
                    191:      phpize_check_build_files
                    192: 
                    193:      phpize_print_api_numbers
                    194: 
                    195:      phpize_copy_files
                    196: 
                    197:      phpize_replace_prefix
                    198: 
                    199:      touch install-sh mkinstalldirs missing
                    200: 
                    201:      phpize_check_shtool
                    202: 
                    203:      phpize_check_autotools
                    204: 
                    205:      phpize_autotools
                    206:      ;;
                    207: esac
                    208: 
                    209: exit 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>