
The Mozilla build system is big, complicated, and sparsely documented. There are only a few folks that are actively working on it to my knowledge. As bsmedberg pointed out, however, the build system is also quite powerful and has had a ton of bugs worked out of it over the years. Unfortunately for most XULRunner developers it’s also off limits unless you feel like jumping in and hacking it yourself. It builds Firefox, Thunderbird, XULRunner, and other Mozilla-hosted apps and extensions happily, but what about XULMine? Other XULRunner apps? Songbird?
Well, the build system underwent a substantial change last week. (more…)
I’m happy to say that I landed some of the work to make the build system cooperate with XULRunner apps in bug 380846. I’m going to continue some smaller tasks next week. As some other guys have already started making changes to their products’ builds I figured I should at least blog about the changes that have gone in until I have time to make a doc on MDC.
The major changes are:
-
Support for arbitrary applications through ‘–enable-application’ in mozconfig files.
- Adding ‘–enable-application=myapp’ to your ‘mozconfig’ file instructs the build system to check the folder ‘mozilla/myapp/’ for a ‘build.mk’ file. This file, in turn, tells the build system where to start the build process. See the Minimo ‘build.mk’ for the simplest example in the tree. Note that if you forget to make a ‘build.mk’ the build system will stop dead in its tracks and yell at you.
- The folder ‘mozilla/myapp/’ will be checked for a ‘confvars.sh’ file to influence the behavior of the configure script. See the XULRunner ‘confvars.sh’ for an idea of what to do there. At a minimum you should set ‘MOZ_APP_NAME=myapp’, ‘MOZ_APP_DISPLAYNAME=My Amazing App’, and ‘MOZ_XUL_APP=1′. Add anything else you want. This file is completely optional, however.
- The folder ‘mozilla/myapp/’ will also be checked for a ‘makefiles.sh’ file that will be called to tell the build system which makefiles the app requires. That script should call the ‘add_makefiles’ function. See the Suite ‘makefiles.sh’ for a shiny new example. This file is optional, but it doesn’t really make sense to build a new app without adding at least one Makefile…
-
Support for arbitrary extensions through ‘–enable-extensions’ in mozconfig files.
- Setting ‘–enable-extensions=myext’ in your mozconfig file instructs the build system to look in the ‘mozilla/extensions/myext/’ folder for a ‘makefiles.sh’ script. That script should call ‘add_makefiles’ as above to tell the build system which makefiles are required to build the extension.
- Note that extensions cannot influence the configure script through a ‘confvars.sh’ script, nor can they influence the starting point of the build system through a ‘build.mk’ file.
-
Support for building extensions without building another app first.
- For lightweight extensions it’s a pain to build something like XULRunner just to get your JAR built, so you can now specify ‘–enable-application=extensions’ followed by ‘–enable-extensions=myext’ in a mozconfig file.
- Note that you probably won’t have much luck trying to compile binary components without building XULRunner first… This option is really only for extensions that have JS/XUL/CSS files (unless you have a libXUL SDK - see below).
So, what to do for XULRunner apps that don’t want to rebuild XULRunner each time? Here’s the plan:
- Make a folder for your app in the ‘mozilla/’ directory. Add ‘build.mk’, ‘confvars.sh’, and ‘makefiles.sh’ files as detailed above.
- Add ‘Makefile.in’ files to your new folder to build your application. See the documentation on MDC for details on how to write makefiles. A good place to start is probably Plasticmillion’s extension tutorial.
- Use a mozconfig file similar to this for whenever you want to build or rebuild your XULRunner SDK.
- Use a mozconfig similar to this to rebuild just your application.
- Run ‘make -f client.mk’ as usual!
This week (or next) I’ll be looking at reducing the number of makefiles required to build an app or extension with a libxul-sdk. I’ll also be looking at making a checkout target for just the build system so that you don’t have to pull the whole mozilla tree every time.
In the meantime, if anyone is interested in yanking makefiles out of the hugely bloated ‘allmakefiles.sh’ and moving them into an app-specific ‘makefiles.sh’ please feel free to ping me.











4 Comments
SubscribeHi Ben!
Im starting to develop with Mozilla and would like to know how do I get access to these goodies? Download the patch and apply to xulrunner source code? Checkout the CVS?
Cheers!
Eduardo.
All the stuff I was describing has already been checked into Mozilla’s CVS.
I read your blog article with interest. I’ve been working on porting songbird to OpenBSD and having the build use –enable-application=songbird would be very helpful.
The current songbird build is not very friendly to build systems that the BSD’s use. Especially the part that builds a custom xulrunner, tar it up and use that for the mozilla sdk and xulrunner for songbird. Since songbird needs to build off trunk/head xulrunner + songbird patches it rules out using an external/common xulrunner for songbird to use.
A –enable-application=songbird based build would be great. Any chance that might be comming soon? That would save me quite a bit of time in the porting process since I wouldn’t need to figure out how to chain the two builds together in a sane way.
how do you include the build system into your current trunk?
i’ve noticed you dont need to have the mozilla build tools in the directory below.