blob: 7d3aa926f33fac558d07f10867b894ee4c4ae294 [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 Jansena2139fe1998-02-25 15:40:35 +000047been built with CodeWarrior Pro 2. Ordering information is
Jack Jansen4c1e56c1996-08-06 16:16:20 +000048available on the <A HREF="http://www.metrowerks.com/">MetroWerks
Jack Jansena2139fe1998-02-25 15:40:35 +000049homepage</A>. Building Python with MPW or Think/Symantec C is
50probably impossible without major surgery.
Jack Jansen4c1e56c1996-08-06 16:16:20 +000051
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 Jansen3412c5d1997-08-27 14:08:22 +000057At the moment Python is built with a slightly modified version of GUSI,
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
Jack Jansena2139fe1998-02-25 15:40:35 +000064number of 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 Jansen44a89311997-12-23 22:56:25 +000078The current distributions, Tcl 8.0p2 and Tk 8.0p2 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
Jack Jansena2139fe1998-02-25 15:40:35 +000084was built using version 1.3, which you can obtain from <A
85HREF="http://www.boingo.com/waste">&lt;http://www.boingo.com/waste&gt;</A>
Jack Jansen4c1e56c1996-08-06 16:16:20 +000086and 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
Jack Jansena2139fe1998-02-25 15:40:35 +0000128 MoreFiles 1.4.3
129 Waste 1.3 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 Jansen3412c5d1997-08-27 14:08:22 +0000134place in the CWGUSI distribution folder. Build the MSL version for your
135platform (ppc, 68k, 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 Jansena2139fe1998-02-25 15:40:35 +0000140and<code>libtiff</code> you build all projects. Usually 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 Jansen3412c5d1997-08-27 14:08:22 +0000147You need to make some minor changes to the Tcl/Tk 8.0
148distribution. You should make the CW Pro projects (in the mac subfolders).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000149<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000150
Jack Jansen32617191997-08-19 14:01:16 +0000151<LI> There are no cfm68k targets. You make these by copying the 68k targets,
152setting the "68k target" to "cfm68k library" and changing the output filename,
153and changing the prefix
154header filename in the C/C++ settings panel to "MW_???HeaderCFM68K".
Jack Jansene66b8c81997-05-29 14:57:07 +0000155
Jack Jansen32617191997-08-19 14:01:16 +0000156<LI> I had to add Search.c (from MoreFiles) to the tcl library projects. I don't
157understand why this is, but it seemed to cure the problems I had.
Jack Jansenf3dd5aa1996-12-23 17:29:51 +0000158
159<LI> Note that if you use a different release of Tcl and Tk than the ones
160I have used you may have to adapt the Python <code>tkresources.rsrc</code> file.
161This is easiest done by building <code>SimpleTk</code> and copying the TEXT, ICON
162and CRSR resources from it to <code>tkresources.rsrc</code>. This allows
163the <code>_tkinter</code> module to work without an installed Tk/Tcl on your
164machine.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000165
Jack Jansen8f2d8021996-08-05 15:34:45 +0000166</UL>
167
Jack Jansenf3dd5aa1996-12-23 17:29:51 +0000168Build first the Tcl library, then
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000169SimpleTcl (test it by typing <code>ls -l</code> in the window you get)
170then the Tk library, then SimpleTk (which can again be tested with
171<code>ls -l</code>). If this all worked you are all set to try
Jack Jansen8f2d8021996-08-05 15:34:45 +0000172building Python.
173
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000174<H2>Building Waste</H2>
175
176You do not need to build the Waste libraries, as Python includes the
Jack Jansena2139fe1998-02-25 15:40:35 +0000177source modules themselves.
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000178
Jack Jansen8f2d8021996-08-05 15:34:45 +0000179<H2>The organization of the Python source tree</H2>
180
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000181Time for a short break, while we have a look at the organization of
182the Python source tree. At the top level, we find the following
183folders:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000184
185<DL>
Jack Jansena2139fe1998-02-25 15:40:35 +0000186<DT> build.macstand
187<DD> This is where you build static 68K interpreter, and possibly (if
188you want them) static PPC and fat interpreters. There is also a project
189here that builds smaller versions of the static interpreter.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000190
Jack Jansena2139fe1998-02-25 15:40:35 +0000191<DT> build.mac
192<DD> This is where you build the CFM68K, PPC and fat shared library,
193interpreter and applet framework. The fat targets are deposited in the
194main folder (one level up), the others, which are intermediate results
195really, are left here.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000196
197<DT> Demo
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000198<DD> Demo programs that are not Mac-specific. Some of these may not
199work, the file <code>README-Mac</code> has some details.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000200
201<DT> Extensions
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000202<DD> Extensions to the interpreter that are not Mac-specific. Contains
203only the <code>img</code> extension in this distribution. Extensions
Jack Jansena2139fe1998-02-25 15:40:35 +0000204are not always built here, as they are on Unix, but sometimes incorporated in
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000205the core interpreter or built as plugin modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000206
207<DT> Grammar
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000208<DD> The Python grammar. Included for reference only, you cannot build
209the parser on a Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000210
211<DT> Include
212<DD> Machine-independent header files.
213
214<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000215<DD> Machine-independent optional modules. Not all of these will work
216on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000217
218<DT> Objects
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000219<DD> Machine-independent code for various objects. Most of these are
220not really optional: the interpreter will not function without them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000221
222<DT> Parser
223<DD> The Python parser (machine-independent).
224
225<DT> PlugIns
Jack Jansen27b10ec1996-08-23 15:44:18 +0000226<DD> This is where you build the PPC and CFM68K dynamically-loaded plugin modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000227
228<DT> Python
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000229<DD> The core interpreter. Most files are machine-independent, some
230are unix-specific and not used on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000231
232<DT> Tools
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000233<DD> Tools for python developers. Contains <code>modulator</code>
234which builds skeleton C extension modules and <code>bgen</code> which
235generates complete interface modules from information in C header
236files. There are some readme files, but more documentation is sorely
237needed.
238
Jack Jansen8f2d8021996-08-05 15:34:45 +0000239</DL>
240
241All the mac-specific stuff lives in the <code>Mac</code> folder:
242<DL>
243
244<DT> Compat
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000245<DD> Unix-compatability routines. Some of these are not used anymore,
246since CWGUSI provides a rather complete emulation, but you may need
247these if you are trying to build a non-GUSI python.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000248
249<DT> Demo
250<DD> Mac-specific demo programs, some of them annotated.
251
252<DT> Include
253<DD> Mac-specific but compiler-independent include files.
254
255<DT> Lib
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000256<DD> Mac-specific standard modules. The <code>toolbox</code> folder
257contains modules specifically needed with various MacOS toolbox
258interface modules.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000259
260<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000261<DD> Mac-specific builtin modules. Theoretically these are all
262optional, but some are rather essential (like
263<code>macmodule</code>). A lot of these modules are generated with
264<code>bgen</code>, in which case the bgen input files are included so
265you can attempt to regenerate them or extend them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000266
267<DT> MPW
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000268<DD> MPW-specific files. These have not been used or kept up-to-date
269for a long time, so use at your own risk.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000270
271<DT> mwerks
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000272<DD> Mwerks-specific sources and headers. Contains glue code for
273Pythons shared-library architecture, a replacement for
274<code>malloc</code> and a directory with various projects for building
275variations on the Python interpreter. The <code>mwerks_*.h</code>
276files here are the option-setting files for the various interpreters
277and such, comparable to the unix command-line <code>-D</code> options
278to the compiler. Each project uses the correct option file as its
279"prefix file" in the "C/C++ language" settings. Disabling optional
280modules (for the 68K interpreter), building non-GUSI interpreters and
281various other things are accomplished by modifying these files (and
282possibly changing the list of files included in the project window, of
283course).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000284
285<DT> Python
286<DD> Mac-specific parts of the core interpreter.
287
288<DT> Resources
289<DD> Resource files needed to build the interpreter.
290
291<DT> Scripts
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000292<DD> A collection of various mac-specific Python scripts. Some are
293essential, some are useful but few are documented, so you will have to
294use your imagination to work them out.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000295
296<DT> Unsupported
297<DD> Modules that are not supported any longer but may still work with a little effort.
298</DL>
299
300<H2>Building the 68K interpreter</H2>
301
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000302If you have all the optional libraries mentioned <A
303HREF="#optional">above</A> loaded buildin Python for 68K macs is a
Jack Jansen3412c5d1997-08-27 14:08:22 +0000304breeze: open the project in the folder <code>build.macstand</code> and
305build the 68K target. Do <em>not</em> run it yet, this will possibly
306result in a garbled preferences file. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000307
Jack Jansen3412c5d1997-08-27 14:08:22 +0000308First remove the <code>Python XXX preferences</code> file from your
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000309preference folder, only if you had an older version of Python
310installed. (this is also what you do if you did not heed the last
311sentence of the preceeding paragraph). Next, move the interpreter to
312the main Python folder (up one level) and run it there. This will
313create a correct initial preferences file. You are now all set, and
314your tree should be completely compatible with a binary-only
315distribution. Read the release notes
316(<code>Relnotes-somethingorother</code>) and
Jack Jansen3412c5d1997-08-27 14:08:22 +0000317<code>ReadMe</code> in the <code>Mac</code> folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000318
Jack Jansen3412c5d1997-08-27 14:08:22 +0000319<H2>Building the PPC and CFM68K interpreter</H2>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000320
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000321First you build the interpreter, core library and applet skeleton in
Jack Jansen3412c5d1997-08-27 14:08:22 +0000322folder <code>build.mac</code>. The projects are all linked together, so
323building the fat targets in <code>Python.prj</code> and
324<code>PythonApplet.prj</code> will result in everything being built. The
325resulting applications and fat shared library are deposited in the main
326Python folder. For completeness sake here is a breakdown of the
327projects:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000328
329<DL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000330
Jack Jansen3412c5d1997-08-27 14:08:22 +0000331<DT> PythonCore (with subprojects PythonCorePPC and PythonCoreCFM68K)
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000332<DD> The shared library that contains the bulk of the interpreter and
333its resources. It is a good idea to immedeately put an alias to this
334shared library in the <code>Extensions</code> folder of your system
335folder. Do exactly that: put an <em>alias</em> there, copying or
Jack Jansen3412c5d1997-08-27 14:08:22 +0000336moving the file will cause you grief later if you rebuild the library and
337forget to copy it to the extensions folder again.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000338
Jack Jansen3412c5d1997-08-27 14:08:22 +0000339<DT> Python
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000340<DD> The interpreter. This is basically a routine to call out to the
Jack Jansen3412c5d1997-08-27 14:08:22 +0000341shared library. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000342
Jack Jansen061ac501996-10-22 15:27:56 +0000343<DT> PythonAppletPPC
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000344<DD> The applet skeleton application. Very similar to
345<code>PythonPPC</code>, but it calls to a different entrypoint in the
346core library. The <code>mkapplet</code> script will copy this complete
347file, and add a <code>'PYC '</code> with the module to generate an
348applet. <p>
349
Jack Jansen8f2d8021996-08-05 15:34:45 +0000350</DL>
351
Jack Jansen3412c5d1997-08-27 14:08:22 +0000352After creating the alias to <code>PythonCore</code> you remove any old
Jack Jansen061ac501996-10-22 15:27:56 +0000353<code>Python XXX Preferences</code> file from the <code>Preferences</code> folder
354(if you had python installed on your system before) and run the interpreter once
Jack Jansen3412c5d1997-08-27 14:08:22 +0000355to create the correct preferences file. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000356
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000357Next, you have to build the extension modules in the
Jack Jansen3412c5d1997-08-27 14:08:22 +0000358<code>PlugIns</code> folder. The <code>PlugIns.ppc</code> project has all the
359other projects as subprojects and builds everything. After all
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000360the dynamically loaded modules are built you have to create a number
361of aliases: some modules live together in a single dynamic
Jack Jansen3412c5d1997-08-27 14:08:22 +0000362library. Run the <code>ConfigurePython.py</code> script from
Jack Jansen27b10ec1996-08-23 15:44:18 +0000363<code>Mac:scripts</code> to create the aliases. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000364
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000365Finally, you must build the standard applets:
Jack Jansen3412c5d1997-08-27 14:08:22 +0000366<code>EditPythonPrefs</code>, <code>BuildApplet</code>, etc. This is
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000367easiest done with the <code>fullbuild</code> script from
Jack Jansen3412c5d1997-08-27 14:08:22 +0000368<code>Mac:scripts</code>. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000369
370<BLOCKQUOTE>
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000371Actually, the <code>fullbuild</code> script can be used to build
372everything, but you need a fully-functional interpreter before you can
373use it (and one that isn't rebuilt in the process: you cannot rebuild
374a running program). You could copy the 68K interpreter to a different
375place and use that to run fullbuild, or use the standalone PPC python
376for this. I tend to keep a standalone interpreter in a safe place for
Jack Jansene66b8c81997-05-29 14:57:07 +0000377this use only. <p>
378
Jack Jansen8f2d8021996-08-05 15:34:45 +0000379</BLOCKQUOTE>
380
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000381You are all set now, and should read the release notes and
Jack Jansen3412c5d1997-08-27 14:08:22 +0000382<code>ReadMe</code> file from the <code>Mac</code> folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000383
Jack Jansen27b10ec1996-08-23 15:44:18 +0000384<H2>Rebuilding <code>.exp</code> files for PPC and CFM68K</H2>
385
386Occasionally it may be necessary to rebuild your PythonCore <code>.exp</code>
387file, a file that controls which symbols are exported by your PythonCore
388shared library. Rebuild it if you get unexpected undefined symbols when you
389are building a plugin module. <p>
390
391Rebuilding the .exp file is done by first removing the file and removing the
392reference to it in the project (in the "config" section). Next, build PythonCore.
393This will create a new .exp file. Edit this file to remove the references to
394the symbols <code>__initialize</code>, <code>__terminate</code>, <code>setjmp</code>,
Jack Jansen1473af71997-05-07 15:43:38 +0000395<code>longjmp</code>, <code>main</code> and (for PPC) <code>__ptmf_null</code> or (for
396CFM68K) <code>__start</code> and <code>dummy_init_routine</code>.
397Next, add the .exp file to the project
Jack Jansen27b10ec1996-08-23 15:44:18 +0000398again and rebuild PythonCore. <p>
399
400This rather convoluted procedure is needed to ensure that plugin modules don't
401accidentally link with those entrypoints from PythonCore, which will not work because
402those routines have to be in the same code fragment as they are used from.
403
Jack Jansen8f2d8021996-08-05 15:34:45 +0000404<H2>Odds and ends</H2>
405
406Some remarks that I could not fit in elsewhere:
407
408<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000409
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000410<LI> It may be possible to use the <code>PythonCore</code> shared
411library to embed Python in another program, if your program can live
Jack Jansen1473af71997-05-07 15:43:38 +0000412with using GUSI for I/O. Use PythonCore in stead of your MSL C library
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000413(or, at the very least, link it before the normal C library). Let me
414know whether this works.
415
416<LI> It is possible to build PPC extension modules without building a
417complete Python. Take the binary distribution, add folders
418<code>Include</code>, <code>Mac:Include</code> and
419<code>Mac:mwerks</code> from the source distribution and you should be
420all set. A template for a dynamic module can be found in
Jack Jansen3412c5d1997-08-27 14:08:22 +0000421<code>xx.prj</code>.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000422
423<LI> The Python shared library architecture is a variant of the architecture
424described as "application with shared libraries and dropins" in the MetroWerks
425"Targeting MacOS" documentation. The Python Application and applet-template use
Jack Jansen1473af71997-05-07 15:43:38 +0000426the <code>MSL AppRuntime.Lib</code> runtime library (with properly set CFM
427initialization and termination routines). PythonCore uses <code>MSL Runtime.Lib</code>,
428which is really intended for standalone programs but which we fool into working by
429providing a dummy main program.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000430It is linked statically into PythonCore (and exported to the applications and plugins)
431so we do not have to distribute yet another shared library. Plugin modules use
Jack Jansen1473af71997-05-07 15:43:38 +0000432<code>MSL ShlibRuntime.Lib</code> (not the dropin runtime: modules are never unloaded)
433and obtain the rest from PythonCore. PythonCore uses a
Jack Jansen27b10ec1996-08-23 15:44:18 +0000434non-standard initialization entry point, <code>__initialize_with_resources</code>, to
Jack Jansen1473af71997-05-07 15:43:38 +0000435be able to obtain resources from the library file later on. Plugins can do the same
436(_tkinter does) or use the standard <code>__initialize</code> entry point.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000437
438
Jack Jansen6ad8d131997-01-15 16:53:37 +0000439</UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000440</BODY>
441</HTML>