Gentoo Archives: gentoo-dev

From: Michael Orlitzky <mjo@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 2/2] php-ext-source-r2.eclass: add prefix support.
Date: Wed, 26 Aug 2015 02:20:13
Message-Id: 1440555552-12929-3-git-send-email-mjo@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/2] Add prefix support to php-ext-source-r2.eclass. by Michael Orlitzky
1 The php-ext-source-r2 eclass sets a bunch of environment variables of
2 the form,
3
4 PHPIZE="/usr/${libdir}/${1}/bin/phpize"
5
6 and also tests for the existence of an INI file using absolute
7 paths. To accomodate a prefix environment, all of these paths need to
8 be prefixed with $EPREFIX. This commit adds the prefix to all absolute
9 paths in the eclass. We then need to strip $EPREFIX from one
10 invocation of `insinto` which handles $EPREFIX in its own way.
11
12 This has been tested on =dev-php/pecl-imagick-3.3.0_rc2 in a prefix
13 environment.
14
15 Bug: 371985
16 Bug: 481410
17 ---
18 eclass/php-ext-source-r2.eclass | 19 ++++++++++---------
19 1 file changed, 10 insertions(+), 9 deletions(-)
20
21 diff --git a/eclass/php-ext-source-r2.eclass b/eclass/php-ext-source-r2.eclass
22 index 17073a9..ad82fee 100644
23 --- a/eclass/php-ext-source-r2.eclass
24 +++ b/eclass/php-ext-source-r2.eclass
25 @@ -191,8 +191,9 @@ php-ext-source-r2_src_install() {
26 for slot in $(php_get_slots); do
27 php_init_slot_env ${slot}
28
29 - # Let's put the default module away
30 - insinto "${EXT_DIR}"
31 + # Let's put the default module away. Strip $EPREFIX from
32 + # $EXT_DIR before calling newins (which handles EPREFIX itself).
33 + insinto "${EXT_DIR#$EPREFIX}"
34 newins "modules/${PHP_EXT_NAME}.so" "${PHP_EXT_NAME}.so" || die "Unable to install extension"
35
36 local doc
37 @@ -217,12 +218,12 @@ php_get_slots() {
38 php_init_slot_env() {
39 libdir=$(get_libdir)
40
41 - PHPIZE="/usr/${libdir}/${1}/bin/phpize"
42 - PHPCONFIG="/usr/${libdir}/${1}/bin/php-config"
43 - PHPCLI="/usr/${libdir}/${1}/bin/php"
44 - PHPCGI="/usr/${libdir}/${1}/bin/php-cgi"
45 + PHPIZE="${EPREFIX}/usr/${libdir}/${1}/bin/phpize"
46 + PHPCONFIG="${EPREFIX}/usr/${libdir}/${1}/bin/php-config"
47 + PHPCLI="${EPREFIX}/usr/${libdir}/${1}/bin/php"
48 + PHPCGI="${EPREFIX}/usr/${libdir}/${1}/bin/php-cgi"
49 PHP_PKG="$(best_version =dev-lang/php-${1:3}*)"
50 - PHPPREFIX="/usr/${libdir}/${slot}"
51 + PHPPREFIX="${EPREFIX}}/usr/${libdir}/${slot}"
52 EXT_DIR="$(${PHPCONFIG} --extension-dir 2>/dev/null)"
53 PHP_CURRENTSLOT=${1:3}
54
55 @@ -239,7 +240,7 @@ php-ext-source-r2_buildinilist() {
56 PHPINIFILELIST=""
57 local x
58 for x in ${PHPSAPILIST} ; do
59 - if [[ -f "/etc/php/${x}-${1}/php.ini" ]] ; then
60 + if [[ -f "${EPREFIX}/etc/php/${x}-${1}/php.ini" ]] ; then
61 PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-${1}/ext/${PHP_EXT_NAME}.ini"
62 fi
63 done
64 @@ -281,7 +282,7 @@ php-ext-source-r2_createinifiles() {
65 done
66
67 # Add support for installing PHP files into a version dependant directory
68 - PHP_EXT_SHARED_DIR="/usr/share/php/${PHP_EXT_NAME}"
69 + PHP_EXT_SHARED_DIR="${EPREFIX}/usr/share/php/${PHP_EXT_NAME}"
70 done
71 }
72
73 --
74 2.4.6