Patchwork [10/10] libgcc: get the gcc header files working

login
register
mail settings
Submitter Nitin A Kamble
Date Feb. 22, 2012, 6:37 a.m.
Message ID <44285a7a69f45582670350ca63e1fa8996dac890.1329892604.git.nitin.a.kamble@intel.com>
Download mbox | patch
Permalink /patch/21557/
State New
Headers show

Comments

Nitin A Kamble - Feb. 22, 2012, 6:37 a.m.
From: Nitin A Kamble <nitin.a.kamble@intel.com>

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
---
 meta/recipes-devtools/gcc/libgcc_4.6.bb |   53 +++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
Richard Purdie - Feb. 22, 2012, 1:43 p.m.
On Tue, 2012-02-21 at 22:37 -0800, nitin.a.kamble@intel.com wrote:
> From: Nitin A Kamble <nitin.a.kamble@intel.com>
> 
> Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
> ---
>  meta/recipes-devtools/gcc/libgcc_4.6.bb |   53 +++++++++++++++++++++++++++++++
>  1 files changed, 53 insertions(+), 0 deletions(-)
> 
> diff --git a/meta/recipes-devtools/gcc/libgcc_4.6.bb b/meta/recipes-devtools/gcc/libgcc_4.6.bb
> index 076cf37..6d93341 100644
> --- a/meta/recipes-devtools/gcc/libgcc_4.6.bb
> +++ b/meta/recipes-devtools/gcc/libgcc_4.6.bb
> @@ -14,6 +14,9 @@ FILES_${PN} = "${base_libdir}/libgcc*.so.*"
>  FILES_${PN}-dev = " \
>    ${base_libdir}/libgcc*.so \
>    ${libdir}/${TARGET_SYS}/${BINV}/crt* \
> +  ${libdir}/${TARGET_SYS}/${BINV}/32 \
> +  ${libdir}/${TARGET_SYS}/${BINV}/x32 \
> +  ${libdir}/${TARGET_SYS}/${BINV}/n32 \
>    ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
>  FILES_libgcov-dev = " \
>    ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a "
> @@ -51,3 +54,53 @@ BBCLASSEXTEND = "nativesdk"
>  INSANE_SKIP_libgcc-dev = "staticdev"
>  INSANE_SKIP_libgcov-dev = "staticdev"
>  
> +addtask multilib_install after do_install before do_package
> +
> +
> +# this makes multilib gcc files findable for target gcc
> +# like this directory is made findable 
> +#    /usr/lib/i586-pokymllib32-linux/4.6.3/
> +# by creating this symlink to it
> +#    /usr/lib64/x86_64-poky-linux/4.6.3/32

This might be one case where moving the files is actually the right
thing to do. The "pokymllib32" is an artefact of the way we do multilib
builds and likely shouldn't be exposed on the target. I'm not sure how
relocatable these files are though.

