Source

macports / aqua / emacs-app / Portfile

Full commit
# -*- 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 89440 2012-01-29 10:29:46Z hum@macports.org $

PortSystem          1.0

name                emacs-app
version             23.4
revision            1
categories          aqua editors
maintainers         css hum openmaintainer

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.

homepage            http://www.gnu.org/software/emacs/
platforms           darwin
license             GPL-3+

master_sites        gnu:emacs
distname            emacs-${version}
dist_subdir         emacs
checksums           rmd160  5fb7e4cd4270a524b8723ad86a145a0e47336bf7 \
                    sha256  b9a2b8434052771f797d2032772eba862ff9aa143029efc72295170607289c18

depends_lib         port:ncurses

patchfiles          patch-src_emacs.c.diff
# patch.pre_args      -p1

if {${configure.compiler} == "clang"} {
    patchfiles-append   patch-clang.diff
}

post-patch {
    reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/src/emacs.c
}

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

use_parallel_build  yes

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
}

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

# inline and font patches are fetched from MacEmacsJP.
#   http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk/
#   revision 574.
# patch-macemacsjp-inline.diff <= emacs-inline.patch
# patch-macemacsjp-jpfont.diff <= font.patch
variant inline description {Add inline patch from MacEmacsJP} {
    patchfiles-append   patch-macemacsjp-inline.diff
}

variant jpfont description {Add Japanese font patch from MacEmacsJP} {
    patchfiles-append   patch-macemacsjp-jpfont.diff
}

variant shiftmodifier conflicts inline description {Add Shift modifier patch from http://github.com/typester/emacs/downloads} {
    patchfiles-append   patch-shiftmodifier-with-ime.diff
}

variant patches requires fullscreen inline jpfont shiftmodifier description {Add all patches: fullscreen, inline and jpfont} {}

platform darwin 11 {
   patchfiles-append    patch-fix-title-bar.diff
   # patch-lion-fullscreen.diff
   #   https://github.com/downloads/typester/emacs/emacs-23-lion-fullscreen-test.patch
   if {[variant_isset fullscreen]} {
       patchfiles-append   patch-lion-fullscreen.diff
   }
   configure.cflags-append   -fno-pie -O2
   configure.ldflags-append  -fno-pie
}

livecheck.type      regex
livecheck.url       http://ftp.gnu.org/gnu/emacs/?C=M&O=D
livecheck.regex     emacs-(\\d+\\.\\d+\\w*)\\.tar