# -*- 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

PortSystem          1.0
PortGroup           elisp 1.0

name                org-mode
elpa.setup          org 9.8.6

categories          editors
license             GPL-3+
maintainers         {dports @drkp} openmaintainer

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            https://orgmode.org/

checksums           rmd160  c28373933ffc658ee7a6876284e26842e65d3bf0 \
                    sha256  92a87c4b90d9afc6505fb3fffde21275d162ed3c8b1f9218528a393413618961 \
                    size    10465280

# ELPA package ships org-loaddefs.el; don't regenerate
elisp.autoloads     no
elisp.install_dir   org

build {
    set srcdir ${worksrcpath}
    set skip_files {org-pkg.el org-loaddefs.el}
    foreach el [glob -nocomplain -tails -directory $srcdir *.el] {
        if {[lsearch -exact $skip_files $el] != -1} {
            continue
        }
        ui_info "Byte-compiling ${el}"
        system -W $srcdir \
            "${emacs_binary} -Q --batch -L . -f batch-byte-compile [shellescape ${el}]"
    }
}

destroot {
    set srcdir ${worksrcpath}
    set dest ${destroot}${emacs_lispdir}/org

    xinstall -d ${dest}

    foreach f [glob -directory $srcdir *.el] {
        xinstall -m 0644 $f ${dest}
    }
    foreach f [glob -nocomplain -directory $srcdir *.elc] {
        xinstall -m 0644 $f ${dest}
    }

    # Install etc/ data files (ODT styles, CSL, etc.)
    copy ${srcdir}/etc ${dest}/etc

    # Install info documentation
    set infodir ${destroot}${prefix}/share/info
    xinstall -d ${infodir}
    foreach f [glob -directory $srcdir *.info] {
        xinstall -m 0644 $f ${infodir}
    }
}
