# $Id: Portfile 59973 2009-10-28 07:05:26Z pguyot@kallisys.net $

PortSystem			1.0
name				tuareg-mode.el
# reverting to version 1.45 because 1.46 was removed from official download website
epoch				1
version				1.45.6
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 hilighted using Font-Lock. Support \
					to run an interactive Caml toplevel and debbuger is provided.
homepage			http://www-rocq.inria.fr/~acohen/tuareg/
platforms			darwin
distname			tuareg-mode-${version}
use_bzip2			yes
master_sites		http://www-rocq.inria.fr/~acohen/tuareg/mode/
checksums           md5     75df362cba2d32e9828eebe80716009f \
                    sha1    ee557fc003537a2eed8c351fcb50cf52e8926c48 \
                    rmd160  cd99520a8b6940198b2db9a2cb9abeee309f8514

# 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			path:${prefix}/bin/emacs:emacs
depends_run			bin:ocaml: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 (.*)";}
