How to build a Windows installer under Linux or OSX
These are instructions for building a Windows installer (.exe) of your package under a foreign operating system. For this purposes, Wine is used to emulate Windows, although there is no reason why the extension cannot be built on a virtual machine.
- Install Wine (available on OSX via macports).
- Install Python 2.5 from python.org
- Install mingw. Install the base system and g++.
- Start the registry editor (wine regedit) and setup the system path:
- Search for Environment and find the PATH key
- Append to it c:\python25;c:\mingw\bin;c:\python25\scripts
- Add a new key called HOME and set it to c:\windows\profiles\yourusername
- Create a new file in ~/.wine/drive_c/windows/profiles/yourusername/ called pydistutils.cfg containing
[build] compiler=mingw32
This tells distutils not to look for the Microsoft Compilers, but to use mingw as the default compiler.
- Install setuptools (not necessary, but convenient if you want to install other packages).
- Get the .tar.gz from the http://pypi.python.org/pypi/setuptools and unpack.
- wine python setup.py install
- Install Cython (either from source as in 6 or using easy_install cython).
- Compile you extension from within your package source directory
python setup.py bdist_wininst
This will only work if you have a setup.py file, similar to the one in http://dip.sun.ac.za/~stefan/code/cython_demo.git.
This step should then generate a .exe in the dist/ directory.
If your package requires NumPy to work, you'll have to install that prior to step 8 via the provided installer or by
- Extracting the numpy source tree
- python setup.py build -c mingw32
- python setup.py install --skip-build
