Skip to contentSkip to conversation

siteinfo: add siteinfo_get_files_for_machine()

PATCH New [email protected] 1 participant 2 messages Sep 28

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 siteinfo: add siteinfo_get_files_for_machine()

From: "mark.yang" <[email protected]>

Add siteinfo_get_files_for_machine() to look up the site files for any arch/os pair, not just HOST_ARCH-HOST_OS. siteinfo_get_files() now calls it with HOST_ARCH and HOST_OS, as 7429ed8d2a ("siteinfo:
generalise siteinfo") did for siteinfo_data().

---
 meta/classes-recipe/siteinfo.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/classes-recipe/siteinfo.bbclass +4 -2
index 25b53d929a..9dc8d3a477 100644
@@ -194,8 +194,8 @@ python () {
 # sstate isn't path specific
 SITEINFO_PATHVARS = "COREBASE"
 
-def siteinfo_get_files(d, sysrootcache=False):
-    sitedata = siteinfo_data(d)
+def siteinfo_get_files_for_machine(arch, osname, d):
+    sitedata = siteinfo_data_for_machine(arch, osname, d)
     sitefiles = []
     searched = []
     for path in d.getVar("BBPATH").split(":"):
@@ -223,4 +223,6 @@ def siteinfo_get_files(d, sysrootcache=False):
 
     return sitefiles, searched
 
+def siteinfo_get_files(d, sysrootcache=False):
+    return siteinfo_get_files_for_machine(d.getVar("HOST_ARCH"), d.getVar("HOST_OS"), d)
 

base-commit: fb479118c94f5448759a3ce8f1aad89d5aebdf75

#1 lore raw

PATCH 2/2 toolchain-scripts/meta-environment: use each variant's own site files

From: "mark.yang" <[email protected]>

Compute TOOLCHAIN_CONFIGSITE_NOCACHE for TARGET_ARCH and TARGET_OS instead of HOST_ARCH and HOST_OS, so each multilib variant's site-config matches its own tune.

Commit 1e13d1fd22 ("meta-environment: ensure corret TOOLCHAIN_CONFIGSITE_NOCACHE value") expanded the variable with := before cross-canadian changes HOST_ARCH to SDK_ARCH. Since then, every multilib variant has used the default tune's site files.

On qemux86-64 with the multilib-x86-lib32 fragment, the lib32 site-config has:

  before: ac_cv_sizeof_long=${ac_cv_sizeof_long=8}
  after:  ac_cv_sizeof_long=${ac_cv_sizeof_long=4}

An i686 configure run that loads it uses the cached 8 instead of running the compile test.

Drop the := as it is no longer needed. Collect do_generate_content[file-checksums] with all_multilib_tune_values(), as the [depends] flag does, instead of in an anonymous function that covered one variant only.

---
 meta/classes-recipe/toolchain-scripts.bbclass | 3 ++-
 meta/recipes-core/meta/meta-environment.bb    | 9 ++-------
 2 files changed, 4 insertions(+), 8 deletions(-)
meta/classes-recipe/toolchain-scripts.bbclass +2 -1
index e971b9a270..fe7333afa2 100644
@@ -213,7 +213,8 @@ EOF
 }
 
 #we get the cached site config in the runtime
-TOOLCHAIN_CONFIGSITE_NOCACHE = "${@' '.join(siteinfo_get_files(d)[0])}"
+# cross-canadian changes HOST_ARCH/HOST_OS to the SDK host
+TOOLCHAIN_CONFIGSITE_NOCACHE = "${@' '.join(siteinfo_get_files_for_machine(d.getVar('TARGET_ARCH'), d.getVar('TARGET_OS'), d)[0])}"
 TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses"
 DEPENDS += "${TOOLCHAIN_NEED_CONFIGSITE_CACHE}"
 
meta/recipes-core/meta/meta-environment.bb +2 -7
index f814061281..8162b70294 100644
@@ -9,8 +9,6 @@ REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
 
 inherit toolchain-scripts
 TOOLCHAIN_NEED_CONFIGSITE_CACHE:append = " zlib"
-# Need to expand here before cross-candian changes HOST_ARCH -> SDK_ARCH
-TOOLCHAIN_CONFIGSITE_NOCACHE := "${TOOLCHAIN_CONFIGSITE_NOCACHE}"
 
 SDK_DIR = "${WORKDIR}/sdk"
 SDK_OUTPUT = "${SDK_DIR}/image"
@@ -22,6 +20,8 @@ do_generate_content[cleandirs] = "${SDK_OUTPUT}"
 do_generate_content[dirs] = "${SDK_OUTPUT}/${SDKPATH}"
 # Need to ensure we have the virtual mappings and site files for all multtilib variants
 do_generate_content[depends] = "${@oe.utils.build_depends_string(oe.utils.all_multilib_tune_values(d, 'TOOLCHAIN_NEED_CONFIGSITE_CACHE'), 'do_populate_sysroot')}"
+TOOLCHAIN_CONFIGSITE_SEARCHED = "${@' '.join(siteinfo_get_files_for_machine(d.getVar('TARGET_ARCH'), d.getVar('TARGET_OS'), d)[1])}"
+do_generate_content[file-checksums] += "${@oe.utils.all_multilib_tune_values(d, 'TOOLCHAIN_CONFIGSITE_SEARCHED')}"
 python do_generate_content() {
     # Handle multilibs in the SDK environment, siteconfig, etc files...
     localdata = bb.data.createCopy(d)
@@ -46,11 +46,6 @@ python do_generate_content() {
 }
 addtask generate_content before do_install after do_compile
 
-python () {
-    sitefiles, searched = siteinfo_get_files(d, sysrootcache=False)
-    d.appendVarFlag("do_generate_content", "file-checksums", " " + " ".join(searched))
-}
-
 create_sdk_files() {
 	# Setup site file for external use
 	toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}