Message ID | 20220222035234.463162-2-andrew@aj.id.au |
---|---|
State | New |
Headers | show |
Series | rust: Fix powerpc64le support | expand |
On Tue, 2022-02-22 at 14:22 +1030, Andrew Jeffery wrote: > This will allow us to use it elsewhere for architecture name > translation. This move is motivated by powerpc64le support. > > Signed-off-by: Andrew Jeffery <andrew@aj.id.au> > --- > meta/classes/rust-common.bbclass | 16 ++++++++++++++++ > meta/recipes-devtools/rust/rust-common.inc | 16 ---------------- > 2 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass > index 98d65970e8c0..2f2a31867ad0 100644 > --- a/meta/classes/rust-common.bbclass > +++ b/meta/classes/rust-common.bbclass > @@ -1,5 +1,21 @@ > inherit python3native > > +# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something > +# rust's internals won't choke on. > +def arch_to_rust_target_arch(arch): > + if arch == "i586" or arch == "i686": > + return "x86" > + elif arch == "mipsel": > + return "mips" > + elif arch == "mip64sel": > + return "mips64" > + elif arch == "armv7": > + return "arm" > + elif arch == "powerpc64le": > + return "powerpc64" > + else: > + return arch > + > # Common variables used by all Rust builds > export rustlibdir = "${libdir}/rust" > FILES:${PN} += "${rustlibdir}/*.so" If we're moving this, it may be a good candidate to move to a new meta/lib/oe/rust.py python function library for rust. I appreciate that is slightly move involved and will likely need the imports in base.bbclass to be tweaked but is probably the better long term fix. Cheers, Richard
On Tue, 22 Feb 2022, at 20:35, Richard Purdie wrote: > On Tue, 2022-02-22 at 14:22 +1030, Andrew Jeffery wrote: >> This will allow us to use it elsewhere for architecture name >> translation. This move is motivated by powerpc64le support. >> >> Signed-off-by: Andrew Jeffery <andrew@aj.id.au> >> --- >> meta/classes/rust-common.bbclass | 16 ++++++++++++++++ >> meta/recipes-devtools/rust/rust-common.inc | 16 ---------------- >> 2 files changed, 16 insertions(+), 16 deletions(-) >> >> diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass >> index 98d65970e8c0..2f2a31867ad0 100644 >> --- a/meta/classes/rust-common.bbclass >> +++ b/meta/classes/rust-common.bbclass >> @@ -1,5 +1,21 @@ >> inherit python3native >> >> +# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something >> +# rust's internals won't choke on. >> +def arch_to_rust_target_arch(arch): >> + if arch == "i586" or arch == "i686": >> + return "x86" >> + elif arch == "mipsel": >> + return "mips" >> + elif arch == "mip64sel": >> + return "mips64" >> + elif arch == "armv7": >> + return "arm" >> + elif arch == "powerpc64le": >> + return "powerpc64" >> + else: >> + return arch >> + >> # Common variables used by all Rust builds >> export rustlibdir = "${libdir}/rust" >> FILES:${PN} += "${rustlibdir}/*.so" > > > If we're moving this, it may be a good candidate to move to a new > meta/lib/oe/rust.py python function library for rust. I appreciate that is > slightly move involved and will likely need the imports in base.bbclass to be > tweaked but is probably the better long term fix. I'll take a look. Andrew
diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass index 98d65970e8c0..2f2a31867ad0 100644 --- a/meta/classes/rust-common.bbclass +++ b/meta/classes/rust-common.bbclass @@ -1,5 +1,21 @@ inherit python3native +# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something +# rust's internals won't choke on. +def arch_to_rust_target_arch(arch): + if arch == "i586" or arch == "i686": + return "x86" + elif arch == "mipsel": + return "mips" + elif arch == "mip64sel": + return "mips64" + elif arch == "armv7": + return "arm" + elif arch == "powerpc64le": + return "powerpc64" + else: + return arch + # Common variables used by all Rust builds export rustlibdir = "${libdir}/rust" FILES:${PN} += "${rustlibdir}/*.so" diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc index ceeee9786376..742933f1bd22 100644 --- a/meta/recipes-devtools/rust/rust-common.inc +++ b/meta/recipes-devtools/rust/rust-common.inc @@ -254,22 +254,6 @@ def sys_for(d, thing): def prefix_for(d, thing): return d.getVar('{}_PREFIX'.format(thing)) -# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something -# rust's internals won't choke on. -def arch_to_rust_target_arch(arch): - if arch == "i586" or arch == "i686": - return "x86" - elif arch == "mipsel": - return "mips" - elif arch == "mip64sel": - return "mips64" - elif arch == "armv7": - return "arm" - elif arch == "powerpc64le": - return "powerpc64" - else: - return arch - # generates our target CPU value def llvm_cpu(d): cpu = d.getVar('PACKAGE_ARCH')
This will allow us to use it elsewhere for architecture name translation. This move is motivated by powerpc64le support. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> --- meta/classes/rust-common.bbclass | 16 ++++++++++++++++ meta/recipes-devtools/rust/rust-common.inc | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-)