Portfile

# $Id: Portfile 22251 2007-02-24 05:53:25Z takanori@macports.org $

PortSystem 1.0
name FDclone
version 2.09c
revision 1
categories sysutils shells
maintainers takanori@macports.org
description File & Directory Maintenance Tool
long_description ${description}
homepage http://hp.vector.co.jp/authors/VA012337/soft/fd/index.html
master_sites http://hp.vector.co.jp/authors/VA012337/soft/fd/ \
ftp://ftp.unixusers.net/src/fdclone/
platforms darwin
distname FD-${version}
checksums md5 afd9060e6fbbd2dcd838eca1c2e91ec7 \
sha1 2de8e5d3c36e05c8e77ba4d83187ec4cfff5654e \
rmd160 cea4859c6af718e2833a1aa27c04d1e3c0e0aa44

depends_lib port:ncurses

set editor ""
set pager ""

patchfiles nojmaninstall.patch
post-patch {
foreach f [glob ${worksrcpath}/*.c] {
reinplace "s|\\(#include \\)|\\1\\\n#include |" ${f}
}
reinplace "s|\$(TOPDIR)/man|\$(TOPDIR)/share/man|g" ${worksrcpath}/Makefile.in
}

configure {
if {[variant_isset nojpnmes]} {
system "echo \"#define _NOJPNMES\" >> ${worksrcpath}/config.hin"
}

if {${editor} != ""} { reinplace "s|\"vi\"|\"${editor}\"|g" ${worksrcpath}/fd.h }
if {${pager} != ""} { reinplace "s|\"more%K\"|\"${pager}\"|g" ${worksrcpath}/fd.h }

if {[variant_isset autosort]} {
reinplace "s|SORTTYPE\t0|SORTTYPE\t1|" ${worksrcpath}/fd.h
reinplace "s|DISPLAYMODE\t0|DISPLAYMODE\t3|" ${worksrcpath}/fd.h
reinplace "s|SORTTREE\t0|SORTTREE\t1|" ${worksrcpath}/fd.h
}
}

build.args CONFDIR=${prefix}/etc PREFIX=${prefix} CPPFLAGS="-I${prefix}/include/ncurses" LDFLAGS="-L${prefix}/lib -lncurses"

destroot.args BUILD=${destroot} PREFIX=${prefix}
post-destroot {
xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
foreach f {FAQ* HISTORY* Install* LICENSES* README* TECHKNOW* ToAdmin* *.cat} {
eval xinstall -m 644 [glob ${worksrcpath}/${f}] ${destroot}${prefix}/share/doc/${name}
}
xinstall -m 644 ${worksrcpath}/_fdrc ${destroot}${prefix}/etc/fd2rc.dist
}

variant nojpnmes {}
variant emacs conflicts vim {set editor emacs}
variant vim conflicts emacs {set editor vim}
variant lv conflicts less jless {set pager lv}
variant less conflicts lv jless {set pager less}
variant jless conflicts lv less {set pager jless}
variant autosort {}

livecheck.check regex
livecheck.url ${homepage}
livecheck.regex FD-(\[0-9.a-z\]+)\\.tar

files