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

name            lv
version         4.51
revision        4
checksums       rmd160  ae0d58b52dbf714f8b371f51ac87490ecba1c994 \
                sha256  e1cd2e27109fbdbc6d435f2c3a99c8a6ef2898941f5d2f7bacf0c1ad70158bcf \
                size    605082

categories      textproc
maintainers     nomaintainer
description     Powerful Multilingual File Viewer / Grep
long_description \
                {*}${description}
license         GPL-2+
homepage        http://www.ff.iij4u.or.jp/~nrt/lv/index.html
master_sites    http://www.ff.iij4u.or.jp/~nrt/freeware/
distname        ${name}[string map {. {}} ${version}]

depends_lib     port:ncurses
depends_run     bin:bzcat:bzip2 \
                bin:gzcat:gzip

patchfiles      patch-src_stream.c.diff \
                patch-src_configure.diff \
                patch-src_Makefile.in.diff \
                implicit.patch

configure.dir   ${worksrcpath}/build
configure.cmd   ../src/configure

build.dir       ${worksrcpath}/build
build.target

destroot {
    xinstall -m 755 -d ${destroot}${prefix}/lib/lv

    xinstall -m 755 ${worksrcpath}/build/lv ${destroot}${prefix}/bin
    xinstall -m 755 ${worksrcpath}/build/lv ${destroot}${prefix}/bin/lgrep
    xinstall -m 644 ${worksrcpath}/lv.hlp ${destroot}${prefix}/lib/lv
    xinstall -m 644 ${worksrcpath}/lv.1 ${destroot}${prefix}/share/man/man1
}

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    foreach f {GPL.txt README hello* index.html relnote.html} {
        xinstall -m 644 {*}[glob ${worksrcpath}/${f}] ${destroot}${prefix}/share/doc/${name}
    }
}

default_variants +xz

variant lesslikeslash description {Make the behavior of the search command more similar to the one in Less} {
    patchfiles-append   patch-src_command.c.diff
}

variant xz description {Experimental support for XZ Utils} {
    patchfiles-append   xz_support.diff
    depends_run-append  path:bin/xz:xz
}

livecheck.type  regex
livecheck.url   ${homepage}
livecheck.regex The latest version is ver (\[0-9.a-z\]+)
