| [25] | 1 | Tcl Mac OS X README | 
|---|
 | 2 | ------------------- | 
|---|
 | 3 |  | 
|---|
 | 4 | RCS: @(#) $Id: README,v 1.16 2007/12/13 15:26:03 dgp Exp $ | 
|---|
 | 5 |  | 
|---|
 | 6 | This is the README file for the Mac OS X/Darwin version of Tcl. | 
|---|
 | 7 |  | 
|---|
 | 8 |  | 
|---|
 | 9 | 1. Where to go for support | 
|---|
 | 10 | -------------------------- | 
|---|
 | 11 |  | 
|---|
 | 12 | - The tcl-mac mailing list on sourceforge is the best place to ask questions | 
|---|
 | 13 | specific 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 | 
|---|
 | 16 | before 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 | 
|---|
 | 28 | please make sure that your report Tk specific bugs to the tktoolkit project bug | 
|---|
 | 29 | tracker rather than the tcl project bug tracker. | 
|---|
 | 30 | Mac OS X specific bugs should usually be assigned to 'das' or 'wolfsuit'. | 
|---|
 | 31 |  | 
|---|
 | 32 |  | 
|---|
 | 33 | 2. 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 | 
|---|
 | 37 | recommended (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 | 
|---|
 | 40 | with y < x; on the other hand Tcl built on 10.y will always run on 10.x with | 
|---|
 | 41 | y <= x (but without any of the fixes and optimizations that would be available | 
|---|
 | 42 | in a binary built on 10.x). | 
|---|
 | 43 | Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl | 
|---|
 | 44 | built 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). | 
|---|
 | 50 | Given 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. | 
|---|
 | 52 | This allows building extensions as frameworks with all script files contained in | 
|---|
 | 53 | the 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, | 
|---|
 | 57 | and bundles are also loaded more efficiently from VFS (no temporary copy to the | 
|---|
 | 58 | native filesystem required). | 
|---|
 | 59 |  | 
|---|
 | 60 | - The 'deploy' target of macosx/GNUmakefile installs the html manpages into the | 
|---|
 | 61 | standard documentation location in the Tcl framework: | 
|---|
 | 62 |         Tcl.framework/Resources/Documentation/Reference/Tcl | 
|---|
 | 63 | No nroff manpages are installed by default by the GNUmakefile. | 
|---|
 | 64 |  | 
|---|
 | 65 | - The Tcl framework can be installed in any of the system's standard | 
|---|
 | 66 | framework directories: | 
|---|
 | 67 |         $HOME/Library/Frameworks /Library/Frameworks | 
|---|
 | 68 |         /Network/Library/Frameworks /System/Library/Frameworks | 
|---|
 | 69 |  | 
|---|
 | 70 |  | 
|---|
 | 71 | 3. 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 | 
|---|
 | 75 | need to be installed (only the most recent version matching your OS release is | 
|---|
 | 76 | supported). The Developer Tools installer is available on Mac OS X retail disks | 
|---|
 | 77 | or is present in /Applications/Installers on Macs that came with OS X | 
|---|
 | 78 | preinstalled. The most recent version can be downloaded from the ADC website | 
|---|
 | 79 | http://connect.apple.com (after you register for free ADC membership). | 
|---|
 | 80 |  | 
|---|
 | 81 | - Tcl is most easily built as a Mac OS X framework via GNUmakefile in tcl/macosx | 
|---|
 | 82 | (see below for details), but can also be built with the standard unix configure | 
|---|
 | 83 | and make buildsystem in tcl/unix as on any other unix platform (indeed, the | 
|---|
 | 84 | GNUmakefile is just a wrapper around the unix buildsystem). | 
|---|
 | 85 | The Mac OS X specific configure flags are --enable-framework and | 
|---|
 | 86 | --disable-corefoundation (which disables CF and notably reverts to the standard | 
|---|
 | 87 | select based notifier). | 
|---|
 | 88 |  | 
|---|
 | 89 | - It is also possible to build with Apple's IDE via the projects in tcl/macosx, | 
|---|
 | 90 | take care to only use the project matching your DevTools and OS version: | 
|---|
 | 91 |     * Tcl.pbproj for Xcode or ProjectBuilder on 10.3 and earlier, this has a | 
|---|
 | 92 |         'Tcl' target that simply calls through to the tcl/macosx/GNUMakefile. | 
|---|
 | 93 |     * Tcl.xcode for Xcode 2.4 on 10.4 and Xcode 2.5 on 10.4 and later, which | 
|---|
 | 94 |         additionally has a native 'tcltest' target useful for debugging, this | 
|---|
 | 95 |         target's 'Debug' build configuration has ZeroLink and Fix&Continue | 
|---|
 | 96 |         enabled, use the 'DebugNoFixZL' build configuration if you need a debug | 
|---|
 | 97 |         build without these features. The following additional build | 
|---|
 | 98 |         configurations are available for the 'Tcl' and 'tcltest' targets: | 
|---|
 | 99 |         'DebugUnthreaded': debug build with threading turned off. | 
|---|
 | 100 |         'DebugMemCompile': debug build with memory and bytecode debugging on. | 
|---|
 | 101 |         'DebugLeaks': debug build with PURIFY defined. | 
|---|
 | 102 |         'Debug64bit': builds the targets as 64bit with debugging enabled, | 
|---|
 | 103 |                 requires a 64bit capable processor (i.e. G5 or Core2/Xeon). | 
|---|
 | 104 |         'ReleaseUniversal': builds the targets as universal binaries for the | 
|---|
 | 105 |                 ppc, ppc64, i386 and x86_64 architectures. | 
|---|
 | 106 |         'ReleaseUniversal10.4uSDK': same as 'ReleaseUniversal' but builds | 
|---|
 | 107 |                 against the 10.4u SDK, required to build universal binaries on | 
|---|
 | 108 |                 PowerPC Tiger (where the system libraries are not universal). | 
|---|
 | 109 |         'ReleasePPC10.3.9SDK': builds for PowerPC against the 10.3.9 SDK, useful | 
|---|
 | 110 |                 for verifying on Tiger that building on Panther would succeed. | 
|---|
 | 111 |         'ReleasePPC10.2.8SDK': builds for PowerPC with gcc-3.3 against the | 
|---|
 | 112 |                 10.2.8 SDK, useful to verify on Tiger that building on Jaguar | 
|---|
 | 113 |                 would succeed. | 
|---|
 | 114 |     * Tcl.xcodeproj for Xcode 3.0 on 10.5 and later, which has the following | 
|---|
 | 115 |         additional build configuration: | 
|---|
 | 116 |         'ReleaseUniversal10.5SDK': same as 'ReleaseUniversal' but builds | 
|---|
 | 117 |                 against the 10.5 SDK on Leopard (with 10.5 deployment target). | 
|---|
 | 118 |  | 
|---|
 | 119 | Notes about the native targets of the Xcode projects: | 
|---|
 | 120 |     * the Xcode projects refer to the toplevel tcl source directory through the | 
|---|
 | 121 |         TCL_SRCROOT user build setting, by default this is set to the | 
|---|
 | 122 |         project-relative path '../../tcl', if your tcl source directory is named | 
|---|
 | 123 |         differently, e.g. '../../tcl8.5', you'll need to manually change the | 
|---|
 | 124 |         TCL_SRCROOT setting by editing your ${USER}.pbxuser file (located inside | 
|---|
 | 125 |         the Tcl.xcodeproj bundle directory) with a text editor. | 
|---|
 | 126 |     * the native targets need a version of the unix configure script with config | 
|---|
 | 127 |         headers enabled, this is automatically generated as tcl/macosx/configure | 
|---|
 | 128 |         by the project but that requires 2.59 versions of autoconf & autoheader. | 
|---|
 | 129 |         These are not available on Mac OS X 10.5 by default and need to be | 
|---|
 | 130 |         installed manually. By default they are assumed to be installed as | 
|---|
 | 131 |         /usr/local/bin/autoconf-2.59 and /usr/local/bin/autoheader-2.59, set the | 
|---|
 | 132 |         AUTOCONF and AUTOHEADER build settings in ${USER}.pbxuser to their true | 
|---|
 | 133 |         locations if necessary. | 
|---|
 | 134 |  | 
|---|
 | 135 | - To build universal binaries outside of Tcl.xcodeproj, set CFLAGS as follows: | 
|---|
 | 136 |     export CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 \ | 
|---|
 | 137 |         -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" | 
|---|
 | 138 | This requires Mac OS X 10.4 and Xcode 2.4 (or Xcode 2.2 if -arch x86_64 is | 
|---|
 | 139 | omitted, but _not_ Xcode 2.1) and will work on any of the architectures (the | 
|---|
 | 140 | -isysroot flag is only required on PowerPC Tiger). | 
|---|
 | 141 | Note that configure requires CFLAGS to contain a least one architecture that can | 
|---|
 | 142 | be run on the build machine (i.e. ppc on G3/G4, ppc or ppc64 on G5, ppc or i386 | 
|---|
 | 143 | on Core and ppc, i386 or x86_64 on Core2/Xeon). | 
|---|
 | 144 | Universal builds of Tcl TEA extensions are also possible with CFLAGS set as | 
|---|
 | 145 | above, they will be [load]able by universal as well as thin binaries of Tcl. | 
|---|
 | 146 |  | 
|---|
 | 147 | - To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable | 
|---|
 | 148 | to the minimal OS version (>= 10.2) the binaries should be able to run on, e.g: | 
|---|
 | 149 |     export MACOSX_DEPLOYMENT_TARGET=10.2 | 
|---|
 | 150 | This requires Mac OS X 10.2 and gcc 3.1; if you have gcc 4 or later you can set | 
|---|
 | 151 | CFLAGS instead: | 
|---|
 | 152 |     export CFLAGS="-mmacosx-version-min=10.2" | 
|---|
 | 153 | The Tcl.xcode project is setup to produce binaries that can run on 10.2 or | 
|---|
 | 154 | later (except for the Universal and SDK configurations). | 
|---|
 | 155 | Support for weak-linking was added to the code for 8.4.14/8.5a5. | 
|---|
 | 156 |  | 
|---|
 | 157 | Detailed Instructions for building with macosx/GNUmakefile | 
|---|
 | 158 | ---------------------------------------------------------- | 
|---|
 | 159 |  | 
|---|
 | 160 | - Unpack the tcl source release archive. | 
|---|
 | 161 |  | 
|---|
 | 162 | - The following instructions assume the tcl source tree is named "tcl${ver}", | 
|---|
 | 163 | where ${ver} is a shell variable containing the tcl version number (for example | 
|---|
 | 164 | '8.4.12'). | 
|---|
 | 165 | Setup the shell variable as follows: | 
|---|
 | 166 |         set ver="8.4.12" ;: if your shell is csh | 
|---|
 | 167 |         ver="8.4.12"     ;: if your shell is sh | 
|---|
 | 168 | The source tree will be named this way only if you are building from a release | 
|---|
 | 169 | archive, if you are building from CVS, the version numbers will be missing; so | 
|---|
 | 170 | set ${ver} to the empty string instead: | 
|---|
 | 171 |         set ver=""       ;: if your shell is csh | 
|---|
 | 172 |         ver=""           ;: if your shell is sh | 
|---|
 | 173 |  | 
|---|
 | 174 | - The following steps will build Tcl from the Terminal, assuming you are located | 
|---|
 | 175 | in the directory containing the tcl source tree: | 
|---|
 | 176 |         make -C tcl${ver}/macosx | 
|---|
 | 177 | and the following will then install Tcl onto the root volume (admin password | 
|---|
 | 178 | required): | 
|---|
 | 179 |         sudo make -C tcl${ver}/macosx install | 
|---|
 | 180 | if you don't have the admin password, you can install into your home directory, | 
|---|
 | 181 | instead by passing an INSTALL_ROOT argument to make: | 
|---|
 | 182 |         make -C tcl${ver}/macosx install INSTALL_ROOT="${HOME}/" | 
|---|
 | 183 |  | 
|---|
 | 184 | - The default Makefile targets will build _both_ debug and optimized versions of | 
|---|
 | 185 | the Tcl framework with the standard convention of naming the debug library | 
|---|
 | 186 | Tcl.framework/Tcl_debug. | 
|---|
 | 187 | This allows switching to the debug libraries at runtime by setting | 
|---|
 | 188 |         export DYLD_IMAGE_SUFFIX=_debug | 
|---|
 | 189 | (c.f. man dyld for more details) | 
|---|
 | 190 |  | 
|---|
 | 191 | If you only want to build and install the debug or optimized build, use the | 
|---|
 | 192 | 'develop' or 'deploy' target variants of the Makefiles, respectively. | 
|---|
 | 193 | For example, to build and install only the optimized versions: | 
|---|
 | 194 |         make -C tcl${ver}/macosx deploy | 
|---|
 | 195 |         sudo make -C tcl${ver}/macosx install-deploy | 
|---|