[Pythonmac-SIG] ANNOUNCE: Tcl/Tk for Mac OS X (fwd)

Guido van Rossum guido@python.org
Mon, 15 Oct 2001 20:50:04 -0400


------- Forwarded Message

Date:    Mon, 15 Oct 2001 17:55:21 -0500
From:    Cameron Laird <claird@starbase.neosoft.com>
To:      guido@python.org, nick.ing-simmons@elixent.com, lusol@Pandora.CC.Lehig
	  h.ED
cc:      
Subject: ANNOUNCE: Tcl/Tk for Mac OS X (fwd)

Pass the word.
- ------- start of forwarded message -------
From: jingham@apple.com (Jim Ingham)
Newsgroups: comp.lang.tcl.announce,comp.lang.tcl
Subject: ANNOUNCE: Tcl/Tk for Mac OS X
Followup-To: comp.lang.tcl
Date: 15 Oct 2001 12:31:10 -0700
Organization: Apple Computer, Inc.
Lines: 208
Approved: tcl-announce@mitchell.org
Message-ID: <pgpmoose.200110151230.24573@non.non.net>
NNTP-Posting-Host: non.non.net
X-Trace: maxwell.emf.net 1003174415 7402 205.217.47.130 (15 Oct 2001 19:33:35 G
MT)
X-Complaints-To: news@news2.emf.net
NNTP-Posting-Date: 15 Oct 2001 19:33:35 GMT
X-Original-Trace: news.apple.com 1003143020 5594 17.254.160.31 (15 Oct 2001 10:
50:20 GMT)
X-Original-Complaints-To: usenet@news.apple.com
X-Original-NNTP-Posting-Date: 15 Oct 2001 10:50:20 GMT
User-Agent: NewsWatcher-X 2.2.3b1
X-Auth: PGPMoose V1.1 PGP comp.lang.tcl.announce
	iQCVAwUAO8s5dMVCYQpvzJ9ZAQFgvwP+NcUxI9hTf2V7kYrzKf4dxXq6Xs76y59w
	HYOPmwSE4W5bHNrttq56sx7H1EQpF6VFom8ffQJnoKI03B4OTUq1N1oznnXvqEAl
	5ql/oC7SBkxEe6oN0TCgsCzb4mpL9JMLQLRVi9E+MUHrzJDsODAWouSCALVbqpEZ
	k3qW4C46+us=
	=JV3M
Xref: news-f.iadfw.net comp.lang.tcl.announce:1932 comp.lang.tcl:191234

Hi, all...

With a lot of support from Apple, I have at long last a fairly
workable port of Tk for Mac OS X.  The sources are currently on a
branch off of the Tcl/Tk 8.4a4 branch, the branch name is:

macosx-8-4-branch

Go to the SourceForge Tcl headquarters for more details, at:

http://tcl.sourceforge.net

I also put a binary snapshot of Wish and the Tcl & Tk Frameworks in
the SourceForge release, under the package name "Mac OS X Tk
Snapshots".  You can get to this by looking at the page:

http://sourceforge.net/projects/tcl/

and look for Latest File Releases.  Probably should have put this in
the Tk site instead, Doh!  I am just getting used to SourceForge.


SO HOW DO I USE THIS STUFF:

========================================
First for the binaries...  

The snapshot is just a gzipped tar file, that has the structure:

Applications/Wish Shell.app
   ...
Library/Frameworks/Tcl.framework
   ...
Library/Frameworks/Tk.framework
   ...

So you can either untar this in / - to make an installation that is
available to all users on your machine, or in ~ to make one useable
only to you.  In any case, just double-click on Wish Shell.app to get
started.  You will probably also want to change the files to
make them owned by you...

In fact, you can move things around even more than this.  The Frameworks
just need to be in one of the system paths (/Library/Frameworks,
/System/Library/Frameworks, or ~/Library/Frameworks) to be found
automatically by dyld.  Or you can put them somewhere else and set
DYLD_FRAMEWORK_PATH to point to that location.

After that, you can put "Wish Shell.app" pretty much anywhere you
want.

One other little trick about the "Wish Shell.app" that may come in
handy.  If you put a file called "AppMain.tcl" inside the "Wish
Shell.app" package, in the folder:

Wish Shell.app/Contents/Resources/Scripts

then that will be sourced in as if you had given it as the first
argument on the command-line in Unix, or equivalently had made a D&D
Tclet with that file on the Mac.  The Mac OS X version goes one
better, because the Scripts directory is also added to the auto_path,
so you can put your script libraries there, and they will be found as
well. 

The "Wish Shell.app" uses the same console that the Windows & Mac
ports use.  However, if you want to use a terminal console for some
reason, then just do:

$ ./Wish Shell.app/Contents/MacOS/Wish Shell"

in Terminal.app, and it will use the Terminal window instead of the Tk
based one.

There is some support for the Custom MDEF that Tk used on MacOS X, but
it is pretty rough right now, so I have turned it off by default.  If
you want to play with this, do:

set ::tk::mac::useCustomMDEF 1

