caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Native labltk for Mac OS X
@ 2003-01-07 11:26 Ken Wakita
  2003-01-08  4:33 ` Ken Wakita
  0 siblings, 1 reply; 8+ messages in thread
From: Ken Wakita @ 2003-01-07 11:26 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]


Today I found some time to install Tcl/Tk for Aqua, which is the native user
interface for Macintosh OS X and configured ocaml-3.06 so that its labltk
links with the Tcl/Tk for Aqua.

labltk, ocamlbrowser, and accompanying examples (hello, eyes, tetris, ...)
under otherlibs/labltk/examples_labltk compiles with little problem.

With a small effort you could make a clickable native application for Mac OS
X.

Though behavior of some applications is weird (some, for instance
ocamlbrowser, are very weird) but I can tolerate.

The following is an outline of installation steps (Mac OS 10.2.2 and higher
is expected):

0. Visit "www.tcl.tk" and get TclTkAqua_8.4.1-Jaguar.dmg, and install it.

After installation make four symbolic links as show followingly (you need to
be a super user):

/Library/Frameworks/Tcl.framework:

lr-xr-xr-x  1 root  staff   11 Jan  7 18:58 libtcl -> libtcl8.4.a
lr-xr-xr-x  1 root  staff   16 Jan  7 18:58 libtcl8.4.a -> Versions/8.4/Tcl

/Library/Frameworks/Tk.framework:

lr-xr-xr-x  1 root  staff   10 Jan  7 18:58 libTk -> libTk8.4.a
lr-xr-xr-x  1 root  staff   15 Jan  7 18:58 libTk8.4.a -> Versions/8.4/Tk

1. Extract ocaml-3.06.tgz and apply the attached patch (tcltk4aqua.patch)

cd ocaml-3.06; patch -p1 tcltk4aqua.patch

2. Execute the configuration script

sh ocaml4darwin.conf

This script configures ocaml-3.06 for Mac OS X and for the Tcl/Tk just
installed.  It also builds "world, opt, and opt.opt".

 You might want to save the existing ocaml-3.06 installation.  In that case,
modify the script appropriately.

3. Install the ocaml-3.06 system

make install

4. Store makeapp.sh and Info.plist at the labltk's examples directory and
build clickable applications.

4.1 store makeapp.sh and Info.plist in "otherlibs/labltk/examples_labltk"
directory.

4.2 build examples

cd otherlibs/labltk/examples_labltk
make

4.3 build clickable applications

./makeapp hello
./makeapp tetris
...

4.4 locate the Finder application to the examples_labltk directory and start
the clickable applications.

Good luck

Ken
 


[-- Attachment #2: tcltk4aqua.patch --]
[-- Type: application/octet-stream, Size: 3255 bytes --]

diff -c -r ocaml-3.06/configure ocaml-ken/configure
*** ocaml-3.06/configure	Wed Aug  7 21:45:00 2002
--- ocaml-ken/configure	Tue Jan  7 15:28:58 2003
***************
*** 1269,1274 ****
--- 1269,1275 ----
    fi
  fi
  
+ export verbose=yes
  tkauxlibs="$mathlib $dllib"
  tcllib=''
  tklib=''
***************
*** 1307,1312 ****
--- 1308,1314 ----
      has_tk=false
    fi
  fi
+ verbose=no
  
  if test $has_tk = true; then
    if test $tk_x11 = yes; then
diff -c -r ocaml-3.06/otherlibs/labltk/browser/main.ml ocaml-ken/otherlibs/labltk/browser/main.ml
*** ocaml-3.06/otherlibs/labltk/browser/main.ml	Tue Aug  6 18:17:26 2002
--- ocaml-ken/otherlibs/labltk/browser/main.ml	Tue Jan  7 18:49:59 2003
***************
*** 88,97 ****
          \032    X/x enable/disable all other warnings\n\
          \032    default setting is \"Al\" (all warnings but labels enabled)" ]
    and errmsg = "Command line: ocamlbrowser <options>" in
!   if not (check ~spec Sys.argv) then fatal_error (usage ~spec errmsg);
    Arg.parse spec
      (fun name -> raise(Arg.Bad("don't know what to do with " ^ name)))
      errmsg;
    Config.load_path :=
      Sys.getcwd ()
      :: List.rev_map ~f:(Misc.expand_directory Config.standard_library) !path
--- 88,99 ----
          \032    X/x enable/disable all other warnings\n\
          \032    default setting is \"Al\" (all warnings but labels enabled)" ]
    and errmsg = "Command line: ocamlbrowser <options>" in
! (*
!   if not (check ~spec argv) then fatal_error (usage ~spec errmsg);
    Arg.parse spec
      (fun name -> raise(Arg.Bad("don't know what to do with " ^ name)))
      errmsg;
+ *)
    Config.load_path :=
      Sys.getcwd ()
      :: List.rev_map ~f:(Misc.expand_directory Config.standard_library) !path
diff -c -r ocaml-3.06/otherlibs/labltk/support/cltkImg.c ocaml-ken/otherlibs/labltk/support/cltkImg.c
*** ocaml-3.06/otherlibs/labltk/support/cltkImg.c	Tue Jul 23 23:11:59 2002
--- ocaml-ken/otherlibs/labltk/support/cltkImg.c	Tue Jan  7 18:05:24 2003
***************
*** 99,105 ****
    pib.offset[0] = 0;
    pib.offset[1] = 1;
    pib.offset[2] = 2;
!   Tk_PhotoPutBlock(ph,&pib,Int_val(x),Int_val(y),Int_val(w),Int_val(h)); 
  }
  
  CAMLprim void camltk_setimgdata_bytecode(argv,argn)
--- 99,105 ----
    pib.offset[0] = 0;
    pib.offset[1] = 1;
    pib.offset[2] = 2;
!   Tk_PhotoPutBlock(ph,&pib,Int_val(x),Int_val(y),Int_val(w),Int_val(h), TK_PHOTO_COMPOSITE_OVERLAY); 
  }
  
  CAMLprim void camltk_setimgdata_bytecode(argv,argn)
diff -c -r ocaml-3.06/otherlibs/labltk/tkanim/tkAnimGIF.c ocaml-ken/otherlibs/labltk/tkanim/tkAnimGIF.c
*** ocaml-3.06/otherlibs/labltk/tkanim/tkAnimGIF.c	Tue Jul 23 23:12:00 2002
--- ocaml-ken/otherlibs/labltk/tkanim/tkAnimGIF.c	Tue Jan  7 18:14:54 2003
***************
*** 336,342 ****
              }
          }
          Tk_PhotoPutBlock(photoHandle, &block, 0, 0, 
!                          imageWidth, imageHeight);
  #ifdef TKANIM_DEBUG
      fprintf(stderr, " Retrieving result\n");
  #endif
--- 336,342 ----
              }
          }
          Tk_PhotoPutBlock(photoHandle, &block, 0, 0, 
!                          imageWidth, imageHeight, TK_PHOTO_COMPOSITE_OVERLAY);
  #ifdef TKANIM_DEBUG
      fprintf(stderr, " Retrieving result\n");
  #endif

[-- Attachment #3: ocaml4darwin.conf --]
[-- Type: application/octet-stream, Size: 265 bytes --]

TCLDIR=/Library/Frameworks/Tcl.framework
TKDIR=/Library/Frameworks/Tk.framework
INCS="-I$TCLDIR/Headers -I$TKDIR/Headers"
LIBS="-L$TCLDIR -lTcl -L$TKDIR -lTk"

./configure \
	-tk-no-x11 \
	-tkdefs "$INCS" \
	-tklibs "$LIBS"

ulimit -s 65536

make world opt opt.opt

[-- Attachment #4: makeapp.sh --]
[-- Type: application/octet-stream, Size: 141 bytes --]

#!/bin/sh

app=$1
mkdir -p $app.app/Contents/MacOS
cp $app $app.app/Contents/MacOS
sed s/APP/$app/ Info.plist > $app.app/Contents/Info.plist

[-- Attachment #5: Info.plist --]
[-- Type: application/octet-stream, Size: 218 bytes --]

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
	<key>CFBundleExecutable</key>
	<string>APP</string>
</dict>
</plist>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-01-09 12:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07 11:26 [Caml-list] Native labltk for Mac OS X Ken Wakita
2003-01-08  4:33 ` Ken Wakita
2003-01-08  8:53   ` Sven Luther
2003-01-08 11:17     ` Ken Wakita
2003-01-08 11:23       ` Sven Luther
2003-01-09  9:12         ` Jacques Garrigue
2003-01-09 12:00           ` Ken Wakita
2003-01-09 12:46           ` Sven Luther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).