mozilla

Revision 168282 of Building XULRunner with Python

  • Revision slug: Building_XULRunner_with_Python
  • Revision title: Building XULRunner with Python
  • Revision id: 168282
  • Created:
  • Creator: SteveLee
  • Is current revision? No
  • Comment

Revision Content

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.

Apply any Service Packs and for MSVC71 SP 1 is available. The matching platform SDK is also needed and for MSVC71 that is .NET Framework SDK 1.1.

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.


Building

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.

set CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot

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

Deploying

Revision Source

<p><i><b>Work In progress</b></i>
</p><p>
</p>
<h2 name="Building_XULRunner_with_Python"> Building XULRunner with Python </h2>
<p>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. 
</p><p>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. 
</p><p>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 <a href="en/Download_Mozilla_Source_Code">source code</a> and <a href="en/Build_Documentation">building</a> as wells as <a href="en/PyXPCOM">pyXPCOM</a>
</p><p>XULRunner with Python promises to be a great platform for accessibility projects and both <a class="external" href="http://www.oatsoft.org/trac/jambu/wiki">Jambu Alternative Input</a> and the IAccessible2 test tool are using it. Of particular interested is access to MSAA and IAccessible2 via the Python comtypes package.
</p><p><br>
</p>
<h3 name="Development_Machine_Setup"> Development Machine Setup </h3>
<p>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.
</p><p>Ensure your PC is running XP with all the latest Service Packs and patches applied.
</p><p>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. 
</p><p>Apply any Service Packs and for MSVC71 <a class="external" href="http://www.microsoft.com/downloads/details.aspx?familyid=69d2219f-ce82-46a5-8aec-072bd4bb955e&amp;displaylang=en">SP 1</a> is available. The matching platform SDK is also needed and for MSVC71 that is <a class="external" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9b3a2ca6-3647-4070-9f41-a333c6b9181d&amp;DisplayLang=en">.NET Framework SDK 1.1</a>.
</p><p>Next you need the latest <a href="en/Windows_Build_Prerequisites"> Mozilla Build system</a> and the latest incarnation is very easy to use. Also install the included Python using <i>python25\python-2.5.msi</i>. 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.
</p><p><br>
</p>
<h3 name="Building"> Building </h3>
<p>The batch file <i>start-msvc71.bat</i> 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.
</p>
<pre>set CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
</pre>
<p>Having created a <i>mozilla</i> 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.
</p>
<pre>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 
</pre> 
<p>To check out and build execute
</p>
<pre>cd /c/projects
cvs co mozilla/client.mk
cd mozilla
make -f client.mk
</pre>
<p>In order to build without a check out use
</p>
<pre>cd mozilla
make -f client.mk build
</pre>
<p>The built XULRunner can then be found as c:\projects\obj-xulrunner\dist\xulrunner.exe
</p>
<h3 name="Deploying"> Deploying </h3>
Revert to this revision