commit:     872519317ecee8bb04b9b6c93caa5b288df9c3d7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 11 21:44:55 2016 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Apr 11 21:48:42 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=87251931

perl-module.eclass: Add new control variable DIST_EXAMPLES

 eclass/perl-module.eclass | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass
index 8b2f3a4..c22b685 100644
--- a/eclass/perl-module.eclass
+++ b/eclass/perl-module.eclass
@@ -131,6 +131,14 @@ LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
 # (EAPI=6) This variable sets the module author name for the calculation of
 # SRC_URI. Named MODULE_AUTHOR in EAPI=5.
 
+# @ECLASS-VARIABLE: DIST_EXAMPLES
+# @DESCRIPTION:
+# (EAPI=6) This Bash array allows passing a list of example files to be 
installed
+# in /usr/share/doc/${PF}/examples. If set before inherit, automatically adds
+# a use-flag examples, if not you'll have to add the useflag in your ebuild.
+# Examples are installed only if the useflag examples exists and is activated.
+
+
 if [[ ${EAPI:-0} == 5 ]]; then
        if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then
                : ${MY_P:=${MY_PN:-${PN}}-${MY_PV:-${MODULE_VERSION:-${PV}}}}
@@ -158,6 +166,8 @@ else
                
SRC_URI="mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${DIST_SECTION:+${DIST_SECTION}/}${DIST_A}"
        [[ -z "${HOMEPAGE}" ]] && \
                HOMEPAGE="http://search.cpan.org/dist/${DIST_NAME}/";
+
+       [[ -z "${DIST_EXAMPLES}" ]] || IUSE+=" examples"
 fi
 
 SRC_PREP="no"
@@ -419,6 +429,12 @@ perl-module_src_install() {
                [[ -s ${f} ]] && dodoc ${f}
        done
 
+       if [[ ${EAPI:-0} != 5 ]] ; then
+               if in_iuse examples && use examples ; then
+                        [[ -z "${DIST_EXAMPLES}" ]] || perl_doexamples 
${DIST_EXAMPLES}
+               fi
+       fi
+
        perl_link_duallife_scripts
 }
 

Reply via email to