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