66< H1 > Building Mac Python from source</ H1 >
77< HR >
88
9- < B > Note</ B > : This document is mostly still for Python 2.0, so
10- it is not correct. See the < a href ="http://www.cwi.nl/~jack/macpython.html ">
11- MacPython homepage</ a > for an updated version, and if none is available
12- complain bitterly to me and work on it should progress faster.
13- < p >
14-
159This document explains how to build MacPython from source. This is
1610necessary if you want to make modifications to the Python core. Building
1711Python is not something to be undertaken lightly, you need a reasonable
@@ -41,10 +35,8 @@ <H2>What you need.</H2>
4135< UL >
4236
4337< LI > You need a MacPython source distribution, of course. You can
44- obtain one from < A HREF ="ftp://ftp.cwi.nl/pub/jack/python/mac ">
45- ftp://ftp.cwi.nl/pub/jack/python/mac</ A > or from the companion webpage
46- at < A HREF ="http://www.cwi.nl/~jack/macpython.html ">
47- http://www.cwi.nl/~jack/macpython.html</ A > (which has up-to-date links
38+ obtain one via < A HREF ="http://www.cwi.nl/~jack/macpython.html ">
39+ http://www.cwi.nl/~jack/macpython.html</ A > (which has up-to-date links
4840to the other packages needed too) and possibly also from the standard
4941< A HREF ="ftp://ftp.python.org/pub/python/mac "> python.org ftp
5042site</ A > . < BR >
@@ -57,8 +49,8 @@ <H2>What you need.</H2>
5749< LI > You need MetroWerks CodeWarrior. The current distribution has
5850been built with CodeWarrior Pro 6.1. Ordering information is
5951available on the < A HREF ="http://www.metrowerks.com/ "> MetroWerks
60- homepage</ A > . Building Python with MPW or Think/Symantec C is
61- probably impossible without major surgery.
52+ homepage</ A > . Building Python with MPW, Think/Symantec C or the OSX
53+ developer tools is impossible without major surgery.
6254
6355< LI > You need GUSI version 2, the Grand Unified Socket Interface, by
6456Matthias Neeracher. The original GUSI is obtainable from < A
@@ -68,11 +60,7 @@ <H2>What you need.</H2>
68602.1.1, so it may be better to check the < A
6961HREF ="http://www.cwi.nl/~jack/macpython.html "> MacPython homepage</ A >
7062for a GUSI that is most easily used for building Python.
71- < br >
7263
73- If nothing is listed there (yet) you will have problems building a
74- Carbon Python. Complaining loudly on the
[email protected] mailing
75- list will make me work faster towards distributing Carbon-GUSI:-).
7664</ UL >
7765
7866< A NAME ="optional "> The MacPython project files are configured to
@@ -96,30 +84,26 @@ <H2>What you need.</H2>
9684HREF ="
mailto:[email protected] "
> <
[email protected] >
</ A > . Python
9785was built using version 2.0, which is included in the CodeWarrior
9886package. You can also obtain it from < A
99- HREF ="http://www.boingo .com/waste "> <http://www.boingo .com/waste></ A >
87+ HREF ="http://www.merzwaren .com/waste "> <http://www.merzwaren .com/waste></ A >
10088and various other places.
10189
10290< LI > Gdbm library for the Mac. Available from Jack's Mac software page at
10391< A HREF ="http://www.cwi.nl/~jack/macsoftware.html ">
10492http://www.cwi.nl/~jack/macsoftware.html</ A > and < A HREF ="ftp://ftp.cwi.nl/pub/jack/mac ">
105- ftp://ftp.cwi.nl/pub/jack/mac</ A > . Also in the MacPython cvs repository at
106- < code > lib-src/gdbm</ code > .
93+ ftp://ftp.cwi.nl/pub/jack/mac</ A > .
10794
10895< LI > JPEG library by the Independent JPEG Group. A version including
10996Mac projects can be found at Jack's page mentioned above.
11097The most recent JPEG library can always be obtained from < A
111- HREF ="ftp://ftp.uu.net/graphics/jpeg/ "> ftp://ftp.uu.net/graphics/jpeg/</ A > . Again,
112- also in the MacPython cvs repository at < code > lib-src/jpeg</ code > .
98+ HREF ="ftp://ftp.uu.net/graphics/jpeg/ "> ftp://ftp.uu.net/graphics/jpeg/</ A > .
11399
114100< LI > The netpbm/pbmplus, libtiff, zlib and png libraries. The netpbm distribution
115101(which includes libtiff) is generally available on Internet ftp
116102servers. For Python pbmplus, an older incarnation of netpbm, is
117103functionally identical to netpbm, since Python only uses the library
118104and not the complete applications. A distribution with correct
119105projects and library source only is available from, you guessed it, Jack's Mac software
120- page mentioned above. And, guessed it again, in the MacPython cvs repository
121- at < code > lib-src/netpbm</ code > , etc. The only gotcha is that libtiff lives in
122- < code > lib-src/netpbm/libtiff</ code > , for historical reasons.
106+ page mentioned above.
123107
124108</ UL >
125109
@@ -279,7 +263,7 @@ <H2>The organization of the Python source tree</H2>
279263< DT > Modules
280264< DD > Mac-specific builtin modules. Theoretically these are all
281265optional, but some are rather essential (like
282- < code > macmodule </ code > ). A lot of these modules are generated with
266+ < code > macosmodule </ code > ). A lot of these modules are generated with
283267< code > bgen</ code > , in which case the bgen input files are included so
284268you can attempt to regenerate them or extend them.
285269
@@ -327,69 +311,65 @@ <H2>The organization of the Python source tree</H2>
327311< DD > Modules that are not supported any longer but may still work with a little effort.
328312</ DL >
329313
330- < H2 > Building the 68K interpreter</ H2 >
331-
332- 68K Python is no longer supported, and the projects are not included in the
333- source distribution anymore. If you really want to build Python for the 68K
334- your best bet is to check the sources out of the CVS repository. The latest
335- projects (in :Mac:build:) that support 68K development are tagged as such,
336- and are dated around August 2000. If you plan on doing this announce it on
337- the SIG, please. < p >
338-
339314< H2 > Building the PPC interpreter</ H2 >
340315< em > This is different under 2.1. You are best off using the fullbuild.py
341- script. </ em > < p >
316+ script, see < a href ="#fullbuild "> below</ a > . </ em > < p >
317+
342318First you optionally build the external libraries with buildlibs.prj. Next,
343319the projects for
344- interpreter, core library and applet skeleton are all linked together, so
345- building the PythonInterpreter target in < code > PythonEngine.prj</ code >
346- will result in everything being built. The
347- resulting applications and fat shared library are deposited in the main
348- Python folder. Finally, you build all the plugins with the plugins.prj project.
320+ interpreter and core library are linked together, so
321+ building the PythonInterpreterClassic and/or PythonInterpreterCarbon target
322+ in < code > PythonInterpreter.prj</ code >
323+ will result in everything being built. The result, however, is an "Application
324+ template", (filetype Atmp). If you don't use fullbuild you can manually
325+ turn either of these into an interpreter by copying it to PythonInterpreter
326+ and setting the filetype to APPL (with ResEdit or some such). < p >
327+
328+ Fullbuild does this for you, and the Atmp files is also how ConfigurePythonCarbon
329+ and ConfigurePythonClassic work their magic. < p >
349330
350331For completeness sake here is a breakdown of the projects:
351332
352333< DL >
353334
354- < DT > PythonCore (with subproject PythonCorePPC)
335+ < DT > PythonCore
355336< DD > The shared library that contains the bulk of the interpreter and
356- its resources. It is a good idea to immedeately put an alias to this
337+ its resources. It has targets for PythonCore and PythonCoreCarbon.
338+ It is a good idea to immedeately put an alias to this
357339shared library in the < code > Extensions</ code > folder of your system
358340folder. Do exactly that: put an < em > alias</ em > there, copying or
359341moving the file will cause you grief later if you rebuild the library and
360- forget to copy it to the extensions folder again. The InstallPython applet
361- will also do this, along with creating the plugin aliases. < br >
362- Note that the subproject looks a bit silly nowadays (with no more CFM68K
363- support) but you will have to live with that for this release.
342+ forget to copy it to the extensions folder again. The ConfigurePythonXXX applets
343+ will also do this. < br >
364344
365345< DT > PythonInterpeter
366346< DD > The interpreter. This is basically a routine to call out to the
367347shared library. Unlike in previous releases the same program is used for
368348creating applets (for which formerly PythonApplet was used). < p >
369349
370350< DT > Plugin projects
371- < DD > Each plugin module has a separate project. The < code > Plugins.prj </ code >
372- project tries to build them all, but is known to be flakey. See < code > fullbuild </ code >
373- below for a better way to build everything .
351+ < DD > Each plugin module has a separate project, and these can be rebuilt on
352+ the fly. Fullbuild (or actually it's little helper genpluginprojects) takes
353+ care of this .
374354</ DL >
375355
376356After creating the alias to < code > PythonCore</ code > you remove any old
377- < code > Python 2.0b1 Preferences</ code > file from the < code > Preferences</ code > folder
357+ < code > Python XXXX Preferences</ code > file from the < code > Preferences</ code > folder
378358(if you had python installed on your system before) and run the interpreter once
379359to create the correct preferences file. < p >
380360
381361Next, you have to build the extension modules.
382- The < code > PlugIns.ppc</ code > project has all the
383- other projects as subprojects and builds everything (but see the gotcha above).
362+ If you don't use fullbuild simply open each project and build it.
384363< p >
385364
386365Finally, you must build the standard applets:
387- < code > EditPythonPrefs</ code > , < code > BuildApplet</ code > , etc. This is
388- easiest done with the < code > fullbuild </ code > script from
389- < code > Mac:scripts </ code > . < p >
366+ < code > EditPythonPrefs</ code > , < code > BuildApplet</ code > , etc. For the N-th time:
367+ fullbuild does this for you, but you can also manually drag/drop them onto
368+ BuildApplet . < p >
390369
391370< BLOCKQUOTE >
392- Actually, the < code > fullbuild</ code > script can be used to build
371+ < a name ="fullbuild "> </ a >
372+ The < code > fullbuild</ code > script can be used to build
393373everything, but you need a fully-functional interpreter before you can
394374use it (and one that isn't rebuilt in the process: you cannot rebuild
395375a running program). You could copy the interpreter to a different
@@ -409,24 +389,24 @@ <H2>Rebuilding <code>.exp</code> files</H2>
409389shared library. Rebuild it if you get unexpected undefined symbols when you
410390are building a plugin module. < p >
411391
412- Rebuilding the .exp file is done by first removing the file and removing the
413- reference to it in the project (in the "config" section). Next, build PythonCore.
414- This will create a new .exp file. Edit this file to remove the references to
392+ Rebuilding the .exp file is done by first both removing the file and removing the
393+ reference to it in the project (in the "config" section). Next, build PythonCore or
394+ PythonCoreCarbon.
395+ This will create a new .exp file, with the name < code > PythonCore.mcp.exp</ code > .
396+ Rename this file to either < code > PythonCore.exp</ code > or < code > PythonCoreCarbon.exp</ code >
397+ and add this file back to the project. Next, edit ot to remove the references to
415398the symbols < code > __initialize</ code > , < code > __terminate</ code > , < code > setjmp</ code > ,
416- < code > longjmp</ code > , < code > vec_longjmp</ code > , < code > main</ code > and (for PPC) < code > __ptmf_null</ code > or (for
417- CFM68K) < code > __start </ code > and < code > dummy_init_routine </ code > .
418- Next, add the .exp file to the project
419- again and rebuild PythonCore . < p >
399+ < code > longjmp</ code > , < code > vec_longjmp</ code > , < code > main</ code > and < code > __ptmf_null</ code > .
400+ They are all close together about halfway the file .
401+
402+ Finally rebuild again . < p >
420403
421404This rather convoluted procedure is needed to ensure that plugin modules don't
422405accidentally link with those entrypoints from PythonCore, which will not work because
423406those routines have to be in the same code fragment as they are used from.
424407
425408< H2 > < a name ="cvs "> Using the CVS source archive</ a > </ H2 >
426409
427- < em > Please check the MacPython homepage to see whether this information is
428- still current: MacPython should move to sourceforge shortly. </ em > < p >
429-
430410It is possible (and probably best) to access the Python sources through remote CVS. The
431411advantage of this is that you get the very latest sources, so any bug
432412fixed or new features will be immedeately available. This is also the
@@ -441,41 +421,31 @@ <H2><a name="cvs">Using the CVS source archive</a></H2>
441421applesingle" and (in the "text files" section) "use ISO latin 1
442422conversion". < p >
443423
444- It is also a good idea to disable Quicktime Exchange in the Quicktime
424+ < blockquote >
425+ There is one group of people for whom MacCVS is not the best choice: people with
426+ checkin rights to the Python repository. You will have to use MacCVS Pro
427+ (completely unrelated) from www.maccvs.org, because it has working SSH support.
428+ </ blockquote >
429+
430+ It is a good idea to disable Quicktime Exchange in the Quicktime
445431control panel. Quicktime Exchange will magically map some extensions to
446432filetypes, and this can seriously hinder you if, for instance, < code > .bmp</ code >
447433is not a Windows bitmap file. < p >
448434
449- The machine-independent Python sources are checked out from the main
435+ The Python sources are checked out from the main
450436Python CVS archive on sourceforge.net, see the < a
451437href ="http://www.python.org/download/cvs.html "> Source access via
452438CVS</ a > page for details. When you check the sources out you will get
453439something like < code > Python:dist:src</ code > , and under that the
454- < code > Modules</ code > , < code > Lib</ code > , etc hierarchy. The
455- < code > src</ code > folder should be renamed to < code > Python</ code > , and
440+ < code > Modules</ code > , < code > Lib</ code > , < code > Mac </ code > etc hierarchy. The
441+ < code > src</ code > folder can be renamed to < code > Python</ code > , and
456442is what this document refers to as the "toplevel Python folder". < P >
457443
458- Next, < em > in a separate folder</ em > , you check out the
459- mac-specific sources. You then move the < code > Mac</ code > folder from this
460- checkout (the only folder with anything in it) to the Python source folder.
461- Note that the checking out in a separate folder and moving is necessary,
462- due to the way cvs works.
463-
464- The CVS path to use for the mac stuff can be found
465- at the < a href ="http://www.cwi.nl/~jack/macpython.html "> MacPython
466- homepage</ a > . Finally, you check out the external libraries needed in
467- the parent of the toplevel Python folder. The CVS path for these libraries is
468- also mentioned at the MacPython homepage. < p >
469-
470-
471- You should end up with a folder structure as described at the top of this
472- document. < p >
473-
474- Note that while the Mac folder is now a subfolder of your toplevel Python
475- folder this does not mean that they "act as one" as far as CVS is concerned.
476- To update all your sources you have to do a "cvs update" in the toplevel
477- Python folder and another one in the Mac folder. This is again a cvs problem:
478- it cannot deal with subpackages coming from different repositories. < p >
444+ The CVS repository does not contain all the projects for the plugin modules,
445+ these are built with < code > fullbuild.py</ code > normally. For this reason
446+ it is probably a good idea to first build < code > PythonStandSmall.prj</ code > ,
447+ which builds a fairly minimal interpreter, and then follow the
448+ < a href ="#fullbuild "> fullbuild instructions</ a > .
479449
480450< H2 > Odds and ends</ H2 >
481451
0 commit comments