From: Ross Burton Date: Mon, 20 May 2024 10:18:31 +0000 (+0000) Subject: toolchain-scripts: export the target endianism and word size X-Git-Tag: uninative-4.6~531 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2fee816cae6dbedcb40f15be4a1b9ee91757a64;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git toolchain-scripts: export the target endianism and word size Some build systems (notably, Meson) like to be told when cross-compiling what the target endian and word size is. We don't have these exported via the variables, so add them using siteinfo as a source of data. Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass index 6bfe0b6de0d..cbef412e796 100644 --- a/meta/classes-recipe/toolchain-scripts.bbclass +++ b/meta/classes-recipe/toolchain-scripts.bbclass @@ -16,6 +16,13 @@ DEBUG_PREFIX_MAP = "" EXPORT_SDK_PS1 = "${@ 'export PS1=\\"%s\\"' % d.getVar('SDK_PS1') if d.getVar('SDK_PS1') else ''}" +def siteinfo_with_prefix(d, prefix): + # Return a prefixed value from siteinfo + for item in siteinfo_data_for_machine(d.getVar("TARGET_ARCH"), d.getVar("TARGET_OS"), d): + if item.startswith(prefix): + return item.replace(prefix, "") + raise KeyError + # This function creates an environment-setup-script for use in a deployable SDK toolchain_create_sdk_env_script () { # Create environment setup script. Remember that $SDKTARGETSYSROOT should @@ -63,6 +70,8 @@ toolchain_create_sdk_env_script () { echo 'export OECORE_BASELIB="${baselib}"' >> $script echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script + echo 'export OECORE_TARGET_BITS="${@siteinfo_with_prefix(d, 'bit-')}"' >>$script + echo 'export OECORE_TARGET_ENDIAN="${@siteinfo_with_prefix(d, 'endian-')}"' >>$script echo 'unset command_not_found_handle' >> $script