# -*- 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 108161 2013-07-15 03:09:33Z dports@macports.org $

PortSystem          1.0
PortGroup           elisp 1.0

name                org-mode
version             8.0.6
categories          editors
license             GPL-3+
maintainers         dports
platforms           darwin
supported_archs     noarch

description         an Emacs Mode for Notes, Project Planning, and Authoring
long_description    Org is a mode for keeping notes, maintaining TODO lists, \
                    and doing project planning with a fast and effective     \
                    plain-text system.

homepage            http://orgmode.org/
master_sites        ${homepage}
distname            org-${version}

checksums           rmd160  2bd0c1cc6f05b15462049bb138994c7b9787f5ef \
                    sha256  6a3f9800347160074c5d9cd3a20bf4ae1a42bb2ffd66bc77b5e10cde0fbc2ed1

depends_lib         path:${emacs_binary}:${emacs_binary_provider}
depends_build       port:texinfo


configure {
    system -W ${worksrcpath} "make local.mk"
    reinplace "s|EMACS	= emacs|EMACS	= ${emacs_binary}|g" ${worksrcpath}/local.mk
}

destroot.destdir    prefix=${destroot}${prefix}/share
destroot.target     install-lisp install-info

variant contrib description "Include additional contributed packages" {
    # Install all contrib elisp files except those listed in org_skip_contrib
    #   org-jira and ob-oz have build dependencies not available in MacPorts
    post-configure {
        set org_skip_contrib "ob-oz org-jira"
        
        set localmk [open ${worksrcpath}/local.mk "a"]
        puts $localmk "ORG_ADD_CONTRIB="

        foreach f [glob -directory ${worksrcpath}/contrib/lisp -tails *.el] {
            set x [file rootname $f]
            if {[lsearch -exact $org_skip_contrib $x] == -1} {
                puts $localmk "ORG_ADD_CONTRIB+=$x"
            }
        }
        
        close $localmk
    }
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     {Stable version <b>([\w.]+)</b>}
