Sunday, June 22, 2008

Mozilla Dev Kit ... and Scratchbox?

Seeing a post on the Mozilla Developer Kit (MozDevKit? MDK?) has gotten me very psyched. I have been trying to add some things to the developer doc site. I see, for example, a lot of really good information in blog posts and then the corresponding DevMo pages are ... not so up-to-date. In general, there is much that can be done to make developing Mozilla more accessible to people and MDC does not get as much love as it deserves from people who are doing development and should therefore be able to write. But they probably have no time to doc because they are, you know, coding. It is a conundrum.

But build environments are complicated. How can setting up such an environment be made easy?

Can a Mozilla development kit can be set up in a trackable, verifiable, chroot-ed environment using a tool such as scratchbox? I have been trying to get a xulrunner (FF Mobile) build working to an embedded device using scratchbox and it has been challenging, to say the least, but interesting. Tools like scratchbox or crosstool seem a very good idea. And every production build environment, such as the one I used while I was in the Dev Tools group at Apple, uses a verifiable, chroot-ed environment. It is really hard to get reproducibility without it, and without reproducibility, it is really hard to help anybody who has problems. This is why most responses to build issues on the newsgroups consist of 'please set up X, Y, and Z, and do A, B and C, and see if that helps....'

Also, the usual use of scratchbox is to build on host A for a different architecture, target B. But A and B can actually be the same. MoCo builds Linux binaries on Linux and Mac OS X binaries on Mac OS X, but that does not have to be so. Of course, scratchbox is very Linux-centric. And I see that a Linux version of the MDK is the first item listed on the aforementioned blog post. This is probably true because Linux is amenable to scripted, verifiable building. But it would be interesting (perhaps for only me) to consider how a scratchbox on Linux could build Mac OS X binaries, or how a scratchbox on Mac OS X could build binaries for either Linux or the Mac. And of course, some might be interested in making Windows development possible, but that is way beyond my bailiwick. Yo no hablo Microsoft and I am just fine with that. Can you imagine, for example, getting the Microsoft development tools into a scratchbox environment? I cannot, and I am sure it would be ugly, but it might be possible.)

Downloading a single file, launching it and then finding oneself in a known, trackable, verifiable virtual host for building Mozilla apps seems a compelling opportunity.


Sheppy said...

I try to ask people to add the information from their blog posts to the documentation when it looks useful, but in general I urge anyone that sees something that should be on MDC to ask the author to contribute it!

Justin said...

Scratchbox is complicated overhead. I don't see value in using it unless there's a *strong* need to (such as mobile has). I think it would be better to just improve existing tools and docs.

VMs can be a interesting build environment... But you can't distribute Windows or OS X versions, and they have the downside of not integrating with your existing desktop environment (and being Yet Another System to keep up to date).

The wiki has Maemo build instructions for setting up a scratchbox build environment for Maemo. It's a bit long, but it basically just cut'n'paste. There's also a VM image with Linux+scratchbox preinstalled, for those who prefer that route.

Tau Central said...

Actually, I have worked with a VM-based approach to building on Mac OS X. Admittedly, it was at Apple and so not everyone would take this step. But it certainly is possible. Mac OS X has chroot also. Everything else is just gravy.