blob: 73e3d4e8c17a65e353238b4e2946cdfc50ae1bee [file] [log] [blame]
Jack Jansen8f2d8021996-08-05 15:34:45 +00001<HTML>
2<HEAD>
3<TITLE>Building Mac Python from source</TITLE>
4</HEAD>
5<BODY>
6<H1>Building Mac Python from source</H1>
7<HR>
Jack Jansen8f2d8021996-08-05 15:34:45 +00008
Jack Jansen4c1e56c1996-08-06 16:16:20 +00009This document explains how to build MacPython from source. This is
10necessary if you want to write extension modules for 68K Python, and
11currently also probably the easiest way to build PPC extension
12modules. Building Python is not something to be undertaken lightly,
13the process is not very streamlined so you need a reasonable working
14knowledge of the CodeWarrior development environment, a good net
15connection and probably quite some time too. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +000016
Jack Jansen4c1e56c1996-08-06 16:16:20 +000017The information density in this file is high, so you should probably
18print it and read it at your leasure. Most things are explained only
19once (and probably in the wrong place:-). <p>
20
21I am very interested in feedback on this document, contact me at <A
22HREF="mailto:jack@cwi.nl">&lt;jack@cwi.nl&gt;</A> or send your
23comments to the <A
24HREF="http://www.python.org/sigs/pythonmac-sig/">Mac Python Special
25Interest Group</A>.
Jack Jansen8f2d8021996-08-05 15:34:45 +000026
27<H2>What you need.</H2>
28
29The following things you definitely need:
30
31<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +000032
Jack Jansen4c1e56c1996-08-06 16:16:20 +000033<LI> You need a MacPython source distribution, of course. You can
34obtain one from <A
35HREF="ftp://ftp.cwi.nl/pub/jack/python/mac">ftp://ftp.cwi.nl/pub/jack/python/mac</A>,
36and possibly also from the standard <A
37HREF="ftp://ftp.python.org/pub/python/mac">python.org ftp
38site</A>. Everything you need is also included in the standard Python
39source distribution, but the organization is different. Look in
40directory <code>Mac/mwerks/projects</code> for the project files and
41related stuff.
Jack Jansen8f2d8021996-08-05 15:34:45 +000042
Jack Jansen4c1e56c1996-08-06 16:16:20 +000043<LI> You need MetroWerks CodeWarrior. The current distribution has
44been built with version 9 of CodeWarrior. Ordering information is
45available on the <A HREF="http://www.metrowerks.com/">MetroWerks
46homepage</A>. You might still be able to build Python with MPW or
47Think/Symantec C but you are basically on your own.
48
49<LI> You need GUSI, the Grand Unified Socket Interface, by Matthias
50Neeracher. The current distribution has been built with CWGUSI 1.7.2,
51obtainable from <A
52HREF="ftp://ftp.switch.ch/software/mac/src/mw_c">ftp://ftp.switch.ch/software/mac/src/mw_c</A>.
53It is possible to build a non-GUSI Python, see below.
54
Jack Jansen8f2d8021996-08-05 15:34:45 +000055</UL>
56
Jack Jansen4c1e56c1996-08-06 16:16:20 +000057<A NAME="optional">The MacPython project files are configured to
58include a plethora of optional modules</A>, and these modules need a
59number extra packages. To use the project files as-is you have to
Jack Jansen27b10ec1996-08-23 15:44:18 +000060download these packages too. PPC and CFM68K Python have all such modules as
Jack Jansen4c1e56c1996-08-06 16:16:20 +000061dynamically loaded modules, so if you don't need a certain package it
Jack Jansen27b10ec1996-08-23 15:44:18 +000062suffices to just refrain from builing the extension module. For static 68K
Jack Jansen4c1e56c1996-08-06 16:16:20 +000063Python things are a bit more complicated: you have to edit the
64interpreter project file to remove the reference to the module (and
Jack Jansen27b10ec1996-08-23 15:44:18 +000065the libraries it uses), and edit the <code>Mac:mwerks:mwerks_nonshared_config.h</code>
66file to remove the <code>USE_...</code> line. Here are the locations for the various things
Jack Jansen4c1e56c1996-08-06 16:16:20 +000067you need:
Jack Jansen8f2d8021996-08-05 15:34:45 +000068
69<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +000070
Jack Jansen4c1e56c1996-08-06 16:16:20 +000071<LI> Tcl and Tk can be obtained from <A
72HREF="ftp://ftp.smli.com/pub/tcl/mac/">ftp://ftp.smli.com/pub/tcl/mac/</A>.
73The current distributions, Tcl 7.5p1 and Tk 4.1p1 need a bit of work,
74see the section on <A HREF="#tcltk">building Tcl/Tk Python</A>
75below. Get the "full source" distribution, which includes MoreFiles.
Jack Jansen8f2d8021996-08-05 15:34:45 +000076
Jack Jansen4c1e56c1996-08-06 16:16:20 +000077<LI> Waste, a TextEdit replacement written by Marco Piovanelli, <A
78HREF="mailto:piovanel@kagi.com">&lt;piovanel@kagi.com&gt;</A>. Python
79was built using version 1.2, which you can obtain from <A
80HREF="ftp://rhino.harvard.edu/pub/dan/WASTE">&lt;ftp://rhino.harvard.edu/pub/dan/WASTE&gt;</A>
81and various other places.
Jack Jansen8f2d8021996-08-05 15:34:45 +000082
Jack Jansen4c1e56c1996-08-06 16:16:20 +000083<LI> JPEG library by the Independent JPEG Group. Python is still built
84using an archaic version of the library, version 4. It can be obtained
85from the <A HREF="ftp://ftp.cwi.nl/pub/jack/python/mac">
86ftp://ftp.cwi.nl/pub/jack/python/mac</A> directory, complete with CW8
87projects. If someone manages to build Python with the version 6
88library I would be grateful if they sent me the changes needed. The
89most recent JPEG library can always be obtained from <A
90HREF="ftp://ftp.uu.net/graphics/jpeg/">ftp://ftp.uu.net/graphics/jpeg/</A>.
91
92<LI> The netpbm/pbmplus and libtiff libraries. The netpbm distribution
93(which includes libtiff) is generally available on Internet ftp
94servers. For Python pbmplus, an older incarnation of netpbm, is
95functionally identical to netpbm, since Python only uses the library
96and not the complete applications. A distribution with correct
97projects and library source only is available from, you guessed it, <A
98HREF="ftp://ftp.cwi.nl/pub/jack/python/mac">ftp://ftp.cwi.nl/pub/jack/python/mac</A>.
99
Jack Jansen8f2d8021996-08-05 15:34:45 +0000100</UL>
101
102<H2>Setting Up</H2>
103
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000104Now that you have collected everything you should start with building
105the various parts. Everything is independent, with the single
106exception that Tcl and Tk depend on CWGUSI. If you don't want to fix
107access paths try to set things up as follows:
108
Jack Jansen8f2d8021996-08-05 15:34:45 +0000109<PRE>
110Top-level-folder:
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000111 CWGUSI
Jack Jansen8f2d8021996-08-05 15:34:45 +0000112 imglibs
113 libjpeg
114 pbmplus
115 libtiff
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000116 MoreFiles 1.4.2 (not needed by Python, only by tcl/tk)
Jack Jansen8f2d8021996-08-05 15:34:45 +0000117 Python
118 Tcl 7.5
119 Tk 4.1
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000120 Waste 1.2 distribution (if you want waste)
Jack Jansen8f2d8021996-08-05 15:34:45 +0000121</PRE>
122
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000123Now build all the libraries. In <code>CWGUSI</code> you build the
Jack Jansen27b10ec1996-08-23 15:44:18 +0000124projects <code>GUSI.68K.µ</code>, <code>GUSI.CFM68K.µ</code>
125and <code>GUSI.PPC.µ</code>, in
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000126<code>MoreFiles</code>, <code>libjpeg</code>, <code>pbmplus</code>
127and<code>libtiff</code> you build all projects. Tcl/tk is a special
Jack Jansen27b10ec1996-08-23 15:44:18 +0000128case, see below. Of course, if you are only interested in one of
129static 68K, CFM68K or PPC you can skip building the other libraries.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000130
131<H2><A NAME="tcltk">Building Tcl/Tk</H2>
132
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000133You need to make a minor organizational change to the Tcl/Tk
134distribution. The current instructions are for the
135<code>tcl7.5.1</code> and <code>tk4.1.1</code> distribution:
136
Jack Jansen8f2d8021996-08-05 15:34:45 +0000137<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000138
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000139<LI> Rename the <code>compat</code> folders to <code>(compat)</code>
140in both the Tcl and Tk folders.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000141
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000142<LI> In the Tcl folder, move <code>strncasecmp.c</code> and
143<code>tclErrno.h</code> from <code>(compat)</code> to the main Tcl
144folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000145
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000146<LI> Fix <code>dnr.c</code> as provided by MetroWerks by inserting
147<pre><code> #pragma ANSI_strict off </code></pre> at the
148beginning. The tcl library is built with strict ANSI on, and this file
149uses C++ style comments.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000150
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000151<LI> If you want to build <code>SimpleTcl</code> and
152<code>SimpleTk</code> you will probably have to remove the references
153to <code>libmoto</code> from the project.
154
155<LI> You are <EM>strongly</EM> advised to add a line
Jack Jansen8f2d8021996-08-05 15:34:45 +0000156<pre><code>
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000157#define USE_TCLALLOC 1
Jack Jansen8f2d8021996-08-05 15:34:45 +0000158</code></pre>
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000159somewhere at the beginning of <code>MW_TclHeader.pch</code>.
160As distributed, tcl and tk assume that malloc calls always succeed and
161use the resulting pointer without checking for <code>NULL</code>
162values. Needless to say, this wreaks havoc on a Macintosh.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000163
Jack Jansen27b10ec1996-08-23 15:44:18 +0000164<LI> If you want to build for CFM68K you have to modify <code>TclMacNotify.c</code>
165because there is an error in the Apple Universal headers (sic!). Read the
166comments at the beginning of <code>Mac:Python:macglue.c</code> and copy the
167code to <code>TclMacNotify.c</code>. If you get linker errors on <code>GetEvQHdr</code>
168you have not done this correctly.
169
Jack Jansen8f2d8021996-08-05 15:34:45 +0000170</UL>
171
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000172Build first the MoreFiles library, then the Tcl library, then
173SimpleTcl (test it by typing <code>ls -l</code> in the window you get)
174then the Tk library, then SimpleTk (which can again be tested with
175<code>ls -l</code>). If this all worked you are all set to try
Jack Jansen8f2d8021996-08-05 15:34:45 +0000176building Python.
177
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000178<H2>Building Waste</H2>
179
180You do not need to build the Waste libraries, as Python includes the
181source modules themselves. You have to make one modification,
182though. In file <code>ICCFMGlue.c</code> in folder <code>Minimal IC
183APIs</code>, add the following lines:
184
185<blockquote><pre><code>
186#include <Gestalt.h>
187#include <Errors.h>
188</code></pre></blockquote>
189
Jack Jansen8f2d8021996-08-05 15:34:45 +0000190<H2>The organization of the Python source tree</H2>
191
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000192Time for a short break, while we have a look at the organization of
193the Python source tree. At the top level, we find the following
194folders:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000195
196<DL>
197<DT> build.mac68k.stand
Jack Jansen27b10ec1996-08-23 15:44:18 +0000198<DD> This is where you will build static 68K interpreters.
199
200<DT> build.mac68k.shared
201<DD> This is where you build the CFM68K shared library, interpreter
202and applet framework.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000203
204<DT> build.macppc.shared
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000205<DD> This is where you build the PPC shared library, interpreter and
Jack Jansen27b10ec1996-08-23 15:44:18 +0000206applet framework. You can also build the fat applet framework here.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000207
208<DT> build.macppc.stand
209<DD> This is where you build a nonshared PPC interpreter (optional).
210
211<DT> Demo
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000212<DD> Demo programs that are not Mac-specific. Some of these may not
213work, the file <code>README-Mac</code> has some details.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000214
215<DT> Extensions
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000216<DD> Extensions to the interpreter that are not Mac-specific. Contains
217only the <code>img</code> extension in this distribution. Extensions
218are <em>not</em> built here, as they are on Unix, but incorporated in
219the core interpreter or built as plugin modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000220
221<DT> Grammar
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000222<DD> The Python grammar. Included for reference only, you cannot build
223the parser on a Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000224
225<DT> Include
226<DD> Machine-independent header files.
227
228<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000229<DD> Machine-independent optional modules. Not all of these will work
230on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000231
232<DT> Objects
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000233<DD> Machine-independent code for various objects. Most of these are
234not really optional: the interpreter will not function without them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000235
236<DT> Parser
237<DD> The Python parser (machine-independent).
238
239<DT> PlugIns
Jack Jansen27b10ec1996-08-23 15:44:18 +0000240<DD> This is where you build the PPC and CFM68K dynamically-loaded plugin modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000241
242<DT> Python
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000243<DD> The core interpreter. Most files are machine-independent, some
244are unix-specific and not used on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000245
246<DT> Tools
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000247<DD> Tools for python developers. Contains <code>modulator</code>
248which builds skeleton C extension modules and <code>bgen</code> which
249generates complete interface modules from information in C header
250files. There are some readme files, but more documentation is sorely
251needed.
252
Jack Jansen8f2d8021996-08-05 15:34:45 +0000253</DL>
254
255All the mac-specific stuff lives in the <code>Mac</code> folder:
256<DL>
257
258<DT> Compat
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000259<DD> Unix-compatability routines. Some of these are not used anymore,
260since CWGUSI provides a rather complete emulation, but you may need
261these if you are trying to build a non-GUSI python.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000262
263<DT> Demo
264<DD> Mac-specific demo programs, some of them annotated.
265
266<DT> Include
267<DD> Mac-specific but compiler-independent include files.
268
269<DT> Lib
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000270<DD> Mac-specific standard modules. The <code>toolbox</code> folder
271contains modules specifically needed with various MacOS toolbox
272interface modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000273
274<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000275<DD> Mac-specific builtin modules. Theoretically these are all
276optional, but some are rather essential (like
277<code>macmodule</code>). A lot of these modules are generated with
278<code>bgen</code>, in which case the bgen input files are included so
279you can attempt to regenerate them or extend them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000280
281<DT> MPW
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000282<DD> MPW-specific files. These have not been used or kept up-to-date
283for a long time, so use at your own risk.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000284
285<DT> mwerks
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000286<DD> Mwerks-specific sources and headers. Contains glue code for
287Pythons shared-library architecture, a replacement for
288<code>malloc</code> and a directory with various projects for building
289variations on the Python interpreter. The <code>mwerks_*.h</code>
290files here are the option-setting files for the various interpreters
291and such, comparable to the unix command-line <code>-D</code> options
292to the compiler. Each project uses the correct option file as its
293"prefix file" in the "C/C++ language" settings. Disabling optional
294modules (for the 68K interpreter), building non-GUSI interpreters and
295various other things are accomplished by modifying these files (and
296possibly changing the list of files included in the project window, of
297course).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000298
299<DT> Python
300<DD> Mac-specific parts of the core interpreter.
301
302<DT> Resources
303<DD> Resource files needed to build the interpreter.
304
305<DT> Scripts
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000306<DD> A collection of various mac-specific Python scripts. Some are
307essential, some are useful but few are documented, so you will have to
308use your imagination to work them out.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000309
310<DT> Unsupported
311<DD> Modules that are not supported any longer but may still work with a little effort.
312</DL>
313
314<H2>Building the 68K interpreter</H2>
315
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000316If you have all the optional libraries mentioned <A
317HREF="#optional">above</A> loaded buildin Python for 68K macs is a
318breeze: open the project in the folder <code>build.mac68k.stand</code>
319and build it. Do <em>not</em> run it yet, this will possibly result
320in a garbled preferences file. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000321
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000322First remove the <code>Python preferences</code> file from your
323preference folder, only if you had an older version of Python
324installed. (this is also what you do if you did not heed the last
325sentence of the preceeding paragraph). Next, move the interpreter to
326the main Python folder (up one level) and run it there. This will
327create a correct initial preferences file. You are now all set, and
328your tree should be completely compatible with a binary-only
329distribution. Read the release notes
330(<code>Relnotes-somethingorother</code>) and
331<code>ReadMeOrSuffer</code> in the <code>Mac</code> folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000332
Jack Jansen27b10ec1996-08-23 15:44:18 +0000333<H2>Building the CFM68K interpreter</H2>
334
335Building the CFM68K interpreter is as almost exactly the same as building
336the PPC interpreter, with the exception that you should read "CFM68K"
337for "PPC" every time. Continue reading with the next section.
338
Jack Jansen8f2d8021996-08-05 15:34:45 +0000339<H2>Building the PPC interpreter</H2>
340
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000341First you build the interpreter, core library and applet skeleton in
342folder <code>build.macppc.stand</code>. The order to build things is
343the following:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000344
345<DL>
Jack Jansen27b10ec1996-08-23 15:44:18 +0000346<DT> MWRuntimeStaticLib
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000347<DD> A modified version of the MetroWerks runtime library that is
348suitable for Pythons' shared library architecture. The sources all
349come from the MW distribution.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000350
Jack Jansen27b10ec1996-08-23 15:44:18 +0000351<DT> PythonCorePPC
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000352<DD> The shared library that contains the bulk of the interpreter and
353its resources. It is a good idea to immedeately put an alias to this
354shared library in the <code>Extensions</code> folder of your system
355folder. Do exactly that: put an <em>alias</em> there, copying or
356moving the file will cause you grief later.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000357
358<DT> PythonPPC
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000359<DD> The interpreter. This is basically a routine to call out to the
360shared library. Because of the organization of GUSI it also contains
361the Gusi settings resource (together with a ResEdit template, so you
362can change the gusi settings should you feel like doing so). Do
363<em>not</em> run it yet, this will possibly result in a garbled
364preferences file. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000365
366<DT> PythonApplet
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000367<DD> The applet skeleton application. Very similar to
368<code>PythonPPC</code>, but it calls to a different entrypoint in the
369core library. The <code>mkapplet</code> script will copy this complete
370file, and add a <code>'PYC '</code> with the module to generate an
371applet. <p>
372
Jack Jansen8f2d8021996-08-05 15:34:45 +0000373</DL>
374
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000375After creating the alias to <code>PythonCore</code> you should move
376<code>PythonPPC</code> to the main Python folder. Next you remove any
377old <code>Python Preferences</code> file from the
378<code>Preferences</code> folder (if you had python installed on your
379system before) and run the interpreter once to create the correct
380preferences file. You should also make an alias to
381<code>PythonApplet</code> in the main Python folder. (again: making an
382alias is preferrable to copying or moving the file, since this will
383cause the correct file to be used if you ever rebuild
384PythonApplet). <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000385
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000386Next, you have to build the extension modules in the
Jack Jansen27b10ec1996-08-23 15:44:18 +0000387<code>PlugIns</code> folder. Open each project with <code>.ppc</code> in the
388name and build it. After all
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000389the dynamically loaded modules are built you have to create a number
390of aliases: some modules live together in a single dynamic
Jack Jansen27b10ec1996-08-23 15:44:18 +0000391library. Run the <code>MkPluginAliases.py</code> script from
392<code>Mac:scripts</code> to create the aliases. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000393
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000394Finally, you must build the standard applets:
395<code>EditPythonPrefs</code>, <code>mkapplet</code>, etc. This is
396easiest done with the <code>fullbuild</code> script from
397<code>Mac:scripts</code>. Answer <em>no</em> to all questions except
398when it asks whether to build the applets. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000399
400<BLOCKQUOTE>
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000401Actually, the <code>fullbuild</code> script can be used to build
402everything, but you need a fully-functional interpreter before you can
403use it (and one that isn't rebuilt in the process: you cannot rebuild
404a running program). You could copy the 68K interpreter to a different
405place and use that to run fullbuild, or use the standalone PPC python
406for this. I tend to keep a standalone interpreter in a safe place for
407this use only.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000408</BLOCKQUOTE>
409
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000410You are all set now, and should read the release notes and
411<code>ReadMeOrSuffer</code> file from the <code>Mac</code> folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000412
Jack Jansen27b10ec1996-08-23 15:44:18 +0000413<H2>Rebuilding <code>.exp</code> files for PPC and CFM68K</H2>
414
415Occasionally it may be necessary to rebuild your PythonCore <code>.exp</code>
416file, a file that controls which symbols are exported by your PythonCore
417shared library. Rebuild it if you get unexpected undefined symbols when you
418are building a plugin module. <p>
419
420Rebuilding the .exp file is done by first removing the file and removing the
421reference to it in the project (in the "config" section). Next, build PythonCore.
422This will create a new .exp file. Edit this file to remove the references to
423the symbols <code>__initialize</code>, <code>__terminate</code>, <code>setjmp</code>,
424<code>longjmp</code> and <code>__ptmf_null</code>. Next, add the .exp file to the project
425again and rebuild PythonCore. <p>
426
427This rather convoluted procedure is needed to ensure that plugin modules don't
428accidentally link with those entrypoints from PythonCore, which will not work because
429those routines have to be in the same code fragment as they are used from.
430
Jack Jansen8f2d8021996-08-05 15:34:45 +0000431<H2>Odds and ends</H2>
432
433Some remarks that I could not fit in elsewhere:
434
435<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000436
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000437<LI> It may be possible to use the <code>PythonCore</code> shared
438library to embed Python in another program, if your program can live
439with using GUSI for I/O. Use PythonCore in stead of your C library
440(or, at the very least, link it before the normal C library). Let me
441know whether this works.
442
443<LI> It is possible to build PPC extension modules without building a
444complete Python. Take the binary distribution, add folders
445<code>Include</code>, <code>Mac:Include</code> and
446<code>Mac:mwerks</code> from the source distribution and you should be
447all set. A template for a dynamic module can be found in
Jack Jansen27b10ec1996-08-23 15:44:18 +0000448<code>xx.ppc.µ</code> or <code>xx.CFM68K.µ</code>.
449
450<LI> The Python shared library architecture is a variant of the architecture
451described as "application with shared libraries and dropins" in the MetroWerks
452"Targeting MacOS" documentation. The Python Application and applet-template use
453the <code>AppRuntime.Lib</code> runtime library (with properly set CFM
454initialization and termination routines). PythonCore uses <code>ShlibRuntime.Lib</code>
455and <code>MWRuntimeStaticLib.Lib</code>, which is almost identical to the MW
456standard <code>MWRuntimeLib</code>, but not dynamically loaded. This library contains
457the part of the runtime that can (or must) be shared between all modules in the program.
458It is linked statically into PythonCore (and exported to the applications and plugins)
459so we do not have to distribute yet another shared library. Plugin modules use
460<code>ShlibRuntime.Lib</code> and obtain the rest from PythonCore. PythonCore uses a
461non-standard initialization entry point, <code>__initialize_with_resources</code>, to
462be able to obtain resources from the library file lateron. Plugins can do the same or
463use the standard <code>__initialize</code> entry point.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000464
465
466<UL>
467</BODY>
468</HTML>