aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Orling <TicoTimo@gmail.com>2014-07-05 20:46:11 -0700
committerTim Orling <TicoTimo@gmail.com>2014-07-06 09:26:46 -0700
commit5101337a65f67f81df872f05362fadbda12ec068 (patch)
treeca953c90bf28911e6fed4b9538c8a211462e07ea
parent3b8b3d0621f07fc697a884a1a6f4f511c7b606f0 (diff)
downloadopenembedded-core-contrib-timo/cpanminus.tar.gz
openembedded-core-contrib-timo/cpanminus.tar.bz2
openembedded-core-contrib-timo/cpanminus.zip
cpanm.bbclasstimo/cpanminus
* Use cpanm (App::cpanminus, libapp-cpanminus-perl) to get, unpack, build and install perl modules from CPAN Signed-off-by: Tim Orling <TicoTimo@gmail.com>
-rw-r--r--meta/classes/cpanm.bbclass58
1 files changed, 58 insertions, 0 deletions
diff --git a/meta/classes/cpanm.bbclass b/meta/classes/cpanm.bbclass
new file mode 100644
index 0000000000..77aa854b0a
--- /dev/null
+++ b/meta/classes/cpanm.bbclass
@@ -0,0 +1,58 @@
+#
+# This is for perl modules that use cpanm (App::cpanminus)
+#
+inherit cpan-base perlnative
+
+# Env var which tells perl if it should use host (no) or target (yes) settings
+export PERLCONFIGTARGET = "${@is_target(d)}"
+export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
+export LD = "${CCLD}"
+
+# Env var which tells cpanm where to download files
+export PERL_CPANM_HOME = "${DL_DIR}/.cpanm"
+# Env vars which would be set by local::lib
+export PERL_MB_OPT = "--install_base ${PERL_ARCHLIB}"
+export PERL_MM_OPT = "INSTALL_BASE=${PERL_ARCHLIB}"
+export PERL5LIB = "${PERL_ARCHLIB}:${STAGING_LIBDIR}/perl/"
+export PERL_LOCAL_LIB_ROOT = "${libdir}/perl"
+
+#
+# We also need to have built libapp-cpanminus-perl-native for
+# everything except libapp-cpanminus-perl-native itself (which uses
+# this class, but uses itself as the provider of
+# libapp-cpanminus-perl)
+#
+def cpanm_dep_prepend(d):
+ if d.getVar('CPANM_DEPS', True):
+ return ''
+ pn = d.getVar('PN', True)
+ if pn in ['libapp-cpanminus-perl', 'libapp-cpanminus-perl-native']:
+ return ''
+ return 'libapp-cpanminus-perl-native '
+
+DEPENDS_prepend = "${@cpanm_dep_prepend(d)}"
+
+cpanm_do_configure () {
+ if [ "${@is_target(d)}" = "yes" ]; then
+ # build for target
+ . ${STAGING_LIBDIR}/perl/config.sh
+ fi
+
+ perl Build.PL --installdirs vendor \
+ --destdir ${D} \
+ --install_path arch="${libdir}/perl" \
+ --install_path script=${bindir} \
+ --install_path bin=${bindir} \
+ --install_path bindoc=${mandir}/man1 \
+ --install_path libdoc=${mandir}/man3 \
+}
+
+cpanm_do_compile () {
+ cpanm perl Build
+}
+
+cpanm_do_install () {
+ cpanm perl Build install
+}
+
+EXPORT_FUNCTIONS do_configure do_compile do_install