mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 17:39:31 +00:00
meson.bbclass: split python routines into a separate class
This allows reusing them in nativesdk-meson without copy-pasting code. (From OE-Core rev: f2715f5f2a56f9b660f9f0fe2933ec231a2dd8c0) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
6f8cc237bf
commit
830e634bbb
@@ -0,0 +1,51 @@
|
|||||||
|
inherit siteinfo
|
||||||
|
|
||||||
|
def meson_array(var, d):
|
||||||
|
items = d.getVar(var).split()
|
||||||
|
return repr(items[0] if len(items) == 1 else items)
|
||||||
|
|
||||||
|
# Map our ARCH values to what Meson expects:
|
||||||
|
# http://mesonbuild.com/Reference-tables.html#cpu-families
|
||||||
|
def meson_cpu_family(var, d):
|
||||||
|
import re
|
||||||
|
arch = d.getVar(var)
|
||||||
|
if arch == 'powerpc':
|
||||||
|
return 'ppc'
|
||||||
|
elif arch == 'powerpc64' or arch == 'powerpc64le':
|
||||||
|
return 'ppc64'
|
||||||
|
elif arch == 'armeb':
|
||||||
|
return 'arm'
|
||||||
|
elif arch == 'aarch64_be':
|
||||||
|
return 'aarch64'
|
||||||
|
elif arch == 'mipsel':
|
||||||
|
return 'mips'
|
||||||
|
elif arch == 'mips64el':
|
||||||
|
return 'mips64'
|
||||||
|
elif re.match(r"i[3-6]86", arch):
|
||||||
|
return "x86"
|
||||||
|
elif arch == "microblazeel":
|
||||||
|
return "microblaze"
|
||||||
|
else:
|
||||||
|
return arch
|
||||||
|
|
||||||
|
# Map our OS values to what Meson expects:
|
||||||
|
# https://mesonbuild.com/Reference-tables.html#operating-system-names
|
||||||
|
def meson_operating_system(var, d):
|
||||||
|
os = d.getVar(var)
|
||||||
|
if "mingw" in os:
|
||||||
|
return "windows"
|
||||||
|
# avoid e.g 'linux-gnueabi'
|
||||||
|
elif "linux" in os:
|
||||||
|
return "linux"
|
||||||
|
else:
|
||||||
|
return os
|
||||||
|
|
||||||
|
def meson_endian(prefix, d):
|
||||||
|
arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
|
||||||
|
sitedata = siteinfo_data_for_machine(arch, os, d)
|
||||||
|
if "endian-little" in sitedata:
|
||||||
|
return "little"
|
||||||
|
elif "endian-big" in sitedata:
|
||||||
|
return "big"
|
||||||
|
else:
|
||||||
|
bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
inherit siteinfo python3native
|
inherit python3native meson-routines
|
||||||
|
|
||||||
DEPENDS_append = " meson-native ninja-native"
|
DEPENDS_append = " meson-native ninja-native"
|
||||||
|
|
||||||
@@ -35,56 +35,6 @@ MESON_CROSS_FILE = ""
|
|||||||
MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"
|
MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"
|
||||||
MESON_CROSS_FILE_class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"
|
MESON_CROSS_FILE_class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"
|
||||||
|
|
||||||
def meson_array(var, d):
|
|
||||||
items = d.getVar(var).split()
|
|
||||||
return repr(items[0] if len(items) == 1 else items)
|
|
||||||
|
|
||||||
# Map our ARCH values to what Meson expects:
|
|
||||||
# http://mesonbuild.com/Reference-tables.html#cpu-families
|
|
||||||
def meson_cpu_family(var, d):
|
|
||||||
import re
|
|
||||||
arch = d.getVar(var)
|
|
||||||
if arch == 'powerpc':
|
|
||||||
return 'ppc'
|
|
||||||
elif arch == 'powerpc64' or arch == 'powerpc64le':
|
|
||||||
return 'ppc64'
|
|
||||||
elif arch == 'armeb':
|
|
||||||
return 'arm'
|
|
||||||
elif arch == 'aarch64_be':
|
|
||||||
return 'aarch64'
|
|
||||||
elif arch == 'mipsel':
|
|
||||||
return 'mips'
|
|
||||||
elif arch == 'mips64el':
|
|
||||||
return 'mips64'
|
|
||||||
elif re.match(r"i[3-6]86", arch):
|
|
||||||
return "x86"
|
|
||||||
elif arch == "microblazeel":
|
|
||||||
return "microblaze"
|
|
||||||
else:
|
|
||||||
return arch
|
|
||||||
|
|
||||||
# Map our OS values to what Meson expects:
|
|
||||||
# https://mesonbuild.com/Reference-tables.html#operating-system-names
|
|
||||||
def meson_operating_system(var, d):
|
|
||||||
os = d.getVar(var)
|
|
||||||
if "mingw" in os:
|
|
||||||
return "windows"
|
|
||||||
# avoid e.g 'linux-gnueabi'
|
|
||||||
elif "linux" in os:
|
|
||||||
return "linux"
|
|
||||||
else:
|
|
||||||
return os
|
|
||||||
|
|
||||||
def meson_endian(prefix, d):
|
|
||||||
arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
|
|
||||||
sitedata = siteinfo_data_for_machine(arch, os, d)
|
|
||||||
if "endian-little" in sitedata:
|
|
||||||
return "little"
|
|
||||||
elif "endian-big" in sitedata:
|
|
||||||
return "big"
|
|
||||||
else:
|
|
||||||
bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
|
|
||||||
|
|
||||||
addtask write_config before do_configure
|
addtask write_config before do_configure
|
||||||
do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS"
|
do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS"
|
||||||
do_write_config() {
|
do_write_config() {
|
||||||
|
|||||||
Reference in New Issue
Block a user