SoCLib’s configuration file is parsed by soclib_cc.config, and is used by other modules:
SoCLib configuration module will set default parameters, then look for the following files, in order:
All configuration items defined in these files override previously set items. Therefore the soclib.conf file in current directory can override everything else.
Any of these files can be absent, this will be silently ignored.
SoCLib configuration files are:
Some attributes are reserved for special meanings, all other are considered to be build environment specifiers.
Integer. Filesystem limitation workaround. Sets the maximal file name length for temporary files in Temporary objects reuse.
Configuration files contain 3 types of objects:
As definition of compiler and library variants are often nearly the same, build-environment specifiers can be inherited. Moreover, some build environment specifiers can be templates where usual data is provided with parts to replace. See inheriting configuration for an example, see soclib_cc.config.objects for implementation details.
There are also some configuration directives.
Sets the build-environment named name as default. This can be overridden with soclib-cc -t.
Built-In configuration is made of:
See utils/lib/python/soclib_cc/config/built-in.conf for its implementation. Dont modify this file directly, use configuration file paths.
Library, Toolchain and BuildEnv all can take a parent = construction keyword argument of the same type, and will inherit all their attributes.
Example creating a new toolchain with ccache and gcc-4.2:
config.my_toolchain = Toolchain( parent = config.toolchain, tool_CC = ["ccache", "gcc-4.2"], tool_CXX = ["ccache", "g++-4.2"], )
This does not define a new build environment, therefore we cant use it yet. We now have to define a new build environment:
config.my_build_env = BuildEnv( parent = config.build_env, toolchain = config.my_toolchain, )
Now if we use soclib-cc, we’ll see:
$ soclib-cc -h ... --type=TYPE, -t TYPE Use a different configuration: <*build_env, my_build_env>
So we can use our my_build_env with soclib-cc -t my_build_env. Now if we set my_build_env as default with:
$ soclib-cc -h ... --type=TYPE, -t TYPE Use a different configuration: <*my_build_env, build_env>
and explicitly setting -t wont be necessary any more.