Gentoo Archives: gentoo-dev

From: Brian Evans <grknight@g.o>
To: gentoo-dev@l.g.o
Cc: Brian Evans <grknight@g.o>
Subject: [gentoo-dev] [PATCH 2/2] php-ext-source-r3.eclass: Introduce PHP_EXT_NEEDED_USE
Date: Fri, 26 Jan 2018 15:39:30
Message-Id: 20180126153857.30315-3-grknight@gentoo.org
In Reply to: [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements by Brian Evans
1 This simplifies the dependencies in an ebuild
2
3 @DESCRIPTION:
4 A list of USE flags to append to each PHP target selected
5 as a valid USE-dependency string. The value should be valid
6 for all targets so USE defaults may be necessary.
7 Example:
8 PHP_EXT_NEEDED_USE="mysql?,pdo,pcre(+)"
9
10 The PHP dependencies will result in:
11 php_targets_php7-0? ( dev-lang/php:7.0[mysql?,pdo,pcre(+)] )
12 ---
13 eclass/php-ext-source-r3.eclass | 19 +++++++++++++++++++
14 1 file changed, 19 insertions(+)
15
16 diff --git a/eclass/php-ext-source-r3.eclass b/eclass/php-ext-source-r3.eclass
17 index 315ce32887f..96d55f97a55 100644
18 --- a/eclass/php-ext-source-r3.eclass
19 +++ b/eclass/php-ext-source-r3.eclass
20 @@ -84,6 +84,22 @@ esac
21 # @CODE@
22 : ${PHP_INI_NAME:=${PHP_EXT_NAME}}
23
24 +# @ECLASS-VARIABLE: PHP_EXT_NEEDED_USE
25 +# @DEFAULT_UNSET
26 +# @DESCRIPTION:
27 +# A list of USE flags to append to each PHP target selected
28 +# as a valid USE-dependency string. The value should be valid
29 +# for all targets so USE defaults may be necessary.
30 +# Example:
31 +# @CODE
32 +# PHP_EXT_NEEDED_USE="mysql?,pdo,pcre(+)"
33 +# @CODE
34 +#
35 +# The PHP dependencies will result in:
36 +# @CODE
37 +# php_targets_php7-0? ( dev-lang/php:7.0[mysql?,pdo,pcre(+)] )
38 +# @CODE
39 +
40
41 # Make sure at least one target is installed. First, start a USE
42 # conditional like "php?", but only when PHP_EXT_OPTIONAL_USE is
43 @@ -96,6 +112,9 @@ for _php_target in ${USE_PHP}; do
44 REQUIRED_USE+="php_targets_${_php_target} "
45 _php_slot=${_php_target/php}
46 _php_slot=${_php_slot/-/.}
47 + if [[ ${PHP_EXT_NEEDED_USE} ]] ; then
48 + _php_slot+=[${PHP_EXT_NEEDED_USE}]
49 + fi
50 PHPDEPEND+=" php_targets_${_php_target}? ( dev-lang/php:${_php_slot} )"
51 done
52
53 --
54 2.16.1