Work In progress
Building XULRunner with Python
This page describes how to build XULRunner with python extension on Windows and while useful for anyone building XULRunner with Python it is written based on experiences with accessibility projects.
With the Python extensions enabled XULRunner provides python script access to the DOM and XPCOM in addition to the usual Java Script. This gives access to Python features and modules and builds on Mark Hammond's pyXPCOM work from Active State.
Currently (Mar 07) Python is not enabled by default so a custom build of Mozilla is needed. This page provides instructions in the hope of eliminating much trial and error. You should also read the the developer documentation on source code and building as wells as pyXPCOM
XULRunner with Python promises to be a great platform for accessibility projects and both Jambu Alternative Input and the IAccessible2 test tool are using it. Of particular interested is access to MSAA and IAccessible2 via the Python comtypes package.
Development Machine Setup
First a word of warning that ZoneAlarm has exhibited memory leaks that cause build machines to crash with rather spurious errors. You may want to uninstall it you suspect this to be a problem. You will also want to disable any virus scanner resident monitoring as that will slow builds.
Ensure your PC is running XP with all the latest Service Packs and patches applied.
Microsoft C++ compiler is required and whilst the current free version is Visual Studio 8 Express (MSVC8) you will almost certainly want to use Visual Studio .NET 2003 (MSVC71) which is not longer officially available. The issue is that XULRunner must be built with the same version of C as Python and with Python 2.5 that is MSVC71. Both must use the same version of the C runtime library MSVCRT?.DLL or crashes will ensue. The alternative is to build Python with MSVC8 as well asMozilla, but that may be problematic. It might also be possible to use the FOSS MinGW compiler with the correct MSVC run time library but that is apparently not recommended.
Next you need the latest Mozilla Build system and the latest incarnation is very easy to use. Also install the included Python using python25\python-2.5.msi. It doesn't need to be installed for the build but will be useful later when installing Python packages which look for entires in the Windows' registry.
The batch file start-msvc71.bat is used to launch the build console (MSys from the MinGw project ). You could modify it to set the CVSROOT environment variable if you are mainly working with Mozilla.
Having created a mozilla project directory (e.g. C:\projects\mozilla) created the following .mozconfig file in the mozilla directory. Note this is complete and does not need any other project specific .mozconfig files. This effectively specifies a release build that is not really suitable for debugging XULRunner itself.
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-xulrunner mk_add_options MOZ_CO_PROJECT=xulrunner ac_add_options --enable-application=xulrunner ac_add_options --enable-extensions=python,default ac_add_options --disable-javaxpcom ac_add_options --disable-activex ac_add_options --disable-activex-scripting ac_add_options --disable-tests ac_add_options --enable-optimize
To check out and build execute
cd /c/projects cvs co mozilla/client.mk cd mozilla make -f client.mk
In order to build without a check out use
cd mozilla make -f client.mk build
The built XULRunner can then be found as c:\projects\obj-xulrunner\dist\xulrunner.exe