* Re: site/* - using common files for site information
[not found] ` <20060817153312.GA23152@twibble.org>
@ 2006-08-25 5:33 ` Jamie Lenehan
2006-08-25 8:08 ` Richard Purdie
0 siblings, 1 reply; 7+ messages in thread
From: Jamie Lenehan @ 2006-08-25 5:33 UTC (permalink / raw)
To: openembedded-devel
On Fri, Aug 18, 2006 at 01:33:12AM +1000, Jamie Lenehan wrote:
> On Thu, Aug 17, 2006 at 08:53:25PM +1000, Jamie Lenehan wrote:
> > 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
> [...]
I've extended this a bit to allow site files to be per package,
rather than having to be global - including version specific site
files (such as db needs). Lots of packages just need a few site file
entries which are generally common across all builds or specific to
glibc or uclibc.
Probably the most useful part is allowing all of the x86 site files
to be merged together.
If no one has any comments on this then I guess I'll push it in.
First the info.bbclass, then clean up the few recipes that directly
mess with CONFIG_SITE, then clean up the x86 files and the the few
recipes that I've been maintaining.
=== oe-multi-site-file.patch ===
#
# old_revision [ac2124fc98391df1b17c8e6b7041eecdfa7543ed]
#
# add_file "classes/info.bbclass"
# content [e4021d0330d1006610d2d86ba7a6ebd6a1afbf23]
#
# patch "classes/autotools.bbclass"
# from [9467624c157cb8970b3658f48e7952ac0fa11fcc]
# to [e1849c9126d9460cb1c931e9a920ec02c3cb091c]
#
============================================================
--- classes/info.bbclass e4021d0330d1006610d2d86ba7a6ebd6a1afbf23
+++ classes/info.bbclass e4021d0330d1006610d2d86ba7a6ebd6a1afbf23
@@ -0,0 +1,81 @@
+# 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
+#
+# It is an error for the target not to exist.
+# If 'what' doesn't exist then an empty value is returned
+#
+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" ),\
+ "arm-linux-gnueabi": dict(endianess="le", bits="32", libc="gnueabi", alias="arm-linux"),\
+ "arm-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc" ),\
+ "i386-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i486-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i586-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i686-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i386-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-uclibc"),\
+ "i486-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-uclibc"),\
+ "i586-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-uclibc"),\
+ "i686-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-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" ),\
+ "powerpc-linux-uclibc": dict(endianess="be", bits="32", libc="uclibc"),\
+ "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
+ return info.get(what, "")
+ 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)
+
+
+#
+# Return the value of 'le' if the target is little endian, or 'be' if
+# it's big endian. Let's a recipe define a specific value based on
+# the endianess of the target without the need to write lots of
+# tests.
+#
+def get_info_choice_endianess(le, be, d):
+ import bb
+ e = get_info_for_target('endianess', d);
+ if e == 'le':
+ return le
+ if e == 'be':
+ return be
+ else:
+ bb.error("Endianess unknown for target '%s'" % target)
============================================================
--- classes/autotools.bbclass 9467624c157cb8970b3658f48e7952ac0fa11fcc
+++ classes/autotools.bbclass e1849c9126d9460cb1c931e9a920ec02c3cb091c
@@ -1,5 +1,67 @@
-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) common - common settings
+# 2) common-<libc> - libc specified settings
+# 3) common-(32|64)bits - bit-size specific settings
+# 4) common-(le|be) - endianess specific settings
+# 5) <alias> - target alias, if it has one
+# 6) <arch>-<os> - target specific settings
+#
+# Search for the files in the following directories:
+# 1) ${BBPATH}/site (in reverse) - app specific, then site wide
+# 2) ${FILE_DIRNAME}/site-${PV} - app version specific
+#
+def get_config_site_files(d):
+ import bb, os
+ # How to map a specific type of info to the name of a site file
+ sitenamemap = { "common": "%s", \
+ "libc": "common-%s", \
+ "bits": "common-%sbits", \
+ "endianess": "common-%s", \
+ "alias": "%s", \
+ "target": "%s" }
+ sites = []
+ sitefiles = ""
+
+ # Determine which site files to look for
+ for i in ["common", "libc", "bits", "endianess", "alias", "target"]:
+ tmp = get_info_for_target(i, d)
+ if tmp:
+ sites.append(sitenamemap[i] % tmp)
+
+ # Check along bbpath for site files and append in reverse order so
+ # the application specific sites files are last and system site
+ # files first.
+ path_bb = bb.data.getVar('BBPATH', d, 1)
+ for p in (path_bb or "").split(':'):
+ tmp = ""
+ for i in sites:
+ fname = os.path.join(p, 'site', i)
+ if os.path.exists(fname):
+ tmp += fname + " "
+ sitefiles = tmp + sitefiles;
+
+ # Now check for the applications version specific site files
+ path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1))
+ for i in sites:
+ fname = os.path.join(path_pkgv, i)
+ if os.path.exists(fname):
+ sitefiles += fname + " "
+
+ bb.debug(1, "SITE files " + sitefiles);
+ return sitefiles
+
+#
+# Export CONFIG_SITE to the enviroment. The autotools will make use
+# of this to determine where to load in variables from. This is a
+# space seperate list of shell scripts processed in the order listed.
+#
+export CONFIG_SITE = "${@get_config_site_files(d)}"
+
+
def autotools_dep_prepend(d):
import bb;
=== oe-openssl-useinfo.patch ===
This is just an example of using the info class, and the methods I
added there, to clean up the openssl endianess selection code:
#
# old_revision [ac2124fc98391df1b17c8e6b7041eecdfa7543ed]
#
# patch "packages/openssl/openssl.inc"
# from [f31f2327d25b80adafc3098cc53e6327891e3bc3]
# to [7bf91f408b25843e121832d1c8baa068c66112c1]
#
============================================================
--- packages/openssl/openssl.inc f31f2327d25b80adafc3098cc53e6327891e3bc3
+++ packages/openssl/openssl.inc 7bf91f408b25843e121832d1c8baa068c66112c1
@@ -6,6 +6,8 @@ S = "${WORKDIR}/openssl-${PV}"
SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz"
S = "${WORKDIR}/openssl-${PV}"
+inherit info
+
AR_append = " r"
export CFLAG = "-fPIC -DTHREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIO -Wall ${FULL_OPTIMIZATION}"
@@ -26,15 +28,8 @@ do_compile () {
cd ..
ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
- # endianness fun.. whee
- . ${CONFIG_SITE}
- if [ "x$ac_cv_c_bigendian" = "xyes" -o "x$ac_cv_c_littleendian" = "xno" ]; then
- CFLAG="${CFLAG} -DB_ENDIAN"
- elif [ "x$ac_cv_c_littleendian" = "xyes" -o "x$ac_cv_c_bigendian" = "xno" ]; then
- CFLAG="${CFLAG} -DL_ENDIAN"
- else
- oefatal do_configure cannot determine endianess
- fi
+ # Additional flag based on target endiness (see info.bbclass)
+ CFLAG="${CFLAG} ${@get_info_endianess_select('-DL_ENDIAN', '-DB_ENDIAN', d)}"
os=${HOST_OS}
if [ "x$os" = "xlinux-uclibc" ]; then
--
Jamie Lenehan <lenehan@twibble.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: site/* - using common files for site information
2006-08-25 5:33 ` site/* - using common files for site information Jamie Lenehan
@ 2006-08-25 8:08 ` Richard Purdie
2006-08-25 8:22 ` Jamie Lenehan
0 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2006-08-25 8:08 UTC (permalink / raw)
To: Using the OpenEmbedded metadata to build Linux Distributions
On Fri, 2006-08-25 at 15:33 +1000, Jamie Lenehan wrote:
> On Fri, Aug 18, 2006 at 01:33:12AM +1000, Jamie Lenehan wrote:
> > On Thu, Aug 17, 2006 at 08:53:25PM +1000, Jamie Lenehan wrote:
> > > 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
> > [...]
>
> I've extended this a bit to allow site files to be per package,
> rather than having to be global - including version specific site
> files (such as db needs). Lots of packages just need a few site file
> entries which are generally common across all builds or specific to
> glibc or uclibc.
>
> Probably the most useful part is allowing all of the x86 site files
> to be merged together.
>
> If no one has any comments on this then I guess I'll push it in.
> First the info.bbclass, then clean up the few recipes that directly
> mess with CONFIG_SITE, then clean up the x86 files and the the few
> recipes that I've been maintaining.
For what its worth, I like the idea of this but haven't had time to
review the patches. The name info.bbclass is perhaps too generic though
- could you call it something like autotools-info.bbclass?
Regards,
Richard
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: site/* - using common files for site information
2006-08-25 8:08 ` Richard Purdie
@ 2006-08-25 8:22 ` Jamie Lenehan
2006-08-25 8:40 ` Richard Purdie
0 siblings, 1 reply; 7+ messages in thread
From: Jamie Lenehan @ 2006-08-25 8:22 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-devel
On Fri, Aug 25, 2006 at 09:08:09AM +0100, Richard Purdie wrote:
> On Fri, 2006-08-25 at 15:33 +1000, Jamie Lenehan wrote:
[...]
> > If no one has any comments on this then I guess I'll push it in.
> > First the info.bbclass, then clean up the few recipes that directly
> > mess with CONFIG_SITE,
I missed out the need to update autotools.bbclass once none of the
recipes directly mess with the CONFIG_SITE files.
> >then clean up the x86 files and the the few
> > recipes that I've been maintaining.
>
> For what its worth, I like the idea of this but haven't had time to
I changed my mind about a dozen times on this, so seeing what someone
else thinks would be good.
> review the patches. The name info.bbclass is perhaps too generic though
> - could you call it something like autotools-info.bbclass?
The reason I called it info.bbclass is because it's not actually
related to autotools. What it does is provide information about a
target - endianess, 32/64 bit, which libc it's using, what alias
exists for it in a general sort of way.
The autotools.bbclass then makes use of this to decided which site
files to use.
I also made use of the info.bbclass to provide the endiness
information to recipes that were currently manaully looking in the
site file to determine this (since the way they currently work breaks
with the site file.)
--
Jamie Lenehan <lenehan@twibble.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: site/* - using common files for site information
2006-08-25 8:22 ` Jamie Lenehan
@ 2006-08-25 8:40 ` Richard Purdie
2006-08-25 9:34 ` Jamie Lenehan
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Richard Purdie @ 2006-08-25 8:40 UTC (permalink / raw)
To: Jamie Lenehan; +Cc: openembedded-devel
On Fri, 2006-08-25 at 18:22 +1000, Jamie Lenehan wrote:
> On Fri, Aug 25, 2006 at 09:08:09AM +0100, Richard Purdie wrote:
> I changed my mind about a dozen times on this, so seeing what someone
> else thinks would be good.
I'll try and take a look at the patches this weekend. I can't promise
but I will try :).
> > review the patches. The name info.bbclass is perhaps too generic though
> > - could you call it something like autotools-info.bbclass?
>
> The reason I called it info.bbclass is because it's not actually
> related to autotools. What it does is provide information about a
> target - endianess, 32/64 bit, which libc it's using, what alias
> exists for it in a general sort of way.
>
> The autotools.bbclass then makes use of this to decided which site
> files to use.
You can argue that both ways. Ultimately, those files are generally used
by configure which implies autotools but other packages also use them to
provide supplementary info, just to confuse the issue :). I like the
idea of some functions like get_info_endianess_select (although your
example doesn't quite match with get_info_choice_endianess) and it would
be good to abstract direct access to the site files.
I still feel info is too generic as we have 101 different forms of info
around and we need to find a better more descriptive name.
config-info.bclass? site-config.bbclass? Calling it autotools-info
doesn't mean none autotooled packages can't use it btw!
> I also made use of the info.bbclass to provide the endiness
> information to recipes that were currently manaully looking in the
> site file to determine this (since the way they currently work breaks
> with the site file.)
Just throwing ideas around, rather than create a function for each
option like endiness, why not have a variable which contains the
endiness set by the class and use base_conditional to get the value you
want? This might make things a little more flexiable?
Cheers,
Richard
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: site/* - using common files for site information
2006-08-25 8:40 ` Richard Purdie
@ 2006-08-25 9:34 ` Jamie Lenehan
2006-08-25 9:57 ` Michael 'Mickey' Lauer
2006-08-28 0:05 ` Jamie Lenehan
2 siblings, 0 replies; 7+ messages in thread
From: Jamie Lenehan @ 2006-08-25 9:34 UTC (permalink / raw)
To: Richard Purdie
On Fri, Aug 25, 2006 at 09:40:56AM +0100, Richard Purdie wrote:
> On Fri, 2006-08-25 at 18:22 +1000, Jamie Lenehan wrote:
> > On Fri, Aug 25, 2006 at 09:08:09AM +0100, Richard Purdie wrote:
> > I changed my mind about a dozen times on this, so seeing what someone
> > else thinks would be good.
>
> I'll try and take a look at the patches this weekend. I can't promise
> but I will try :).
No hurry. I'd had enough of looking at them was all and so figure I
should either throw out or push it of no one else had any comments on
it ;)
[...]
> > The autotools.bbclass then makes use of this to decided which site
> > files to use.
>
> You can argue that both ways. Ultimately, those files are generally used
> by configure which implies autotools but other packages also use them to
> provide supplementary info, just to confuse the issue :). I like the
Right. I focussed too much on the "call it autotools-info" rather
than the "don't call it info cause that's too generic" bit of your
email. I agree with you now that I think about it that way.
> idea of some functions like get_info_endianess_select (although your
> example doesn't quite match with get_info_choice_endianess) and it would
> be good to abstract direct access to the site files.
Duh. I've been unable to decide on what to call the damn thing and
the two diffs were taken a few minutes apart - and I'd renamed it
(again!) during those few minutes.
> I still feel info is too generic as we have 101 different forms of info
> around and we need to find a better more descriptive name.
> config-info.bclass? site-config.bbclass? Calling it autotools-info
> doesn't mean none autotooled packages can't use it btw!
Yep. Agreed. config-info or target-info or something would probably make
more sense.
> > I also made use of the info.bbclass to provide the endiness
> > information to recipes that were currently manaully looking in the
> > site file to determine this (since the way they currently work breaks
> > with the site file.)
>
> Just throwing ideas around, rather than create a function for each
> option like endiness, why not have a variable which contains the
> endiness set by the class and use base_conditional to get the value you
> want? This might make things a little more flexiable?
I didn't know about base_conditional, but now that I look it - yeah
that looks like it's very close to what I was trying to do and it'll
work fine in this case. And pre-loading into variables is probably a
good idea as well.
Thanks.
--
Jamie Lenehan <lenehan@twibble.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: site/* - using common files for site information
2006-08-25 8:40 ` Richard Purdie
2006-08-25 9:34 ` Jamie Lenehan
@ 2006-08-25 9:57 ` Michael 'Mickey' Lauer
2006-08-28 0:05 ` Jamie Lenehan
2 siblings, 0 replies; 7+ messages in thread
From: Michael 'Mickey' Lauer @ 2006-08-25 9:57 UTC (permalink / raw)
To: Using the OpenEmbedded metadata to build Linux Distributions
Sorry, I'm much too busy to seriously comment on that now, but I want to
drop you a note that I'm really liking this idea. Most everything that
reduces redundance is a relief for future maintenance effort.
--
Regards,
Michael 'Mickey' Lauer | FreeLancer | http://www.Vanille-Media.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: site/* - using common files for site information
2006-08-25 8:40 ` Richard Purdie
2006-08-25 9:34 ` Jamie Lenehan
2006-08-25 9:57 ` Michael 'Mickey' Lauer
@ 2006-08-28 0:05 ` Jamie Lenehan
2 siblings, 0 replies; 7+ messages in thread
From: Jamie Lenehan @ 2006-08-28 0:05 UTC (permalink / raw)
To: openembedded-devel
On Fri, Aug 25, 2006 at 09:40:56AM +0100, Richard Purdie wrote:
[...]
> config-info.bclass? site-config.bbclass? Calling it autotools-info
Ok, renamed to config-info.bbclass.
[...]
> option like endiness, why not have a variable which contains the
> endiness set by the class and use base_conditional to get the value you
And I've set some variables and made made use of base_conditional now
also - that works well.
Here's my current patch with examples for openssl and net-snmp using
base_conditional:
#
# old_revision [1e0480e593c593d843d47a6544316b0a4962aabc]
#
# add_file "classes/config-info.bbclass"
# content [8f5ae6c352748a5abdecb295e1ed6e45d6d26f23]
#
# patch "classes/autotools.bbclass"
# from [9467624c157cb8970b3658f48e7952ac0fa11fcc]
# to [8641748ec51a12f9d91fefe054dc3cfec7bbe8f2]
#
# patch "packages/net-snmp/net-snmp_5.1.2.bb"
# from [b7fa972e12bd3059d7830244f8cf6f3baa933c5b]
# to [935cbe24aaddf4489a0a7c779092a8649ca9bc0e]
#
# patch "packages/openssl/openssl.inc"
# from [f31f2327d25b80adafc3098cc53e6327891e3bc3]
# to [c995ed00c1d37d995145bf9519a803e6f6ce6121]
#
============================================================
--- classes/config-info.bbclass 8f5ae6c352748a5abdecb295e1ed6e45d6d26f23
+++ classes/config-info.bbclass 8f5ae6c352748a5abdecb295e1ed6e45d6d26f23
@@ -0,0 +1,72 @@
+# config-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
+#
+# It is an error for the target not to exist.
+# If 'what' doesn't exist then an empty value is returned
+#
+def get_config_info_for(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" ),\
+ "arm-linux-gnueabi": dict(endianess="le", bits="32", libc="gnueabi", alias="arm-linux"),\
+ "arm-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc" ),\
+ "i386-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i486-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i586-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i686-linux": dict(endianess="le", bits="32", libc="glibc", alias="ix86-linux"),\
+ "i386-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-uclibc"),\
+ "i486-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-uclibc"),\
+ "i586-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-uclibc"),\
+ "i686-linux-uclibc": dict(endianess="le", bits="32", libc="uclibc", alias="ix86-linux-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" ),\
+ "powerpc-linux-uclibc": dict(endianess="be", bits="32", libc="uclibc"),\
+ "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
+ return info.get(what, "")
+ else:
+ bb.error("Information not available for target '%s'" % target)
+
+#
+# Returns information about 'what' for the current target
+#
+def get_config_info(what, d):
+ import bb
+ target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + bb.data.getVar('HOST_OS', d, 1)
+ return get_config_info_for(target, what, d)
+
+#
+# Make some information available via variables
+#
+CONFIG_INFO_ENDIANESS = "${@get_config_info('endianess', d)}"
+CONFIG_INFO_BITS = "${@get_config_info('bits', d)}"
+CONFIG_INFO_LIBC = "${@get_config_info('libc', d)}"
+CONFIG_INFO_ALIAS = "${@get_config_info('alias', d)}"
============================================================
--- classes/autotools.bbclass 9467624c157cb8970b3658f48e7952ac0fa11fcc
+++ classes/autotools.bbclass 8641748ec51a12f9d91fefe054dc3cfec7bbe8f2
@@ -1,5 +1,67 @@
-inherit base
+inherit base config-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) common - common settings
+# 2) common-<libc> - libc specified settings
+# 3) common-(32|64)bits - bit-size specific settings
+# 4) common-(le|be) - endianess specific settings
+# 5) <alias> - target alias, if it has one
+# 6) <arch>-<os> - target specific settings
+#
+# Search for the files in the following directories:
+# 1) ${BBPATH}/site (in reverse) - app specific, then site wide
+# 2) ${FILE_DIRNAME}/site-${PV} - app version specific
+#
+def get_config_site_files(d):
+ import bb, os
+ # How to map a specific type of info to the name of a site file
+ sitenamemap = { "common": "%s", \
+ "libc": "common-%s", \
+ "bits": "common-%sbits", \
+ "endianess": "common-%s", \
+ "alias": "%s", \
+ "target": "%s" }
+ sites = []
+ sitefiles = ""
+
+ # Determine which site files to look for
+ for i in ["common", "libc", "bits", "endianess", "alias", "target"]:
+ tmp = get_config_info(i, d)
+ if tmp:
+ sites.append(sitenamemap[i] % tmp)
+
+ # Check along bbpath for site files and append in reverse order so
+ # the application specific sites files are last and system site
+ # files first.
+ path_bb = bb.data.getVar('BBPATH', d, 1)
+ for p in (path_bb or "").split(':'):
+ tmp = ""
+ for i in sites:
+ fname = os.path.join(p, 'site', i)
+ if os.path.exists(fname):
+ tmp += fname + " "
+ sitefiles = tmp + sitefiles;
+
+ # Now check for the applications version specific site files
+ path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1))
+ for i in sites:
+ fname = os.path.join(path_pkgv, i)
+ if os.path.exists(fname):
+ sitefiles += fname + " "
+
+ bb.debug(1, "SITE files " + sitefiles);
+ return sitefiles
+
+#
+# Export CONFIG_SITE to the enviroment. The autotools will make use
+# of this to determine where to load in variables from. This is a
+# space seperate list of shell scripts processed in the order listed.
+#
+export CONFIG_SITE = "${@get_config_site_files(d)}"
+
+
def autotools_dep_prepend(d):
import bb;
============================================================
--- packages/net-snmp/net-snmp_5.1.2.bb b7fa972e12bd3059d7830244f8cf6f3baa933c5b
+++ packages/net-snmp/net-snmp_5.1.2.bb 935cbe24aaddf4489a0a7c779092a8649ca9bc0e
@@ -11,23 +11,15 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snm
file://snmpd.conf \
file://snmptrapd.conf"
-inherit autotools
+inherit config-info autotools
PARALLEL_MAKE = ""
EXTRA_OECONF = "--enable-shared --disable-manuals"
EXTRA_OEMAKE = "INSTALL_PREFIX=${D}"
do_configure() {
- # endianness fun... inspired by openssl.inc
- . ${CONFIG_SITE}
- if [ "x$ac_cv_c_bigendian" = "xyes" -o "x$ac_cv_c_littleendian" = "xno" ]; then
- ENDIANESS=" --with-endianness=big"
- elif [ "x$ac_cv_c_littleendian" = "xyes" -o "x$ac_cv_c_bigendian" = "xno" ]; then
- ENDIANESS=" --with-endianness=little"
- else
- oefatal do_configure cannot determine endianess
- fi
- oenote Determined endianess as: $ENDIANESS
+ # Additional flag based on target endiness (see config-info.bbclass)
+ ENDIANESS="${@base_conditional('CONFIG_INFO_ENDIANESS', 'le', '--with-endianness=little', '--with-endianness=big', d)}"
oe_runconf $ENDIANESS
}
============================================================
--- packages/openssl/openssl.inc f31f2327d25b80adafc3098cc53e6327891e3bc3
+++ packages/openssl/openssl.inc c995ed00c1d37d995145bf9519a803e6f6ce6121
@@ -6,6 +6,8 @@ S = "${WORKDIR}/openssl-${PV}"
SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz"
S = "${WORKDIR}/openssl-${PV}"
+inherit config-info
+
AR_append = " r"
export CFLAG = "-fPIC -DTHREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIO -Wall ${FULL_OPTIMIZATION}"
@@ -26,15 +28,8 @@ do_compile () {
cd ..
ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
- # endianness fun.. whee
- . ${CONFIG_SITE}
- if [ "x$ac_cv_c_bigendian" = "xyes" -o "x$ac_cv_c_littleendian" = "xno" ]; then
- CFLAG="${CFLAG} -DB_ENDIAN"
- elif [ "x$ac_cv_c_littleendian" = "xyes" -o "x$ac_cv_c_bigendian" = "xno" ]; then
- CFLAG="${CFLAG} -DL_ENDIAN"
- else
- oefatal do_configure cannot determine endianess
- fi
+ # Additional flag based on target endiness (see info.bbclass)
+ CFLAG="${CFLAG} ${@base_conditional('CONFIG_INFO_ENDIANESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)}"
os=${HOST_OS}
if [ "x$os" = "xlinux-uclibc" ]; then
--
Jamie Lenehan <lenehan@twibble.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-08-28 0:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20060817105325.GA2172@twibble.org>
[not found] ` <20060817153312.GA23152@twibble.org>
2006-08-25 5:33 ` site/* - using common files for site information Jamie Lenehan
2006-08-25 8:08 ` Richard Purdie
2006-08-25 8:22 ` Jamie Lenehan
2006-08-25 8:40 ` Richard Purdie
2006-08-25 9:34 ` Jamie Lenehan
2006-08-25 9:57 ` Michael 'Mickey' Lauer
2006-08-28 0:05 ` Jamie Lenehan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.