Skip to contentSkip to conversation

cpan_build.bbclass; added cc and ld flags to the perl Build.PL invocation

PATCH Superseded Frans Meulenbroeks 2 participants 3 messages Dec 26, 2010 – Dec 27, 2010

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cpan_build.bbclass; added cc and ld flags to the perl Build.PL invocation

Without these gcc would be used which resolves to /usr/bin/gcc and one gets an intel exe.
This showed up with libparams-validate-perl and libdatetime-perl The LDFLAGS are added to resolve the GNU_HASH QA error

---
 classes/cpan_build.bbclass     |    1 +
 classes/poky/cpan-base.bbclass |   42 ++++++++++++++++++++++++++++++++++++++++
 classes/poky/cpan.bbclass      |   38 ++++++++++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 classes/poky/cpan-base.bbclass
 create mode 100644 classes/poky/cpan.bbclass
classes/cpan_build.bbclass +1 -0
index d1bbc4f..070e061 100644
@@ -26,6 +26,7 @@ cpan_build_do_configure () {
 		# build for target
 		. ${STAGING_LIBDIR}/perl/config.sh
 		perl Build.PL --installdirs vendor \
+		        --config cc="${CC} ${LDFLAGS}" --config ld="${CCLD} ${LDFLAGS}" \
 			--destdir ${D} \
 			--install_path lib="${datadir}/perl5" \
 			--install_path arch="${libdir}/perl5" \
classes/poky/cpan-base.bbclass new file +42 -0

42 lines not on this page · raw message

classes/poky/cpan.bbclass new file +38 -0
new file mode 100644
index 0000000..513f0b3
@@ -0,0 +1,38 @@
+#
+# This is for perl modules that use the old Makefile.PL build system
+#
+inherit cpan-base
+
+EXTRA_CPANFLAGS ?= ""
+
+# Env var which tells perl if it should use host (no) or target (yes) settings
+export PERLCONFIGTARGET = "${@is_target(d)}"
+
+# Env var which tells perl where the perl include files are
+export PERL_INC = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}/CORE"
+export PERL_LIB = "${STAGING_DATADIR}/perl/${@get_perl_version(d)}"
+export PERL_ARCHLIB = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}"
+
+cpan_do_configure () {
+	export PERL5LIB="${PERL_ARCHLIB}"
+	yes '' | perl Makefile.PL ${EXTRA_CPANFLAGS}
+	if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
+		. ${STAGING_LIBDIR}/perl/config.sh
+		# Use find since there can be a Makefile generated for each Makefile.PL
+		for f in `find -name Makefile.PL`; do
+			f2=`echo $f | sed -e 's/.PL//'`
+			sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
+			$f2
+		done
+	fi
+}
+
+cpan_do_compile () {
+	oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}"
+}
+
+cpan_do_install () {
+	oe_runmake DESTDIR="${D}" install_vendor
+}
+
+EXPORT_FUNCTIONS do_configure do_compile do_install
Signature · 1 line
1.7.1
#1 lore raw
Quoted 6 lines · Frans Meulenbroeks

Without these gcc would be used which resolves to /usr/bin/gcc and one gets an intel exe.
This showed up with libparams-validate-perl and libdatetime-perl The LDFLAGS are added to resolve the GNU_HASH QA error

Why a new dir called poky ?

Quoted 112 lines
---
  classes/cpan_build.bbclass     |    1 +
  classes/poky/cpan-base.bbclass |   42 ++++++++++++++++++++++++++++++++++++++++
  classes/poky/cpan.bbclass      |   38 ++++++++++++++++++++++++++++++++++++
  3 files changed, 81 insertions(+), 0 deletions(-)

create mode 100644 classes/poky/cpan-base.bbclass create mode 100644 classes/poky/cpan.bbclass

