Python 1.5.1 for BeOS

This directory contains several useful things to help you build your own
version of Python for BeOS.

At this time, Python only supports BeOS on the PowerPC platform; if you'd
like to help me port it to the x86 platform, please let me know (I only
have limited access to BeOS on an x86 system).  If you'd like to lend
me an x86 laptop running BeOS to do the port, _definitely_ let me know! :-)
I'll even give it back when I'm done.

What's Here?

ar-1.1 - An "ar" command with a POSIX 1003.2 interface; you'll need
         this for building the Python libraries under BeOS
         (/bin/ar just won't cut it).

linkcc - A shell script used by the build process to build the Python
         shared library.

linkmodule - A shell script used by the build process to build the
             shared library versions of the standard modules; you'll
             probably need this if you want to build dynamically loaded
             modules from the Python archives.

PyImport_BeImageID.html - Documentation for a function added to the
                          Python interpreter under BeOS; not interesting
                          unless you're writing your own BeOS-specific
                          modules for dealing with dynamically-loaded
                          Python modules.

README - This file (obviously!).

README.readline-2.2 - Instructions for compiling/installing GNU readline 2.2.
                      You'll have to grab the GNU readline source code from 
                      prep.ai.mit.edu:/pub/GNU or any other GNU mirror.

                      The Python interpreter is much nicer to work with
                      interactively if you've got readline installed.  Highly
                      recommended.

Compiling Your Own Version

To compile your own version of Python 1.5.1 for BeOS (with any luck,
Python 1.6 will compile "out of the box" on BeOS), try this:

1) Get the Python 1.5.1 source code from ftp.python.org.

2) Get the Python 1.5.1 diffs from my web pages 
   (http://www.qnx.com/~chrish/Be/software/); if you can't get them through
   a web browser, send me email and I'll mail them back to you.  These
   diffs should also be available at ftp.python.org along with the BeOS
   binary archive.
   
   Run autoconf.  If you don't have autoconf, you can get a precompiled
   version from GeekGadgets (ftp://ftp.ninemoons.com/pub/geekgadgets/...).

3) Compile and install the POSIX ar from the ar-1.1 directory; see the
   README in there for details.

4) Configure with:

   AR=ar-posix RANLIB=: ./configure --verbose --without-gcc \
   --prefix=/boot/home/config --with-thread
   
   The only strange thing that happens during the configure is that
   we fail the "genuine getopt()" test; this is odd because we've got
   a real live GNU getopt() in the system libs.  Other packages built
   using configure (such as all of the goodies in GeekGadgets) suffer
   the same fate though, so it's not a Python problem.

5) Copy Modules/Setup.in to Modules/Setup.

6) Edit Modules/Setup to turn on all the modules you want built.  I've
   personally built the following modules:

   array, audioop, binascii, cPickle, cStringIO, cmath, crypt, curses,
   errno, fcntl, gdbm, grp, imageop, math, md5, new, operator, parser,
   pcre, posix, pwd, readline, regex, reop, rgbimg, rotor, select,
   signal, socket, soundex, strop, struct, syslog, termios, thread,
   time, timing, zlib

   Newly compiled/tested with 1.5.1:
   
   _locale

   You can get precompiled gdbm, ncurses, and zlib libraries from the
   GeekGadgets repository (ftp://ftp.ninemoons.com/pub/geekgadgets/...).
   
   Make sure you use _socket instead of socket for the name of the
   socketmodule on BeOS.

7) Make:

   make
   
   or, if you feel the need for speed:
   
   make OPT="-O7 -opt schedule604"
   
   You can safely ignore any warnings you see during the build (and you'll
   see several if you use full warnings; I compiled the distribution with
   -w9 -ansi strict and cleaned up any errors...).

8) Test:

   make test

   Expect the following errors:

   test_builtin failed -- round(1000000000.0)
   test_fcntl skipped -- an optional feature could not be imported
   test_grp crashed -- exceptions.KeyError : getgrnam(): name not found
   test_pwd failed -- Writing: 'fakename', expected: 'caught e'
   test_socket crashed -- exceptions.AttributeError : SOCK_RAW

   These are all due to either partial support for certain things (like
   sockets), or valid differences between systems (like the round()
   error; different CPUs represent floating point numbers differently,
   which can cause minor rounding errors).

9) Install:

   make install

10) Enjoy!

NOTE

If you're going to build your own C/C++-based Python modules, link them
against the libpython1.5.so shared library (in /boot/home/config/lib)
instead of the libpython1.5.a (in /boot/home/config/lib/python1.5/config),
unless you're building a statically-linked python interpreter (then you
could try linking against _APP_ instead).

Mixing modules linked against the shared library with a statically-linked
interpreter is a bad idea (and it'll fail in _interesting_ ways).

- Chris Herborth (chrish@qnx.com)
  April 25, 1998
