usr/src/cmd/php5/install-php5
author Jon Tibble <meths@btinternet.com>
Wed, 13 Feb 2013 10:12:56 +0000
branchoi_151a
changeset 198 be4eee29f428
parent 7 f96733ecc878
permissions -rw-r--r--
Bump PHP to 5.2.17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     1
#!/usr/bin/ksh93
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     2
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     3
# CDDL HEADER START
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     4
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     8
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    12
# and limitations under the License.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    13
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    19
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    20
# CDDL HEADER END
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    21
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    22
#
198
be4eee29f428 Bump PHP to 5.2.17
Jon Tibble <meths@btinternet.com>
parents: 7
diff changeset
    23
# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    24
#
198
be4eee29f428 Bump PHP to 5.2.17
Jon Tibble <meths@btinternet.com>
parents: 7
diff changeset
    25
#pragma ident	"@(#)install-php5	1.17	11/02/07 SMI"
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    26
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    27
set -o errexit
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    28
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    29
# use builtin commands (faster)
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    30
builtin cp
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    31
builtin rm
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    32
builtin mv
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    33
builtin chmod
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    34
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    35
source "${SRC}/tools/install.subr"
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    36
source "${SRC}/cmd/apache2/apache.build.env"
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    37
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    38
CWD=$(pwd)
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    39
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    40
PHP_VER=$(grep "^VERSION:" METADATA | awk '{print $2}')
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    41
PHP_REL=$(grep "^PHP_REL=" Makefile.sfw | sed s/PHP_REL=//)
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    42
PHPDIR=php-${PHP_VER}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    43
PHPCGI=${PHPDIR}-cgi
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    44
PHPNSAPI=${PHPDIR}-nsapi
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    45
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    46
PHP_ROOT_CONF=/etc/php/${PHP_REL}
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    47
PHP_ROOT_NSAPI_CONF=/etc/php/${PHP_REL}/nsapi
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    48
PHP_ROOT_MODULES_CONF=/etc/php/${PHP_REL}/conf.d
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    49
PHP_ROOT_ZTS_MODULES_CONF=/etc/php/${PHP_REL}/zts-conf.d
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    50
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    51
PHP_ROOT=/usr/php/${PHP_REL}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    52
PHP_ROOT_BIN=${PHP_ROOT}/bin
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    53
PHP_ROOT_LIB=${PHP_ROOT}/lib
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    54
PHP_ROOT_INC=${PHP_ROOT}/include/php
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    55
PHP_ROOT_EXT=${PHP_ROOT}/modules
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    56
PHP_ROOT_ZTS_EXT=${PHP_ROOT}/zts-modules
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    57
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    58
LOCAL_CONFDIR=${CWD}/config/extensions
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    59
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    60
CONFDIR=${ROOT}/etc/php/${PHP_REL}
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    61
NSAPI_CONFDIR=${ROOT}/etc/php/${PHP_REL}/nsapi
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    62
MODULES_CONFDIR=${CONFDIR}/conf.d
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    63
ZTS_MODULES_CONFDIR=${CONFDIR}/zts-conf.d
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    64
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    65
TOPDIR=${ROOT}/usr/php/${PHP_REL}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    66
BINDIR=${TOPDIR}/bin
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    67
LIBDIR=${TOPDIR}/lib
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    68
DOCDIR=${TOPDIR}/doc
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    69
MANDIR=${TOPDIR}/man/man1
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    70
INCDIR=${TOPDIR}/include/php
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    71
EXTDIR=${TOPDIR}/modules
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    72
ZTS_EXTDIR=${TOPDIR}/zts-modules
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    73
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    74
SCRIPTS_DIR=${TOPDIR}/samples/scripts
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    75
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    76
PEAR_TOPDIR=${ROOT}/var/php/${PHP_REL}/pear
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    77
SESSION_TOPDIR=${ROOT}/var/php/${PHP_REL}/sessions
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    78
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    79
APACHE2_SAMPLES_CONFDIR=${ROOT}/${APACHE_ETC_PREFIX}/samples-conf.d
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    80
APACHE2_CONFDIR=${ROOT}/${APACHE_ETC_PREFIX}/conf.d
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    81
APACHE2_EXTDIR=${ROOT}/${APACHE_USR_PREFIX}/libexec
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    82
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    83
COPYRIGHT_TMPL=${CWD}/Solaris/copyright.tmpl
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    84
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    85
# ----- Common Utility Functions -----
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    86
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    87
# Handle the glue to Apache 2 HTTP Server.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    88
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    89
add_apache2_module_support() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    90
    _install N ${CWD}/Solaris/php${PHP_REL}.conf $APACHE2_CONFDIR/php${PHP_REL}.conf  644
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    91
    _install D $APACHE2_EXTDIR/libphp5.so $APACHE2_EXTDIR/mod_php${PHP_REL}.so 555
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    92
    (cd $APACHE2_EXTDIR/ && _install L mod_php${PHP_REL}.so mod_php5.so)
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    93
    rm -f $APACHE2_EXTDIR/libphp5.so
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    94
    chmod 750 "${SESSION_TOPDIR}"
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    95
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
    96
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    97
add_nsapi_module_support() {
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    98
	mkdir -p $TOPDIR/nsapi
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
    99
    _install D $PHPNSAPI/libs/libphp5.so $TOPDIR/nsapi/libphp5.so 555
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   100
}
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   101
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   102
# handle all configuration related manipulations.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   103
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   104
fix_config_files() {
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   105
    mkdir -p ${NSAPI_CONFDIR} ${MODULES_CONFDIR} ${ZTS_MODULES_CONFDIR}
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   106
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   107
    # Ship a default php.ini to simplify ease of use. 
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   108
    (cd ${CWD}/php-${PHP_VER} && \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   109
		gpatch -p1 -o php.ini-patched -i ${CWD}/patches/php_ini.patch && \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   110
		cat php.ini-patched | sed -e "s#<<VERSION>>#${PHP_REL}#g" > php.ini )
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   111
    _install N ${CWD}/php-${PHP_VER}/php.ini ${CONFDIR}/php.ini 644
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   112
 
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   113
	# Ship a default php.ini for NSAPI module.
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   114
    (cd ${CWD}/${PHPNSAPI} && \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   115
		cat ${CONFDIR}/php.ini | \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   116
			sed -e "s,extension_dir = \(.*\),extension_dir=$PHP_ROOT_ZTS_EXT," > php.ini )
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   117
    _install N ${CWD}/${PHPNSAPI}/php.ini ${NSAPI_CONFDIR}/php.ini 644
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   118
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   119
    # Prepare configuration files for each extension
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   120
    # By default, disable following 3rd party extensions:
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   121
    # xdebug suhosin
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   122
    for module in ${EXTDIR}/*.so; do
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   123
        module=${module%.so}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   124
        ext=${module##*/}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   125
        cat ${COPYRIGHT_TMPL} | sed -e s@\#@\;@  > ${ext}.ini
3
ad3552f8e1ef Import sfw build 129
Cyril Plisko <cyril.plisko@grigale.com>
parents: 0
diff changeset
   126
        echo "extension=${ext}.so" >> ${ext}.ini
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   127
    	_install N ${ext}.ini ${MODULES_CONFDIR}/${ext}.ini 644
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   128
    	_install N ${ext}.ini ${ZTS_MODULES_CONFDIR}/${ext}.ini 644
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   129
    	rm ${ext}.ini
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   130
    done
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   131
    for each in ${LOCAL_CONFDIR}/*.ini; do
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   132
        ext=${each##*/}
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   133
        _install N $each $MODULES_CONFDIR/${ext}  644
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   134
		cat $each | \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   135
			sed -e "s,zend_extension=$PHP_ROOT_EXT,zend_extension=$PHP_ROOT_ZTS_EXT," > tmp
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   136
        _install N tmp $ZTS_MODULES_CONFDIR/${ext}  644
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   137
		rm tmp
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   138
    done
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   139
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   140
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   141
# scripts in the bin directory have paths to the build environment
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   142
# wired into them - need to fix these
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   143
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   144
fix_bin_scripts() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   145
    # Adjust scripts for building extensions
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   146
    mkdir -p ${BINDIR}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   147
    cd ${CWD}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   148
    cat ${PHPDIR}/scripts/phpize | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   149
	  sed -e "s#^prefix=.*#prefix=${PHP_ROOT}#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   150
	  sed -e "s#^exec_prefix=.*#exec_prefix=${PHP_ROOT}#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   151
	  sed -e "s#^includedir=.*#includedir=${PHP_ROOT_INC}#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   152
	  sed -e "s#^phpdir=.*#phpdir=${PHP_ROOT_LIB}/build#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   153
	  sed -e "s#^php_binary=.*#php_binary=${PHP_ROOT_BIN}/php#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   154
	  sed -e "s#^extension_dir=.*#extension_dir=${PHP_ROOT_EXT}#" \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   155
	  > phpize
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   156
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   157
    cat ${PHPDIR}/scripts/php-config | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   158
	  sed -e "s#^prefix=.*#prefix=${PHP_ROOT}#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   159
	  sed -e "s#^exec_prefix=.*#exec_prefix=${PHP_ROOT}#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   160
	  sed -e "s#^includedir=.*#includedir=${PHP_ROOT_INC}#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   161
	  sed -e "s#^phpdir=.*#phpdir=${PHP_ROOT}#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   162
	  sed -e "s#^php_binary=.*#php_binary=${PHP_ROOT_BIN}/php#" | \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   163
	  sed -e "s#^extension_dir=.*#extension_dir=${PHP_ROOT_EXT}#" \
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   164
	  > php-config
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   165
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   166
    # Ensure basic file permissions.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   167
    _install S php-config ${BINDIR}/php-config 555
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   168
    _install S phpize ${BINDIR}/phpize 555
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   169
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   170
    _install E ${PHPDIR}/sapi/cli/php ${BINDIR}/php  555
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   171
    _install E ${PHPCGI}/sapi/cgi/php-cgi ${BINDIR}/php-cgi  555
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   172
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   173
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   174
# doc related
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   175
install_docs() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   176
    mkdir -p ${DOCDIR}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   177
    cd ${DOCDIR}; 
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   178
    cat ${CWD}/Solaris/php_manual_en_20090130.tar.gz | gunzip | tar xf - ;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   179
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   180
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   181
# samples related
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   182
install_samples() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   183
    mkdir -p $APACHE2_SAMPLES_CONFDIR $SCRIPTS_DIR
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   184
    _install N ${CWD}/Solaris/php-apc-stats.conf $APACHE2_SAMPLES_CONFDIR/php-apc-stats.conf 644
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   185
    _install N ${CWD}/Solaris/php-memcache-stats.conf $APACHE2_SAMPLES_CONFDIR/php-memcache-stats.conf 644
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   186
	cat ${CWD}/Solaris/configure-sun-webserver | \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   187
		sed -e "s,<<INSTALL_DIR>>,$PHP_ROOT," | \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   188
		sed -e "s,<<CONF_DIR>>,$PHP_ROOT_CONF," | \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   189
		sed -e "s,<<NSAPI_CONF_DIR>>,$PHP_ROOT_NSAPI_CONF," | \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   190
		sed -e "s,<<MODULES_CONF_DIR>>,$PHP_ROOT_MODULES_CONF," | \
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   191
		sed -e "s,<<ZTS_MODULES_CONF_DIR>>,$PHP_ROOT_ZTS_MODULES_CONF," > tmp
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   192
    _install N tmp $SCRIPTS_DIR/configure-sun-webserver  555
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   193
	rm tmp
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   194
	(cd $ROOT/$PHP_ROOT_BIN && _install L ../samples/scripts/configure-sun-webserver  configure-webserver7 555)
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   195
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   196
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   197
# configure man pages 
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   198
install_man() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   199
    cd ${CWD}; 
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   200
    _install N Solaris/php.1.sunman ${ROOT}/usr/share/man/man1/php.1 444
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   201
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   202
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   203
# patch installation to support pear installation.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   204
install_pear() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   205
    cd ${BINDIR};
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   206
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   207
    # Ensure basic file permissions.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   208
    chmod u+w pecl php-config;
