[buildout]
extends =
  ../autoconf/buildout.cfg
  ../automake/buildout.cfg
  ../jbigkit/buildout.cfg
  ../leptonica/buildout.cfg
  ../libpng/buildout.cfg
  ../libtool/buildout.cfg
  ../webp/buildout.cfg

parts =
  tesseract

[tesseract]
recipe = slapos.recipe.cmmi
url = http://tesseract-ocr.googlecode.com/files/tesseract-3.01.tar.gz
md5sum = 1ba496e51a42358fb9d3ffe781b2d20a
patch-options =
  -p1
patches =
  ${:_profile_base_location_}/tesseract-3.00-gcc-4.7-build.patch#ca80db3ec489c547b03f3ee48879c1b1
  ${:_profile_base_location_}/tesseract-3.01-remove-bom.patch#2e691858cb492b7c17d23bf0912b3d24
configure-command =
  libtoolize -f -c
  aclocal -I ${libtool:location}/share/aclocal -I config
  autoheader -f
  automake -c -a -f
  autoconf -Wno-portability
  ./configure --prefix=${buildout:parts-directory}/${:_buildout_section_name_} --disable-static --datarootdir=${tesseract-eng-traineddata:location}
# XXX: tesseract seems not easily configurable at runtime about where to find
# its trained data, so we set its datarootdir above to a controlled location

# tesseract has a non-standard way of testing for leptonica, hence the
# LIBLEPT_HEADERSDIR entry below:
environment =
  PATH=${autoconf:location}/bin:${automake:location}/bin:${libtool:location}/bin:${m4:location}/bin:%(PATH)s
  ACLOCAL_ARGS=-I${libtool:location}/share/aclocal
  LIBLEPT_HEADERSDIR=${leptonica:location}/include
  CPPFLAGS=-I${leptonica:location}/include
  LDFLAGS =-L${leptonica:location}/lib -Wl,-rpath=${leptonica:location}/lib -L${jbigkit:location}/lib -Wl,-rpath=${jbigkit:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
make-options =
  LIBTOOL=${libtool:location}/bin/libtool

[tesseract-eng-traineddata]
recipe = hexagonit.recipe.download
strip-top-level-dir = true
url = http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.01.eng.tar.gz
md5sum = 89c139a73e0e7b1225809fc7b226b6c9
