# Building the Python XPCOM package.

This file describes how to build the Python XPCOM C++ sources.

There are the following steps

- Configure environment variables
- Building the sources

Testing etc is described in the main readme.

## Configuring environment variables

### MOZ_SRC

Windows: Run the standard MOZENV.BAT used to build Mozilla. This sets MOZ_SRC

Unix: Set MOZ_SRC to point to the base source directory - assumes "mozilla" sub-directory with mozilla directory tree under that. eg: assuming /home/user/src/mozilla/dist/..."

    export MOZ_SRC=/home/user/src

### PYTHON_SRC

Windows: Set PYTHON_SRC to point to the base Python source directory. eg: assuming c:\src\python\PCBuild\...

    set PYTHON_SRC=c:\src\python

Unix: Set PYTHON_SRC to point to the base of an "installed" Python tree. eg:

    export PYTHON_SRC=/usr/local/ActivePython-1.6

## Building the sources

You must ensure some environment variables are setup. The section on configuring environment variables explains how.

There are 2 build processes to run All C++ sources are in the xpcom\src directory.:

### Windows

- Execute "compile.py" in this directory. This will take Setup.in, create an MSDev project, and build ..\_xpcom.pyd and ..\_xpcom_d.pyd"
- Change to the loader directory.
- Run nmake -f makefile.win. This will create pyloader.dll, and automatically copy it to the Mozilla build directory.

Finally, run the tests, where we also test everything imports correctly.

### Linux

NOTE: Do not attempt to use "Setup.in" to create a Makefile

- Run "make" in this directory. This will create ../_xpcommodule.so
- Run "make" in the loader directory. This will create libpyloader.so, and copy it to the Mozilla directory.

Finally, running the tests, where we also test everything imports correctly.