7
f96733ecc878 Import sfw build 133
Cyril Plisko <cyril.plisko@grigale.com>
parents: 6
diff changeset
   209
    gpatch -i ${CWD}/patches/pear_pecl.patch;
f96733ecc878 Import sfw build 133
Cyril Plisko <cyril.plisko@grigale.com>
parents: 6
diff changeset
   210
    gpatch -i ${CWD}/patches/pear_php_config.patch;
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   211
    chmod u-w pear peardev pecl php-config;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   212
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   213
    cd ${LIBDIR}/build;
7
f96733ecc878 Import sfw build 133
Cyril Plisko <cyril.plisko@grigale.com>
parents: 6
diff changeset
   214
    gpatch --no-backup-if-mismatch -i ${CWD}/patches/pear_Makefile_global.patch;
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   215
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   216
    cd ${PEAR_TOPDIR};
7
f96733ecc878 Import sfw build 133
Cyril Plisko <cyril.plisko@grigale.com>
parents: 6
diff changeset
   217
    gpatch -p0 -i ${CWD}/patches/pear_Builder_php.patch;
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   218
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   219
	# Ship default PEAR registry files as generated registry files
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   220
	# are corrupted by default.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   221
	cp ${CWD}/config/pear/*.reg ${PEAR_TOPDIR}/.channels/
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   222
	chmod 0644 ${PEAR_TOPDIR}/.channels/*.reg
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   223
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   224
	# clean up directories unwanted for packages.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   225
	if [ -d "${ROOT}/var/tmp/pear/cache" ]; then
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   226
		rm -rf ${ROOT}/var/tmp
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   227
	fi
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   228
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   229
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   230
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   231
# Create symbolic links
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   232
create_symlinks() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   233
    cd ${ROOT}/usr/php;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   234
    _install L ./${PHP_REL}/bin bin;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   235
    _install L ./${PHP_REL}/lib lib;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   236
    _install L ./${PHP_REL}/include include;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   237
    _install L ./${PHP_REL}/modules modules;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   238
    _install L ./${PHP_REL}/doc doc;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   239
    _install L ./${PHP_REL}/man man;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   240
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   241
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   242
fix_php_perms() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   243
    cd ${ROOT}/${PHP_ROOT};
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   244
    find . -type d -exec chmod 755 {} \;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   245
    find . -type f -exec chmod ugo-w {} \;
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   246
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   247
    
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   248
# Final cleanup
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   249
cleanup() {
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   250
    cd ${ROOT};
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   251
    /bin/rm -rf .lock .depdb .filemap .depdblock .channels .registry
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   252
}
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   253
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   254
# ----- START HERE - actual script processing starts here -----
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   255
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   256
# Even though this is called "install-php5", it doesn't really
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   257
# install the whole thing.  Much of php itself is installed by
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   258
# make install - we need to fix only permissions.  What we install here
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   259
# are stuffs that php won't install as part of its normal build.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   260
# Each install task is a function, so it's relatively easy to add new
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   261
# stuff.
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   262
#
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   263
add_apache2_module_support
6
1fb1123973f8 Import sfw build 132
Cyril Plisko <cyril.plisko@grigale.com>
parents: 3
diff changeset
   264
add_nsapi_module_support
0
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   265
fix_config_files
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   266
fix_bin_scripts
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   267
install_docs
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   268
install_man
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   269
create_symlinks
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   270
install_pear
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   271
install_samples
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   272
fix_php_perms
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   273
cleanup
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   274
b34509ac961f Import sfw repo b126
Cyril Plisko <cyril.plisko@grigale.com>
parents:
diff changeset
   275
exit 0