# $Id: Portfile 72529 2010-10-19 19:35:24Z gwright@macports.org $

PortSystem 1.0
name		tuareg-mode.el
# reverting to version 1.45 because 1.46 was removed from official download website
epoch		1
version		2.0.2
categories	lang editors
maintainers	nomaintainer
description	A GNU Emacs/XEmacs major mode for editing Caml and OCaml programs.
long_description\
	Tuareg is a Caml mode for GNU Emacs  and XEmacs. It handles \
	automatic indentation of Objective Caml and Camllight codes. \
	Key parts of the code are highlighted using Font-Lock. Support \
	to run an interactive Caml toplevel and debugger is provided.

homepage	http://tuareg.forge.ocamlcore.org/
platforms	darwin
distname	tuareg-${version}
master_sites	http://forge.ocamlcore.org/frs/download.php/468/

checksums	md5     71f54eb051d9e4ad84e1250c7e5b9534 \
		sha1    0361f39c35d759cee66c549f3400390e9019c431 \
		rmd160  153a0958bed6e6517db1a30bdd23980f7add37f9

# We want emacs from MacPorts since this will install stuff in emacs'
# site-lisp and we want it to go into ${prefix}'s site-lisp.
depends_lib	port:emacs
depends_run	port:ocaml

use_configure	no

build		{
	system "cd ${worksrcpath} && \
		emacs --batch --eval \
			'(progn (setq load-path (cons \".\" load-path)) \
				(byte-compile-file \"tuareg.el\") \
				(byte-compile-file \"camldebug.el\"))'"
}

destroot			{
	file mkdir ${destroot}${prefix}/share/emacs/site-lisp
	xinstall ${worksrcpath}/tuareg.el ${destroot}${prefix}/share/emacs/site-lisp/
	xinstall ${worksrcpath}/tuareg.elc ${destroot}${prefix}/share/emacs/site-lisp/
	xinstall ${worksrcpath}/camldebug.el ${destroot}${prefix}/share/emacs/site-lisp/
	xinstall ${worksrcpath}/camldebug.elc ${destroot}${prefix}/share/emacs/site-lisp/
	xinstall ${worksrcpath}/sym-lock.el ${destroot}${prefix}/share/emacs/site-lisp/
}

post-install {
	ui_msg "To use this, put the following into your ~/.emacs:"
	ui_msg "(setq auto-mode-alist"
	ui_msg "  (cons '(\"\\\\.ml\\\\w?\" . tuareg-mode) auto-mode-alist))"
	ui_msg "(autoload 'tuareg-mode \"tuareg\" \"Major mode for editing Caml code.\" t)"
	ui_msg "(autoload 'camldebug \"cameldeb\" \"Run the Caml debugger.\" t)"
}

livecheck.type	regex
livecheck.regex	{var last_version = "Tuareg Version (.*)";}
