Meson now supports native-files, which are the same as cross files but describe the native build.
By writing and using a native file which describes the tools to use, we can drop the environment variable overriding. Signed-off-by: Ross Burton <ross.bur...@arm.com> --- meta/classes/meson.bbclass | 49 ++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass index a7644e70cb..290b39e1e0 100644 --- a/meta/classes/meson.bbclass +++ b/meta/classes/meson.bbclass @@ -26,7 +26,8 @@ MESONOPTS = " --prefix ${prefix} \ --sysconfdir ${sysconfdir} \ --localstatedir ${localstatedir} \ --sharedstatedir ${sharedstatedir} \ - --wrap-mode nodownload" + --wrap-mode nodownload \ + --native-file ${WORKDIR}/native.cross" EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}" @@ -121,9 +122,28 @@ system = '${@meson_operating_system('TARGET_OS', d)}' cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}' cpu = '${TARGET_ARCH}' endian = '${@meson_endian('TARGET', d)}' +EOF + + cat >${WORKDIR}/native.cross <<EOF +[binaries] +c = ${@meson_array('BUILD_CC', d)} +cpp = ${@meson_array('BUILD_CXX', d)} +ar = ${@meson_array('BUILD_AR', d)} +nm = ${@meson_array('BUILD_NM', d)} +strip = ${@meson_array('BUILD_STRIP', d)} +readelf = ${@meson_array('BUILD_READELF', d)} +pkgconfig = 'pkg-config-native' + +[properties] +needs_exe_wrapper = false +c_args = ${@meson_array('BUILD_CFLAGS', d)} +c_link_args = ${@meson_array('BUILD_LDFLAGS', d)} +cpp_args = ${@meson_array('BUILD_CXXFLAGS', d)} +cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)} EOF } +# Tell externalsrc that changes to this file require a reconfigure CONFIGURE_FILES = "meson.build" meson_do_configure() { @@ -140,33 +160,6 @@ meson_do_configure() { fi } -override_native_tools() { - # Set these so that meson uses the native tools for its build sanity tests, - # which require executables to be runnable. The cross file will still - # override these for the target build. - export CC="${BUILD_CC}" - export CXX="${BUILD_CXX}" - export LD="${BUILD_LD}" - export AR="${BUILD_AR}" - export STRIP="${BUILD_STRIP}" - # These contain *target* flags but will be used as *native* flags. The - # correct native flags will be passed via -Dc_args and so on, unset them so - # they don't interfere with tools invoked by Meson (such as g-ir-scanner) - unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS -} - -meson_do_configure_prepend_class-target() { - override_native_tools -} - -meson_do_configure_prepend_class-nativesdk() { - override_native_tools -} - -meson_do_configure_prepend_class-native() { - export PKG_CONFIG="pkg-config-native" -} - python meson_do_qa_configure() { import re warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE) -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#149846): https://lists.openembedded.org/g/openembedded-core/message/149846 Mute This Topic: https://lists.openembedded.org/mt/81562048/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-