# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit depend.apache PHP_EXT_ZENDEXT="yes" PHP_EXT_NAME="ZendOptimizer" PHP_EXT_INI="yes" inherit php-ext-base-r1 # ATTENTION: at 07-dec-2006 do not exists ZendOptimizer for MAC/PPC/ # so please do not add ~ppc keyword and SRC_URI until # the new extension will be available into the Zend Download Center. KEYWORDS="~amd64 ~x86" SRC_URI="amd64? ( ${PN}-${PV}-linux-glibc23-x86_64.tar.gz ) x86? ( ${PN}-${PV}-linux-glibc21-i386.tar.gz )" #SRC_URI=" ppc64? ( ${PN}-${PV}-linux-glibc23-ppc64.tar.gz )" MY_ARCH=${ARCH/x86/glibc21-i386} MY_ARCH=${MY_ARCH/amd64/glibc23-x86_64} MY_ARCH=${MY_ARCH/ppc64/glibc23-ppc64} S="${WORKDIR}/${PN}-${PV}-linux-${MY_ARCH}" DESCRIPTION="The Zend PHP optimizer and loader for encoded scripts." HOMEPAGE="http://www.zend.com/products/zend_optimizer" LICENSE="zend" SLOT="0" IUSE="doc" RESTRICT="mirror fetch strip" DEPEND="" RDEPEND="!dev-php5/xdebug !dev-php5/pecl-apd !dev-php5/eaccelerator !dev-php5/pecl-apc" need_php_by_category pkg_nofetch() { einfo einfo "Please download ${PN}-${PV}-linux-${MY_ARCH} from:" einfo "${HOMEPAGE}" einfo "and put it into /usr/portage/distfiles/." einfo "Please note that you need a valid Zend Account" einfo "(free) to download the Zend Optimizer!" einfo } pkg_setup() { php_binary_extension } src_install() { php-ext-base-r1_src_install # Detect which PHP5 version is installed if has_version =dev-lang/php-5.0* ; then ZENDOPT_VERSION_DIR="5_0_x_comp" elif has_version =dev-lang/php-5.1* ; then ZENDOPT_VERSION_DIR="5_1_x_comp" elif has_version =dev-lang/php-5.2* ; then ZENDOPT_VERSION_DIR="5_2_x_comp" else die "Unable to find an installed dev-lang/php-5* package." fi # Detect if we use ZTS and change the file path accordingly if has_zts ; then ZENDOPT_SO_FILE="data/${ZENDOPT_VERSION_DIR}/TS/${PHP_EXT_NAME}.so" else ZENDOPT_SO_FILE="data/${ZENDOPT_VERSION_DIR}/${PHP_EXT_NAME}.so" fi # Install the binary insinto ${EXT_DIR} doins ${ZENDOPT_SO_FILE} # Add the correct settings to the extension ini files php-ext-base-r1_addtoinifiles "zend_optimizer.optimization_level" "15" php-ext-base-r1_addtoinifiles "zend_optimizer.enable_loader" "0" php-ext-base-r1_addtoinifiles "zend_optimizer.disable_licensing" "0" dodoc-php README-${PN} } pkg_postinst() { has_php # detect the right apache local apache_version=0 if use apache2; then apache_version="apache2" elif use apache; then apache_version="apache" fi # You only need to restart Apache if you're using mod_php if ! apache_versione == 0; then elog elog "You need to restart your Apache to activate the ${PN}:" elog " /etc/init.d/${apache_version} reload" elog fi }