# $Id: Portfile,v 1.10 2006/06/23 09:55:25 jkh Exp $

PortSystem 1.0
name		emacs-devel
version		22.0.50.1
revision	2
categories	editors
maintainers	darwinports@opendarwin.org
description	The GNU Emacs text editor, bleeding edge version
long_description	GNU Emacs is a self-documenting, customizable, extensible real-time display editor. \
			Users new to Emacs will be able to use basic features fairly rapidly \
			by studying the tutorial and using the self-documentation features. \
			Emacs also has an extensive interactive manual browser.	 It is easily \
			extensible since its editing commands are written in Lisp.
platforms	darwin freebsd
homepage	http://www.gnu.org/software/emacs/emacs.html
master_sites	gnu
fetch.type		cvs
cvs.root		:pserver:anonymous@cvs.sv.gnu.org:/sources/emacs
cvs.module		emacs
cvs.date		20060622
version			${version}-${cvs.date}

worksrcdir		emacs

patch.pre_args	-p1
patchfiles		patch-src-s-darwin.h

configure.args	--mandir=${prefix}/share/man --infodir=${prefix}/share/info --without-x
configure.env	\
	LDFLAGS="-L${prefix}/lib" \
	CFLAGS="-I${prefix}/include" \
	CPPFLAGS="-I${prefix}/include"

platform darwin 8 {
	configure.env-append	CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0
}

build.target	bootstrap

#destroot.args	prefix=${destroot}${prefix}

post-destroot {
	cd ${destroot}${prefix}
	file mkdir share/emacs/${version}/leim
	if {[variant_isset carbon]} {
		global version
		file delete bin/emacs
		file delete bin/emacs-${version}
	}
}

variant x11 {
	configure.args-delete --without-x
	configure.args-append --with-x-toolkit=lucid --without-carbon \
		--with-xpm --with-jpeg --with-tiff --with-gif --with-png
	depends_lib-append  lib:libX11:XFree86 lib:libXpm:XFree86 \
			    lib:libjpeg:jpeg lib:libtiff:tiff \
			    lib:libungif:libungif lib:libpng:libpng
}

variant gtk requires x11 {
	configure.args-delete --with-x-toolkit=lucid
	configure.args-append --with-x-toolkit=gtk
	depends_lib-append  lib:libgtk.2:gtk2 lib:libglib.2:glib2
}

variant carbon conflicts x11 {
	configure.args-append	--with-carbon --enable-carbon-app=/Applications/DarwinPorts
}

variant atsui requires carbon {
	configure.env-delete    CFLAGS="-I${prefix}/include"
	configure.env-append    CFLAGS="-I${prefix}/include -DUSE_ATSUI"
}
