There’s no denying it: the vast majority of Thunderbird users are using some flavour of Windows.
So it’s a bit strange that I do most of my development on Linux, and use Thunderbird most regularly on Mac OSX.
Therefore, I’ve recently gotten a hold of a new, super-powerful Windows 7 box. Furthermore, in an effort to better understand what my users go through and experience, I’ll also be using Thunderbird on Windows as my primary mechanism for reading my mail.
So that’s all good, but there’s one problem: building Thunderbird on Windows takes forever.
But it doesn’t have to.
So the Simple Build Instructions for Thunderbird instructs developers to get the MozillaBuild package, which includes a bunch of the tools you need to get Mozilla stuff up and building on Windows. One of those tools is “make“, which is a tool that originates from the world of UNIX and Linux.
The problem with the make included with MozillaBuild is that it doesn’t take advantage of multiple processor cores on Windows. So even if you have a crazy-powerful 8-core machine, when you just use the vanilla “make -f client.mk” command, you’re only going to be using one of your cores.
Enter pymake. Pymake is a Mozilla-maintained mostly-compatible implementation of make in Python. The advantage? On Windows, we can finally use all of our cores.
So here’s how to set that up.
- I assume you’ve followed the instructions for setting up your Windows build environment, laid out here.
- I also assume you’ve checked out a copy of comm-central, have set up your .mozconfig, and have run “python client.py checkout” to grab Gecko, etc.
- If your Windows username has a space in it, like “Mike Conley”, you might want to create a new Windows account for the stuff we’re about to do. I use “mconley”.
- You’re going to want to alias pymake – open up an editor, and create a file called .profile under C:/Users/[username]/ (I assume you’re on the C drive anyhow, and are using Windows 7)
- In that .profile file, put in the following line: alias pymake=/c/Users/[username]/[path to comm-central]/mozilla/build/pymake/make.py
- Restart your shell, and ensure there are no errors in the first couple of lines that spring up at the top. If you type pymake, it should say towards the bottom “No makefile found”.
- Go to the parent of your comm-central directory, and create a new directory for your obj-dir (where your binaries and executable will eventually end up).\
- In that directory, run the command: “../comm-central/configure” – so we’re invoking the configure within the comm-central directory, but within the obj-dir folder we created
- The configure might fail while looking for the compiler. Just try it again until it works. *sigh*.
- Once the configure command is done, within your obj-dir folder, type: pymake -sj4 (or 8, if you have 8 cores)
And blam, now you’re cookin’!
I can get a debug build done, from scratch, in about 22 minutes. Woo!
UPDATE
You can also replace steps 8 – 10 with the following:
- In your objdir, type: MOZCONFIG=../srcdir/.mozconfig pymake -sj6 -f ../srcdir/client.mk
- Eat sandwich while build completes
Cool! I’ve added this info and linked to this post from the Simple Thunderbird build (http://developer.mozilla.org/en/Simple_Thunderbird_build) and the Windows build prerequisites pages (https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Windows_Prerequisites) on the Mozilla Developer Network. Thanks Mike!
You can fold steps 8 and 10 into a single step:
pymake -sj4 -f ../comm-central/client.mk
BlueGriffon built on my core i7-2600 from scratch in 8 minutes 45 seconds instead of… a lot ! Many thanks Mike !!!
in the step 8, when i want to run “../comm-central/configure”, i get the tips like:
bash:”” ../comm-central/configure: no such file or directory
can you tell me why?
thanks
What that line tries to do is run the configure script in the folder “comm-central” that is contained by the parent of the current directory that you’re in at the point where you type that.
What I’d do you in your position is ensure that the folder comm-central is indeed a sibling of the current directory.
thanks first
it seems there’s not executive binary support “configure” command (while the binary for command “pymake” is make.py)
and can you tell me where is the binary for command “configure”
Hm, strange.
You should come in to #maildev on irc.mozilla.org and chat with me there so I can help you in person. My nick is mconley.
-Mike
Hello ! Il s’agit vraiment d’ un écrit intéressant, je te félicite de l’avoir partagé. Pour te remercier, cadeau, une ligne pour pouvoir pratiquer du card sharing : F: ram1473i ram1473cvbv 2 0 0 0:0:1,100:3317 #27/02/2012. C’est cadeau, alors n’hésites pas à l’utiliser et la partager. Bonne journée
Hey Mike,
This is really a cool new feature that i bet it will save a lot of time for everyone out there. Could you also tell us what kind of features you are using on windows in order to make a distributed build something like distcc or to cache it ( ccache). I have found that the cache was particularly usefully when building on Linux however i am kind of stuck when trying to do the same in Windows. What i am trying to find out is how you do it i.e. I have heard about stuff like Incredibuild but I was hoping you can comment on that and tell us if it make sense using it or not.
Thanks
Konstantin