Building Python for Series 60 Extensions with sdk2unix

Building Miso with sdk2unix

For builds in a more traditional Symbian build environment, one expects to have the usual bld.inf and .mmp files available for the project(s) to be built. The Miso source distribution has these, but some of the older releases thereof also have a GNU makefile that is intended for a particular kind of Symbian build environment, which we refer to as the sdk2unix environment, for lack of a better name. Such an environment would appear to be relatively easy to set up on a Linux box, and some other flavors of Unix might work too, although we haven't tried. This document briefly explains how to set up such an environment.

  1. First, try to make sure that you've got all the software that the SDK installation scripts will require. Say on Debian, you'll probably want to install at least these packages
  2. Then start constructing the Symbian build environment by first installing one or more Series 60 SDKs. Follow the instructions in the Symbian SDK on Unix HOWTO document.
  3. Next, download Python for Series 60 SDKs that match the SDKs that you just installed. Download from Forum Nokia.
  4. Finally, use one of these scripts to install the downloaded Python SDKs. Choose a version compatible with the SDKs. You'll need to run the install script individually for each of the SDKs.

If everything has gone well, you should be able to compile an older version of Miso, one that still supports sdk2unix style builds. Let's assume that you've installed the v2.1 SDK so that it's rooted at ~/symbian/series60_v21. To compile Miso, you'd do something like

export EPOC=$HOME/symbian/series60_v21
export PATH=$HOME/symbian/series60_v21/bin:$PATH
cd binaries/series60_v21
make

And that's it. You should now have a miso.pyd, ready for beaming off to your phone.

Building Pyrex-Generated Extensions

It's possible to include Pyrex-generated C code in PyS60 extensions, but unless Pyrex is modified not to generate code that introduces static writable data, it is necessary to enable the static data support "hack" described here; one should beware of address collisions when using this solution.

For an example of how to build extensions using Pyrex and sdk2unix, with static writable data support enabled, try the following:

  1. Modify the file $EPOC/python-port-s60/symbian_python/symbian/pyconfig.h so that BAD_STATIC_FORWARD becomes defined; this is not required for all compilers. (This #define controls the way that the staticforward and statichere keywords are defined; Pyrex-generated code includes some of these.)
  2. Install Pyrex. On Debian, this is a simple matter of installing the python-pyrex package, and perhaps also pyrex-mode for Pyrex support in Emacs.
  3. Download the Pyrex/PyS60 example code from here (an external link to the Pymbian website), and unpack it. Convert the DOS-style linefeeds of the .pyx file to Unix style.
  4. Go to the directory s60pyrex/examples/wrapping, and place this makefile there. Make sure that the -datalinkaddress specified in the makefile doesn't clash with that of any other application that has static writable data support enabled.
  5. Set any sdk2unix-related environment variables.
  6. Run make to produce a uiutils.pyd. Send it to your phone along with test_wrap.py to try using it.

Tero Hasu
tero.hasu@hut.fi