dev-php/twig: don't run eclass phases when USE="extension" is unset.
authorMichael Orlitzky <mjo@gentoo.org>
Fri, 6 Jan 2017 21:50:11 +0000 (16:50 -0500)
committerMichael Orlitzky <mjo@gentoo.org>
Fri, 6 Jan 2017 21:50:51 +0000 (16:50 -0500)
If the user does not wish to build the C extension, there is no need
to run the php-ext-source-r3 eclass phases. Doing so can lead to a
build failure because those eclass phases use DEPENDencies that are
only required conditionally on USE=extension.

Gentoo-Bug: 604874

Package-Manager: portage-2.3.0

dev-php/twig/twig-1.29.0.ebuild

index 0cfa0e18f6297c37f86a44150fd97ee47a53647d..679424cdfef4ec24d8778df6292f36477fcc256a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -25,22 +25,26 @@ IUSE="doc extension test"
 DEPEND="test? ( dev-php/phpunit )"
 
 src_prepare(){
-       # We need to call eapply_user ourselves, just in case the user's
+       # We need to call eapply_user ourselves, because it may be skipped
+       # if either the "extension" USE flag is not set, or if the user's
        # PHP_TARGETS is essentially empty (does not contain "php5-6"). In
-       # that case the eclass src_prepare does nothing.
+       # the latter case, the eclass src_prepare does nothing.
        eapply_user
-       php-ext-source-r3_src_prepare
+       use extension && php-ext-source-r3_src_prepare
 }
 
 src_install(){
-       php-ext-source-r3_src_install
+       use extension && php-ext-source-r3_src_install
 
        cd "${S}" || die
        # The autoloader requires the 'T' in "Twig" capitalized.
        insinto "/usr/share/php/${MY_PN}"
        doins -r lib/"${MY_PN}"/*
 
+       # The eclass src_install calls einstalldocs, so we may install a few
+       # files twice. Doing so should be harmless.
        dodoc README.rst CHANGELOG
+
        # This installs the reStructuredText source documents. There's got
        # to be some way to turn them into HTML using Sphinx, but upstream
        # doesn't provide for it.