Attached is a patch I'd like to propose to allow for multiple site
files to be used so that common stuff can be moved into common site
files. This should save having to update dozens of copies of things
which are just going to be the same over all the site files anyway
and it should make adding new targets a lot easier.

Using my sh4 glibc builds as an example It would normally end up
using this site file:

  site/sh4-linux

With my changes it will use multiple site files in the following
order:

  site/sh4-linux site/common-le site/common-32bit site/common-libc-glibc 
site/common

So I can put:
 - "sh4 glibc" specific stuff in site/sh4-linux,
 - "little endian" specific stuff in site/common-le
 - "32-bit" specific stuff in site/common-32bit
 - "glibc" specific stuff in site/common-libc-glibc
 - common stuff in site/common

The disadvantages of this approach would be that one change can
effect lots of platforms, rather than just the one it's tested on as
happens now. There's also more places to look when trying to figure
out what site variables are being used. However things will probably
work more often across targets if common stuff goes in the common
places.

I've implemented an info.bbclass ro return various details about a
build, such as the bit size and endianess. So this information is
available to other things that need, like a few .bb's which currently
need to know the endianess, and can be extended easily with
additional information. The autotools.bbclass class includes the
info.bbclass and uses the provided information to calculate the patch
for the files. The settings of CONFIG_SITE could be removed from
bitbake.conf if this is added (once the few recipes that fiddle with
CONFIG_SITE are checked and/or updated if need be).

Does anyone else think this is a reasonable idea?

---
This is the patch to add support for multiple site files:

