Using the build system to create custom extensions
What you need
First of all, I have only gotten this to work on trunk. If anyone finds a way to make it work on branch feel free to add here.
If you have any advanced dependancies, you may need to include more directories. You will obviously need to customize the below mozconfig.
# Options for client.mk. mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-gdata mk_add_options MOZ_CO_PROJECT="gdata" mk_add_options AVAILABLE_PROJECTS="gdata" # Needed to keep allmakefiles.sh from complaining that toolkit/ does not exist export LIBXUL_SDK=1 # Extra modules and files mk_add_options MODULES_gdata="mozilla/config mozilla/build mozilla/probes mozilla/calendar/providers/gdata mozilla/calendar/locales/en-US/chrome/calendar/providers/gdata" mk_add_options MODULES_NS_gdata="mozilla/" # Options for 'configure' (same as command-line options). ac_add_options --enable-application=calendar/providers/gdata ac_add_options --disable-tests
You will need a directory containing your extension code and the build-specific files. The Makefile.in could look like this:
DEPTH = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = gdata-provider export USE_EXTENSION_MANIFEST = 1 export XPI_NAME = gdata-provider DIST_FILES = install.rdf XPI_PKGNAME = gdata-provider DEFINES += -DAB_CD=$(AB_CD) STRIP_XPI = 1 PREF_JS_EXPORTS = $(srcdir)/defaults/preferences.js DIRS = components include $(topsrcdir)/config/rules.mk
This file is not technically required, but you will probably want one. See the jar.mn page or Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System for more details.
I needed a build.mk file in the target directory, so that the build system is correctly instructed to build my extension. This file is quite simple and contains only the following lines:
TIERS += app tier_app_dirs += calendar/providers/gdata
Check out and Build your extension
Now you can try to build your extension:
cvs -d :pserver:anonymous:email@example.com:/cvsroot co mozilla/client.mk MOZCONFIG=/path/to/custom/mozconfig make -f client.mk checkout MOZCONFIG=/path/to/custom/mozconfig make -f client.mk build
If any files seem to be missing, check out the mozilla/client.mk file and look for MODULES_core. There are a number of directories there, you could try adding them to your MODULES_gdata equivalent.