summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Fredric <kentnl@gentoo.org>2017-09-15 18:25:51 +1200
committerKent Fredric <kentnl@gentoo.org>2017-09-17 12:07:35 +1200
commit8a10fbbec5dcca39cd0680dd47add7925947a208 (patch)
treec4177554d03cc34128fe97806201bf95ff3a899b
parentperl-module.eclass: Fatalize pkg_postrm outside perl-core (diff)
downloadperl-overlay-8a10fbbe.tar.gz
perl-overlay-8a10fbbe.tar.bz2
perl-overlay-8a10fbbe.zip
perl-module.eclass: Add DIST_EXAMPLES support to EAPI6
-rw-r--r--eclass/perl-module.eclass17
1 files changed, 17 insertions, 0 deletions
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
}