Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Aqua (non-X) labltk on Mac OS 10
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Trevor Jim <trevor@r...>
Subject: [Caml-list] Aqua (non-X) labltk on Mac OS 10
I managed to get labltk working in Mac OS 10 with the Aqua (non-X)
version of Tk.  It's a bit clunky but maybe someone who knows more
about these things can clean it up.

Here's how it goes:

You need Mac OS 10.x with the Developer's CD installed (I'm running
10.2.2).

Obtain the tcl-8.4.1 and tk-8.4.1 source from
http://tcl.sourceforge.net/.  (There now seems to be a binary
distribution, but that wasn't available when I started this.  Someone
else can give that a try.)

Follow these instructions to compile and install Tcl/Tk
(summarized from http://mini.net/tcl/4052):

   tar zxvf tcl8.4.1-src.tar.gz
   tar zxvf tk8.4.1-src.tar.gz
   mv tcl8.4.1 tcl
   mv tk8.4.1 tk
   cd tcl/macosx
   make >& make.log
   sudo make install
   cd ../../tk/macosx
   make >& make.log
   sudo make install

(NOTE: the mv's are in fact necessary.)

Obtain the ocaml-3.06 source and apply Jacques' patch so that it will
compile with tcl/tk 8.4.  (See
http://groups.google.com/groups?selm=fa.i2v96ov.1p7cmbc%40ifi.uio.no)

In the ocaml source directory do

   ./configure -tkdefs "-I/Library/Frameworks/Tcl.framework/Headers 
-I/Library/Frameworks/Tk.framework/Headers" -tk-no-x11 -tklibs 
"-F/Library/Frameworks/Tcl.framework -framework Tcl 
-F/Library/Frameworks/Tk.framework -framework Tk"

   make world
   make opt
   sudo make install
   make clean

Now you should be able to compile programs using labltk; but it takes
a bit more to get your program to run properly.  For example, in the
ocaml source directory, do

   cd otherlibs/labltk/examples_labltk
   ocamlc -o calc -I +labltk labltk.cma calc.ml

You now have a compiled calc program that will bring up a window, but
if you do

   ./calc

you will get an error message

   SetFrontProcess failed,-606

when you try to use the calculator.

To fix this you have to make an "application bundle", this is how
applications are packaged up on Mac OS 10.  So do

   mkdir calc.app
   mkdir calc.app/Contents
   mkdir calc.app/Contents/MacOS
   mv calc calc.app/Contents/MacOS

Now using your favorite editor create a file
calc.app/Contents/Info.plist with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
     <key>CFBundleExecutable</key>
     <string>calc</string>
</dict>
</plist>

(For a program named foo, you would of course substitute foo for calc
in the Info.plist file.)

That's it.  You can run the application from a terminal by doing

   open calc.app

Or, you can double-click calc.app from the Finder.  Note, the .app
extension will be hidden by the Finder.  Neither of these methods
allows command-line arguments to be passed to the program; I don't
know how to do that.

The labltk toplevel doesn't quite work -- the SetFrontProcess failure
comes up.  Maybe someone else can fix that.

-Trevor
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners