Building Firefox/SURF: Difference between revisions

Jump to navigation Jump to search
Line 141: Line 141:




'''In Try''': (to be answered)
'''In Try''': In try, you'll need to build your compiler and then use it.  I'm going to assume you're building clang and working on linux64.


Here's a quick tour of where things are first though.  The linux64 builds are defined in [https://searchfox.org/mozilla-central/source/taskcluster/ci/build/linux.yml this file]. Look for 'linux64/debug'.  Some important things to note are ''mozconfig-variant'' and ''fetches''.  You match the mozconfig-variant with the corresponding file in [https://searchfox.org/mozilla-central/source/browser/config/mozconfigs/linux64 this directory]. Observe that the debug mozconfig pulls in additional mozconfigs. But modifying this mozconfig will modify the linux64 debug build.
fetches->toolchain will match up with the keywords defined in the [https://searchfox.org/mozilla-central/source/taskcluster/ci/toolchain toolchain definitions].  So if we're looking for 'linux64-clang' we can [https://searchfox.org/mozilla-central/search?q=linux64-clang&case=false&regexp=false&path=taskcluster%2Fci%2Ftoolchain search for it] and see that while there is nothing defining 'linux64-clang' and a key (it would end in a : (colon)) - there is something saying <tt>toolchain-alias: linux64-clang</tt>. If we follow that, we can see at time of writing, it is defined as [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/taskcluster/ci/toolchain/clang.yml#60 linux64-clang-9]. (This link is a permalink to an old file, it may be different when you read this.)
Let's figure out how we build this toolchain. We want to look at ''build-clang.sh'', which receives the argument ''build/build-clang/clang-linux64.json''. It fetches the clang source using a keyword defined as ''clang-9'' (under fetches->fetch) and this compiler is itself built using the toolchains ''linux64-binutils'' and ''linux64-gcc-7''. (We could follow binutils and gcc-7 to find where they come from also, but we won't do that in this tutorial.)
First let's match ''clang-9'' to the source code. We do that by searching for clang-9 in the [https://searchfox.org/mozilla-central/source/taskcluster/ci/fetch/toolchains.yml toolchain's fetch file].  We see the repository it comes from and the git revision we check out.
Then we can find [https://searchfox.org/mozilla-central/source/taskcluster/scripts/misc/build-clang.sh build-clang.sh] - it looks like most of the heavy lifting is done by a script called [https://searchfox.org/mozilla-central/source/build/build-clang/build-clang.py build-clang.py].  We can also find [https://searchfox.org/mozilla-central/source/build/build-clang/clang-linux64.json clang-linux64.json].  Of special note, is that the json file specifies where to find the compiler to compile clang, as well as patches to apply to clang before compiling it.  (It might be simpler for you to point the source code fetch to your own repo, rather than adding patches in the json file though.)
So -using permanent links to a mozilla-central repo as of 11/4/2019 - the steps to build a compiler to compile Firefox with are
# [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/taskcluster/ci/fetch/toolchains.yml#411-416 Download the clang source code as specified here]
# [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/taskcluster/ci/toolchain/clang.yml#49-67 Build the source code using the job specified here]
## This calls [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/taskcluster/scripts/misc/build-clang.sh build-clang.sh] with [https://searchfox.org/mozilla-central/source/build/build-clang/clang-linux64.json clang-linux64.json] which passes that argument to [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/build/build-clang/build-clang.py build-clang.py]
## We patch the clang source code using the patches specified in the json file before building it.
# We build the linux64 debug job [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/taskcluster/ci/build/linux.yml#113-147 using the job specified here] (which defines what toolchains to use) and the we use [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/browser/config/mozconfigs/linux64/debug the mozconfig specified here].
## IF we follow the mozconfig include tree, we find that [https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/build/unix/mozconfig.unix mozconfig.unix] is where we set the CC and CXX variables.
Modifying components of those steps is how you'd customize the compiler used to build Firefox.


You may also need to set
You may also need to set
124

edits

Navigation menu