PyXPCOM requires access to a shared Python library. The official Python installer for Windows installs this library automatically, so Windows users can simply install Python and skip to Compiling Mozilla.
For non-Windows users, if you already have Python installed and you have the file
/usr/lib/python2.*/config, you meet the shared library requirement and can skip to the Compiling Mozilla section. If you have that file but it's located in
/usr/lib (or whatever your system's library path is) instead, then create the proper symlink to the library as instructed below for Gentoo systems. If you don't have that file at all then you'll need to compile Python with
--enable-shared as outlined in this section.
Python 2.2 and earlier
A shared Python library seems to only be possible with
python-2.3* or later, so you'll need to upgrade if you're using
python-2.2* or earlier.
Python 2.3 and later
If your installed Python ebuild is
python-2.3* or later then the shared library was already built by default.
Symlinking to the shared library
As of this writing even the latest Python ebuilds fail to properly symlink to the shared library, so if for instance you're using
python-2.4.2 then you'll need to create the symlink manually:
ln -s /usr/lib/libpython2.4.so /usr/lib/python2.4/config/libpython2.4.so
If you don't use Windows or Gentoo, get the latest stable Python source tarball from python.org and do:
tar xjf Python-2.4.2.tar.bz2 cd Python-2.4.2 ./configure --enable-shared --prefix=/usr # Adjust --prefix to install over your current Python make sudo make install
Check out Mozilla from DOM_AGNOSTIC2_BRANCH in CVS and build it:
cvs -d :pserver:firstname.lastname@example.org:/cvsroot co -r DOM_AGNOSTIC2_BRANCH mozilla/client.mk cd mozilla make -f client.mk checkout MOZ_CO_PROJECT=suite cat > .mozconfig << "EOF" mk_add_options MOZ_CO_PROJECT=suite ac_add_options --enable-application=suite ac_add_options --enable-default-toolkit=gtk2 ac_add_options --enable-xft ac_add_options --enable-extensions=python/xpcom,python/dom,default ac_add_options --disable-optimize ac_add_options --enable-debug mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/suite-debug EOF make -f client.mk build
To test your newly-built PyXPCOM:
cd suite-debug/dist/bin export PYTHONPATH=python ./run-mozilla.sh ./seamonkey -chrome chrome://pyxultest/content