# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 78120 2011-04-24 16:24:12Z css@macports.org $

PortSystem 1.0

name		emacs-app
version		23.3
revision	0
categories	aqua editors
maintainers	css
description	The GNU Emacs text editor (Cocoa version)

long_description	GNU Emacs is a self-documenting, customizable,      \
	extensible real-time display editor. This is a port of the latest   \
	GNU Emacs source to the OpenStep (or NeXTstep) APIs, as implemented \
	by Cocoa on OS X. It differs from Carbon ports of GNU Emacs in that \
	it makes a more concerted attempt from the ground up to follow OS X \
	desktop and UI conventions.

# Note that this distribution can support GNUstep as well, but that
# configuration is untested at this time.

platforms	darwin
homepage	http://www.gnu.org/software/emacs/
master_sites	gnu:emacs
distname	emacs-${version}
use_bzip2	yes
checksums           md5     a673c163b4714362b94ff6096e4d784a \
                    sha1    de2c924655f0f4e012cc119840cd341a1d40e32c \
                    rmd160  bddaba77f543b41a91d133c6700078a9b41b0bf8

depends_lib     port:ncurses
use_parallel_build      yes

configure.args	--with-ns --without-x --without-dbus

patchfiles      patch-src_unexmacosx.c.diff

variant fullscreen description {Add fullscreen patch from http://gist.github.com/291150 as mentioned in http://www.sanityinc.com/full-screen-support-for-cocoa-emacs-on-osx} {
    patchfiles-append patch-fullscreen.diff
}

destroot {
        system "cd ${worksrcpath} && make install"
	xinstall -m 755 -d ${destroot}${applications_dir}
	file copy ${worksrcpath}/nextstep/Emacs.app \
		${destroot}${applications_dir}
	file copy ${filespath}/site-start.el \
		${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp
}

post-destroot {
	reinplace "s|__PREFIX__|${prefix}|g" \
		${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp/site-start.el
}
