siteinfo class

The siteinfo class provides information for a target with a particular emphasis on determining the names of the site files to be passed to autoconf, as described in the autotools class. Full site information for your target can be determined by looking at the table in the class implementation found in the classes/siteinfo.bbclass file. A typical entry contains the name of the target and a list of site information for the target:

    "sh4-linux":               "endian-little bit-32 common-glibc sh-common",

In the above example for sh4-linux target (that's a build for an sh4 processor using glibc) we see that the endianess and bit-size of target are defined and an additional set of site files that should be used are listed. These include a common site file for glibc and a common site file for sh processors (so sh3 and sh4 can share defines). A "common" entry is automatically added to the end of each of the definitions during processing.

The class makes available three variables based on the information provided for a target:

SITEINFO_ENDIANESS

Defines the endianess of the target as either "le" (little endian) or "be" (big endian). The target must list either endian-little or endian-big in it's site information.

SITEINFO_BITS

Defines the bitsize of the target as either "32" or "64". The target must list either bit-32 or bit-64 in it's site information.

CONFIG_SITE

Defines the site files to be used by autoconf. This is a space separated list of one or more site files for the target.

A typical use for the SITEINFO_ENDIANESS and SITEINFO_BITS variables is to provide configuration within a recipe based on their values. The following example from the openssl recipe showw the correct define for the endiness of the target being passed to openssl via the compiler flags. The define to add to the flags is set based on the value of the SITEINFO_ENDIANESS variable. Note that use of the base_conditional method (see the advanced python section) to select a value conditional on the endianess setting:

  # Additional flag based on target endiness (see siteinfo.bbclass)
    CFLAG="${CFLAG} ${@base_conditional('SITEINFO_ENDIANESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)}"

CONFIG_SITE: The autoconf site files

The autotools configuration method has support for caching the results of tests. In the cross-compilation case it is sometimes necessary to prime the cache with per-calculated results (since tests designed to run on the target cannot be run when cross-compiling). These are defined via the site file(s) for the architecture you are using and may be specific to the package you are building.

Which site files are used is determined via the CONFIG_SITE definition which is calculated via the siteinfo class. Typically the following site files will be checked for, and used in the order found:

endian-(big|little)

Either endian-big or endian-little depending on the endianess of the target. This site file would contain defines that only change based on if the target is little endian or big endian.

bit-(32|64)

Either bit-32 or bit-64 depending on the bitsize of the target. This site file would contain defines that only change based on if the target is a 32-bit or 64-bit cpu.

common-(libc|uclibc)

Either common-libc or common-uclibc based on the C library being used for the target. This site file would contain defines the are specific to the C library being used.

<arch>-common

A common site file for the target architecture. For i386, i485, i586 and i686 this would be x86-common, for sh3 and sh4 this would be sh-common and for various arm targets this would be arm-common.

common

This is a site file which is common for all targets and contains definitions which remain the same no matter what target is being built.

Each of the supported site files for a target is will be checked for in several different directories. Each time a file is found it as added to the list of files in the CONFIG_SITE variable. The following directories are checked:

org.openembedded.dev/recipes/<packagename>/site-<version>/

This directory is for site files which are specific to a particular version (where version is the PV of the package) of a package.

org.openembedded.dev/recipes/<packagename>/site/

This directory is for site files which are specific to a particular package, but apply to all versions of the package.

org.openembedded.dev/site/

This directory is for site files that are common to all packages. Originally this was the only site file directory that was supported.