commit:     8a10fbbec5dcca39cd0680dd47add7925947a208
Author:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 15 06:25:51 2017 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Sun Sep 17 00:07:35 2017 +0000
URL:        https://gitweb.gentoo.org/proj/perl-overlay.git/commit/?id=8a10fbbe

perl-module.eclass: Add DIST_EXAMPLES support to EAPI6

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

diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass
index c68d13173..3b4971389 100644
--- a/eclass/perl-module.eclass
+++ b/eclass/perl-module.eclass
@@ -139,6 +139,15 @@ LICENSE="${LICENSE:-|| ( Artistic GPL-1+ )}"
 # SRC_URI. Only required in rare cases for very special snowflakes.
 # Named MODULE_SECTION in EAPI=5.
 
+# @ECLASS-VARIABLE: DIST_EXAMPLES
+# @DEFAULT_UNSET
+# @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}}}}
@@ -166,6 +175,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"
@@ -425,6 +436,12 @@ perl-module_src_install() {
                [[ -s ${f} ]] && dodoc ${f}
        done
 
+       if [[ ${EAPI:-0} != 5 ]] ; then
+               if in_iuse examples && use examples ; then
+                        [[ ${#DIST_EXAMPLES[@]} -eq 0 ]] || perl_doexamples 
"${DIST_EXAMPLES[@]}"
+               fi
+       fi
+
        perl_link_duallife_scripts
 }
 

Reply via email to