# $Id: Portfile 62875 2010-01-20 18:01:54Z mww@macports.org $

PortSystem		1.0

name 			ocaml
version			3.11.2
set major_vers	[join [lrange [split ${version} .] 0 1] .]
platforms		darwin
maintainers		mww openmaintainer
categories		lang ml
description		Objective Caml is an implementation of the ML language
homepage		http://www.ocaml.org/
master_sites	http://caml.inria.fr/pub/distrib/ocaml-${major_vers}/ \
                ftp://ftp.inria.fr/INRIA/Projects/cristal/ocaml/ocaml-${major_vers}
checksums           md5     4601a7aea66444d61704de8de46c52c6 \
                    sha1    59053ce0078da2367f4ce61da886d22c6e86a46d \
                    rmd160  a407e579b7fa134fc8126c5c5b544dd60cedecb1

long_description \
			Objective Caml is an implementation of the ML language, based on \
			the Caml Light dialect extended with a complete class-based object \
			system	and a powerful module system in the style of Standard ML.

use_bzip2           yes
use_parallel_build  no
universal_variant   no

set docdir          ${prefix}/share/doc/${name}-${version}

# Configure.
configure.pre_args	-prefix ${prefix}
configure.args		-no-tk -cc ${configure.cc} -aspp \"${configure.cc} -c\"

# Building.
build.target		world.opt
build.cmd           "unset LD_PREBIND LD_PREBIND_ALLOW_OVERLAP && ${build.cmd}"

# Install.
destroot.target		install
destroot.destdir	BINDIR=${destroot}${prefix}/bin \
					LIBDIR=${destroot}${prefix}/lib/ocaml \
					MANDIR=${destroot}${prefix}/share/man

post-destroot {
    # Change "ld.conf" to remove ${destroot} in paths.
    reinplace "s:${destroot}::g" ${destroot}${prefix}/lib/ocaml/ld.conf
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} Changes LICENSE README ${destroot}${docdir}
}

# Variants.
variant labltk description {Include TK bindings and ocamlbrowser} {
	depends_lib		lib:tcl8.4:tcl lib:tk8.4:tk
	configure.args-delete 	-no-tk
}

livecheck.type	regex
livecheck.url	http://caml.inria.fr/news.en.rss
livecheck.regex	"<title>Objective Caml (.*) released"
