caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ken Wakita <wakita@is.titech.ac.jp>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] Native labltk for Mac OS X
Date: Tue, 07 Jan 2003 20:26:48 +0900	[thread overview]
Message-ID: <BA40E890.130F5%wakita@is.titech.ac.jp> (raw)

[-- 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>

             reply	other threads:[~2003-01-07 11:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-07 11:26 Ken Wakita [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BA40E890.130F5%wakita@is.titech.ac.jp \
    --to=wakita@is.titech.ac.jp \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).