# -*- 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 78847 2011-05-24 12:30:12Z ryandesign@macports.org $

PortSystem          1.0

name                autojump
version             15
categories          sysutils
platforms           darwin
maintainers         gmail.com:johnny.kuan
supported_archs     noarch

description         a cd command that learns

long_description    ${name} is ${description}.

homepage            http://github.com/joelthelion/autojump
master_sites        http://cloud.github.com/downloads/joelthelion/autojump
distname            ${name}_v${version}

checksums           sha1    aba6ba8dc8d5624fc660a947f835f731e594969f \
                    rmd160  f479dee936fa4ffc746fcffacf33fa2602673503

post-patch {
    reinplace "s:/etc/profile.d:${prefix}/etc/profile.d:g" ${worksrcpath}/autojump.sh
}

use_configure       no

build {}

destroot {
    xinstall -m 755 -W ${worksrcpath} autojump ${destroot}${prefix}/bin/
    xinstall -m 755 -W ${worksrcpath} autojump.1 ${destroot}${prefix}/share/man/man1/
    xinstall -d ${destroot}${prefix}/etc/profile.d/
    xinstall -m 644 -W ${worksrcpath} autojump.sh autojump.bash autojump.zsh ${destroot}${prefix}/etc/profile.d/
    xinstall -d ${destroot}${prefix}/share/zsh/site-functions/
    xinstall -m 644 -W ${worksrcpath} _j ${destroot}${prefix}/share/zsh/site-functions/
}

notes "
To use autojump for bash, add the following to the end of your .bash_profile:
if \[ -f ${prefix}/etc/profile.d/autojump.sh \]; then
    . ${prefix}/etc/profile.d/autojump.sh
fi

To use autojump for zsh, add the following to the end of your .zshrc:
export FPATH=\"\$FPATH:${prefix}/share/zsh/site-functions/\"
if \[ -f ${prefix}/etc/profile.d/autojump.sh \]; then
    . ${prefix}/etc/profile.d/autojump.sh
fi
"
