diff --git a/Mac/Demo/building.html b/Mac/Demo/building.html index 36932431686..036ff91b989 100644 --- a/Mac/Demo/building.html +++ b/Mac/Demo/building.html @@ -5,193 +5,221 @@
-The information density in this file is high, so you should probably print it and -read it at your leasure. Most things are explained only once (and probably in the -wrong place:-).
+This document explains how to build MacPython from source. This is +necessary if you want to write extension modules for 68K Python, and +currently also probably the easiest way to build PPC extension +modules. Building Python is not something to be undertaken lightly, +the process is not very streamlined so you need a reasonable working +knowledge of the CodeWarrior development environment, a good net +connection and probably quite some time too.
-I am very interested in feedback on this document, contact me at -<jack@cwi.nl> or send your comments to the -Mac Python Special Interest Group. +The information density in this file is high, so you should probably +print it and read it at your leasure. Most things are explained only +once (and probably in the wrong place:-).
+ +I am very interested in feedback on this document, contact me at <jack@cwi.nl> or send your +comments to the Mac Python Special +Interest Group.
Mac/mwerks/projects
for the project files and related
-stuff.
-Mac/mwerks/projects
for the project files and
+related stuff.
+
+Top-level-folder: - CWGUSI 1.6.4 + CWGUSI imglibs libjpeg pbmplus libtiff - MoreFiles 1.4.1 (not needed by Python, only by tcl/tk) + MoreFiles 1.4.2 (not needed by Python, only by tcl/tk) Python Tcl 7.5 Tk 4.1 + Waste 1.2 distribution (if you want waste)-Now build all the libraries. In
CWGUSI
you build the projects
-GUSI.68K.µ
and GUSI.PPC.µ
, in MoreFiles
,
-libjpeg
, pbmplus
andlibtiff
you build all
-projects. Tcl/tk is a special case, see below. Of course, if you are only
-interested in 68K you can skip building the PPC libraries and vice versa.
+Now build all the libraries. In CWGUSI
you build the
+projects GUSI.68K.µ
and GUSI.PPC.µ
, in
+MoreFiles
, libjpeg
, pbmplus
+andlibtiff
you build all projects. Tcl/tk is a special
+case, see below. Of course, if you are only interested in 68K you can
+skip building the PPC libraries and vice versa.
tcl7.5
and tk4.1
distribution:
+You need to make a minor organizational change to the Tcl/Tk
+distribution. The current instructions are for the
+tcl7.5.1
and tk4.1.1
distribution:
+
compat
folders to (compat)
in both the Tcl and Tk folders.
-strncasecmp.c
from (compat)
to the
-main Tcl folder.
+compat
folders to (compat)
+in both the Tcl and Tk folders.
-MoreFiles 1.4.2
, change this to MoreFiles 1.4.1
.
-Alternatively you could get the real MoreFiles 1.4.2, but there seem to be problems with
-this too (undefined references).
+strncasecmp.c
and
+tclErrno.h
from (compat)
to the main Tcl
+folder.
-MacHeaders.h
but should be set to MW_TkHeader.h
-and MW_TclHeader.h
respectively.
+dnr.c
as provided by MetroWerks by inserting
+ #pragma ANSI_strict off
at the
+beginning. The tcl library is built with strict ANSI on, and this file
+uses C++ style comments.
-tcl.h
. As distributed,
-tcl and tk assume that malloc calls always succeed and use the resulting pointer without
-checking for NULL
values. Needless to say, this wreaks havoc on a Macintosh.
-Fortunately a checking malloc is included and easy to enable: look for the
-#define
's for ckalloc, ckfree and ckrealloc and replace them by the
-following code:
+SimpleTcl
and
+SimpleTk
you will probably have to remove the references
+to libmoto
from the project.
+
+
-# define ckalloc(x) Tcl_Ckalloc(x)
-# define ckfree(x) Tcl_Ckfree(x)
-# define ckrealloc(x,y) Tcl_Ckrealloc(x,y)
+#define USE_TCLALLOC 1
-With this fix, out-of-memory situations will still cause a hard abort of the python
-interpreter, but at least they will not crash your system.
+somewhere at the beginning of MW_TclHeader.pch
.
+As distributed, tcl and tk assume that malloc calls always succeed and
+use the resulting pointer without checking for NULL
+values. Needless to say, this wreaks havoc on a Macintosh.
-SimpleTcl
and SimpleTk
-to make sure that the distributions are working you should make the previous
-changes in those projects too. Moreover, you have to replace the MoreFiles
-library reference by the correct one MoreFiles 1.4.1:Libraries:MoreFiles.PPC
-(or 68K).
ls -l
in the window you get) then the Tk library, then SimpleTk
-(which can again be tested with ls -l
). If this all worked you are all set to try
+Build first the MoreFiles library, then the Tcl library, then
+SimpleTcl (test it by typing ls -l
in the window you get)
+then the Tk library, then SimpleTk (which can again be tested with
+ls -l
). If this all worked you are all set to try
building Python.
+ICCFMGlue.c
in folder Minimal IC
+APIs
, add the following lines:
+
+++#include
+#include +
README-Mac
has some details.
+README-Mac
has some details.
img
-extension in this distribution. Extensions are not built here, as they are on Unix,
-but incorporated in the core interpreter or built as plugin modules.
+img
extension in this distribution. Extensions
+are not built here, as they are on Unix, but incorporated in
+the core interpreter or built as plugin modules.
modulator
which builds skeleton
-C extension modules and bgen
which generates complete interface modules from
-information in C header files. There are some readme files, but more documentation is
-sorely needed.
+modulator
+which builds skeleton C extension modules and bgen
which
+generates complete interface modules from information in C header
+files. There are some readme files, but more documentation is sorely
+needed.
+
Mac
folder:
toolbox
folder contains modules
-specifically needed with various MacOS toolbox interface modules.
+toolbox
folder
+contains modules specifically needed with various MacOS toolbox
+interface modules.
macmodule
). A lot of these modules are generated
-with bgen
, in which case the bgen input files are included so you can attempt to
-regenerate them or extend them.
+macmodule
). A lot of these modules are generated with
+bgen
, in which case the bgen input files are included so
+you can attempt to regenerate them or extend them.
malloc
and a directory with various projects
-for building variations on the Python interpreter. The mwerks_*.h
files here
-are the option-setting files for the various interpreters and such, comparable to the unix
-command-line -D
options to the compiler. Each project uses the correct option file
-as its "prefix file" in the "C/C++ language" settings. Disabling optional modules (for the 68K
-interpreter), building non-GUSI interpreters and various other things are accomplished by
-modifying these files (and possibly changing the list of files included in the project window, of course).
+malloc
and a directory with various projects for building
+variations on the Python interpreter. The mwerks_*.h
+files here are the option-setting files for the various interpreters
+and such, comparable to the unix command-line -D
options
+to the compiler. Each project uses the correct option file as its
+"prefix file" in the "C/C++ language" settings. Disabling optional
+modules (for the 68K interpreter), building non-GUSI interpreters and
+various other things are accomplished by modifying these files (and
+possibly changing the list of files included in the project window, of
+course).
build.mac68k.stand
and build it.
-Do not run it yet, this will possibly result in a garbled preferences file.
+If you have all the optional libraries mentioned above loaded buildin Python for 68K macs is a
+breeze: open the project in the folder build.mac68k.stand
+and build it. Do not run it yet, this will possibly result
+in a garbled preferences file.
-First remove the Python preferences
file
-from your preference folder, only if you had an older version of Python installed.
-(this is also what you do if you did not heed the last sentence of the
-preceeding paragraph). Next, move the interpreter to the main Python folder (up one level) and run it
-there. This will create a correct initial preferences file. You are now all set, and your tree
-should be completely compatible with a binary-only distribution. Read the release notes
-(Relnotes-somethingorother
) and ReadMeOrSuffer
in the Mac
folder.
+First remove the Python preferences
file from your
+preference folder, only if you had an older version of Python
+installed. (this is also what you do if you did not heed the last
+sentence of the preceeding paragraph). Next, move the interpreter to
+the main Python folder (up one level) and run it there. This will
+create a correct initial preferences file. You are now all set, and
+your tree should be completely compatible with a binary-only
+distribution. Read the release notes
+(Relnotes-somethingorother
) and
+ReadMeOrSuffer
in the Mac
folder.
build.macppc.stand
.
-The order to build things is the following:
+First you build the interpreter, core library and applet skeleton in
+folder build.macppc.stand
. The order to build things is
+the following:
Extensions
folder of your system folder.
-Do exactly that: put an alias there, copying or moving the file will cause you grief later.
+Extensions
folder of your system
+folder. Do exactly that: put an alias there, copying or
+moving the file will cause you grief later.
+
PythonPPC
, but it calls to a different
-entrypoint in the core library. The mkapplet
script will copy this complete file, and add
-a 'PYC '
with the module to generate an applet. +
PythonPPC
, but it calls to a different entrypoint in the
+core library. The mkapplet
script will copy this complete
+file, and add a 'PYC '
with the module to generate an
+applet. +
PythonCore
you should move PythonPPC
to the main
-Python folder. Next you remove any old Python Preferences
file from the Preferences
-folder (if you had python installed on your system before) and run the interpreter once to create the
-correct preferences file. You should also make an alias to PythonApplet
in the main Python
-folder. (again: making an alias is preferrable to copying or moving the file, since this will cause the
-correct file to be used if you ever rebuild PythonApplet).
+After creating the alias to PythonCore
you should move
+PythonPPC
to the main Python folder. Next you remove any
+old Python Preferences
file from the
+Preferences
folder (if you had python installed on your
+system before) and run the interpreter once to create the correct
+preferences file. You should also make an alias to
+PythonApplet
in the main Python folder. (again: making an
+alias is preferrable to copying or moving the file, since this will
+cause the correct file to be used if you ever rebuild
+PythonApplet).
-Next, you have to build the extension modules in the PlugIns
folder. Open each project and
-build it. After all the dynamically loaded modules are built you have to create a number of aliases: some
-modules live together in a single dynamic library. Copy or move the MkPluginAliases.py
script
-from Mac:scripts
to the main python folder and run it.
+Next, you have to build the extension modules in the
+PlugIns
folder. Open each project and build it. After all
+the dynamically loaded modules are built you have to create a number
+of aliases: some modules live together in a single dynamic
+library. Copy or move the MkPluginAliases.py
script from
+Mac:scripts
to the main python folder and run it.
-Finally, you must build the standard applets: EditPythonPrefs
, mkapplet
, etc. This
-is easiest done with the fullbuild
script from Mac:scripts
. Answer no to
-all questions except when it asks whether to build the applets.
+Finally, you must build the standard applets:
+EditPythonPrefs
, mkapplet
, etc. This is
+easiest done with the fullbuild
script from
+Mac:scripts
. Answer no to all questions except
+when it asks whether to build the applets.
-Actually, the-You are all set now, and should read the release notes andfullbuild
script can be used to build everything, but you need a fully-functional -interpreter before you can use it (and one that isn't rebuilt in the process: you cannot rebuild a running -program). You could copy the 68K interpreter to a different place and use that to run fullbuild, or use the -standalone PPC python for this. I tend to keep a standalone interpreter in a safe place for this use only. +Actually, thefullbuild
script can be used to build +everything, but you need a fully-functional interpreter before you can +use it (and one that isn't rebuilt in the process: you cannot rebuild +a running program). You could copy the 68K interpreter to a different +place and use that to run fullbuild, or use the standalone PPC python +for this. I tend to keep a standalone interpreter in a safe place for +this use only.
ReadMeOrSuffer
file from
-the Mac
folder.
+You are all set now, and should read the release notes and
+ReadMeOrSuffer
file from the Mac
folder.
PythonCore
shared library to embed Python in
-another program, if your program can live with using GUSI for I/O. Use PythonCore in stead of
-your C library (or, at the very least, link it before the normal C library). Let me know whether this
-works.
-Include
, Mac:Include
and Mac:mwerks
from the source
-distribution and you should be all set. A template for a dynamic module can be found in xxmodule.µ
.
+PythonCore
shared
+library to embed Python in another program, if your program can live
+with using GUSI for I/O. Use PythonCore in stead of your C library
+(or, at the very least, link it before the normal C library). Let me
+know whether this works.
+
+Include
, Mac:Include
and
+Mac:mwerks
from the source distribution and you should be
+all set. A template for a dynamic module can be found in
+xxmodule.µ
.