> +python do_multilib_install() {
> +        import re
> +        # do this only for multilib extended recipe
> +        if d.getVar('PN', 1) != 'libgcc':
> +                return
> +
> +        tune_arch = d.getVar('TUNE_ARCH', 1) or ''
> +        defaulttune = d.getVar('DEFAULTTUNE', 1) or ''
> +        multilibs = d.getVar('MULTILIB_VARIANTS', 1) or ''
> +        if multilibs == '':
> +                return
> +
> +	tunes_32 = ['x86', 'core2', 'i586', 'mips', 'mipsel', 'mips-nf', 'mipsel-nf', 'powerpc', 'powerpc-nf']
> +        tunes_64 = ['x86-64', 'core2-64', 'mips64', 'mips64el', 'mips64-nf', 'mips64el-nf', 'powerpc64']
> +        tunes_x32 = ['x86-64-x32', 'core2-64-x32']
> +        tunes_n32 = ['mips64-n32', 'mips64el-n32', 'mips64-nf-n32', 'mips64el-nf-n32']

Just for reference, duplicating these lists over two files is an
extremely bad idea...

I'm hoping we can clean some of this up with the comments in my reply to
the other patch too.

Cheers,

Richard

Patch

diff --git a/meta/recipes-devtools/gcc/libgcc_4.6.bb b/meta/recipes-devtools/gcc/libgcc_4.6.bb
index 076cf37..6d93341 100644
--- a/meta/recipes-devtools/gcc/libgcc_4.6.bb
+++ b/meta/recipes-devtools/gcc/libgcc_4.6.bb
@@ -14,6 +14,9 @@  FILES_${PN} = "${base_libdir}/libgcc*.so.*"
 FILES_${PN}-dev = " \
   ${base_libdir}/libgcc*.so \
   ${libdir}/${TARGET_SYS}/${BINV}/crt* \
+  ${libdir}/${TARGET_SYS}/${BINV}/32 \
+  ${libdir}/${TARGET_SYS}/${BINV}/x32 \
+  ${libdir}/${TARGET_SYS}/${BINV}/n32 \
   ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
 FILES_libgcov-dev = " \
   ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a "
@@ -51,3 +54,53 @@  BBCLASSEXTEND = "nativesdk"
 INSANE_SKIP_libgcc-dev = "staticdev"
 INSANE_SKIP_libgcov-dev = "staticdev"
 
+addtask multilib_install after do_install before do_package
+
+
+# this makes multilib gcc files findable for target gcc
+# like this directory is made findable 
+#    /usr/lib/i586-pokymllib32-linux/4.6.3/
+# by creating this symlink to it
+#    /usr/lib64/x86_64-poky-linux/4.6.3/32
+
+python do_multilib_install() {
+        import re
+        # do this only for multilib extended recipe
+        if d.getVar('PN', 1) != 'libgcc':
+                return
+
+        tune_arch = d.getVar('TUNE_ARCH', 1) or ''
+        defaulttune = d.getVar('DEFAULTTUNE', 1) or ''
+        multilibs = d.getVar('MULTILIB_VARIANTS', 1) or ''
+        if multilibs == '':
+                return
+
+	tunes_32 = ['x86', 'core2', 'i586', 'mips', 'mipsel', 'mips-nf', 'mipsel-nf', 'powerpc', 'powerpc-nf']
+        tunes_64 = ['x86-64', 'core2-64', 'mips64', 'mips64el', 'mips64-nf', 'mips64el-nf', 'powerpc64']
+        tunes_x32 = ['x86-64-x32', 'core2-64-x32']
+        tunes_n32 = ['mips64-n32', 'mips64el-n32', 'mips64-nf-n32', 'mips64el-nf-n32']
+
+        for ml in multilibs.split(' '):
+                ml_tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, 1) or ''
+		ml_tune_features = d.getVar('TUNE_FEATURES_tune-' + ml_tune, 1) or ''
+                ml_baselib = d.getVar('BASE_LIB_tune-' + ml_tune, 1) or ''
+                for feature in ml_tune_features.split():
+                        ml_feature_arch = d.getVar('TUNE_FEATURE_ARCH-' + feature, 1) or ''
+		if ml_tune in tunes_32:
+                        bitness = '32'
+                elif ml_tune in tunes_64:
+                        bitness = '64'
+                elif ml_tune in tunes_x32:
+                        bitness = 'x32'
+                elif ml_tune in tunes_n32:
+                        bitness = 'n32'
+
+	binv = d.getVar('BINV', 1) or ''
+
+	src = '/usr/' + ml_baselib + '/' + ml_feature_arch + '-pokyml' + ml + '-linux/' + binv + '/' 
+	dest = (d.getVar('D', 1) or '') + (d.getVar('libdir', 1) or '') + '/' + (d.getVar('TARGET_SYS', 1) or '') + '/' + binv + '/' + bitness
+	if os.path.lexists(dest):
+		os.unlink(dest)
+	os.symlink(src, dest)
+
+}