はじめに
とりあえず出ているのでビルドしてみただけです。
configure
まずmakeの準備。一応ビルドしておく。GNU makeじゃないとだめ。
$ sudo port install gmake $ make -v GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-apple-darwin10.0
つぎにconfigureする。
$ mkdir /opt/ocaml/ocaml3.12.0b1
$ curl http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.0+beta1.tar.bz2 > ocaml-3.12.0+beta1.tbz
$ tar xjf ocaml-3.12.0+beta1.tbz
$ cd ocaml-3.12.0+beta1
$ ./configure -prefix /opt/ocaml/3.12.0b1 -cc "gcc -m64"
...
** Configuration summary **
Directories where Objective Caml will be installed:
binaries.................. /opt/ocaml/3.12.0b1/bin
standard library.......... /opt/ocaml/3.12.0b1/lib/ocaml
manual pages.............. /opt/ocaml/3.12.0b1/man (with extension .1)
Configuration for the bytecode compiler:
C compiler used........... gcc -m64
options for compiling..... -fno-defer-pop -no-cpp-precomp -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
options for linking....... -lcurses -lpthread
shared libraries are supported
options for compiling..... -fno-defer-pop -no-cpp-precomp -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
command for building...... gcc -m64 -bundle -flat_namespace -undefined suppress -o lib.so /a/path objs
Configuration for the native-code compiler:
hardware architecture..... amd64
OS variant................ macosx
C compiler used........... gcc -m64
options for compiling..... -D_FILE_OFFSET_BITS=64 -D_REENTRANT
options for linking.......
assembler ................ as -arch x86_64
preprocessed assembler ... gcc -arch x86_64 -c
native dynlink ........... true
profiling with gprof ..... supported
Source-level replay debugger: supported
Additional libraries supported:
unix str num dynlink bigarray systhreads threads graph dbm labltk
Configuration for the "num" library:
target architecture ...... amd64 (asm level 1)
Configuration for the "graph" library:
options for compiling .... -I/usr/X11R6/include
options for linking ...... -L/usr/X11R6/lib -lX11
Configuration for the "labltk" library:
use tcl/tk version ....... 8.5
options for compiling ....
options for linking ...... -ltk8.5 -ltcl8.5
** Objective Caml configuration completed successfully **
make
これもINSTALLに書いてある通りにビルドするだけ。
$ make world $ make bootstrap $ make opt $ make opt.opt $ sudo umask 022 $ sudo make install $ make clean
あまりに順調に行ってしまって非常につまらない。
テストしてみる
レコード
$ rlwrap ocaml
Objective Caml version 3.12.0+beta1
# type r = {int: x; int: y};;
Error: Two labels are named int
# type r = {x: int; y: int};;
type r = { x : int; y : int; }
# let x = 3 and y = 2;;
val x : int = 3
val y : int = 2
# let r = {x;y};;
val r : r = {x = 3; y = 2}