Note that in order to develop such components, you do not need the full sources of e.g. Firefox, since you do not acces parts of the front end from within a component. Furthermore, since a component contains basic functionality, it is intended to run with every product of the Mozilla platform. Therefore it makes no sense to use a particular product to build general functionality. That's the reason why the Gecko SDK was devised.
Do not confuse the Gecko SDK with XULRunner. The Gecko SDK is a collection of header files and tools used to develop general XPCOM components which add functionality to the existing platform, whereas XULRunner is a runtime to bootstrap stand-alone applications based on the Mozilla framework.
Get the SDK
When downloading the Gecko SDK, it is important to choose the version that corresponds to the earliest version of Mozilla that you wish to target. In other words, you shouldn't download the 1.7 Gecko SDK if you want to use your component with Mozilla 1.6. This is important because binary compatibility is ensured only with future versions of the Gecko runtime. For this tutorial, we'll be using the 1.7 version of the Gecko SDK so that our component is binary compatible with Mozilla 1.7 (and any derived products such as Firefox 1.0 or Netscape 7.2).
NOTE: The Gecko SDK changed significantly between Mozilla 1.6 and 1.7,
including string API changes that result in smaller components since there is
no longer any need to link to the
embedstring static library.
Download the 1.7 Gecko SDK from here.
- gecko-sdk-i686-pc-linux-gnu.tar.gz for development under Linux (x86 architecture)
- gecko-sdk-i586-pc-msvc.zip for development under Windows
The Gecko SDK is not officially supported for other platforms, though for some other platforms it may be available under the contrib subdirectory.
Unpack the SDK tarball to some suitable location. I'll refer to that location
$GECKO_SDK from now on.
Building from Source
The Gecko SDK is output by a normal Mozilla build under
dist/sdk. See Build Documentation for information on how to build from source.
NOTE: There's no need to download or rebuild the Gecko SDK corresponding to security updates of Mozilla (i.e., Mozilla 1.7.3) since the Gecko SDK is not changed as a result of security updates.
For the remainder of this guide, we'll assume you are developing components under Linux. (Ports of this guide are welcome.)
Contents of the SDK
The SDK contains the following:
- IDL files for frozen interfaces (under
- Header files for frozen interfaces, XPCOM functions, and NSPR functions (under
- Import libraries or shared libraries (under
- Static utility libraries (under
- Various tools (under