Guido van Rossum | 8ce65b4 | 1994-08-29 08:58:39 +0000 | [diff] [blame] | 1 | From: walker@island.com (Richard Walker) |
| 2 | Date: Wed, 1 Jun 94 15:28:40 PDT |
| 3 | |
| 4 | Compiling Python Under MPW C |
| 5 | ============================ |
| 6 | |
| 7 | This directory contains the Makefiles, source files and scripts |
| 8 | required to compile Python under MPW C. |
| 9 | |
| 10 | Compiling: |
| 11 | ---------- |
| 12 | the "buildall" file at the top level is an MPW script |
| 13 | which rebuilds the entire Python source. |
| 14 | |
| 15 | To build, start the MPW Shell and select the Worksheet window. |
| 16 | Go to top level directory of the Python source tree. |
| 17 | Type: buildall<ENTER> |
| 18 | |
| 19 | To rebuild: |
| 20 | Type: buildall clean<ENTER> |
| 21 | Type: buildall<ENTER> |
| 22 | |
| 23 | Configuration: |
| 24 | -------------- |
Guido van Rossum | 31e7642 | 1994-09-16 11:08:31 +0000 | [diff] [blame^] | 25 | The files "Makefile", "config.h", "Mac:config.c" and |
| 26 | "Modules:Makefile" are normally configured and/or generated |
Guido van Rossum | 8ce65b4 | 1994-08-29 08:58:39 +0000 | [diff] [blame] | 27 | automagically under Unix. |
| 28 | |
| 29 | Macintosh programmers will have to be content with editing |
| 30 | these files manually to reflect their desired configuration. |
| 31 | The files provided here are examples only; Modules which |
| 32 | made it into this version are those which required little or |
| 33 | no modification. |
| 34 | |
| 35 | Running: |
| 36 | -------- |
| 37 | The top-level Makefile compiles Python as an MPW Tool. |
| 38 | You can then run Python interactively from within |
| 39 | the MPW Worksheet. |
| 40 | |
| 41 | Diagnostics: |
| 42 | ------------ |
| 43 | If Python fails to run by aborting in file "Parser:grammar1.c", |
| 44 | at the end of the function "finddfa", line 46, |
| 45 | try defining the preprocessor symbol "MPW_881_BUG" in |
| 46 | file "Parser:acceler.c", function "fixstate", line 107. |
| 47 | |
Guido van Rossum | c0af2aa | 1994-09-09 12:10:21 +0000 | [diff] [blame] | 48 | --------------------------------------------------------------- |
| 49 | |
| 50 | Additional notes by Guido for Python 1.1: |
| 51 | ----------------------------------------- |
| 52 | |
| 53 | I have tried this with MPW 3.2 and tweaked Richards Makefiles and |
| 54 | buildall script slightly to work with Python 1.1. The same configure |
Guido van Rossum | 31e7642 | 1994-09-16 11:08:31 +0000 | [diff] [blame^] | 55 | file now works for THINK C 6.0 (or 7.0) and MPW 3.2. It is essential |
| 56 | that 'MPW' is defined when compiling with MPW; for both compilers, |
Guido van Rossum | c0af2aa | 1994-09-09 12:10:21 +0000 | [diff] [blame] | 57 | 'HAVE_CONFIG_H' should also be defined. For MPW, the buildall script |
| 58 | takes care of this. |
| 59 | |
| 60 | I moved some files around or renamed them and modified the Makefiles |
| 61 | accordingly. All Mac specific files are now in the Mac subdirectory, |
| 62 | especially config.c, config.h, macmodule.c, and (new) macmain.c. |
| 63 | |
Guido van Rossum | 31e7642 | 1994-09-16 11:08:31 +0000 | [diff] [blame^] | 64 | I wouldn't bother with the Grammar subdirectory or the Parser |
| 65 | generator (Pgen) -- the needed Pgen output files are part of the |
| 66 | distribution. |
Guido van Rossum | c0af2aa | 1994-09-09 12:10:21 +0000 | [diff] [blame] | 67 | |
| 68 | If the buildall script stops at a compilation error you are usually |
| 69 | left in one of the subordinate directories. |
| 70 | |
| 71 | Instead of using the buildall script you can also once execute the Set |
| 72 | and Export commands listed at its top (which set compiler and linker |
| 73 | options) and in each of the directories Mac, Parser, Python, Objects, |
| 74 | Modules and finally the python rot directory, execute the two command |
| 75 | |
| 76 | make >makefile.out |
| 77 | makefile.out |
| 78 | |
| 79 | Or you could execute |
| 80 | |
| 81 | make |
Guido van Rossum | 31e7642 | 1994-09-16 11:08:31 +0000 | [diff] [blame^] | 82 | |
Guido van Rossum | c0af2aa | 1994-09-09 12:10:21 +0000 | [diff] [blame] | 83 | have a look at its output and execute selected commands from it. |
| 84 | |
| 85 | The buildall script executes |
| 86 | |
| 87 | Directory {Python} |
Guido van Rossum | c0af2aa | 1994-09-09 12:10:21 +0000 | [diff] [blame] | 88 | |
Guido van Rossum | 31e7642 | 1994-09-16 11:08:31 +0000 | [diff] [blame^] | 89 | which normally prints the current directory, because {Python} is not |
| 90 | defined. If it is set to the python root directory, you could place |
| 91 | buildall somewhere in your command search path and execute it from |
| 92 | anywhere. |
| 93 | |
| 94 | If you are mixing THINK C and MPW, you may experience weird errors in |
| 95 | previously correct modules. These disappear when you throw away the |
Guido van Rossum | c0af2aa | 1994-09-09 12:10:21 +0000 | [diff] [blame] | 96 | module's .pyc file. The errors usually have to do with string |
| 97 | literals containing '\n' or '\r'. The reason is an incompatibility |
| 98 | between their handling of '\n' and '\r' -- in MPW C, '\n' actually is |
| 99 | ASCII CR while '\r' is ASCII LF, which is the reverse situation from |
| 100 | any other ASCII based C implementation. This behaviour is inherited |
Guido van Rossum | 31e7642 | 1994-09-16 11:08:31 +0000 | [diff] [blame^] | 101 | by Python compiled with MPW C. This is normally not a problem, but |
| 102 | *binary* files written by one system will be mis-interpreted by the |
| 103 | other, and this is what happens to the .pyc files. There is no easy |
| 104 | way to fix this in the source. (This is a real shame, since the |
| 105 | format of .pyc files was carefully designed to be independent of byte |
| 106 | order and integer size -- deviations in the ASCII character codes were |
| 107 | never anticipated.) |