diff options
author | Marcin Juszkiewicz <hrw@openedhand.com> | 2007-05-30 09:32:36 +0000 |
---|---|---|
committer | Marcin Juszkiewicz <hrw@openedhand.com> | 2007-05-30 09:32:36 +0000 |
commit | 6c47cd48aff1dbc3b2550ea71307c48debca9298 (patch) | |
tree | 96e18b82c2f72e76c3c1ddbc148c7ef2fbf56ad7 /meta | |
parent | 4ed25e747d7a5a636d9e517b59601ff66f1d6c15 (diff) | |
download | poky-6c47cd48aff1dbc3b2550ea71307c48debca9298.tar.gz |
cpan classes: sync Perl with OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1815 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/cpan-base.bbclass | 55 | ||||
-rw-r--r-- | meta/classes/cpan.bbclass | 52 | ||||
-rw-r--r-- | meta/classes/cpan_build.bbclass | 70 |
3 files changed, 161 insertions, 16 deletions
diff --git a/meta/classes/cpan-base.bbclass b/meta/classes/cpan-base.bbclass new file mode 100644 index 0000000000..a5fdb33895 --- /dev/null +++ b/meta/classes/cpan-base.bbclass | |||
@@ -0,0 +1,55 @@ | |||
1 | # | ||
2 | # cpan-base providers various perl related information needed for building | ||
3 | # cpan modules | ||
4 | # | ||
5 | FILES_${PN} += "${libdir}/perl5 ${datadir}/perl5" | ||
6 | |||
7 | DEPENDS += "perl perl-native" | ||
8 | RDEPENDS += "perl" | ||
9 | |||
10 | # Determine the staged version of perl from the perl configuration file | ||
11 | def get_perl_version(d): | ||
12 | import os, bb, re | ||
13 | cfg = bb.data.expand('${STAGING_DIR}/${HOST_SYS}/perl/config.sh', d) | ||
14 | try: | ||
15 | f = open(cfg, 'r') | ||
16 | except IOError: | ||
17 | return None | ||
18 | l = f.readlines(); | ||
19 | f.close(); | ||
20 | r = re.compile("version='(\d\.\d\.\d)'") | ||
21 | for s in l: | ||
22 | m = r.match(s) | ||
23 | if m: | ||
24 | return m.group(1) | ||
25 | return None | ||
26 | |||
27 | # Only 5.8.7 and 5.8.4 existed at the time we moved to the new layout | ||
28 | def is_new_perl(d): | ||
29 | ver = get_perl_version(d) | ||
30 | if ver == "5.8.4" or ver == "5.8.7": | ||
31 | return "no" | ||
32 | return "yes" | ||
33 | |||
34 | # Determine where the library directories are | ||
35 | def perl_get_libdirs(d): | ||
36 | import bb | ||
37 | libdir = bb.data.getVar('libdir', d, 1) | ||
38 | if is_new_perl(d) == "yes": | ||
39 | libdirs = libdir + '/perl5' | ||
40 | else: | ||
41 | libdirs = libdir + '/*/*/perl5' | ||
42 | return libdirs | ||
43 | |||
44 | def is_target(d): | ||
45 | import bb | ||
46 | if not bb.data.inherits_class('native', d): | ||
47 | return "yes" | ||
48 | return "no" | ||
49 | |||
50 | IS_NEW_PERL = "${@is_new_perl(d)}" | ||
51 | PERLLIBDIRS = "${@perl_get_libdirs(d)}" | ||
52 | |||
53 | FILES_${PN}-dbg += "${PERLLIBDIRS}/auto/*/.debug \ | ||
54 | ${PERLLIBDIRS}/auto/*/*/.debug \ | ||
55 | ${PERLLIBDIRS}/auto/*/*/*/.debug" | ||
diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass index 159633d17a..4fff5974c1 100644 --- a/meta/classes/cpan.bbclass +++ b/meta/classes/cpan.bbclass | |||
@@ -1,32 +1,52 @@ | |||
1 | # | 1 | # |
2 | # This is for perl modules that use the old Makefile.PL build system | 2 | # This is for perl modules that use the old Makefile.PL build system |
3 | # | 3 | # |
4 | FILES_${PN} += '${libdir}/perl5' | 4 | inherit cpan-base |
5 | EXTRA_CPANFLAGS = "" | ||
6 | 5 | ||
7 | DEPENDS += "perl-native perl" | 6 | EXTRA_CPANFLAGS ?= "" |
8 | RDEPENDS += "perl" | 7 | |
8 | # Env var which tells perl if it should use host (no) or target (yes) settings | ||
9 | export PERLCONFIGTARGET = "${@is_target(d)}" | ||
10 | |||
11 | # Env var which tells perl where the perl include files are | ||
12 | export PERL_INC = "${STAGING_DIR}/${BUILD_SYS}/lib/perl/${@get_perl_version(d)}/CORE" | ||
9 | 13 | ||
10 | cpan_do_configure () { | 14 | cpan_do_configure () { |
11 | perl Makefile.PL ${EXTRA_CPANFLAGS} | 15 | yes '' | perl Makefile.PL ${EXTRA_CPANFLAGS} |
12 | if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then | 16 | if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then |
13 | . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh | 17 | . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh |
14 | sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ | 18 | if [ "${IS_NEW_PERL}" = "yes" ]; then |
15 | -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ | 19 | sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ |
16 | -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ | 20 | -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ |
17 | -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ | 21 | -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${datadir}/perl5:" \ |
18 | -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ | 22 | -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5:" \ |
19 | Makefile | 23 | -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ |
24 | Makefile | ||
25 | else | ||
26 | sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ | ||
27 | -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ | ||
28 | -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ | ||
29 | -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ | ||
30 | -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ | ||
31 | Makefile | ||
32 | fi | ||
20 | fi | 33 | fi |
21 | } | 34 | } |
22 | 35 | ||
23 | cpan_do_compile () { | 36 | cpan_do_compile () { |
24 | # You must use gcc to link on sh | 37 | if [ "${IS_NEW_PERL}" = "yes" ]; then |
25 | OPTIONS="" | 38 | oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}" |
26 | if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then | 39 | else |
27 | OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" | 40 | # You must use gcc to link on sh |
41 | OPTIONS="" | ||
42 | if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then | ||
43 | OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" | ||
44 | fi | ||
45 | if test ${TARGET_ARCH} = "powerpc" ; then | ||
46 | OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" | ||
47 | fi | ||
48 | oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS | ||
28 | fi | 49 | fi |
29 | oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS | ||
30 | } | 50 | } |
31 | 51 | ||
32 | cpan_do_install () { | 52 | cpan_do_install () { |
diff --git a/meta/classes/cpan_build.bbclass b/meta/classes/cpan_build.bbclass new file mode 100644 index 0000000000..63e716c099 --- /dev/null +++ b/meta/classes/cpan_build.bbclass | |||
@@ -0,0 +1,70 @@ | |||
1 | # | ||
2 | # This is for perl modules that use the new Build.PL build system | ||
3 | # | ||
4 | inherit cpan-base | ||
5 | |||
6 | INHIBIT_NATIVE_STAGE_INSTALL = "1" | ||
7 | |||
8 | # | ||
9 | # We also need to have built libmodule-build-perl-native for | ||
10 | # everything except libmodule-build-perl-native itself (which uses | ||
11 | # this class, but uses itself as the provider of | ||
12 | # libmodule-build-perl) | ||
13 | # | ||
14 | def cpan_build_dep_prepend(d): | ||
15 | import bb; | ||
16 | if bb.data.getVar('CPAN_BUILD_DEPS', d, 1): | ||
17 | return '' | ||
18 | pn = bb.data.getVar('PN', d, 1) | ||
19 | if pn in ['libmodule-build-perl', 'libmodule-build-perl-native']: | ||
20 | return '' | ||
21 | return 'libmodule-build-perl-native ' | ||
22 | |||
23 | DEPENDS_prepend = "${@cpan_build_dep_prepend(d)}" | ||
24 | |||
25 | cpan_build_do_configure () { | ||
26 | if [ ${@is_target(d)} == "yes" ]; then | ||
27 | # build for target | ||
28 | . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh | ||
29 | if [ "${IS_NEW_PERL}" = "yes" ]; then | ||
30 | perl Build.PL --installdirs vendor \ | ||
31 | --destdir ${D} \ | ||
32 | --install_path lib="${datadir}/perl5" \ | ||
33 | --install_path arch="${libdir}/perl5" \ | ||
34 | --install_path script=${bindir} \ | ||
35 | --install_path bin=${bindir} \ | ||
36 | --install_path bindoc=${mandir}/man1 \ | ||
37 | --install_path libdoc=${mandir}/man3 | ||
38 | else | ||
39 | perl Build.PL --installdirs vendor \ | ||
40 | --destdir ${D} \ | ||
41 | --install_path lib="${libdir}/perl5/site_perl/${version}" \ | ||
42 | --install_path arch="${libdir}/perl5/site_perl/${version}/${TARGET_SYS}" \ | ||
43 | --install_path script=${bindir} \ | ||
44 | --install_path bin=${bindir} \ | ||
45 | --install_path bindoc=${mandir}/man1 \ | ||
46 | --install_path libdoc=${mandir}/man3 | ||
47 | fi | ||
48 | else | ||
49 | # build for host | ||
50 | perl Build.PL --installdirs site | ||
51 | fi | ||
52 | } | ||
53 | |||
54 | cpan_build_do_compile () { | ||
55 | perl Build | ||
56 | } | ||
57 | |||
58 | cpan_build_do_install () { | ||
59 | if [ ${@is_target(d)} == "yes" ]; then | ||
60 | perl Build install | ||
61 | fi | ||
62 | } | ||
63 | |||
64 | do_stage_append () { | ||
65 | if [ ${@is_target(d)} == "no" ]; then | ||
66 | perl Build install | ||
67 | fi | ||
68 | } | ||
69 | |||
70 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||