/[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.22 Revision 1.35
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2015 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.22 2012/01/13 23:25:40 mabi Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r2.eclass,v 1.35 2015/05/04 18:59:30 grknight Exp $
4 4
5# @ECLASS: php-ext-source-r2.eclass 5# @ECLASS: php-ext-source-r2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo PHP team <php-bugs@gentoo.org> 7# Gentoo PHP team <php-bugs@gentoo.org>
8# @AUTHOR: 8# @AUTHOR:
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 19inherit flag-o-matic autotools multilib eutils
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
23DEPEND=">=sys-devel/m4-1.4.3 23DEPEND=">=sys-devel/m4-1.4.3
24 >=sys-devel/libtool-1.5.18" 24 >=sys-devel/libtool-1.5.18"
25RDEPEND="" 25RDEPEND=""
26 26
27# Because of USE deps, we require at least EAPI 2 27# Because of USE deps, we require at least EAPI 2
28case ${EAPI} in 28case ${EAPI} in
29 2|3|4) ;; 29 4|5) ;;
30 *) 30 *)
31 die "php-ext-source-r2 is not compatible with EAPI=${EAPI}" 31 die "php-ext-source-r2 is not compatible with EAPI=${EAPI}"
32esac 32esac
33 33
34# @ECLASS-VARIABLE: PHP_EXT_NAME 34# @ECLASS-VARIABLE: PHP_EXT_NAME
35# @REQUIRED
35# @DESCRIPTION: 36# @DESCRIPTION:
36# The extension name. This must be set, otherwise the eclass dies. 37# The extension name. This must be set, otherwise the eclass dies.
37# Only automagically set by php-ext-pecl-r2.eclass, so unless your ebuild 38# Only automagically set by php-ext-pecl-r2.eclass, so unless your ebuild
38# inherits that eclass, you must set this manually before inherit. 39# inherits that eclass, you must set this manually before inherit.
39[[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-source-r2 eclass" 40[[ -z "${PHP_EXT_NAME}" ]] && die "No module name specified for the php-ext-source-r2 eclass"
49# Controls whether the extension is a ZendEngine extension or not. 50# Controls whether the extension is a ZendEngine extension or not.
50# Defaults to "no" and if you don't know what is it, you don't need it. 51# Defaults to "no" and if you don't know what is it, you don't need it.
51[[ -z "${PHP_EXT_ZENDEXT}" ]] && PHP_EXT_ZENDEXT="no" 52[[ -z "${PHP_EXT_ZENDEXT}" ]] && PHP_EXT_ZENDEXT="no"
52 53
53# @ECLASS-VARIABLE: USE_PHP 54# @ECLASS-VARIABLE: USE_PHP
55# @REQUIRED
54# @DESCRIPTION: 56# @DESCRIPTION:
55# Lists the PHP slots compatibile the extension is compatibile with 57# Lists the PHP slots compatibile the extension is compatibile with
56[[ -z "${USE_PHP}" ]] && USE_PHP="php5-3 php5-2" 58# Example:
59# @CODE
60# USE_PHP="php5-5 php5-6"
61# @CODE
62[[ -z "${USE_PHP}" ]] && die "USE_PHP is not set for the php-ext-source-r2 eclass"
57 63
58# @ECLASS-VARIABLE: PHP_EXT_OPTIONAL_USE 64# @ECLASS-VARIABLE: PHP_EXT_OPTIONAL_USE
59# @DESCRIPTION: 65# @DESCRIPTION:
60# If set, this is the USE flag that the PHP dependencies are behind 66# If set, this is the USE flag that the PHP dependencies are behind
61# Most commonly set as PHP_EXT_OPTIONAL_USE=php to get the dependencies behind 67# Most commonly set as PHP_EXT_OPTIONAL_USE=php to get the dependencies behind
66# The relative location of the temporary build directory for the PHP extension within 72# The relative location of the temporary build directory for the PHP extension within
67# the source package. This is useful for packages that bundle the PHP extension. 73# the source package. This is useful for packages that bundle the PHP extension.
68# Defaults to ${S} 74# Defaults to ${S}
69[[ -z "${PHP_EXT_S}" ]] && PHP_EXT_S="${S}" 75[[ -z "${PHP_EXT_S}" ]] && PHP_EXT_S="${S}"
70 76
71#Make sure at least one target is installed. Abuses USE dependencies. 77#Make sure at least one target is installed.
78REQUIRED_USE="${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( }|| ( "
72for target in ${USE_PHP}; do 79for target in ${USE_PHP}; do
73 IUSE="${IUSE} php_targets_${target}" 80 IUSE="${IUSE} php_targets_${target}"
74 target=${target/+} 81 target=${target/+}
75 SELFDEPEND="${SELFDEPEND} =${CATEGORY}/${PF}[php_targets_${target}]" 82 REQUIRED_USE+="php_targets_${target} "
76 slot=${target/php} 83 slot=${target/php}
77 slot=${slot/-/.} 84 slot=${slot/-/.}
78 PHPDEPEND="${PHPDEPEND} 85 PHPDEPEND="${PHPDEPEND}
79 php_targets_${target}? ( dev-lang/php:${slot} )" 86 php_targets_${target}? ( dev-lang/php:${slot} )"
80done 87done
88REQUIRED_USE+=") ${PHP_EXT_OPTIONAL_USE:+ )}"
81 89
82RDEPEND="${RDEPEND} 90RDEPEND="${RDEPEND}
83 ${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( } 91 ${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( }
84 || ( ${SELFDEPEND} )
85 ${PHPDEPEND} 92 ${PHPDEPEND}
86 ${PHP_EXT_OPTIONAL_USE:+ )}" 93 ${PHP_EXT_OPTIONAL_USE:+ )}"
87 94
88DEPEND="${DEPEND} 95DEPEND="${DEPEND}
89 ${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( } 96 ${PHP_EXT_OPTIONAL_USE}${PHP_EXT_OPTIONAL_USE:+? ( }
102# Set PHP_EXT_SKIP_PHPIZE="yes" in your ebuild if you do not want to run phpize. 109# Set PHP_EXT_SKIP_PHPIZE="yes" in your ebuild if you do not want to run phpize.
103php-ext-source-r2_src_unpack() { 110php-ext-source-r2_src_unpack() {
104 unpack ${A} 111 unpack ${A}
105 local slot orig_s="${PHP_EXT_S}" 112 local slot orig_s="${PHP_EXT_S}"
106 for slot in $(php_get_slots); do 113 for slot in $(php_get_slots); do
107 cp -r "${orig_s}" "${WORKDIR}/${slot}" 114 cp -r "${orig_s}" "${WORKDIR}/${slot}" || die "Failed to copy source ${orig_s} to PHP target directory"
108 done 115 done
109} 116}
110 117
111php-ext-source-r2_src_prepare() { 118php-ext-source-r2_src_prepare() {
112 local slot orig_s="${PHP_EXT_S}" 119 local slot orig_s="${PHP_EXT_S}"
138 145
139# @VARIABLE: my_conf 146# @VARIABLE: my_conf
140# @DESCRIPTION: 147# @DESCRIPTION:
141# Set this in the ebuild to pass configure options to econf. 148# Set this in the ebuild to pass configure options to econf.
142php-ext-source-r2_src_configure() { 149php-ext-source-r2_src_configure() {
150 # net-snmp creates this file #385403
151 addpredict /usr/share/snmp/mibs/.index
152 addpredict /var/lib/net-snmp/mib_indexes
153
143 local slot 154 local slot
144 for slot in $(php_get_slots); do 155 for slot in $(php_get_slots); do
145 php_init_slot_env ${slot} 156 php_init_slot_env ${slot}
146 # Set the correct config options 157 # Set the correct config options
147 econf --with-php-config=${PHPCONFIG} ${my_conf} || die "Unable to configure code to compile" 158 econf --with-php-config=${PHPCONFIG} ${my_conf} || die "Unable to configure code to compile"
152# @DESCRIPTION: 163# @DESCRIPTION:
153# Takes care of standard compile for PHP extensions (modules). 164# Takes care of standard compile for PHP extensions (modules).
154php-ext-source-r2_src_compile() { 165php-ext-source-r2_src_compile() {
155 # net-snmp creates this file #324739 166 # net-snmp creates this file #324739
156 addpredict /usr/share/snmp/mibs/.index 167 addpredict /usr/share/snmp/mibs/.index
168 addpredict /var/lib/net-snmp/mib_indexes
169
157 # shm extension createss a semaphore file #173574 170 # shm extension createss a semaphore file #173574
158 addpredict /session_mm_cli0.sem 171 addpredict /session_mm_cli0.sem
159 local slot 172 local slot
160 for slot in $(php_get_slots); do 173 for slot in $(php_get_slots); do
161 php_init_slot_env ${slot} 174 php_init_slot_env ${slot}
162 emake || die "Unable to make code" 175 emake || die "Unable to make code"
163 176
164 done 177 done
165} 178}
166 179
167# @FUNCTION: php-ext-source-r1_src_install 180# @FUNCTION: php-ext-source-r2_src_install
168# @DESCRIPTION: 181# @DESCRIPTION:
169# Takes care of standard install for PHP extensions (modules). 182# Takes care of standard install for PHP extensions (modules).
170 183
171# @VARIABLE: DOCS 184# @VARIABLE: DOCS
172# @DESCRIPTION: 185# @DESCRIPTION:
216} 229}
217 230
218php-ext-source-r2_buildinilist() { 231php-ext-source-r2_buildinilist() {
219 # Work out the list of <ext>.ini files to edit/add to 232 # Work out the list of <ext>.ini files to edit/add to
220 if [[ -z "${PHPSAPILIST}" ]] ; then 233 if [[ -z "${PHPSAPILIST}" ]] ; then
221 PHPSAPILIST="apache2 cli cgi fpm" 234 PHPSAPILIST="apache2 cli cgi fpm embed"
222 fi 235 fi
223 236
224 PHPINIFILELIST="" 237 PHPINIFILELIST=""
225 local x 238 local x
226 for x in ${PHPSAPILIST} ; do 239 for x in ${PHPSAPILIST} ; do
254 267
255 # Symlink the <ext>.ini files from ext/ to ext-active/ 268 # Symlink the <ext>.ini files from ext/ to ext-active/
256 local inifile 269 local inifile
257 for inifile in ${PHPINIFILELIST} ; do 270 for inifile in ${PHPINIFILELIST} ; do
258 if [[ -n "${PHP_EXT_INIFILE}" ]]; then 271 if [[ -n "${PHP_EXT_INIFILE}" ]]; then
259 cat "${FILESDIR}/${PHP_EXT_INIFILE}" > "${inifile}" 272 cat "${FILESDIR}/${PHP_EXT_INIFILE}" >> "${ED}/${inifile}"
260 einfo "Added content of ${FILESDIR}/${PHP_EXT_INIFILE} to ${inifile}" 273 einfo "Added content of ${FILESDIR}/${PHP_EXT_INIFILE} to ${inifile}"
261 fi 274 fi
262
263
264
265
266 inidir="${inifile/${PHP_EXT_NAME}.ini/}" 275 inidir="${inifile/${PHP_EXT_NAME}.ini/}"
267 inidir="${inidir/ext/ext-active}" 276 inidir="${inidir/ext/ext-active}"
268 dodir "/${inidir}" 277 dodir "/${inidir}"
269 dosym "/${inifile}" "/${inifile/ext/ext-active}" 278 dosym "/${inifile}" "/${inifile/ext/ext-active}"
270 done 279 done

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.35

  ViewVC Help
Powered by ViewVC 1.1.20