Customization with the .userconfig file

  • Revision slug: Mozilla/Boot_to_Gecko/Customization_with_the_.userconfig_file
  • Revision title: Customization with the .userconfig file
  • Revision id: 315035
  • Created:
  • Creator: dhylands@mozilla.com
  • Is current revision? No
  • Comment

Revision Content

{{draft()}}

You can customize certain aspects of the build process by putting some bash code into your .userconfig file. The .userconfig file isn't checked into source code control, so your changes won't be overwritten when you update your source tree. It needs to be created in the root of your B2G tree (so in the same directory as flash.sh, build.sh, etc)

The .userconfig file, if it exists, is sourced by the load-config.sh script, which is in turn sourced by these scripts: flash.sh, build.sh (through setup.sh), run-gdb.sh, and run-emulator.sh

Change the gecko source tree
By default, the build uses the gecko tree, which is cloned from a tree in github. Some people like to use mozilla-inbound, or mozilla-central. To do this create your clone of whereever you like and add a line to your .userconfig which sets GECKO_PATH, for example:
GECKO_PATH=/home/work/B2G/mozilla-inbound
Do a debug build
B2G_DEBUG=1
Disable the optimizer
B2G_NOOPT=1
Determine where your object tree goes
GECKO_OBJDIR=$PWD/objdir-gecko-custom
Have a different directory for debug objects versus non-debug objects
This allows you switch back and forth between debug and release builds without having to rebuild the world.
GECKO_PATH=/home/work/B2G-profiler/mozilla-inbound
echo "GECKO_PATH = ${GECKO_PATH}"

B2G_DEBUG=1
echo "B2G_DEBUG = ${B2G_DEBUG}"

ECKO_OBJDIR=$PWD/objdir-gecko
if [ "${B2G_DEBUG}" != "0" ]; then
  GECKO_OBJDIR=${GECKO_OBJDIR}-debug
fi
if [ "${GECKO_PATH/*mozilla-inbound*/mozilla-inbound}" = "mozilla-inbound" ]; then
  GECKO_OBJDIR=${GECKO_OBJDIR}-m-i
fi
echo "GECKO_OBJDIR = ${GECKO_OBJDIR}"

I like to have the echos to remind me what my current settings are

Revision Source

<p>{{draft()}}</p>
<p>You can customize certain aspects of the build process by putting some bash code into your .userconfig file. The .userconfig file isn't checked into source code control, so your changes won't be overwritten when you update your source tree. It needs to be created in the root of your B2G tree (so in the same directory as flash.sh, build.sh, etc)</p>
<p>The .userconfig file, if it exists, is sourced by the load-config.sh script, which is in turn sourced by these scripts: flash.sh, build.sh (through setup.sh), run-gdb.sh, and run-emulator.sh</p>
<dl>
  <dt>
    Change the gecko source tree</dt>
  <dd>
    By default, the build uses the gecko tree, which is cloned from a tree in github. Some people like to use mozilla-inbound, or mozilla-central. To do this create your clone of whereever you like and add a line to your .userconfig which sets GECKO_PATH, for example:
    <pre>
GECKO_PATH=/home/work/B2G/mozilla-inbound</pre>
  </dd>
  <dt>
    Do a debug build</dt>
  <dd>
    <pre>
B2G_DEBUG=1</pre>
  </dd>
  <dt>
    Disable the optimizer</dt>
  <dd>
    <pre>
B2G_NOOPT=1</pre>
  </dd>
  <dt>
    Determine where your object tree goes</dt>
  <dd>
    <pre>
GECKO_OBJDIR=$PWD/objdir-gecko-custom</pre>
  </dd>
  <dt>
    Have a different directory for debug objects versus non-debug objects</dt>
  <dd>
    This allows you switch back and forth between debug and release builds without having to rebuild the world.
    <pre>
GECKO_PATH=/home/work/B2G-profiler/mozilla-inbound
echo "GECKO_PATH = ${GECKO_PATH}"

B2G_DEBUG=1
echo "B2G_DEBUG = ${B2G_DEBUG}"

ECKO_OBJDIR=$PWD/objdir-gecko
if [ "${B2G_DEBUG}" != "0" ]; then
&nbsp; GECKO_OBJDIR=${GECKO_OBJDIR}-debug
fi
if [ "${GECKO_PATH/*mozilla-inbound*/mozilla-inbound}" = "mozilla-inbound" ]; then
&nbsp; GECKO_OBJDIR=${GECKO_OBJDIR}-m-i
fi
echo "GECKO_OBJDIR = ${GECKO_OBJDIR}"
</pre>
    <p>I like to have the echos to remind me what my current settings are</p>
  </dd>
</dl>
Revert to this revision