From d913f5b4b1e54abf761348e9a444c63818d04de7 Mon Sep 17 00:00:00 2001 From: Jamie Lenehan Date: Wed, 25 Apr 2007 01:16:14 +0000 Subject: cpan.bbclass: Update to enable the building cpan modules for perl 5.8.8. This uses the installed perl configuration to determine if we are building for the old or the new perl layout. Currently this just changes the installation paths and always uses gcc to link, but more changes will be added later to make the perl module building process a lot more reliable. --- classes/cpan.bbclass | 74 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/classes/cpan.bbclass b/classes/cpan.bbclass index a566f0fa42..9915bf6f67 100644 --- a/classes/cpan.bbclass +++ b/classes/cpan.bbclass @@ -1,38 +1,74 @@ # # This is for perl modules that use the old Makefile.PL build system # -FILES_${PN} += '${libdir}/perl5' -EXTRA_CPANFLAGS = "" +FILES_${PN} += '${libdir}/perl5 ${datadir}/perl5' +EXTRA_CPANFLAGS ?= "" DEPENDS += "perl-native" RDEPENDS += "perl" +# Determine the staged version of perl from the perl configuration file +def get_perl_version(d): + import os, bb, re + cfg = bb.data.expand('${STAGING_DIR}/${HOST_SYS}/perl/config.sh', d) + try: + f = open(cfg, 'r') + except IOError: + return None + l = f.readlines(); + f.close(); + r = re.compile("version='(\d\.\d\.\d)'") + for s in l: + m = r.match(s) + if m: + return m.group(1) + return None + +# Only 5.8.7 and 5.8.4 existed at the time we moved to the new layout +def is_new_perl(d): + ver = get_perl_version(d) + if ver == "5.8.4" or ver == "5.8.7": + return "no" + return "yes" + +IS_NEW_PERL = "${@is_new_perl(d)}" + cpan_do_configure () { perl Makefile.PL ${EXTRA_CPANFLAGS} if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh - sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ - -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ - -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ - -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ - -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ - Makefile + if [ "${IS_NEW_PERL}" = "yes" ]; then + sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ + -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ + -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${datadir}/perl5:" \ + -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5:" \ + -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ + Makefile + else + sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ + -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ + -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ + -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ + -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ + Makefile + fi fi } cpan_do_compile () { - # You must use gcc to link on sh - OPTIONS="" - if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then - OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" + if [ "${IS_NEW_PERL}" = "yes" ]; then + oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD=${TARGET_SYS}-gcc + else + # You must use gcc to link on sh + OPTIONS="" + if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then + OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" + fi + if test ${TARGET_ARCH} = "powerpc" ; then + OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" + fi + oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS fi - - if test ${TARGET_ARCH} = "powerpc" ; then - OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" - fi - - - oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS } cpan_do_install () { -- cgit v1.2.3 From e8a6d182baff2ced6027f8810eee8eb07030fd32 Mon Sep 17 00:00:00 2001 From: Jamie Lenehan Date: Wed, 25 Apr 2007 01:17:54 +0000 Subject: perl 5.8.8: Move comments on how to create the dependency list into the dependency file itself to make the main recipe a bit more readable. Also move the two dependencies that were manually added to the the dependenecy list file and fix use RDEPENDS instead of DEPENDS. --- packages/perl/perl-rdepends_5.8.8.inc | 8 ++++++++ packages/perl/perl_5.8.8.bb | 13 ++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/perl/perl-rdepends_5.8.8.inc b/packages/perl/perl-rdepends_5.8.8.inc index 905edbdaaf..1ce5ad0375 100644 --- a/packages/perl/perl-rdepends_5.8.8.inc +++ b/packages/perl/perl-rdepends_5.8.8.inc @@ -1,3 +1,11 @@ +# To create/update the perl-rdepends_${PV}.inc use this piece of ugly script (modified for your arch/paths etc): +# daka@DaKa2:/home/slug/slugos/tmp/work/perl-5.8.7-r14/install$ egrep -r "use|require" * | grep ";$" | egrep ".pm:use |.pm:require " | grep -v v5.6.0 | grep -v 5.00 | grep -v \$module | sed -e "s, \+, ,g" | cut -f1,2 -d" " | sed -e "s,;, ,g" | sed -e "s,(), ,g" | sed -e "s,::,-,g" | sort | uniq | tr [:upper:] [:lower:] | sed -e "s,/[^ ]\+ , += \"perl-module-,g" | sed -e "s, \?$, \",g" | sed -e "s,_,-,g" | sed -e "s,^,RDEPENDS_,g" | sed -e "s,armeb-linux,\$\{TARGET_ARCH\}-\$\{TARGET_OS\},g" | egrep -v "perl-module-5|perl-module-tk|perl-module-mac-internetconfig|perl-module-ndbm-file|perl-module-html-treebuilder|perl-module-lwp-simple|perl-module-vms-filespec|perl-module-fcgi|perl-module-vms-stdio|perl-module-mac-buildtools" > /home/slug/openembedded/packages/perl/rdepends.tmp + +# Some additional dependencies that the above doesn't manage to figure out +RDEPENDS_perl-module-math-bigint += "perl-module-math-bigint-calc " +RDEPENDS_perl-module-math-bigint-calc += "perl-module-integer " + +# Depends list RDEPENDS_perl-misc += "perl-module-exporter " RDEPENDS_perl-misc += "perl-module-strict " RDEPENDS_perl-misc += "perl-module-warnings " diff --git a/packages/perl/perl_5.8.8.bb b/packages/perl/perl_5.8.8.bb index 6e79066afa..d97cd4cfe9 100644 --- a/packages/perl/perl_5.8.8.bb +++ b/packages/perl/perl_5.8.8.bb @@ -5,7 +5,7 @@ LICENSE = "Artistic|GPL" PRIORITY = "optional" # We need gnugrep (for -I) DEPENDS = "virtual/db perl-native grep-native" -PR = "r3" +PR = "r4" # Major part of version PVM = "5.8" @@ -94,7 +94,7 @@ do_compile() { do_install() { oe_runmake install - # Add versioned perl interpereter + # Add perl pointing at current version ln -sf perl${PV} ${D}/usr/bin/perl # Fix up versioned directories @@ -152,16 +152,7 @@ python populate_packages_prepend () { do_split_packages(d, datadir, '(.*)\.(pm|pl)', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True) } - require perl-rdepends_${PV}.inc - -# To create/update the perl-rdepends_${PV}.inc use this piece of ugly script (modified for your arch/paths etc): -# daka@DaKa2:/home/slug/slugos/tmp/work/perl-5.8.7-r14/install$ egrep -r "use|require" * | grep ";$" | egrep ".pm:use |.pm:require " | grep -v v5.6.0 | grep -v 5.00 | grep -v \$module | sed -e "s, \+, ,g" | cut -f1,2 -d" " | sed -e "s,;, ,g" | sed -e "s,(), ,g" | sed -e "s,::,-,g" | sort | uniq | tr [:upper:] [:lower:] | sed -e "s,/[^ ]\+ , += \"perl-module-,g" | sed -e "s, \?$, \",g" | sed -e "s,_,-,g" | sed -e "s,^,RDEPENDS_,g" | sed -e "s,armeb-linux,\$\{TARGET_ARCH\}-\$\{TARGET_OS\},g" | egrep -v "perl-module-5|perl-module-tk|perl-module-mac-internetconfig|perl-module-ndbm-file|perl-module-html-treebuilder|perl-module-lwp-simple|perl-module-vms-filespec|perl-module-fcgi|perl-module-vms-stdio|perl-module-mac-buildtools" > /home/slug/openembedded/packages/perl/perl-rdepends_5.8.7.inc - -# Some additional dependencies that the above doesn't manage to figure out -DEPENDS_perl-module-math-bigint += "perl-module-math-bigint-calc " -DEPENDS_perl-module-math-bigint-calc += "perl-module-integer " - require perl-rprovides.inc PARALLEL_MAKE = "" -- cgit v1.2.3