= How To Build Sikuli on Mac OS X =

Prerequisite: 
   XCode
   CMake 2.8+
   OpenCV 2.1+
   Tesseract-OCR 2.04 + English language data (3.0 won't work), 
   SWIG 1.3+

The path to these dependent libraries can be set in cmake_modules/common.cmake.
You may need to add appropriate paths on your machine if cmake can not find 
the libraries automatically.

CMake, SWIG and Tesseract-OCR can be installed with MacPorts. 
(http://www.macports.org/) However, if you would like to build a universal 
binary (x86_64 + i386) of Sikuli, you need the patch included in the end
of this file to fix the tesseract-ocr in MacPorts.

In addition, we strongly recommend to download and compile OpenCV from its 
official source instead of using the MacPorts version. 



Assume you are in the top directory of Sikuli's source tree. You can
build Sikuli IDE and Sikuli Script with the following steps.

0. Open the Terminal.app

1. make a "build" directory in sikuli-script/
  mkdir sikuli-script/build

2. generate makefiles with CMake
  cd sikuli-script/build
  cmake ..

3. build sikuli-script
  make

4. make a "build" directory in sikuli-ide/
  cd ../.. # go back to the top directory 
  mkdir sikuli-ide/build

5. generate makefiles of Sikuli-IDE with CMake
  cd sikuli-ide/build
  cmake ..

6. generate a release package of sikuli-ide.
  make package




= Tesseract's patch for building a universal binary (i386+x86_64) =

When "port install tesseract +universal" fails, patch the following file and
then do port install again:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org
_release_ports_textproc_tesseract/work/tesseract-2.04/ccmain/Makefile

718c718
<       ld -r -o libtesseract_full.o tesseractfull.o \
---
>       ld -arch i386 -r -o libtesseract_full_i386.o tesseractfull.o \
729a730,742
>       ld -arch x86_64 -r -o libtesseract_full_x86_64.o tesseractfull.o \
>     libtesseract_main.a \
>     ../textord/libtesseract_textord.a \
>     ../pageseg/libtesseract_pageseg.a \
>     ../wordrec/libtesseract_wordrec.a \
>     ../classify/libtesseract_classify.a \
>     ../dict/libtesseract_dict.a \
>     ../viewer/libtesseract_viewer.a \
>     ../image/libtesseract_image.a \
>     ../cutil/libtesseract_cutil.a \
>     ../ccstruct/libtesseract_ccstruct.a \
>     ../ccutil/libtesseract_ccutil.a
>       lipo -create -output libtesseract_full.o libtesseract_full_i386.o libtes
seract_full_x86_64.o