classes/cpan_build.bbclass +1 -0
index d1bbc4f..070e061 100644
@@ -26,6 +26,7 @@ cpan_build_do_configure () {
  		# build for target
  		. ${STAGING_LIBDIR}/perl/config.sh
  		perl Build.PL --installdirs vendor \
+		        --config cc="${CC} ${LDFLAGS}" --config ld="${CCLD} ${LDFLAGS}" \
  			--destdir ${D} \
  			--install_path lib="${datadir}/perl5" \
  			--install_path arch="${libdir}/perl5" \
classes/poky/cpan-base.bbclass new file +42 -0
new file mode 100644
index 0000000..3175248
@@ -0,0 +1,42 @@
+#
+# cpan-base providers various perl related information needed for building
+# cpan modules
+#
+FILES_${PN} += "${libdir}/perl5 ${datadir}/perl5"
+
+DEPENDS  += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}"
+RDEPENDS  += "${@["perl", ""][(bb.data.inherits_class('native', d))]}"
+
+# Determine the staged version of perl from the perl configuration file
+def get_perl_version(d):
+	import re
+    	cfg = bb.data.expand('${STAGING_LIBDIR}/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
+
+# Determine where the library directories are
+def perl_get_libdirs(d):
+	libdir = bb.data.getVar('libdir', d, 1)
+	libdirs = libdir + '/*/*/perl5'
+	return libdirs
+
+def is_target(d):
+    if not bb.data.inherits_class('native', d):
+        return "yes"
+    return "no"
+
+PERLLIBDIRS = "${@perl_get_libdirs(d)}"
+
+FILES_${PN}-dbg += "${PERLLIBDIRS}/auto/*/.debug \
+                    ${PERLLIBDIRS}/auto/*/*/.debug \
+                    ${PERLLIBDIRS}/auto/*/*/*/.debug"
classes/poky/cpan.bbclass new file +38 -0
new file mode 100644
index 0000000..513f0b3
@@ -0,0 +1,38 @@
+#
+# This is for perl modules that use the old Makefile.PL build system
+#
+inherit cpan-base
+
+EXTRA_CPANFLAGS ?= ""
+
+# Env var which tells perl if it should use host (no) or target (yes) settings
+export PERLCONFIGTARGET = "${@is_target(d)}"
+
+# Env var which tells perl where the perl include files are
+export PERL_INC = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}/CORE"
+export PERL_LIB = "${STAGING_DATADIR}/perl/${@get_perl_version(d)}"
+export PERL_ARCHLIB = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}"
+
+cpan_do_configure () {
+	export PERL5LIB="${PERL_ARCHLIB}"
+	yes '' | perl Makefile.PL ${EXTRA_CPANFLAGS}
+	if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
+		. ${STAGING_LIBDIR}/perl/config.sh
+		# Use find since there can be a Makefile generated for each Makefile.PL
+		for f in `find -name Makefile.PL`; do
+			f2=`echo $f | sed -e 's/.PL//'`
+			sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
+			$f2
+		done
+	fi
+}
+
+cpan_do_compile () {
+	oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}"
+}
+
+cpan_do_install () {
+	oe_runmake DESTDIR="${D}" install_vendor
+}
+
+EXPORT_FUNCTIONS do_configure do_compile do_install
#2 lore raw

2010/12/27 Khem Raj <[email protected]>:

Quoted 10 lines · Frans Meulenbroeks
Quoted 7 lines

Without these gcc would be used which resolves to /usr/bin/gcc and one gets an intel exe.
This showed up with libparams-validate-perl and libdatetime-perl The LDFLAGS are added to resolve the GNU_HASH QA error

Why a new dir called poky ?

I goofed. Sry.

The patch only aimed to contain the following:

classes/cpan_build.bbclass +1 -0
index d1bbc4f..070e061 100644
@@ -26,6 +26,7 @@ cpan_build_do_configure () {
               # build for target
               . ${STAGING_LIBDIR}/perl/config.sh
               perl Build.PL --installdirs vendor \
+                       --config cc="${CC} ${LDFLAGS}" --config
ld="${CCLD} ${LDFLAGS}" \
                       --destdir ${D} \
                       --install_path lib="${datadir}/perl5" \
                       --install_path arch="${libdir}/perl5" \

Thought I'd verified the patch with git log -p but apparently I didn't look carefully enough.
No idea how that poky file ended up in my tree at all.
Will resubmit.

Frans.