1Tcl Mac OS X README
2-------------------
3
4RCS: @(#) $Id: README,v 1.1.2.9 2007/04/29 02:21:33 das Exp $
5
6This is the README file for the Mac OS X/Darwin version of Tcl.
7
8
91. Where to go for support
10--------------------------
11
12- The tcl-mac mailing list on sourceforge is the best place to ask questions
13specific to Tcl & Tk on Mac OS X:
14	http://lists.sourceforge.net/lists/listinfo/tcl-mac
15(this page also has a link to searchable archives of the list, please check them
16before asking on the list, many questions have already been answered).
17
18- For general Tcl/Tk questions, the newsgroup comp.lang.tcl is your best bet:
19	http://groups.google.com/group/comp.lang.tcl/
20
21- The Tcl'ers Wiki also has many pages dealing with Tcl & Tk on Mac OS X, see
22	http://wiki.tcl.tk/references/3753!
23	http://wiki.tcl.tk/references/8361!
24
25- Please report bugs with Tcl or Tk on Mac OS X to the sourceforge bug trackers:
26	Tcl: http://sf.net/tracker/?func=add&group_id=10894&atid=110894
27	Tk:  http://sf.net/tracker/?func=add&group_id=12997&atid=112997
28please make sure that your report Tk specific bugs to the tktoolkit project bug
29tracker rather than the tcl project bug tracker.
30Mac OS X specific bugs should usually be assigned to 'das' or 'wolfsuit'.
31
32
332. Using Tcl on Mac OS X
34------------------------
35
36- At a minimum, Mac OS X 10.1 is required to run Tcl, but OS X 10.3 or higher is
37recommended (certain [file] operations behave incorrectly on earlier releases).
38
39- Unless weak-linking is used, Tcl built on Mac OS X 10.x will not run on 10.y
40with y < x; on the other hand Tcl built on 10.y will always run on 10.x with
41y <= x (but without any of the fixes and optimizations that would be available
42in a binary built on 10.x).
43Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl
44built on 10.x to run on any 10.y with x > y >= z (for a chosen z >= 2).
45
46- Tcl extensions can be installed in any of:
47	$HOME/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl
48	$HOME/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks
49	/System/Library/Frameworks (searched in that order).
50Given a potential package directory $pkg, Tcl on OSX checks for the file
51$pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl.
52This allows building extensions as frameworks with all script files contained in
53the Resources/Scripts directory of the framework.
54
55- [load]able binary extensions can linked as either ordinary shared libraries
56(.dylib) or as MachO bundles (since 8.4.10/8.5a3); only bundles can be unloaded,
57and bundles are also loaded more efficiently from VFS (no temporary copy to the
58native filesystem required).
59
60- The 'deploy' target of macosx/Makefile installs the html manpages into the
61standard documentation location in the Tcl framework:
62	Tcl.framework/Resources/Documentation/Reference/Tcl
63No nroff manpages are installed by default by the Makefile.
64
65- The Tcl framework can be installed in any of the system's standard
66framework directories:
67	$HOME/Library/Frameworks /Library/Frameworks
68	/Network/Library/Frameworks /System/Library/Frameworks
69
70
713. Building Tcl on Mac OS X
72---------------------------
73
74- At least Mac OS X 10.1 is required to build Tcl, and Apple's Developer Tools
75need to be installed (only the most recent version matching your OS release is
76supported). The Developer Tools installer is available on Mac OS X retail disks
77or is present in /Applications/Installers on Macs that came with OS X
78preinstalled. The most recent version can be downloaded from the ADC website
79http://connect.apple.com (after you register for free ADC membership).
80
81- Tcl is most easily built as a Mac OS X framework via Makefile in tcl/macosx
82(see below for details), but can also be built with the standard unix configure
83and make buildsystem in tcl/unix as on any other unix platform (indeed, the
84Makefile is just a wrapper around the unix buildsystem).
85The Mac OS X specific configure flags are --enable-framework and
86--disable-corefoundation (which disables CF and notably reverts to the standard
87select based notifier).
88
89- It is also possible to build with Apple's IDE via the tcl/macosx/Tcl.pbproj
90project, this simply calls through to the tcl/macosx/Makefile.
91
92- To build universal binaries, set CFLAGS as follows:
93    export CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 \
94	-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"
95This requires Mac OS X 10.4 and Xcode 2.4 (or Xcode 2.2 if -arch x86_64 is
96omitted, but _not_ Xcode 2.1) and will work on any of the architectures (the
97-isysroot flag is only required on PowerPC Tiger).
98Note that configure requires CFLAGS to contain a least one architecture that can
99be run on the build machine (i.e. ppc on G3/G4, ppc or ppc64 on G5, ppc or i386
100on Core and ppc, i386 or x86_64 on Core2/Xeon).
101Universal builds of Tcl TEA extensions are also possible with CFLAGS set as
102above, they will be [load]able by universal as well as thin binaries of Tcl.
103
104- To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable
105to the minimal OS version (>= 10.2) the binaries should be able to run on, e.g:
106    export MACOSX_DEPLOYMENT_TARGET=10.2
107This requires Mac OS X 10.2 and gcc 3.1; if you have gcc 4 or later you can set
108CFLAGS instead:
109    export CFLAGS="-mmacosx-version-min=10.2"
110Support for weak-linking was added to the code for 8.4.14/8.5a5.
111
112Detailed Instructions for building with macosx/Makefile
113-------------------------------------------------------
114
115- Unpack the tcl source release archive.
116
117- The following instructions assume the tcl source tree is named "tcl${ver}",
118where ${ver} is a shell variable containing the tcl version number (for example
119'8.4.12').
120Setup the shell variable as follows:
121	set ver="8.4.12" ;: if your shell is csh
122	ver="8.4.12"	 ;: if your shell is sh
123The source tree will be named this way only if you are building from a release
124archive, if you are building from CVS, the version numbers will be missing; so
125set ${ver} to the empty string instead:
126	set ver=""	 ;: if your shell is csh
127	ver=""		 ;: if your shell is sh
128
129- The following steps will build Tcl from the Terminal, assuming you are located
130in the directory containing the tcl source tree:
131	make -C tcl${ver}/macosx
132and the following will then install Tcl onto the root volume (admin password
133required):
134	sudo make -C tcl${ver}/macosx install
135if you don't have the admin password, you can install into your home directory,
136instead by passing an INSTALL_ROOT argument to make:
137	make -C tcl${ver}/macosx install INSTALL_ROOT="${HOME}/"
138
139- The default Makefile targets will build _both_ debug and optimized versions of
140the Tcl framework with the standard convention of naming the debug library
141Tcl.framework/Tcl_debug.
142This allows switching to the debug libraries at runtime by setting
143	export DYLD_IMAGE_SUFFIX=_debug
144(c.f. man dyld for more details)
145
146If you only want to build and install the debug or optimized build, use the
147'develop' or 'deploy' target variants of the Makefiles, respectively.
148For example, to build and install only the optimized versions:
149	make -C tcl${ver}/macosx deploy
150	sudo make -C tcl${ver}/macosx install-deploy
151