============================================================
--- classes/info.bbclass        4ecb67ebb4c7cd18a5693a61bff7f52955c92767
+++ classes/info.bbclass        4ecb67ebb4c7cd18a5693a61bff7f52955c92767
@@ -0,0 +1,65 @@
+# info.bbclass
+#
+# This class exists to provide information about the targets that
+# may be needed by other classes and/or recipes. If you add a new
+# target this will probably need to be updated.
+#
+
+#
+# Returns information about 'what' for the named target 'target'
+# where 'target' == "<arch>-<os>"
+#
+# 'what' can be one of
+# * target: Returns the target name ("<arch>-<os>")
+# * endianess: Return "be" for big endian targets, "le" for little endian
+# * bits: Returns the bit size of the target, either "32" or "64"
+# * libc: Returns the name of the c library used by the target
+#
+def get_info_for_named_target(target, what, d):
+       import bb
+       targetinfo = {\
+               "armeb-linux":          dict(endianess="be", bits="32", 
libc="glibc"),\
+               "armeb-linux-uclibc":   dict(endianess="be", bits="32", 
libc="uclibc"),\
+               "arm-linux":            dict(endianess="le", bits="32", 
libc="glibc"),\
+               "armeb-linux":          dict(endianess="be", bits="32", 
libc="glibc"),\
+               "armeb-linux-uclibc":   dict(endianess="be", bits="32", 
libc="uclibc"),\
+               "arm-linux":            dict(endianess="le", bits="32", 
libc="glibc"),\
+               "arm-linux-gnueabi":    dict(endianess="le", bits="32", 
libc="gnueabi"),\
+               "arm-linux-uclibc":     dict(endianess="le", bits="32", 
libc="uclibc"),\
+               "i386-linux":           dict(endianess="le", bits="32", 
libc="glibc"),\
+               "i386-linux-uclibc":    dict(endianess="le", bits="32", 
libc="uclibc"),\
+               "i486-linux":           dict(endianess="le", bits="32", 
libc="glibc"),\
+               "i586-linux":           dict(endianess="le", bits="32", 
libc="glibc"),\
+               "i686-linux":           dict(endianess="le", bits="32", 
libc="glibc"),\
+               "i686-linux-uclibc":    dict(endianess="le", bits="32", 
libc="uclibc"),\
+               "mipsel-linux":         dict(endianess="le", bits="32", 
libc="glibc"),\
+               "mipsel-linux-uclibc":  dict(endianess="le", bits="32", 
libc="uclibc"),\
+               "powerpc-darwin":       dict(endianess="be", bits="32", 
libc="darwin"),\
+               "powerpc-linux":        dict(endianess="be", bits="32", 
libc="glibc"),\
+               "sh3-linux":            dict(endianess="le", bits="32", 
libc="glibc"),\
+               "sh4-linux":            dict(endianess="le", bits="32", 
libc="glibc"),\
+               "sh4-linux-uclibc":     dict(endianess="le", bits="32", 
libc="uclibc"),\
+               "sparc-linux":          dict(endianess="be", bits="32", 
libc="glibc"),\
+               "x86_64-linux":         dict(endianess="le", bits="64", 
libc="glibc"),\
+               "x86_64-linux-uclibc":  dict(endianess="le", bits="64", 
libc="uclibc")}
+       if targetinfo.has_key(target):
+               info = targetinfo[target]
+               # allow them to ask for the target name
+               if what == "target":
+                       return target;
+               # otherwise get the information from the table
+               if info.has_key(what):
+                       return info[what]
+               else:
+                       bb.error("Information '%s' not available for target 
'%s'" % what % target)
+       else:
+               bb.error("Information not available for target '%s'" % target)
+
+#
+# Returns information about 'what' for the current target
+#
+def get_info_for_target(what, d):
+       import bb
+       target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + 
bb.data.getVar('HOST_OS', d, 1)
+       return get_info_for_named_target(target, what, d)
+
============================================================
--- classes/autotools.bbclass   9467624c157cb8970b3658f48e7952ac0fa11fcc
+++ classes/autotools.bbclass   d5aa1b6a52803b407aeb92566643554e1732ab1b
@@ -1,5 +1,39 @@
-inherit base
+inherit base info
 
+#
+# Define which site files to use. We check for several site files and use
+# each one that is found in the following order:
+#
+# 1) <arch>-<os>       - target specific settings
+# 2) common-(le|be)    - endianess specific settings
+# 3) common-(32|64)bits        - bit-size specific settings
+# 4) common-<libc>     - libc specified settings
+# 5) common            - common settings
+#
+def get_config_site_files(d):
+       import bb
+       sites = []
+       sites.append(get_info_for_target("target", d));
+       sites.append("common-" + get_info_for_target("endianess", d));
+       sites.append("common-" + get_info_for_target("bits", d) + "bit");
+       sites.append("common-libc-" + get_info_for_target("libc", d));
+       sites.append("common");
+       path = bb.data.getVar('BBPATH', d, 1);
+       sitefiles = ""
+       for i in sites:
+               file = bb.which(path, 'site/%s' % i);
+               if file:
+                       sitefiles += file + " ";
+       return sitefiles
+
+#
+# Export CONFIG_SITE to the enviroment. The autotools will
+# make use of this to determine where to load in variables
+# from.
+#
+export CONFIG_SITE = "[EMAIL PROTECTED](d)}"
+
+
 def autotools_dep_prepend(d):
        import bb;
 

---
This is an example of the changes that could be made. This is slrn
which I fixed up today for a few things targets. Note that the actual
settings are fine for all targets, so it's settings could be in the
common area and be used by all. (Note that "cv_func_realloc" etc
things are no longer needed by slrn, hence the deletiong of them).

============================================================
--- site/arm-linux      a3ee719e625e24ebd80691dd98260d52f9bed977
+++ site/arm-linux      63a2273016f46e105be654ae57766f09446201e2
@@ -201,15 +201,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}
-ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}
-ac_cv_func_malloc_works=${ac_cv_func_malloc_works=yes}
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/arm-linux-gnueabi      a3ee719e625e24ebd80691dd98260d52f9bed977
+++ site/arm-linux-gnueabi      63a2273016f46e105be654ae57766f09446201e2
@@ -201,15 +201,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}
-ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}
-ac_cv_func_malloc_works=${ac_cv_func_malloc_works=yes}
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/arm-linux-uclibc       7f9ecd5f3002654f505e4e0bfd63e957d4a94888
+++ site/arm-linux-uclibc       b523923e294e8866a3fbb731434bd056b4dd641b
@@ -252,15 +252,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}
-ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}
-ac_cv_func_malloc_works=${ac_cv_func_malloc_works=yes}
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/armeb-linux    002e44bc87a77bbf311e9f69aad39755143b75f2
+++ site/armeb-linux    5b4c4b2a1f9dd56197fdafe4f83e21ad8206f9eb
@@ -189,15 +189,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}
-ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}
-ac_cv_func_malloc_works=${ac_cv_func_malloc_works=yes}
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/armeb-linux-uclibc     cac99a6b41946b742f875edcf6b443fbc6bc26ef
+++ site/armeb-linux-uclibc     b9c19d925481373247f1a5738519176fe1025c14
@@ -183,15 +183,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}
-ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}
-ac_cv_func_malloc_works=${ac_cv_func_malloc_works=yes}
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/i386-linux     a9400ca9b99556c00f2c8bcc859b3a0499c74f47
+++ site/i386-linux     e06f50ed7cd43f189036b5e6b0bf3dca8e5cb3b1
@@ -109,8 +109,3 @@ racoon_cv_bug_getaddrinfo=${racoon_cv_bu
 ac_cv_va_copy=${ac_cv_va_copy=no}
 ac_cv___va_copy=${ac_cv___va_copy=yes}
 racoon_cv_bug_getaddrinfo=${racoon_cv_bug_getaddrinfo=no}
-
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
============================================================
--- site/i486-linux     87c3e1421e78b5251772d0a1c8cbc85599c26ab2
+++ site/i486-linux     e016c77e5f2567be87aa0a297802adbae2e80dfd
@@ -145,8 +145,3 @@ racoon_cv_bug_getaddrinfo=${racoon_cv_bu
 ac_cv_va_copy=${ac_cv_va_copy=no}
 ac_cv___va_copy=${ac_cv___va_copy=yes}
 racoon_cv_bug_getaddrinfo=${racoon_cv_bug_getaddrinfo=no}
-
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
============================================================
--- site/i586-linux     44c32efc814819809fc6b4ffec77f179536cab02
+++ site/i586-linux     80b5aa83342e76be956be4705e9238cfb5ef31c3
@@ -128,8 +128,3 @@ racoon_cv_bug_getaddrinfo=${racoon_cv_bu
 ac_cv_va_copy=${ac_cv_va_copy=no}
 ac_cv___va_copy=${ac_cv___va_copy=yes}
 racoon_cv_bug_getaddrinfo=${racoon_cv_bug_getaddrinfo=no}
-
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
============================================================
--- site/i686-linux     4ae0cad6c947c358ba283fb3a4cf966c1fa585f8
+++ site/i686-linux     421d0637f0d4ee28042cda5e20dd1cacabf229d6
@@ -202,8 +202,3 @@ ac_cv_file__usr_share_X11_sgml_defs_ent=
 #xserver-xorg
 ac_cv_sys_linker_h=${ac_cv_sys_linker_h=no}
 
ac_cv_file__usr_share_X11_sgml_defs_ent=${ac_cv_file__usr_share_X11_sgml_defs_ent=no}
-
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
============================================================
--- site/mipsel-linux   0d5cd403067e83a5a4da99cde05162b388a3a158
+++ site/mipsel-linux   3e8b226313794085c871dbab6cbca0bc6ff686d5
@@ -58,11 +58,6 @@ ac_cv_func_getaddrinfo=${ac_cv_func_geta
 ac_cv_linux_vers=${ac_cv_linux_vers=2}
 ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo=yes}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=yes}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-
 # startup-notification
 lf_cv_sane_realloc=${lf_cv_sane_realloc=yes}
 
============================================================
--- site/mipsel-linux-uclibc    01326aa66fbe714c7dda3b2fae4ad16400061148
+++ site/mipsel-linux-uclibc    81bd945cbc6dbc49b03ae8f45ab10f4ed0557f8a
@@ -58,11 +58,6 @@ ac_cv_func_getaddrinfo=${ac_cv_func_geta
 ac_cv_linux_vers=${ac_cv_linux_vers=2}
 ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo=yes}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=yes}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-
 # startup-notification
 lf_cv_sane_realloc=${lf_cv_sane_realloc=yes}
 
============================================================
--- site/powerpc-linux  37eb3337a0f8678c90bae1a016739f42c0c8ad6b
+++ site/powerpc-linux  d63145940b66debec4284d920dbcbb39fbf38d37
@@ -170,15 +170,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}
-ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}
-ac_cv_func_malloc_works=${ac_cv_func_malloc_works=yes}
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/sh3-linux      65091f791b01edd0c57e1182756237499399d4e4
+++ site/sh3-linux      3ffd058be6512f4b316297767d258c84b91f9bc9
@@ -262,15 +262,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}
-ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}
-ac_cv_func_malloc_works=${ac_cv_func_malloc_works=yes}
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/sh4-linux      17e2d83d1b4026e803a7812926e7da8c46692768
+++ site/sh4-linux      734a71bf7d6ccb281bad8fd49dbf7ec5fbf282bb
@@ -192,11 +192,6 @@ compat_cv_func_dirname_works=${compat_cv
 compat_cv_func_basename_works=${compat_cv_func_basename_works=no}
 compat_cv_func_dirname_works=${compat_cv_func_dirname_works=no}
 
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}
-
 # startup-notification
 lf_cv_sane_realloc=yes
 
============================================================
--- site/sh4-linux-uclibc       90f38b74ac2d3c14299ecee90c1ae1752c8011aa
+++ site/sh4-linux-uclibc       39634e15cc13a9ad041f6789e7974f6fb1ace12e
@@ -35,8 +35,3 @@ racoon_cv_bug_getaddrinfo=${racoon_cv_bu
 ac_cv_va_copy=${ac_cv_va_copy=no}
 ac_cv___va_copy=${ac_cv___va_copy=yes}
 racoon_cv_bug_getaddrinfo=${racoon_cv_bug_getaddrinfo=no}
-
-# slrn
-slrn_cv___va_copy=${slrn_cv___va_copy=yes}
-slrn_cv_va_copy=${slrn_cv_va_copy=no}
-slrn_cv_va_val_copy=${slrn_cv_va_val_copy=yes}

-- 
 Jamie Lenehan <[EMAIL PROTECTED]>
_______________________________________________
Oe mailing list
[email protected]
https://www.handhelds.org/mailman/listinfo/oe

Reply via email to