blob: c27de03040c3ec816ac6e6dd7f2ee37143e900d1 [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
Jack Jansen1473af71997-05-07 15:43:38 +000035HREF="ftp://ftp.cwi.nl/pub/jack/python/mac">ftp://ftp.cwi.nl/pub/jack/python/mac</A>
36or from the companion webpage at <A HREF="http://www.cwi.nl/~jack/macpython.html">
37http://www.cwi.nl/~jack/macpython.html</A> (which has up-to-date links to the other
38packages needed too)
Jack Jansen4c1e56c1996-08-06 16:16:20 +000039and possibly also from the standard <A
40HREF="ftp://ftp.python.org/pub/python/mac">python.org ftp
41site</A>. Everything you need is also included in the standard Python
42source distribution, but the organization is different. Look in
43directory <code>Mac/mwerks/projects</code> for the project files and
44related stuff.
Jack Jansen8f2d8021996-08-05 15:34:45 +000045
Jack Jansen4c1e56c1996-08-06 16:16:20 +000046<LI> You need MetroWerks CodeWarrior. The current distribution has
Jack Jansen32617191997-08-19 14:01:16 +000047been built with CodeWarrior Pro 1. Ordering information is
Jack Jansen4c1e56c1996-08-06 16:16:20 +000048available on the <A HREF="http://www.metrowerks.com/">MetroWerks
49homepage</A>. You might still be able to build Python with MPW or
50Think/Symantec C but you are basically on your own.
51
52<LI> You need GUSI, the Grand Unified Socket Interface, by Matthias
Jack Jansen1473af71997-05-07 15:43:38 +000053Neeracher. The original CWGUSI is
Jack Jansen4c1e56c1996-08-06 16:16:20 +000054obtainable from <A
Jack Jansenf3dd5aa1996-12-23 17:29:51 +000055HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/src">
Jack Jansene66b8c81997-05-29 14:57:07 +000056ftp://sunsite.cnlab-switch.ch/software/platform/macos/src</A>.
Jack Jansen32617191997-08-19 14:01:16 +000057At the moment Python is built with a slightly modified version of GUSI 1.8.1fc2,
Jack Jansene66b8c81997-05-29 14:57:07 +000058these modifications are available in folder <code>Python:Mac:GUSI-mods</code>.
Jack Jansen4c1e56c1996-08-06 16:16:20 +000059
Jack Jansen8f2d8021996-08-05 15:34:45 +000060</UL>
61
Jack Jansen4c1e56c1996-08-06 16:16:20 +000062<A NAME="optional">The MacPython project files are configured to
63include a plethora of optional modules</A>, and these modules need a
64number extra packages. To use the project files as-is you have to
Jack Jansen27b10ec1996-08-23 15:44:18 +000065download these packages too. PPC and CFM68K Python have all such modules as
Jack Jansen4c1e56c1996-08-06 16:16:20 +000066dynamically loaded modules, so if you don't need a certain package it
Jack Jansen27b10ec1996-08-23 15:44:18 +000067suffices to just refrain from builing the extension module. For static 68K
Jack Jansen4c1e56c1996-08-06 16:16:20 +000068Python things are a bit more complicated: you have to edit the
69interpreter project file to remove the reference to the module (and
Jack Jansen27b10ec1996-08-23 15:44:18 +000070the libraries it uses), and edit the <code>Mac:mwerks:mwerks_nonshared_config.h</code>
71file to remove the <code>USE_...</code> line. Here are the locations for the various things
Jack Jansen4c1e56c1996-08-06 16:16:20 +000072you need:
Jack Jansen8f2d8021996-08-05 15:34:45 +000073
74<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +000075
Jack Jansen4c1e56c1996-08-06 16:16:20 +000076<LI> Tcl and Tk can be obtained from <A
77HREF="ftp://ftp.smli.com/pub/tcl/mac/">ftp://ftp.smli.com/pub/tcl/mac/</A>.
Jack Jansenf3dd5aa1996-12-23 17:29:51 +000078The current distributions, Tcl 7.6 and Tk 4.2 need a bit of work,
Jack Jansen4c1e56c1996-08-06 16:16:20 +000079see the section on <A HREF="#tcltk">building Tcl/Tk Python</A>
80below. Get the "full source" distribution, which includes MoreFiles.
Jack Jansen8f2d8021996-08-05 15:34:45 +000081
Jack Jansen4c1e56c1996-08-06 16:16:20 +000082<LI> Waste, a TextEdit replacement written by Marco Piovanelli, <A
83HREF="mailto:piovanel@kagi.com">&lt;piovanel@kagi.com&gt;</A>. Python
84was built using version 1.2, which you can obtain from <A
85HREF="ftp://rhino.harvard.edu/pub/dan/WASTE">&lt;ftp://rhino.harvard.edu/pub/dan/WASTE&gt;</A>
86and various other places.
Jack Jansen8f2d8021996-08-05 15:34:45 +000087
Jack Jansen1473af71997-05-07 15:43:38 +000088<LI> Gdbm library for the Mac. Available from Jack's Mac software page at
89<A HREF="http://www.cwi.nl/~jack/macsoftware.html">
90http://www.cwi.nl/~jack/macsoftware.html</A> and <A HREF="ftp://ftp.cwi.nl/pub/jack/mac">
91ftp://ftp.cwi.nl/pub/jack/mac</A>.
92
93<LI> JPEG library by the Independent JPEG Group. A version including
94Mac projects can be found at Jack's page mentioned above.
95The most recent JPEG library can always be obtained from <A
Jack Jansen4c1e56c1996-08-06 16:16:20 +000096HREF="ftp://ftp.uu.net/graphics/jpeg/">ftp://ftp.uu.net/graphics/jpeg/</A>.
97
Jack Jansen1473af71997-05-07 15:43:38 +000098<LI> The netpbm/pbmplus, libtiff, zlib and png libraries. The netpbm distribution
Jack Jansen4c1e56c1996-08-06 16:16:20 +000099(which includes libtiff) is generally available on Internet ftp
100servers. For Python pbmplus, an older incarnation of netpbm, is
101functionally identical to netpbm, since Python only uses the library
102and not the complete applications. A distribution with correct
Jack Jansen1473af71997-05-07 15:43:38 +0000103projects and library source only is available from, you guessed it, Jack's Mac software
104page mentioned above.
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000105
Jack Jansen8f2d8021996-08-05 15:34:45 +0000106</UL>
107
108<H2>Setting Up</H2>
109
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000110Now that you have collected everything you should start with building
Jack Jansen1473af71997-05-07 15:43:38 +0000111the various parts. If you don't want to fix
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000112access paths try to set things up as follows:
113
Jack Jansen8f2d8021996-08-05 15:34:45 +0000114<PRE>
115Top-level-folder:
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000116 CWGUSI
Jack Jansen8f2d8021996-08-05 15:34:45 +0000117 imglibs
118 libjpeg
119 pbmplus
Jack Jansen1473af71997-05-07 15:43:38 +0000120 libtiff
121 zlib
122 libpng
123 gdbm
Jack Jansen8f2d8021996-08-05 15:34:45 +0000124 Python
Jack Jansen32617191997-08-19 14:01:16 +0000125 Tcl/Tk Folder
126 tcl8.0
127 tk8.0
128 MoreFiles 1.4.3
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000129 Waste 1.2 distribution (if you want waste)
Jack Jansen8f2d8021996-08-05 15:34:45 +0000130</PRE>
131
Jack Jansen1473af71997-05-07 15:43:38 +0000132First build GUSI. If you didn't get the python-specific GUSI you have to
133move the files from the "CWGUSI-mods" to the right
Jack Jansen32617191997-08-19 14:01:16 +0000134place in the CWGUSI distribution folder. Build the MSL target for your
135platform (MSLGUSI PPC, MSLGUSI 68K or MSLGUSI CFM68K). <p>
Jack Jansen16e99c01996-09-07 17:11:26 +0000136
137Next, in
Jack Jansen1473af71997-05-07 15:43:38 +0000138<code>MoreFiles</code>, <code>libjpeg</code>, <code>pbmplus</code>,
139<code>zlib</code>, <code>libpng</code>, <code>gdbm</code>,
Jack Jansen32617191997-08-19 14:01:16 +0000140and<code>libtiff</code> you build all projects. The projects are in "mac"
Jack Jansen1473af71997-05-07 15:43:38 +0000141subfolders, sometimes they are in the main folder. Tcl/tk is a special
Jack Jansen27b10ec1996-08-23 15:44:18 +0000142case, see below. Of course, if you are only interested in one of
143static 68K, CFM68K or PPC you can skip building the other libraries.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000144
145<H2><A NAME="tcltk">Building Tcl/Tk</H2>
146
Jack Jansen32617191997-08-19 14:01:16 +0000147You need to make some minor changes to the Tcl/Tk 8.0 beta2
148distribution. You should make the CW Pro projects TclLibraries.¹ and
149TkLibraries.¹ (in the mac subfolders).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000150<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000151
Jack Jansen32617191997-08-19 14:01:16 +0000152<LI> There are no cfm68k targets. You make these by copying the 68k targets,
153setting the "68k target" to "cfm68k library" and changing the output filename,
154and changing the prefix
155header filename in the C/C++ settings panel to "MW_???HeaderCFM68K".
Jack Jansene66b8c81997-05-29 14:57:07 +0000156
Jack Jansen32617191997-08-19 14:01:16 +0000157<LI> I had to add Search.c (from MoreFiles) to the tcl library projects. I don't
158understand why this is, but it seemed to cure the problems I had.
Jack Jansenf3dd5aa1996-12-23 17:29:51 +0000159
160<LI> Note that if you use a different release of Tcl and Tk than the ones
161I have used you may have to adapt the Python <code>tkresources.rsrc</code> file.
162This is easiest done by building <code>SimpleTk</code> and copying the TEXT, ICON
163and CRSR resources from it to <code>tkresources.rsrc</code>. This allows
164the <code>_tkinter</code> module to work without an installed Tk/Tcl on your
165machine.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000166
Jack Jansen8f2d8021996-08-05 15:34:45 +0000167</UL>
168
Jack Jansenf3dd5aa1996-12-23 17:29:51 +0000169Build first the Tcl library, then
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000170SimpleTcl (test it by typing <code>ls -l</code> in the window you get)
171then the Tk library, then SimpleTk (which can again be tested with
172<code>ls -l</code>). If this all worked you are all set to try
Jack Jansen8f2d8021996-08-05 15:34:45 +0000173building Python.
174
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000175<H2>Building Waste</H2>
176
177You do not need to build the Waste libraries, as Python includes the
178source modules themselves. You have to make one modification,
179though. In file <code>ICCFMGlue.c</code> in folder <code>Minimal IC
180APIs</code>, add the following lines:
181
182<blockquote><pre><code>
183#include <Gestalt.h>
184#include <Errors.h>
185</code></pre></blockquote>
186
Jack Jansen8f2d8021996-08-05 15:34:45 +0000187<H2>The organization of the Python source tree</H2>
188
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000189Time for a short break, while we have a look at the organization of
190the Python source tree. At the top level, we find the following
191folders:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000192
193<DL>
Jack Jansen32617191997-08-19 14:01:16 +0000194<DT> build.mac
195<DD> This is where you build the PPC, CFM68K and Fat shared libraries,
196interpreter and applet framework. The Fat versions, which are derived
197from the other two, are deposited in the parent folder.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000198
Jack Jansen32617191997-08-19 14:01:16 +0000199<DT> build.macstand
200<DD> This is where you build static 68K interpreters, and possibly static
201PPC interpreters (but you probably won't need those).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000202
203<DT> Demo
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000204<DD> Demo programs that are not Mac-specific. Some of these may not
205work, the file <code>README-Mac</code> has some details.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000206
207<DT> Extensions
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000208<DD> Extensions to the interpreter that are not Mac-specific. Contains
209only the <code>img</code> extension in this distribution. Extensions
210are <em>not</em> built here, as they are on Unix, but incorporated in
211the core interpreter or built as plugin modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000212
213<DT> Grammar
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000214<DD> The Python grammar. Included for reference only, you cannot build
215the parser on a Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000216
217<DT> Include
218<DD> Machine-independent header files.
219
220<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000221<DD> Machine-independent optional modules. Not all of these will work
222on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000223
224<DT> Objects
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000225<DD> Machine-independent code for various objects. Most of these are
226not really optional: the interpreter will not function without them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000227
228<DT> Parser
229<DD> The Python parser (machine-independent).
230
231<DT> PlugIns
Jack Jansen27b10ec1996-08-23 15:44:18 +0000232<DD> This is where you build the PPC and CFM68K dynamically-loaded plugin modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000233
234<DT> Python
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000235<DD> The core interpreter. Most files are machine-independent, some
236are unix-specific and not used on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000237
238<DT> Tools
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000239<DD> Tools for python developers. Contains <code>modulator</code>
240which builds skeleton C extension modules and <code>bgen</code> which
241generates complete interface modules from information in C header
242files. There are some readme files, but more documentation is sorely
243needed.
244
Jack Jansen8f2d8021996-08-05 15:34:45 +0000245</DL>
246
247All the mac-specific stuff lives in the <code>Mac</code> folder:
248<DL>
249
250<DT> Compat
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000251<DD> Unix-compatability routines. Some of these are not used anymore,
252since CWGUSI provides a rather complete emulation, but you may need
253these if you are trying to build a non-GUSI python.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000254
255<DT> Demo
256<DD> Mac-specific demo programs, some of them annotated.
257
258<DT> Include
259<DD> Mac-specific but compiler-independent include files.
260
261<DT> Lib
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000262<DD> Mac-specific standard modules. The <code>toolbox</code> folder
263contains modules specifically needed with various MacOS toolbox
264interface modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000265
266<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000267<DD> Mac-specific builtin modules. Theoretically these are all
268optional, but some are rather essential (like
269<code>macmodule</code>). A lot of these modules are generated with
270<code>bgen</code>, in which case the bgen input files are included so
271you can attempt to regenerate them or extend them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000272
273<DT> MPW
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000274<DD> MPW-specific files. These have not been used or kept up-to-date
275for a long time, so use at your own risk.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000276
277<DT> mwerks
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000278<DD> Mwerks-specific sources and headers. Contains glue code for
279Pythons shared-library architecture, a replacement for
280<code>malloc</code> and a directory with various projects for building
281variations on the Python interpreter. The <code>mwerks_*.h</code>
282files here are the option-setting files for the various interpreters
283and such, comparable to the unix command-line <code>-D</code> options
284to the compiler. Each project uses the correct option file as its
285"prefix file" in the "C/C++ language" settings. Disabling optional
286modules (for the 68K interpreter), building non-GUSI interpreters and
287various other things are accomplished by modifying these files (and
288possibly changing the list of files included in the project window, of
289course).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000290
291<DT> Python
292<DD> Mac-specific parts of the core interpreter.
293
294<DT> Resources
295<DD> Resource files needed to build the interpreter.
296
297<DT> Scripts
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000298<DD> A collection of various mac-specific Python scripts. Some are
299essential, some are useful but few are documented, so you will have to
300use your imagination to work them out.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000301
302<DT> Unsupported
303<DD> Modules that are not supported any longer but may still work with a little effort.
304</DL>
305
306<H2>Building the 68K interpreter</H2>
307
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000308If you have all the optional libraries mentioned <A
309HREF="#optional">above</A> loaded buildin Python for 68K macs is a
310breeze: open the project in the folder <code>build.mac68k.stand</code>
311and build it. Do <em>not</em> run it yet, this will possibly result
312in a garbled preferences file. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000313
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000314First remove the <code>Python preferences</code> file from your
315preference folder, only if you had an older version of Python
316installed. (this is also what you do if you did not heed the last
317sentence of the preceeding paragraph). Next, move the interpreter to
318the main Python folder (up one level) and run it there. This will
319create a correct initial preferences file. You are now all set, and
320your tree should be completely compatible with a binary-only
321distribution. Read the release notes
322(<code>Relnotes-somethingorother</code>) and
323<code>ReadMeOrSuffer</code> in the <code>Mac</code> folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000324
Jack Jansen27b10ec1996-08-23 15:44:18 +0000325<H2>Building the CFM68K interpreter</H2>
326
327Building the CFM68K interpreter is as almost exactly the same as building
328the PPC interpreter, with the exception that you should read "CFM68K"
329for "PPC" every time. Continue reading with the next section.
330
Jack Jansen8f2d8021996-08-05 15:34:45 +0000331<H2>Building the PPC interpreter</H2>
332
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000333First you build the interpreter, core library and applet skeleton in
334folder <code>build.macppc.stand</code>. The order to build things is
335the following:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000336
337<DL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000338
Jack Jansen27b10ec1996-08-23 15:44:18 +0000339<DT> PythonCorePPC
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000340<DD> The shared library that contains the bulk of the interpreter and
341its resources. It is a good idea to immedeately put an alias to this
342shared library in the <code>Extensions</code> folder of your system
343folder. Do exactly that: put an <em>alias</em> there, copying or
344moving the file will cause you grief later.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000345
346<DT> PythonPPC
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000347<DD> The interpreter. This is basically a routine to call out to the
Jack Jansen1473af71997-05-07 15:43:38 +0000348shared library. Do
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000349<em>not</em> run it yet, this will possibly result in a garbled
Jack Jansen1473af71997-05-07 15:43:38 +0000350preferences file. See the section below on rebuilding .exp files if you
351get funny linker errors. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000352
Jack Jansen061ac501996-10-22 15:27:56 +0000353<DT> PythonAppletPPC
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000354<DD> The applet skeleton application. Very similar to
355<code>PythonPPC</code>, but it calls to a different entrypoint in the
356core library. The <code>mkapplet</code> script will copy this complete
357file, and add a <code>'PYC '</code> with the module to generate an
358applet. <p>
359
Jack Jansen8f2d8021996-08-05 15:34:45 +0000360</DL>
361
Jack Jansen061ac501996-10-22 15:27:56 +0000362After creating the alias to <code>PythonCorePPC</code> you should move
363<code>PythonPPC</code> to the main Python folder. Next you remove any old
364<code>Python XXX Preferences</code> file from the <code>Preferences</code> folder
365(if you had python installed on your system before) and run the interpreter once
366to create the correct preferences file. You should also make an alias
367<code>PythonApplet</code> pointing to <code>PythonAppletPPC</code> in the main
368Python folder. (again: making an alias is preferrable to copying or moving the
369file, since this will cause the correct file to be used if you ever rebuild
370PythonAppletPPC). <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000371
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000372Next, you have to build the extension modules in the
Jack Jansen27b10ec1996-08-23 15:44:18 +0000373<code>PlugIns</code> folder. Open each project with <code>.ppc</code> in the
374name and build it. After all
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000375the dynamically loaded modules are built you have to create a number
376of aliases: some modules live together in a single dynamic
Jack Jansen27b10ec1996-08-23 15:44:18 +0000377library. Run the <code>MkPluginAliases.py</code> script from
378<code>Mac:scripts</code> to create the aliases. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000379
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000380Finally, you must build the standard applets:
381<code>EditPythonPrefs</code>, <code>mkapplet</code>, etc. This is
382easiest done with the <code>fullbuild</code> script from
383<code>Mac:scripts</code>. Answer <em>no</em> to all questions except
384when it asks whether to build the applets. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000385
386<BLOCKQUOTE>
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000387Actually, the <code>fullbuild</code> script can be used to build
388everything, but you need a fully-functional interpreter before you can
389use it (and one that isn't rebuilt in the process: you cannot rebuild
390a running program). You could copy the 68K interpreter to a different
391place and use that to run fullbuild, or use the standalone PPC python
392for this. I tend to keep a standalone interpreter in a safe place for
Jack Jansene66b8c81997-05-29 14:57:07 +0000393this use only. <p>
394
395Using fullbuild is also the only easy way to buid the fat application and applet.
396See the fullbuild source for details on how to build the fat binaries "by hand".
397
Jack Jansen8f2d8021996-08-05 15:34:45 +0000398</BLOCKQUOTE>
399
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000400You are all set now, and should read the release notes and
401<code>ReadMeOrSuffer</code> file from the <code>Mac</code> folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000402
Jack Jansen27b10ec1996-08-23 15:44:18 +0000403<H2>Rebuilding <code>.exp</code> files for PPC and CFM68K</H2>
404
405Occasionally it may be necessary to rebuild your PythonCore <code>.exp</code>
406file, a file that controls which symbols are exported by your PythonCore
407shared library. Rebuild it if you get unexpected undefined symbols when you
408are building a plugin module. <p>
409
410Rebuilding the .exp file is done by first removing the file and removing the
411reference to it in the project (in the "config" section). Next, build PythonCore.
412This will create a new .exp file. Edit this file to remove the references to
413the symbols <code>__initialize</code>, <code>__terminate</code>, <code>setjmp</code>,
Jack Jansen1473af71997-05-07 15:43:38 +0000414<code>longjmp</code>, <code>main</code> and (for PPC) <code>__ptmf_null</code> or (for
415CFM68K) <code>__start</code> and <code>dummy_init_routine</code>.
416Next, add the .exp file to the project
Jack Jansen27b10ec1996-08-23 15:44:18 +0000417again and rebuild PythonCore. <p>
418
419This rather convoluted procedure is needed to ensure that plugin modules don't
420accidentally link with those entrypoints from PythonCore, which will not work because
421those routines have to be in the same code fragment as they are used from.
422
Jack Jansen8f2d8021996-08-05 15:34:45 +0000423<H2>Odds and ends</H2>
424
425Some remarks that I could not fit in elsewhere:
426
427<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000428
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000429<LI> It may be possible to use the <code>PythonCore</code> shared
430library to embed Python in another program, if your program can live
Jack Jansen1473af71997-05-07 15:43:38 +0000431with using GUSI for I/O. Use PythonCore in stead of your MSL C library
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000432(or, at the very least, link it before the normal C library). Let me
433know whether this works.
434
435<LI> It is possible to build PPC extension modules without building a
436complete Python. Take the binary distribution, add folders
437<code>Include</code>, <code>Mac:Include</code> and
438<code>Mac:mwerks</code> from the source distribution and you should be
439all set. A template for a dynamic module can be found in
Jack Jansen27b10ec1996-08-23 15:44:18 +0000440<code>xx.ppc.µ</code> or <code>xx.CFM68K.µ</code>.
441
442<LI> The Python shared library architecture is a variant of the architecture
443described as "application with shared libraries and dropins" in the MetroWerks
444"Targeting MacOS" documentation. The Python Application and applet-template use
Jack Jansen1473af71997-05-07 15:43:38 +0000445the <code>MSL AppRuntime.Lib</code> runtime library (with properly set CFM
446initialization and termination routines). PythonCore uses <code>MSL Runtime.Lib</code>,
447which is really intended for standalone programs but which we fool into working by
448providing a dummy main program.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000449It is linked statically into PythonCore (and exported to the applications and plugins)
450so we do not have to distribute yet another shared library. Plugin modules use
Jack Jansen1473af71997-05-07 15:43:38 +0000451<code>MSL ShlibRuntime.Lib</code> (not the dropin runtime: modules are never unloaded)
452and obtain the rest from PythonCore. PythonCore uses a
Jack Jansen27b10ec1996-08-23 15:44:18 +0000453non-standard initialization entry point, <code>__initialize_with_resources</code>, to
Jack Jansen1473af71997-05-07 15:43:38 +0000454be able to obtain resources from the library file later on. Plugins can do the same
455(_tkinter does) or use the standard <code>__initialize</code> entry point.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000456
457
Jack Jansen6ad8d131997-01-15 16:53:37 +0000458</UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000459</BODY>
460</HTML>