@@ -7,11 +7,9 @@ <H1>Building Mac Python from source</H1>
77< HR >
88
99This document explains how to build MacPython from source. This is
10- necessary if you want to write extension modules for 68K Python, and
11- is also necessary if you want to make modifications to the Python core.
12- Building Python is not something to be undertaken lightly,
13- you need a reasonable working
14- knowledge of the CodeWarrior development environment, a good net
10+ necessary if you want to make modifications to the Python core. Building
11+ Python is not something to be undertaken lightly, you need a reasonable
12+ working knowledge of the CodeWarrior development environment, a good net
1513connection and probably quite some time too. < p >
1614
1715The information density in this file is high, so you should probably
@@ -43,49 +41,42 @@ <H2>What you need.</H2>
4341http://www.cwi.nl/~jack/macpython.html</ A > (which has up-to-date links
4442to the other packages needed too) and possibly also from the standard
4543< A HREF ="ftp://ftp.python.org/pub/python/mac "> python.org ftp
46- site</ A > . Everything you need is also included in the standard Python
47- source distribution, but the organization is different. Look in
48- directory < code > Mac/mwerks/projects</ code > for the project files and
49- related stuff. < BR >
44+ site</ A > . < BR >
5045
51- An alternative is to check the sources straight out of the CVS
46+ A better alternative is to check the sources straight out of the CVS
5247repository, see below. Most of the packages mentioned here are also
5348available through CVS. Check the section on < a href ="#cvs "> CVS
5449repository use</ a > below.
5550
5651< LI > You need MetroWerks CodeWarrior. The current distribution has
57- been built with CodeWarrior Pro 4 . Ordering information is
52+ been built with CodeWarrior Pro 5.2 . Ordering information is
5853available on the < A HREF ="http://www.metrowerks.com/ "> MetroWerks
5954homepage</ A > . Building Python with MPW or Think/Symantec C is
6055probably impossible without major surgery.
6156
62- < LI > You need GUSI, the Grand Unified Socket Interface, by Matthias
63- Neeracher. The original CWGUSI is
64- obtainable from < A
65- HREF ="ftp://sunsite.cnlab-switch.ch/software/platform/macos/src ">
66- ftp://sunsite.cnlab-switch.ch/software/platform/macos/src</ A > .
67- At the moment Python is built with a slightly modified version of GUSI,
68- these modifications are available in folder < code > Python:Mac:GUSI-mods</ code > . < br >
57+ < LI > You need GUSI version 2, the Grand Unified Socket Interface, by
58+ Matthias Neeracher. The original GUSI is obtainable from < A
59+ HREF ="ftp://sunsite.cnlab-switch.ch/software/platform/macos/src/mw_c ">
60+ ftp://sunsite.cnlab-switch.ch/software/platform/macos/src/mw_c</ A > . At
61+ the moment Python is built with a slightly modified version of GUSI
62+ 2.1.1, so it may be better to check the < A
63+ HREF ="http://www.cwi.nl/~jack/macpython.html "> MacPython homepage</ A >
64+ for a GUSI that is most easily used for building Python.
65+ < br >
6966
7067The modified GUSI is also in the MacPython cvs source repository, in the
71- directory < code > lib-src/CWGUSI</ code > . However, some files contain slashes in
72- their names, something CVS seriously frowns upon, and each slash has been
73- replaced by < code > "_s_"</ code > . There is a script
74- < code > Mac:scripts:fixgusidir.py</ code > which you should run after checking CWGUSI
75- out
76-
68+ directory < code > lib-src/GUSI2</ code > . As GUSI is moving to sourceforge
69+ this info may be outdated by the time you read it so better check the
70+ MacPython homepage, probably.
7771</ UL >
7872
7973< A NAME ="optional "> The MacPython project files are configured to
8074include a plethora of optional modules</ A > , and these modules need a
8175number of extra packages. To use the project files as-is you have to
82- download these packages too. PPC and CFM68K Python have all such modules as
76+ download these packages too. Python has all such modules as
8377dynamically loaded modules, so if you don't need a certain package it
84- suffices to just refrain from builing the extension module. For static 68K
85- Python things are a bit more complicated: you have to edit the
86- interpreter project file to remove the reference to the module (and
87- the libraries it uses), and edit the < code > Mac:mwerks:mwerks_nonshared_config.h</ code >
88- file to remove the < code > USE_...</ code > line. Here are the locations for the various things
78+ suffices to just refrain from builing the extension module.
79+ Here are the locations for the various things
8980you need:
9081
9182< UL >
@@ -134,7 +125,7 @@ <H2>Setting Up</H2>
134125
135126< PRE >
136127Top-level-folder:
137- CWGUSI
128+ GUSI2
138129 imglibs
139130 jpeg
140131 netpbm
@@ -159,25 +150,21 @@ <H2>Setting Up</H2>
159150If your setup of the libraries is exactly the same as mine (which is
160151not very likely, unless you happen to work from the same CVS
161152repository) you can use the project < code > buildlibs.prj</ code > in the
162- < code > :Mac:build.mac </ code > folder to build all needed libraries in one
153+ < code > :Mac:Build </ code > folder to build all needed libraries in one
163154fell swoop, otherwise you will have to build the libraries one by
164155one. < p >
165156
166157First build GUSI. If you didn't get the python-specific GUSI you have to
167- move the files from the "CWGUSI-mods" to the right
168- place in the CWGUSI distribution folder. Build the MSL version for your
169- platform (ppc, 68k, cfm68k). < p >
170-
171- < em > Note:</ em > always rebuild the CWGUSI libraries, even if you have
172- checked them out from the CVS repository. < P >
158+ massage some of the Python code (missing routines) and you'll miss the
159+ functionality of "delay console".
160+ < p >
173161
174162Next, in
175- < code > MoreFiles </ code > , < code > libjpeg</ code > , < code > pbmplus</ code > ,
163+ < code > libjpeg</ code > , < code > pbmplus</ code > ,
176164< code > zlib</ code > , < code > libpng</ code > , < code > gdbm</ code > ,
177165and< code > libtiff</ code > you build all projects. Usually the projects are in "mac"
178166subfolders, sometimes they are in the main folder. Tcl/tk is a special
179- case, see below. Of course, if you are only interested in one of
180- static 68K, CFM68K or PPC you can skip building the other libraries.
167+ case, see below.
181168
182169< H2 > < A NAME ="tcltk "> Building Tcl/Tk</ H2 >
183170
@@ -222,14 +209,12 @@ <H2>The organization of the Python source tree</H2>
222209< DL >
223210< DT > Demo
224211< DD > Demo programs that are not Mac-specific. Some of these may not
225- work, the file < code > README-Mac </ code > has some details .
212+ work.
226213
227214< DT > Extensions
228215< DD > Extensions to the interpreter that are not Mac-specific. Contains
229- the < code > img</ code > , < code > Imaging</ code > and < code > Numeric</ code > extensions
230- in this distribution. Nowadays, the extensions are all built in their own
231- folders (unlike in older distributions, where img was incorporated in the main
232- build procedure).
216+ the < code > img</ code > , < code > Imaging</ code > and < code > Numerical</ code > extensions
217+ in this distribution.
233218
234219< DT > Grammar
235220< DD > The Python grammar. Included for reference only, you cannot build
@@ -243,7 +228,7 @@ <H2>The organization of the Python source tree</H2>
243228on the Mac.
244229
245230< DT > Objects
246- < DD > Machine-independent code for various objects . Most of these are
231+ < DD > Machine-independent code for various object types . Most of these are
247232not really optional: the interpreter will not function without them.
248233
249234< DT > Parser
@@ -254,11 +239,12 @@ <H2>The organization of the Python source tree</H2>
254239are unix-specific and not used on the Mac.
255240
256241< DT > Tools
257- < DD > Tools for python developers. Contains < code > modulator</ code >
258- which builds skeleton C extension modules and < code > bgen</ code > which
259- generates complete interface modules from information in C header
260- files. There are some readme files, but more documentation is sorely
261- needed.
242+ < DD > Tools for python developers. Contains < code > modulator</ code > which
243+ builds skeleton C extension modules, < code > bgen</ code > which generates
244+ complete interface modules from information in C header files and
245+ < code > freeze</ code > which is used to turn Python scripts into real
246+ applications (used by MacFreeze and BuildApplication) There are some
247+ readme files, but more documentation is sorely needed.
262248
263249</ DL >
264250
@@ -271,8 +257,8 @@ <H2>The organization of the Python source tree</H2>
271257the toplevel folder or the Mac:PlugIns folder (for plugin modules).
272258
273259< DT > Compat
274- < DD > Unix-compatability routines. Some of these are not used anymore,
275- since CWGUSI provides a rather complete emulation, but you may need
260+ < DD > Unix-compatability routines. Most of these are not used anymore,
261+ since GUSI provides a rather complete emulation, but you may need
276262these if you are trying to build a non-GUSI python.
277263
278264< DT > Demo
@@ -339,25 +325,14 @@ <H2>The organization of the Python source tree</H2>
339325
340326< H2 > Building the 68K interpreter</ H2 >
341327
342- If you have all the optional libraries mentioned < A
343- HREF ="#optional "> above</ A > loaded building Python for 68K macs is a
344- breeze: in the Mac:Build folder you build the libraries with buildlibs.prj
345- and then the interpreter with PythonStandalone.prj. < p >
346-
347- If you were previously running another copy of this Python release,
348- from a binary installer for instance, you should
349- first remove the < code > Python XXX preferences</ code > file from your
350- preference folder. Next, run the interpreter, in the toplevel folder. This will
351- create a correct initial preferences file. You are now all set, and
352- your tree should be completely compatible with a binary-only
353- distribution. Read the release notes
354- (< code > Relnotes-somethingorother</ code > ) and
355- < code > ReadMe</ code > in the < code > Mac</ code > folder. < p >
356-
357- If something goes wrong you may end up with a garbled preferences file. Removing
358- it from the system folder and running Python once again will re-create it.
328+ 68K Python is no longer supported, and the projects are not included in the
329+ source distirbution anymore. If you really want to build Python for the 68K
330+ your best bet is to check the sources out of the CVS repository. The latest
331+ projects (in :Mac:build:) that support 68K development are tagged as such,
332+ and are dated around August 2000. If you plan on doing this announce it on
333+ the SIG, please. < p >
359334
360- < H2 > Building the PPC and CFM68K interpreter</ H2 >
335+ < H2 > Building the PPC interpreter</ H2 >
361336
362337First you optionally build the external libraries with buildlibs.prj. Next,
363338the projects for
@@ -371,14 +346,16 @@ <H2>Building the PPC and CFM68K interpreter</H2>
371346
372347< DL >
373348
374- < DT > PythonCore (with subprojects PythonCorePPC and PythonCoreCFM68K )
349+ < DT > PythonCore (with subproject PythonCorePPC)
375350< DD > The shared library that contains the bulk of the interpreter and
376351its resources. It is a good idea to immedeately put an alias to this
377352shared library in the < code > Extensions</ code > folder of your system
378353folder. Do exactly that: put an < em > alias</ em > there, copying or
379354moving the file will cause you grief later if you rebuild the library and
380355forget to copy it to the extensions folder again. The InstallPython applet
381- will also do this, along with creating the plugin aliases.
356+ will also do this, along with creating the plugin aliases. < br >
357+ Note that the subproject looks a bit silly nowadays (with no more CFM68K
358+ support) but you will have to live with that for this release.
382359
383360< DT > PythonInterpeter
384361< DD > The interpreter. This is basically a routine to call out to the
@@ -387,11 +364,12 @@ <H2>Building the PPC and CFM68K interpreter</H2>
387364
388365< DT > Plugin projects
389366< DD > Each plugin module has a separate project. The < code > Plugins.prj</ code >
390- project tries to build them all, but is known to be flakey under CW Pro 4.
367+ project tries to build them all, but is known to be flakey. See < code > fullbuild</ code >
368+ below for a better way to build everything.
391369</ DL >
392370
393371After creating the alias to < code > PythonCore</ code > you remove any old
394- < code > Python XXX Preferences</ code > file from the < code > Preferences</ code > folder
372+ < code > Python 2.0b1 Preferences</ code > file from the < code > Preferences</ code > folder
395373(if you had python installed on your system before) and run the interpreter once
396374to create the correct preferences file. < p >
397375
@@ -409,10 +387,10 @@ <H2>Building the PPC and CFM68K interpreter</H2>
409387Actually, the < code > fullbuild</ code > script can be used to build
410388everything, but you need a fully-functional interpreter before you can
411389use it (and one that isn't rebuilt in the process: you cannot rebuild
412- a running program). You could copy the 68K interpreter to a different
413- place and use that to run fullbuild, or use the standalone PPC python
414- for this. I tend to keep a standalone interpreter in a safe place for
415- this use only . < p >
390+ a running program). You could copy the interpreter to a different
391+ place and use that to run fullbuild. The < code > PythonStandSmall.prj </ code >
392+ project builds an interpreter that is suited to this, and it can also come
393+ in handy if you need to debug things (which is easier in a static program) . < p >
416394
417395</ BLOCKQUOTE >
418396
@@ -441,7 +419,7 @@ <H2>Rebuilding <code>.exp</code> files for PPC and CFM68K</H2>
441419
442420< H2 > < a name ="cvs "> Using the CVS source archive</ a > </ H2 >
443421
444- It is possible to access the Python sources through remote CVS. The
422+ It is possible (and probably best) to access the Python sources through remote CVS. The
445423advantage of this is that you get the very latest sources, so any bug
446424fixed or new features will be immedeately available. This is also the
447425disadvantage, of course: as this is the same tree as is used for
@@ -461,7 +439,7 @@ <H2><a name="cvs">Using the CVS source archive</a></H2>
461439is not a Windows bitmap file. < p >
462440
463441The machine-independent Python sources are checked out from the main
464- Python CVS archive, see the < a
442+ Python CVS archive on sourceforge.net , see the < a
465443href ="http://www.python.org/download/cvs.html "> Source access via
466444CVS</ a > page for details. When you check the sources out you will get
467445something like < code > Python:dist:src</ code > , and under that the
@@ -503,12 +481,11 @@ <H2>Odds and ends</H2>
503481< LI > It may be possible to use the < code > PythonCore</ code > shared
504482library to embed Python in another program, if your program can live
505483with using GUSI for I/O. Use PythonCore in stead of your MSL C library
506- (or, at the very least, link it before the normal C library). Let me
507- know whether this works.
484+ (or, at the very least, link it before the normal C library).
508485
509486< LI > It is possible to build PPC extension modules without building a
510487complete Python. The binary distribution installer can optionally install
511- all the needed folders. A template for a dynamic module can be found in
488+ all the needed folders (the develop option) . A template for a dynamic module can be found in
512489< code > xx.prj</ code > .
513490
514491< LI > The Python shared library architecture is a variant of the architecture
0 commit comments