# -*- 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                gocr
version             0.49
revision            1
categories          graphics
platforms           darwin
license             GPL-2+
maintainers         nomaintainer

description         Optical Character Recognition, converts images back to text

long_description    GOCR is an OCR (Optical Character Recognition) program. It \
                    converts scanned images of text back to text files.

homepage            http://jocr.sourceforge.net/
master_sites        http://www-e.uni-magdeburg.de/jschulen/ocr/

checksums           rmd160  51eee235f56eb73be590286a8a7f6fee805b3c72 \
                    sha256  cc29931d50b3be11608dc79d1c7d8a20919dbe6313b1ba5dc88ecf99cffd171a

depends_lib         port:netpbm

depends_run         path:bin/wish:tk

post-extract {
    # Remove files in examples that we don't want copied
    delete ${worksrcpath}/examples/.#Makefile.1.22 ${worksrcpath}/examples/Makefile
    # Fix permissions so all files are readable
    fs-traverse item ${worksrcpath}/examples {
        file attributes ${item} -permissions a+r
    }
}

set docdir          ${prefix}/share/doc/${name}

patchfiles          patch-man-man1-gocr.1.diff

post-patch {
    reinplace "s|@DOCDIR@|${docdir}|g" ${worksrcpath}/man/man1/gocr.1
}

configure.args      --mandir=/share/man

destroot.destdir    DESTDIR=${destroot}${prefix}

post-destroot {
    xinstall -d ${destroot}${docdir} ${destroot}${prefix}/share/examples
    xinstall -m 0644 -W ${worksrcpath} README REMARK.txt AUTHORS CREDITS HISTORY BUGS TODO ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath}/doc example.dtd example.xml examples.txt gocr.html unicode.txt ${destroot}${docdir}
    file copy ${worksrcpath}/examples ${destroot}${prefix}/share/examples/${name}
}

livecheck.type      regex
livecheck.url       ${homepage}download.html
livecheck.regex     ${name}-(\[0-9.\]+)\\.tar
