# $Id: Portfile,v 1.5 2006/04/19 16:37:28 gwright Exp $

PortSystem 1.0

name		slime
version		20060419
epoch		20060419
categories	lang
maintainers	evenson@panix.com

description	An Emacs mode for unifying Common Lisp development

long_description	\
		SLIME extends Emacs with new support for interactive \
		programming in Common Lisp. The features are \
		centred around `slime-mode', an Emacs minor-mode \
		that complements the standard `lisp-mode'. While \
		`lisp-mode' supports editing Lisp source files, \
		`slime-mode' adds support for interacting with a \
		running Common Lisp process for compilation,\
		debugging, documentation lookup, and so on. 

homepage	http://common-lisp.net/project/slime/	
master_sites	${homepage}
fetch.type	cvs
cvs.root	:pserver:anonymous@common-lisp.net:/project/slime/cvsroot
cvs.module	slime
cvs.password	anonymous
cvs.date	20060419
worksrcdir	slime

use_configure	no
depends_lib	port:emacs
depends_run	port:sbcl

variant devel	{ depends_lib-delete port:emacs
		  depends_lib-append port:emacs-devel
		}

variant openmcl	{ depends_run-delete port:sbcl
		  depends_run-append port:openmcl
		}

variant clisp	{ depends_run-delete port:sbcl
		  depends_run-append port:clisp
		}

post-patch	{ reinplace "s|/usr/local|${prefix}/share|g" \
		    ${worksrcpath}/doc/makefile
}

pre-build	{ global emacs_binary
		  if {[ variant_isset devel ]} {
		  	set emacs_binary [ glob ${prefix}/bin/emacs\-* ]
		  	ui_msg "emacs binary name is ${emacs_binary}"
		  } else {
			set emacs_binary	${prefix}/bin/emacs
		  }
}
			
build		{ cd ${worksrcpath}
		  upvar #0 emacs_binary emacs_bin
		  system "${emacs_bin}			\
   		  	  --batch			\
			  --directory .			\
			  --funcall batch-byte-compile	\
			  slime.el			\
			  hyperspec.el			\
			  tree-widget.el"

		  cd ${worksrcpath}/doc
		  system "make slime.info"
}

destroot	{ cd ${worksrcpath}
		  set site_lisp_dest ${destroot}${prefix}/share/emacs/site-lisp/slime
		  xinstall -m 755 -d ${site_lisp_dest}

		  foreach file [glob *.el *.elc *.lisp ChangeLog] {
			xinstall -m 644 ${file} ${site_lisp_dest}
		  }

		  xinstall -m 644 ${worksrcpath}/doc/slime.info ${destroot}${prefix}/share/info  
}

post-activate	{ ui_msg "To use SLIME, you need to have a Common Lisp installed with which"
		  ui_msg "you wish to interact.  At the moment, 'openmcl', 'sbcl', and"
		  ui_msg "'clisp' all work."
		  ui_msg ""
		  ui_msg "DarwinPorts also has 'gcl' (broken on OS X)."
		  ui_msg ""
		  ui_msg "Then put the following in your ~/.emacs:"
		  ui_msg " (require 'slime)"
		  ui_msg " (slime-setup)"
		  ui_msg " (setq inferior-lisp-program \"sbcl\")"
		  ui_msg ""
		  ui_msg "Replace 'sbcl' with the name of the Common Lisp exectuable"
		  ui_msg "if you wish to use a different lisp."
		  ui_msg ""
		  ui_msg "Then, 'M-x slime' from Emacs should connect you to your chosen"
		  ui_msg "Lisp environment."
		  ui_msg ""
		  ui_msg "You may have to exit and restart Emacs to get slime completely installed."
}

