Guido van Rossum | d8eb211 | 1998-08-04 17:57:28 +0000 | [diff] [blame] | 1 | Python 1.5.1 for BeOS |
| 2 | |
| 3 | This directory contains several useful things to help you build your own |
| 4 | version of Python for BeOS. |
| 5 | |
| 6 | At this time, Python only supports BeOS on the PowerPC platform; if you'd |
| 7 | like to help me port it to the x86 platform, please let me know (I only |
| 8 | have limited access to BeOS on an x86 system). If you'd like to lend |
| 9 | me an x86 laptop running BeOS to do the port, _definitely_ let me know! :-) |
| 10 | I'll even give it back when I'm done. |
| 11 | |
| 12 | What's Here? |
| 13 | |
| 14 | ar-1.1 - An "ar" command with a POSIX 1003.2 interface; you'll need |
| 15 | this for building the Python libraries under BeOS |
| 16 | (/bin/ar just won't cut it). |
| 17 | |
| 18 | linkcc - A shell script used by the build process to build the Python |
| 19 | shared library. |
| 20 | |
| 21 | linkmodule - A shell script used by the build process to build the |
| 22 | shared library versions of the standard modules; you'll |
| 23 | probably need this if you want to build dynamically loaded |
| 24 | modules from the Python archives. |
| 25 | |
| 26 | PyImport_BeImageID.html - Documentation for a function added to the |
| 27 | Python interpreter under BeOS; not interesting |
| 28 | unless you're writing your own BeOS-specific |
| 29 | modules for dealing with dynamically-loaded |
| 30 | Python modules. |
| 31 | |
| 32 | README - This file (obviously!). |
| 33 | |
| 34 | README.readline-2.2 - Instructions for compiling/installing GNU readline 2.2. |
| 35 | You'll have to grab the GNU readline source code from |
| 36 | prep.ai.mit.edu:/pub/GNU or any other GNU mirror. |
| 37 | |
| 38 | The Python interpreter is much nicer to work with |
| 39 | interactively if you've got readline installed. Highly |
| 40 | recommended. |
| 41 | |
| 42 | Compiling Your Own Version |
| 43 | |
| 44 | To compile your own version of Python 1.5.1 for BeOS (with any luck, |
| 45 | Python 1.6 will compile "out of the box" on BeOS), try this: |
| 46 | |
| 47 | 1) Get the Python 1.5.1 source code from ftp.python.org. |
| 48 | |
| 49 | 2) Get the Python 1.5.1 diffs from my web pages |
| 50 | (http://www.qnx.com/~chrish/Be/software/); if you can't get them through |
| 51 | a web browser, send me email and I'll mail them back to you. These |
| 52 | diffs should also be available at ftp.python.org along with the BeOS |
| 53 | binary archive. |
| 54 | |
| 55 | Run autoconf. If you don't have autoconf, you can get a precompiled |
| 56 | version from GeekGadgets (ftp://ftp.ninemoons.com/pub/geekgadgets/...). |
| 57 | |
| 58 | 3) Compile and install the POSIX ar from the ar-1.1 directory; see the |
| 59 | README in there for details. |
| 60 | |
| 61 | 4) Configure with: |
| 62 | |
| 63 | AR=ar-posix RANLIB=: ./configure --verbose --without-gcc \ |
| 64 | --prefix=/boot/home/config --with-thread |
| 65 | |
| 66 | The only strange thing that happens during the configure is that |
| 67 | we fail the "genuine getopt()" test; this is odd because we've got |
| 68 | a real live GNU getopt() in the system libs. Other packages built |
| 69 | using configure (such as all of the goodies in GeekGadgets) suffer |
| 70 | the same fate though, so it's not a Python problem. |
| 71 | |
| 72 | 5) Copy Modules/Setup.in to Modules/Setup. |
| 73 | |
| 74 | 6) Edit Modules/Setup to turn on all the modules you want built. I've |
| 75 | personally built the following modules: |
| 76 | |
| 77 | array, audioop, binascii, cPickle, cStringIO, cmath, crypt, curses, |
| 78 | errno, fcntl, gdbm, grp, imageop, math, md5, new, operator, parser, |
| 79 | pcre, posix, pwd, readline, regex, reop, rgbimg, rotor, select, |
| 80 | signal, socket, soundex, strop, struct, syslog, termios, thread, |
| 81 | time, timing, zlib |
| 82 | |
| 83 | Newly compiled/tested with 1.5.1: |
| 84 | |
| 85 | _locale |
| 86 | |
| 87 | You can get precompiled gdbm, ncurses, and zlib libraries from the |
| 88 | GeekGadgets repository (ftp://ftp.ninemoons.com/pub/geekgadgets/...). |
| 89 | |
| 90 | Make sure you use _socket instead of socket for the name of the |
| 91 | socketmodule on BeOS. |
| 92 | |
| 93 | 7) Make: |
| 94 | |
| 95 | make |
| 96 | |
| 97 | or, if you feel the need for speed: |
| 98 | |
| 99 | make OPT="-O7 -opt schedule604" |
| 100 | |
| 101 | You can safely ignore any warnings you see during the build (and you'll |
| 102 | see several if you use full warnings; I compiled the distribution with |
| 103 | -w9 -ansi strict and cleaned up any errors...). |
| 104 | |
| 105 | 8) Test: |
| 106 | |
| 107 | make test |
| 108 | |
| 109 | Expect the following errors: |
| 110 | |
| 111 | test_builtin failed -- round(1000000000.0) |
| 112 | test_fcntl skipped -- an optional feature could not be imported |
| 113 | test_grp crashed -- exceptions.KeyError : getgrnam(): name not found |
| 114 | test_pwd failed -- Writing: 'fakename', expected: 'caught e' |
| 115 | test_socket crashed -- exceptions.AttributeError : SOCK_RAW |
| 116 | |
| 117 | These are all due to either partial support for certain things (like |
| 118 | sockets), or valid differences between systems (like the round() |
| 119 | error; different CPUs represent floating point numbers differently, |
| 120 | which can cause minor rounding errors). |
| 121 | |
| 122 | 9) Install: |
| 123 | |
| 124 | make install |
| 125 | |
| 126 | 10) Enjoy! |
| 127 | |
| 128 | NOTE |
| 129 | |
| 130 | If you're going to build your own C/C++-based Python modules, link them |
| 131 | against the libpython1.5.so shared library (in /boot/home/config/lib) |
| 132 | instead of the libpython1.5.a (in /boot/home/config/lib/python1.5/config), |
| 133 | unless you're building a statically-linked python interpreter (then you |
| 134 | could try linking against _APP_ instead). |
| 135 | |
| 136 | Mixing modules linked against the shared library with a statically-linked |
| 137 | interpreter is a bad idea (and it'll fail in _interesting_ ways). |
| 138 | |
| 139 | - Chris Herborth (chrish@qnx.com) |
| 140 | April 25, 1998 |