/[gentoo-x86]/eclass/phpconfutils.eclass
Gentoo

Diff of /eclass/phpconfutils.eclass

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

Revision 1.5 Revision 1.9
1# Copyright 1999-2006 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/phpconfutils.eclass,v 1.5 2007/05/10 20:26:45 chtekk Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/phpconfutils.eclass,v 1.9 2008/01/06 19:30:24 swegener Exp $
4# 4#
5# ######################################################################## 5# ########################################################################
6# 6#
7# eclass/phpconfutils.eclass
8# Utility functions to help with configuring PHP
9#
10# Based on Stuart's work on the original confutils eclass 7# Based on Stuart's work on the original confutils eclass
11# 8#
12# Author(s) Luca Longinotti 9# Author(s): Luca Longinotti <chtekk@gentoo.org>
13# <chtekk@gentoo.org>
14# 10#
15# Maintained by the PHP Herd <php-bugs@gentoo.org>
16#
17# ======================================================================== 11# ========================================================================
12
13# @ECLASS: phpconfutils.eclass
14# @MAINTAINER:
15# Gentoo PHP team <php-bugs@gentoo.org>
16# @BLURB: Provides utility functions to help with configuring PHP.
17# @DESCRIPTION:
18# This eclass provides utility functions to help with configuring PHP.
19# It is only used by other php eclasses currently and the functions
20# are not generally intended for direct use in ebuilds.
21
18 22
19# ======================================================================== 23# ========================================================================
20# List of USE flags that need deps that aren't yet in Portage 24# List of USE flags that need deps that aren't yet in Portage
21# or that can't be (fex. certain commercial apps) 25# or that can't be (fex. certain commercial apps)
22# 26#
28# Sort and remove duplicates of the auto-enabled USE flags 32# Sort and remove duplicates of the auto-enabled USE flags
29# 33#
30 34
31phpconfutils_sort_flags() { 35phpconfutils_sort_flags() {
32 # Sort the list of auto-magically enabled USE flags 36 # Sort the list of auto-magically enabled USE flags
33 PHPCONFUTILS_AUTO_USE="`echo ${PHPCONFUTILS_AUTO_USE} | tr '\040\010' '\012\012' | sort -u`" 37 PHPCONFUTILS_AUTO_USE="$(echo ${PHPCONFUTILS_AUTO_USE} | tr '\040\010' '\012\012' | sort -u)"
34} 38}
35 39
36# ======================================================================== 40# ========================================================================
37# phpconfutils_init() 41# phpconfutils_init()
38# 42#
40# this eclass first 44# this eclass first
41# 45#
42 46
43phpconfutils_init() { 47phpconfutils_init() {
44 # Define wheter we shall support shared extensions or not 48 # Define wheter we shall support shared extensions or not
45 if useq "sharedext" ; then 49 if use "sharedext" ; then
46 shared="=shared" 50 shared="=shared"
47 else 51 else
48 shared="" 52 shared=""
49 fi 53 fi
50 54
91 local required_flags="$@" 95 local required_flags="$@"
92 local default_flag="$1" 96 local default_flag="$1"
93 local success="0" 97 local success="0"
94 98
95 while [[ -n "$1" ]] ; do 99 while [[ -n "$1" ]] ; do
96 if useq "$1" ; then 100 if use "$1" ; then
97 einfo "${success_msg} $1" 101 einfo "${success_msg} $1"
98 success="1" 102 success="1"
99 else 103 else
100 einfo "${fail_msg} $1" 104 einfo "${fail_msg} $1"
101 fi 105 fi
131# 135#
132 136
133phpconfutils_use_conflict() { 137phpconfutils_use_conflict() {
134 phpconfutils_sort_flags 138 phpconfutils_sort_flags
135 139
136 if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then 140 if ! use "$1" && ! phpconfutils_usecheck "$1" ; then
137 return 141 return
138 fi 142 fi
139 143
140 local my_flag="$1" 144 local my_flag="$1"
141 shift 145 shift
142 146
143 local my_present="" 147 local my_present=""
144 local my_remove="" 148 local my_remove=""
145 149
146 while [[ "$1+" != "+" ]] ; do 150 while [[ "$1+" != "+" ]] ; do
147 if useq "$1" || phpconfutils_usecheck "$1" ; then 151 if use "$1" || phpconfutils_usecheck "$1" ; then
148 my_present="${my_present} $1" 152 my_present="${my_present} $1"
149 my_remove="${my_remove} -$1" 153 my_remove="${my_remove} -$1"
150 fi 154 fi
151 shift 155 shift
152 done 156 done
175# 179#
176 180
177phpconfutils_use_depend_all() { 181phpconfutils_use_depend_all() {
178 phpconfutils_sort_flags 182 phpconfutils_sort_flags
179 183
180 if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then 184 if ! use "$1" && ! phpconfutils_usecheck "$1" ; then
181 return 185 return
182 fi 186 fi
183 187
184 local my_flag="$1" 188 local my_flag="$1"
185 shift 189 shift
186 190
187 local my_missing="" 191 local my_missing=""
188 192
189 while [[ "$1+" != "+" ]] ; do 193 while [[ "$1+" != "+" ]] ; do
190 if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then 194 if ! use "$1" && ! phpconfutils_usecheck "$1" ; then
191 my_missing="${my_missing} $1" 195 my_missing="${my_missing} $1"
192 fi 196 fi
193 shift 197 shift
194 done 198 done
195 199
219# 223#
220 224
221phpconfutils_use_depend_any() { 225phpconfutils_use_depend_any() {
222 phpconfutils_sort_flags 226 phpconfutils_sort_flags
223 227
224 if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then 228 if ! use "$1" && ! phpconfutils_usecheck "$1" ; then
225 return 229 return
226 fi 230 fi
227 231
228 local my_flag="$1" 232 local my_flag="$1"
229 shift 233 shift
233 237
234 local my_found="" 238 local my_found=""
235 local my_missing="" 239 local my_missing=""
236 240
237 while [[ "$1+" != "+" ]] ; do 241 while [[ "$1+" != "+" ]] ; do
238 if useq "$1" || phpconfutils_usecheck "$1" ; then 242 if use "$1" || phpconfutils_usecheck "$1" ; then
239 my_found="${my_found} $1" 243 my_found="${my_found} $1"
240 else 244 else
241 my_missing="${my_missing} $1" 245 my_missing="${my_missing} $1"
242 fi 246 fi
243 shift 247 shift
267# $2 - USE flag 271# $2 - USE flag
268# $3 - optional message to einfo() to the user 272# $3 - optional message to einfo() to the user
269# 273#
270 274
271phpconfutils_extension_disable() { 275phpconfutils_extension_disable() {
272 if ! useq "$2" && ! phpconfutils_usecheck "$2" ; then 276 if ! use "$2" && ! phpconfutils_usecheck "$2" ; then
273 my_conf="${my_conf} --disable-$1" 277 my_conf="${my_conf} --disable-$1"
274 [[ -n "$3" ]] && einfo " Disabling $1" 278 [[ -n "$3" ]] && einfo " Disabling $1"
275 else 279 else
276 [[ -n "$3" ]] && einfo " Enabling $1" 280 [[ -n "$3" ]] && einfo " Enabling $1"
277 fi 281 fi
307 if [[ "$4+" != "+" ]] ; then 311 if [[ "$4+" != "+" ]] ; then
308 my_shared="=$4" 312 my_shared="=$4"
309 fi 313 fi
310 fi 314 fi
311 315
312 if useq "$2" || phpconfutils_usecheck "$2" ; then 316 if use "$2" || phpconfutils_usecheck "$2" ; then
313 my_conf="${my_conf} --enable-$1${my_shared}" 317 my_conf="${my_conf} --enable-$1${my_shared}"
314 einfo " Enabling $1" 318 einfo " Enabling $1"
315 else 319 else
316 my_conf="${my_conf} --disable-$1" 320 my_conf="${my_conf} --disable-$1"
317 einfo " Disabling $1" 321 einfo " Disabling $1"
329# $2 - USE flag 333# $2 - USE flag
330# $3 - optional message to einfo() to the user 334# $3 - optional message to einfo() to the user
331# 335#
332 336
333phpconfutils_extension_without() { 337phpconfutils_extension_without() {
334 if ! useq "$2" && ! phpconfutils_usecheck "$2" ; then 338 if ! use "$2" && ! phpconfutils_usecheck "$2" ; then
335 my_conf="${my_conf} --without-$1" 339 my_conf="${my_conf} --without-$1"
336 einfo " Disabling $1" 340 einfo " Disabling $1"
337 else 341 else
338 einfo " Enabling $1" 342 einfo " Enabling $1"
339 fi 343 fi
368 if [[ "$4+" != "+" ]] ; then 372 if [[ "$4+" != "+" ]] ; then
369 my_shared="=$4" 373 my_shared="=$4"
370 fi 374 fi
371 fi 375 fi
372 376
373 if useq "$2" || phpconfutils_usecheck "$2" ; then 377 if use "$2" || phpconfutils_usecheck "$2" ; then
374 my_conf="${my_conf} --with-$1${my_shared}" 378 my_conf="${my_conf} --with-$1${my_shared}"
375 einfo " Enabling $1" 379 einfo " Enabling $1"
376 else 380 else
377 my_conf="${my_conf} --without-$1" 381 my_conf="${my_conf} --without-$1"
378 einfo " Disabling $1" 382 einfo " Disabling $1"
391 395
392 local x 396 local x
393 local my_found="0" 397 local my_found="0"
394 398
395 for x in ${PHPCONFUTILS_MISSING_DEPS} ; do 399 for x in ${PHPCONFUTILS_MISSING_DEPS} ; do
396 if useq "${x}" || phpconfutils_usecheck "${x}" ; then 400 if use "${x}" || phpconfutils_usecheck "${x}" ; then
397 ewarn "USE flag ${x} enables support for software not present in Portage!" 401 ewarn "USE flag ${x} enables support for software not present in Portage!"
398 my_found="1" 402 my_found="1"
399 fi 403 fi
400 done 404 done
401 405

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20