| 1 | # Copyright 1999-2006 Gentoo Foundation |
1 | # Copyright 1999-2006 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.2 2006/04/18 12:21:14 chtekk Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/phpconfutils.eclass,v 1.5 2007/05/10 20:26:45 chtekk Exp $ |
| 4 | # |
4 | # |
| 5 | # ######################################################################## |
5 | # ######################################################################## |
| 6 | # |
6 | # |
| 7 | # eclass/phpconfutils.eclass |
7 | # eclass/phpconfutils.eclass |
| 8 | # Utility functions to help with configuring PHP |
8 | # Utility functions to help with configuring PHP |
| 9 | # |
9 | # |
| 10 | # Based on stuart's work on the original confutils eclass |
10 | # Based on Stuart's work on the original confutils eclass |
| 11 | # |
11 | # |
| 12 | # Author(s) Luca Longinotti |
12 | # Author(s) Luca Longinotti |
| 13 | # <chtekk@gentoo.org> |
13 | # <chtekk@gentoo.org> |
| 14 | # |
14 | # |
| 15 | # Maintained by the PHP Herd <php-bugs@gentoo.org> |
15 | # Maintained by the PHP Herd <php-bugs@gentoo.org> |
| 16 | # |
16 | # |
| 17 | # ======================================================================== |
17 | # ======================================================================== |
| 18 | |
18 | |
| 19 | if [[ "${EBUILD_SUPPORTS_SHAREDEXT}" == "1" ]] ; then |
|
|
| 20 | IUSE="sharedext" |
|
|
| 21 | fi |
|
|
| 22 | |
|
|
| 23 | # ======================================================================== |
19 | # ======================================================================== |
| 24 | # List of USE flags that need deps that aren't yet in Portage |
20 | # List of USE flags that need deps that aren't yet in Portage |
| 25 | # or that can't be (fex. certain commercial apps) |
21 | # or that can't be (fex. certain commercial apps) |
| 26 | # |
22 | # |
| 27 | # You must define CONFUTILS_MISSING_DEPS if you need this |
23 | # You must define PHPCONFUTILS_MISSING_DEPS if you need this |
| 28 | |
24 | |
| 29 | # ======================================================================== |
25 | # ======================================================================== |
| 30 | # phpconfutils_sort_flags() |
26 | # phpconfutils_sort_flags() |
| 31 | # |
27 | # |
| 32 | # Sort and remove duplicates of the auto-enabled USE flags |
28 | # Sort and remove duplicates of the auto-enabled USE flags |
| … | |
… | |
| 44 | # this eclass first |
40 | # this eclass first |
| 45 | # |
41 | # |
| 46 | |
42 | |
| 47 | phpconfutils_init() { |
43 | phpconfutils_init() { |
| 48 | # Define wheter we shall support shared extensions or not |
44 | # Define wheter we shall support shared extensions or not |
| 49 | if [[ "${EBUILD_SUPPORTS_SHAREDEXT}" == "1" ]] && useq "sharedext" ; then |
45 | if useq "sharedext" ; then |
| 50 | shared="=shared" |
46 | shared="=shared" |
| 51 | else |
47 | else |
| 52 | shared="" |
48 | shared="" |
| 53 | fi |
49 | fi |
| 54 | |
50 | |
| … | |
… | |
| 91 | shift |
87 | shift |
| 92 | local fail_msg="$1" |
88 | local fail_msg="$1" |
| 93 | shift |
89 | shift |
| 94 | |
90 | |
| 95 | local required_flags="$@" |
91 | local required_flags="$@" |
|
|
92 | local default_flag="$1" |
| 96 | local success="0" |
93 | local success="0" |
| 97 | |
94 | |
| 98 | while [[ -n "$1" ]] ; do |
95 | while [[ -n "$1" ]] ; do |
| 99 | if useq "$1" ; then |
96 | if useq "$1" ; then |
| 100 | einfo "${success_msg} $1" |
97 | einfo "${success_msg} $1" |
| 101 | success="1" |
98 | success="1" |
| 102 | else |
99 | else |
| 103 | ewarn "${fail_msg} $1" |
100 | einfo "${fail_msg} $1" |
| 104 | fi |
101 | fi |
| 105 | shift |
102 | shift |
| 106 | done |
103 | done |
| 107 | |
104 | |
| 108 | # Did we find what we are looking for? |
105 | # Did we find what we are looking for? |
| … | |
… | |
| 110 | return |
107 | return |
| 111 | fi |
108 | fi |
| 112 | |
109 | |
| 113 | # If we get here, then none of the required USE flags were enabled |
110 | # If we get here, then none of the required USE flags were enabled |
| 114 | eerror |
111 | eerror |
| 115 | eerror "You *must* enable one or more of the following USE flags:" |
112 | eerror "You should enable one or more of the following USE flags:" |
| 116 | eerror " ${required_flags}" |
113 | eerror " ${required_flags}" |
| 117 | eerror |
114 | eerror |
| 118 | eerror "You can do this by enabling these flags in /etc/portage/package.use:" |
115 | eerror "You can do this by enabling these flags in /etc/portage/package.use:" |
| 119 | eerror " =${CATEGORY}/${PN}-${PVR} ${required_flags}" |
116 | eerror " =${CATEGORY}/${PN}-${PVR} ${required_flags}" |
| 120 | eerror |
117 | eerror |
| 121 | die "Missing USE flags found" |
118 | eerror "The ${default_flag} USE flag was automatically enabled now." |
|
|
119 | eerror |
|
|
120 | PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE} ${default_flag}" |
| 122 | } |
121 | } |
| 123 | |
122 | |
| 124 | # ======================================================================== |
123 | # ======================================================================== |
| 125 | # phpconfutils_use_conflict() |
124 | # phpconfutils_use_conflict() |
| 126 | # |
125 | # |
| … | |
… | |
| 391 | phpconfutils_sort_flags |
390 | phpconfutils_sort_flags |
| 392 | |
391 | |
| 393 | local x |
392 | local x |
| 394 | local my_found="0" |
393 | local my_found="0" |
| 395 | |
394 | |
| 396 | for x in ${CONFUTILS_MISSING_DEPS} ; do |
395 | for x in ${PHPCONFUTILS_MISSING_DEPS} ; do |
| 397 | if useq "${x}" || phpconfutils_usecheck "${x}" ; then |
396 | if useq "${x}" || phpconfutils_usecheck "${x}" ; then |
| 398 | ewarn "USE flag ${x} enables support for software not present in Portage!" |
397 | ewarn "USE flag ${x} enables support for software not present in Portage!" |
| 399 | my_found="1" |
398 | my_found="1" |
| 400 | fi |
399 | fi |
| 401 | done |
400 | done |
| … | |
… | |
| 407 | ewarn "fail to compile later on." |
406 | ewarn "fail to compile later on." |
| 408 | ewarn "*DO NOT* file bugs about compile failures or issues you're having" |
407 | ewarn "*DO NOT* file bugs about compile failures or issues you're having" |
| 409 | ewarn "when using one of those flags, as we aren't able to support them." |
408 | ewarn "when using one of those flags, as we aren't able to support them." |
| 410 | ewarn "|=|=|=|=|=|=| You are on your own if you use them! |=|=|=|=|=|=|" |
409 | ewarn "|=|=|=|=|=|=| You are on your own if you use them! |=|=|=|=|=|=|" |
| 411 | ewarn |
410 | ewarn |
| 412 | sleep 5 |
411 | ebeep 5 |
| 413 | fi |
412 | fi |
| 414 | } |
413 | } |
| 415 | |
414 | |
| 416 | # ======================================================================== |
415 | # ======================================================================== |
| 417 | # phpconfutils_built_with_use() |
416 | # phpconfutils_built_with_use() |