somewhere BEFORE you create your menus, it will only affect
menus made after you change the setting.  The default setting is done
at the end of tk.tcl in the Resources/Scripts folder in the Tk
framework, so you can also just reverse this setting there to make
Wish always use the custom MDEF.

These binaries were built on Mac OS X - 10.1.  There is no obvious reason
why they wouldn't run on 10.0, but I haven't run that in quite a long
time, so I won't guarantee there aren't any little hitches.  10.1 is SO
much nicer than 10.0, however, that I am not inclined to spend much time
supporting it.

========================================
Next the source:

As I said, the sources are on the SourceForge CVS repositories, the
branch name is macosx-8-4-branch.  The projects expect tcl & tk to be
in the same folder, so like:

./source
    source/tcl
    source/tk

If they are not set up like this, you will have to go muck with the
include paths in the project.

Tcl:

On the Tcl side, there aren't many changes.  I added a MacOS X
directory, but all it contains at present is a Project Builder project
that will build Tcl in the way that Wish currently expects it to be
built.  You can also build the Tcl in this distribution with the
standard configure/make.  But I haven't added the ability to
auto-magically build the Framework from the Makefile.  That is what
the PB Project is for.

The one special thing to note is that Wish requires that you build
the --enable-thread version of Tcl.  I haven't put in any checks to
make sure you do this yet, but it will fail pretty much straight off
the bat if you don't, so...  This was required to wait on Tcl "select"
based sources and still keep Carbon waiting on the App Main Thread as
Ed intended.

I also want to migrate the AppleScript and Resource goodies from the
Classic Mac side to MacOS X, and also add an interface to the CFBundle
API's (which I am now using hackily in tclUnixInit.c).  But I haven't
gotten around to that yet.

Tk:

Tk has the majority of the changes, as you would expect.  There are
not any really substantial changes in the generic folder, there are
some in the library code, mostly because a lot of it assumes
tcl_platform(platform) == unix means you are using X11, which is not
the case for MacOS X.  

Other that that, the code in the macosx folder is the interesting
bits.  It is a pretty straight Carbonization of the Classic Mac code,
but I also took advantage of the opportunity to toss alot of the cruft
from supporting earlier versions of MacOS, and to rework the code to
be a little more to my liking.

I didn't try to rework the Unix Makefiles to support building Wish on
MacOS X.  In part this was because there weren't many similarities
between the Unix & Mac OS X Makefiles, but mostly because I wanted to
use Project Builder, since I actually like GUI development
environments.  If someone with the opposite bent wants to hack up some
Makefiles, I would be happy to accept the changes.

The only trick to building Tcl & Wish is to set the Product
directories for the Tcl.pbproj and Wish.pbproj to the same directory
(either in the PB Global preferences, or in the super-secret Project
specific preferences that you find by selecting the Project entry in
the File tree, and doing "Show Info".)  Then build the topmost Tcl
agregate target, and then build the Wish Target.

In a couple of days I will get together a list of "current and future
projects" in case anyone is interested in helping.  There is a SourceForge
task manager that should be a good venue for this.  There is lots of fun
stuff still to do, by the way, including converting from QuickDraw to
CoreGraphics for the low-level drawing code - so we can get nice looking
line drawing onthe canvas, finally...  And using ATSUI, so we can get the
sweet anti-aliased fonts.

Extensions:

To tell the truth, I only started playing around seriously with
packaging all this stuff up in Frameworks & App Packages in the past
couple of weeks.  I think the structure offers a lot of promise, but I
haven't worked on porting extensions yet, so there will probably be
some refinements to make this easier as time goes on.  

If you have a standard Tcl (not Tk) extension, the way Tcl.pbproj
builds things is a pretty good model.  It shows how to build
frameworks from a Makefile based approach without having to hack up
your Makefiles too badly.

I would like to figure out a way to do this more generally within the
TEA structure, while still getting to use PB, and inflicting the least
pain on other extension writers.  But I've only just started thinking
about this part.

Well, there are probably a lot more little stumbling blocks that I am
forgetting, but it is late, and I am sure you will all remind me of
them in due course.

One thing I can't omit, however, is a big THANKS to Apple, who let me
work with this in spite of my having another day job, to Dave Payne,
my manager, who supported this project even when gdb needed all the
coddling we could give it, to Sergio Mello from Apple DTS who found
the resources to hire Ian Reid to help out with this for the past 6
months, and to Ian, who did all the dog work while I mostly got to say
"Well, I think it should work like..."  

Sometimes it even did...

Jim Ingham
Apple Computer, Inc.

- -- 
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Jim Ingham                            jingham@apple.com
Developer Tools - gdb

[[Send Tcl/Tk announcements to tcl-announce@mitchell.org
  Send administrivia to tcl-announce-request@mitchell.org
  Announcements archived at http://groups.yahoo.com/group/tcl_announce/
  The primary Tcl/Tk archive is ftp://ftp.neosoft.com/pub/tcl/ ]]

- ------- end of forwarded message -------

- -- 

Cameron Laird <claird@NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html

------- End of Forwarded Message