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

name                    cuneiform
version                 1.1.0
revision                8
set branch              [join [lrange [split ${version} .] 0 1] .]
maintainers             nomaintainer
categories              textproc graphics

description             Cuneiform is an OCR system with layout analysis.
long_description        Cuneiform is an OCR system originally developed and \
                        open sourced by Cognitive technologies. \
                        In addition to text recognition it also does layout \
                        analysis and text format recognition. \
                        Cuneiform supports several languages.

homepage                https://launchpad.net/cuneiform-linux
license                 BSD

master_sites            http://launchpad.net/cuneiform-linux/${branch}/${branch}/+download/
distname                ${name}-linux-${version}
use_bzip2               yes

checksums               sha1    b78ebcf987c4792c360f23bdbe054d554ce2251c \
                        rmd160  bc23f83103316ce635635899cf6d4d797edefc45

depends_lib             port:ImageMagick

platform darwin powerpc {
    patchfiles-append   patch-perc.c.diff \
                        patch-CMakeLists.txt.diff
}

patchfiles-append       patch-cuneiform_src-Kern-ced-sources-main-ced_func_rtf.cpp.diff \
                        patch-cuneiform_src-Kern-leo-src-leo_dll.c.diff \
                        patch-cuneiform_src-Kern-rimage-sources-main-cricontrol-abs.diff

# From https://sources.debian.org/src/cuneiform/1.1.0+dfsg-7/debian/patches/
patchfiles-append       fix_buffer_overflow.diff \
                        fix_buffer_overflow_2.diff \
                        typos.patch

# https://trac.macports.org/ticket/59676
configure.cxxflags-append -std=c++03

configure.args-append   -DImageMagick_Magick++_INCLUDE_DIR:PATH=${prefix}/include/ImageMagick-6 \
                        -DImageMagick_Magick++_LIBRARY:FILEPATH=${prefix}/lib/libMagick++-6.Q16.dylib

livecheck.type          regex
livecheck.regex         ${name}-linux-(\[0-9.\]+)${extract.suffix}
