# -*- 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 68451 2010-06-03 20:43:42Z dports@macports.org $

PortSystem 1.0
PortGroup  muniversal 1.0

name            emacs
version         23.2
revision        1

categories      editors
maintainers     dports openmaintainer
description     The GNU Emacs text editor
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

checksums       md5     b6691852dae0bc142b3c12749f6b7ade \
                sha1    2f99c7111c232cf04410607698d2db842e305c82 \
                rmd160  6d25f8d12cfa23e413ea353933ed871a3d3aa08e

configure.args  --without-x \
                --without-carbon \
                --infodir ${prefix}/share/info/${name}

depends_lib     port:ncurses

post-destroot {
    xinstall -d ${destroot}${prefix}/share/emacs/${version}/leim
    delete ${destroot}${prefix}/bin/ctags
    delete ${destroot}${prefix}/share/man/man1/ctags.1
}

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

variant x11 description {Builds emacs as a X11 program with Lucid widgets} {
    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      port:xorg-libXmu \
                            port:xorg-libXaw \
                            port:xpm \
                            lib:libjpeg:jpeg \
                            lib:libtiff:tiff \
                            path:include/gif_lib.h:giflib \
                            lib:libpng:libpng
}

variant motif requires x11 description {Builds emacs as an X11 program with Motif widgets} {
    configure.args-delete   --with-x-toolkit=lucid
    configure.args-append   --with-x-toolkit=motif
    depends_lib-append      lib:libXm:openmotif
}

variant gtk requires x11 description {Builds emacs as an X11 program with GTK+2 widgets} {
    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
}
