mozconfig Files¶
mozconfig files are used to configure how a build works.
mozconfig files are actually shell scripts. They are executed in a special context with specific variables and functions exposed to them.
API¶
Functions¶
The following special functions are available to a mozconfig script.
ac_add_options¶
This function is used to declare extra options/arguments to pass into configure.
e.g.:
ac_add_options --disable-tests
ac_add_options --enable-optimize
mk_add_options¶
This function is used to inject statements into client.mk for execution. It is typically used to define variables, notably the object directory.
e.g.:
mk_add_options AUTOCLOBBER=1
ac_add_options¶
This is a variant of ac_add_options() which only adds configure options for a specified application. This is only used when building multiple applications through client.mk. This function is typically not needed.
Special mk_add_options Variables¶
For historical reasons, the method for communicating certain well-defined variables is via mk_add_options(). In this section, we document what those special variables are.
MOZ_OBJDIR¶
This variable is used to define the object directory for the current build.
Finding the active mozconfig¶
Multiple mozconfig files can exist to provide different configuration
options for different tasks. The rules for finding the active mozconfig
are defined in the
mozbuild.mozconfig.MozconfigLoader.find_mozconfig()
method:
-
class
mozbuild.mozconfig.
MozconfigLoader
(topsrcdir)¶ Handles loading and parsing of mozconfig files.
-
find_mozconfig
(env={'LANG': 'C.UTF-8', 'READTHEDOCS_PROJECT': 'gfritzsche-demo', 'READTHEDOCS': 'True', 'APPDIR': '/app', 'DEBIAN_FRONTEND': 'noninteractive', 'OLDPWD': '/', 'HOSTNAME': 'build-4258433-project-55928-gfritzsche-demo', u'SHELL': u'/bin/bash', 'PWD': '/home/docs/checkouts/readthedocs.org/user_builds/gfritzsche-demo/checkouts/latest/tools/docs', 'BIN_PATH': '/home/docs/checkouts/readthedocs.org/user_builds/gfritzsche-demo/envs/latest/bin', 'READTHEDOCS_VERSION': 'latest', 'PATH': '/home/docs/checkouts/readthedocs.org/user_builds/gfritzsche-demo/checkouts/latest/tools/docs/_build/html/_venv/bin:/home/docs/checkouts/readthedocs.org/user_builds/gfritzsche-demo/envs/latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME': '/home/docs'})¶ Find the active mozconfig file for the current environment.
This emulates the logic in mozconfig-find.
- If ENV[MOZCONFIG] is set, use that
- If $TOPSRCDIR/mozconfig or $TOPSRCDIR/.mozconfig exists, use it.
- If both exist or if there are legacy locations detected, error out.
The absolute path to the found mozconfig will be returned on success. None will be returned if no mozconfig could be found. A MozconfigFindException will be raised if there is a bad state, including conditions from #3 above.
-