/[gentoo-x86]/eclass/php-ext-source-r2.eclass
Gentoo

Diff of /eclass/php-ext-source-r2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.4 Revision 1.7
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r2.eclass,v 1.4 2010/11/02 21:46:05 olemarkus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r2.eclass,v 1.7 2011/01/09 00:05:10 robbat2 Exp $
4# 4#
5# Author: Tal Peer <coredumb@gentoo.org> 5# Author: Tal Peer <coredumb@gentoo.org>
6# Author: Stuart Herbert <stuart@gentoo.org> 6# Author: Stuart Herbert <stuart@gentoo.org>
7# Author: Luca Longinotti <chtekk@gentoo.org> 7# Author: Luca Longinotti <chtekk@gentoo.org>
8# Author: Jakub Moc <jakub@gentoo.org> (documentation) 8# Author: Jakub Moc <jakub@gentoo.org> (documentation)
14# @BLURB: A unified interface for compiling and installing standalone PHP extensions. 14# @BLURB: A unified interface for compiling and installing standalone PHP extensions.
15# @DESCRIPTION: 15# @DESCRIPTION:
16# This eclass provides a unified interface for compiling and installing standalone 16# This eclass provides a unified interface for compiling and installing standalone
17# PHP extensions (modules). 17# PHP extensions (modules).
18 18
19inherit flag-o-matic autotools depend.php 19inherit flag-o-matic autotools
20 20
21EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install 21EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
22 22
23# @ECLASS-VARIABLE: PHP_EXT_NAME 23# @ECLASS-VARIABLE: PHP_EXT_NAME
24# @DESCRIPTION: 24# @DESCRIPTION:
59 59
60# @ECLASS-VARIABLE: USE_PHP 60# @ECLASS-VARIABLE: USE_PHP
61# @DESCRIPTION: 61# @DESCRIPTION:
62# Lists the PHP slots compatibile the extension is compatibile with 62# Lists the PHP slots compatibile the extension is compatibile with
63[[ -z "${USE_PHP}" ]] && USE_PHP="php5-2 php5-3" 63[[ -z "${USE_PHP}" ]] && USE_PHP="php5-2 php5-3"
64
65# @ECLASS-VARIABLE: PHP_EXT_OPTIONAL_USE
66# @DESCRIPTION:
67# If set, this is the USE flag that the PHP dependencies are behind
68# Most commonly set as PHP_EXT_OPTIONAL_USE=php to get the dependencies behind
69# USE=php.
64 70
65#Make sure at least one target is installed. Abuses USE dependencies. 71#Make sure at least one target is installed. Abuses USE dependencies.
66for target in ${USE_PHP}; do 72for target in ${USE_PHP}; do
67 IUSE="${IUSE} php_targets_${target}" 73 IUSE="${IUSE} php_targets_${target}"
68 target=${target/+} 74 target=${target/+}
69 SELFDEPEND="${SELFDEPEND} =${CATEGORY}/${PF}[php_targets_${target}]" 75 SELFDEPEND="${SELFDEPEND} =${CATEGORY}/${PF}[php_targets_${target}]"
70 slot=${target/php} 76 slot=${target/php}
71 slot=${slot/-/.} 77 slot=${slot/-/.}
72 PHPDEPEND="${PHPDEPEND} 78 PHPDEPEND="${PHPDEPEND}
73 php_targets_${target}? ( dev-lang/php:${slot} )" 79 php_targets_${target}? ( dev-lang/php:${slot} )"
74done 80done
75 81
76RDEPEND="${RDEPEND} 82RDEPEND="${RDEPEND}
83 ${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( }
77 || ( ${SELFDEPEND} ) 84 || ( ${SELFDEPEND} )
78 ${PHPDEPEND}" 85 ${PHPDEPEND}
86 ${PHP_EXT_OPTIONAL_USE:+ )}"
79 87
80 88
81# @FUNCTION: php-ext-source-r2_src_unpack 89# @FUNCTION: php-ext-source-r2_src_unpack
82# @DESCRIPTION: 90# @DESCRIPTION:
83# runs standard src_unpack + _phpize 91# runs standard src_unpack + _phpize
84# 92#
85# @VARIABLE: PHP_EXT_SKIP_PHPIZE 93# @VARIABLE: PHP_EXT_SKIP_PHPIZE
86# @DESCRIPTION: 94# @DESCRIPTION:
87# phpize will be run by default for all ebuilds that use 95# phpize will be run by default for all ebuilds that use
88# php-ext-source-r1_src_unpack 96# php-ext-source-r2_src_unpack
89# Set PHP_EXT_SKIP_PHPIZE="yes" in your ebuild if you do not want to run phpize. 97# Set PHP_EXT_SKIP_PHPIZE="yes" in your ebuild if you do not want to run phpize.
90php-ext-source-r2_src_unpack() { 98php-ext-source-r2_src_unpack() {
91 unpack ${A} 99 unpack ${A}
92 local slot orig_s="$S" 100 local slot orig_s="$S"
93 for slot in $(php_get_slots); do 101 for slot in $(php_get_slots); do
114 ${PHPIZE} 122 ${PHPIZE}
115 # force run of libtoolize and regeneration of related autotools 123 # force run of libtoolize and regeneration of related autotools
116 # files (bug 220519) 124 # files (bug 220519)
117 rm aclocal.m4 125 rm aclocal.m4
118 eautoreconf 126 eautoreconf
119 fi 127 fi
120} 128}
121 129
122# @FUNCTION: php-ext-source-r2_src_configure 130# @FUNCTION: php-ext-source-r2_src_configure
123# @DESCRIPTION: 131# @DESCRIPTION:
124# Takes care of standard configure for PHP extensions (modules). 132# Takes care of standard configure for PHP extensions (modules).
143php-ext-source-r2_src_compile() { 151php-ext-source-r2_src_compile() {
144 # net-snmp creates this file #324739 152 # net-snmp creates this file #324739
145 addpredict /usr/share/snmp/mibs/.index 153 addpredict /usr/share/snmp/mibs/.index
146 # shm extension createss a semaphore file #173574 154 # shm extension createss a semaphore file #173574
147 addpredict /session_mm_cli0.sem 155 addpredict /session_mm_cli0.sem
148 local slot 156 local slot
149 for slot in $(php_get_slots); do 157 for slot in $(php_get_slots); do
150 php_init_slot_env ${slot} 158 php_init_slot_env ${slot}
151 emake || die "Unable to make code" 159 emake || die "Unable to make code"
152 160
153 done 161 done
195 PHPCLI="/usr/${libdir}/${1}/bin/php" 203 PHPCLI="/usr/${libdir}/${1}/bin/php"
196 PHPCGI="/usr/${libdir}/${1}/bin/php-cgi" 204 PHPCGI="/usr/${libdir}/${1}/bin/php-cgi"
197 PHP_PKG="$(best_version =dev-lang/php-${1:3}*)" 205 PHP_PKG="$(best_version =dev-lang/php-${1:3}*)"
198 PHPPREFIX="/usr/${libdir}/${slot}" 206 PHPPREFIX="/usr/${libdir}/${slot}"
199 EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)" 207 EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
208 PHP_CURRENTSLOT=${1:3}
200 209
201 S="${WORKDIR}/${1}" 210 S="${WORKDIR}/${1}"
202 cd "${S}" 211 cd "${S}"
203} 212}
204 213
220# @FUNCTION: php-ext-source-r2_createinifiles 229# @FUNCTION: php-ext-source-r2_createinifiles
221# @DESCRIPTION: 230# @DESCRIPTION:
222# Builds ini files for every enabled slot and SAPI 231# Builds ini files for every enabled slot and SAPI
223php-ext-source-r2_createinifiles() { 232php-ext-source-r2_createinifiles() {
224 local slot 233 local slot
225 for slot in $(php_get_slots); do 234 for slot in $(php_get_slots); do
226 php_init_slot_env ${slot} 235 php_init_slot_env ${slot}
227 # Pull in the PHP settings 236 # Pull in the PHP settings
228 237
229 # Build the list of <ext>.ini files to edit/add to 238 # Build the list of <ext>.ini files to edit/add to
230 php-ext-source-r2_buildinilist ${slot} 239 php-ext-source-r2_buildinilist ${slot}
249 258
250php-ext-source-r2_addextension() { 259php-ext-source-r2_addextension() {
251 if [[ "${PHP_EXT_ZENDEXT}" = "yes" ]] ; then 260 if [[ "${PHP_EXT_ZENDEXT}" = "yes" ]] ; then
252 # We need the full path for ZendEngine extensions 261 # We need the full path for ZendEngine extensions
253 # and we need to check for debugging enabled! 262 # and we need to check for debugging enabled!
254 if has_zts ; then 263 if has_version "dev-lang/php:${PHP_CURRENTSLOT}[threads]" ; then
255 if has_debug ; then 264 if has_version "dev-lang/php:${PHP_CURRENTSLOT}[debug]" ; then
256 ext_type="zend_extension_debug_ts" 265 ext_type="zend_extension_debug_ts"
257 else 266 else
258 ext_type="zend_extension_ts" 267 ext_type="zend_extension_ts"
259 fi 268 fi
260 ext_file="${EXT_DIR}/${1}" 269 ext_file="${EXT_DIR}/${1}"
261 else 270 else
262 if has_debug ; then 271 if has_version "dev-lang/php:${PHP_CURRENTSLOT}[debug]"; then
263 ext_type="zend_extension_debug" 272 ext_type="zend_extension_debug"
264 else 273 else
265 ext_type="zend_extension" 274 ext_type="zend_extension"
266 fi 275 fi
267 ext_file="${EXT_DIR}/${1}" 276 ext_file="${EXT_DIR}/${1}"

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20