|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
+++ b/ocroinst.osx Tue Jun 12 18:25:15 2012 -0400 |
|
@@ -0,0 +1,87 @@ |
|
+#!/bin/bash |
|
+ |
|
+# Vaguely following ocroinst |
|
+# Tested on Mac OSX 10.6 |
|
+# Assume we're using Homebrew: http://mxcl.github.com/homebrew/ |
|
+# Assume we're using pip, e.g. |
|
+# https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python |
|
+# (I did this with Homebrew Python 2.7. I don't know whether system python |
|
+# would work.) |
|
+# Warning, I haven't tried running this whole thing at once, so a few small |
|
+# things may be missing. |
|
+ |
|
+set -eux |
|
+ |
|
+## Prerequisities |
|
+brew install scons libtiff jpeg sdl sdl_gfx sdl_image |
|
+ |
|
+## Build and install the components. |
|
+## C++ libraries are installed into a Homebrew-friendly prefix, |
|
+## then "brew link"'d. |
|
+## Python extension are "pip install"'d. |
|
+ |
|
+cd iulib |
|
+scons |
|
+scons install |
|
+brew link iulib |
|
+cd .. |
|
+ |
|
+## Need a newer swig, apparently? |
|
+## OSX 10.6's /usr/bin/swig is 1.3, seems to cause problems |
|
+## Homebrew swig is currently 2.0.6 |
|
+brew install swig |
|
+ |
|
+brew install tesseract |
|
+ |
|
+ |
|
+cd iulib/pyswig |
|
+python setup.py build |
|
+pip install . |
|
+cd ../.. |
|
+ |
|
+cd ocrolseg |
|
+make |
|
+python install . |
|
+cd .. |
|
+ |
|
+cd ocrorast |
|
+make |
|
+python setup.py build_ext |
|
+pip install . |
|
+cd .. |
|
+ |
|
+cd ocropy |
|
+pip install . |
|
+cd .. |
|
+ |
|
+cd llpy |
|
+pip install . |
|
+cd .. |
|
+ |
|
+mkdir -p /usr/local/Cellar/ocropus/0.5 |
|
+ |
|
+cd ocrofst/oscrofstll |
|
+scons |
|
+scons install |
|
+brew link ocropus |
|
+cd ../.. |
|
+ |
|
+cd ocrofst |
|
+python setup.py build |
|
+pip install . |
|
+ |
|
+# Don't use Homebrew's current openfst formula because it's a too-new version. |
|
+tar xf DIST/openfst-1.1.tar.gz |
|
+cd openfst-1.1 |
|
+./configure --prefix=/usr/local/Cellar/openfst/1.1 --disable-dependency-tracking |
|
+make install |
|
+brew switch openfst 1.1 |
|
+cd .. |
|
+ |
|
+cd pyopenfst |
|
+python setup.py build |
|
+pip install . |
|
+ |
|
+ |
|
+## Skipping FLANN for now |
|
+ |
|
====== DIRECTORY iulib |
|
diff -r de8f89afa5e1 pyswig/setup.py |
|
--- a/pyswig/setup.py Tue Jun 12 15:56:06 2012 -0400 |
|
+++ b/pyswig/setup.py Tue Jun 12 18:25:15 2012 -0400 |
|
@@ -1,19 +1,29 @@ |
|
#!/usr/bin/env python |
|
|
|
-import os |
|
+import os, sys |
|
from distutils.core import setup, Extension |
|
from numpy.distutils.misc_util import get_numpy_include_dirs |
|
|
|
baselibs = ['tiff','png','jpeg','SDL','SDL_gfx','SDL_image','m'] |
|
|
|
include_dirs = ['/usr/local/include'] + get_numpy_include_dirs() |
|
+ |
|
+if sys.platform=='darwin': |
|
+ include_dirs += ['hack'] |
|
+ os.system("mkdir -p hack; touch hack/malloc.h") ## accomodate SWIG's lame #include <malloc.h> |
|
+ |
|
swig_opts = ["-c++"] + ["-I" + d for d in include_dirs] |
|
swiglib = os.popen("swig -swiglib").read()[:-1] |
|
|
|
+library_dirs = ['/usr/local/lib'] |
|
+if sys.platform=='darwin': |
|
+ library_dirs += ['/usr/X11/lib'] |
|
+ |
|
iulib = Extension('_iulib', |
|
libraries = ['iulib']+baselibs, |
|
swig_opts = swig_opts, |
|
include_dirs = include_dirs, |
|
+ library_dirs = library_dirs, |
|
sources=['iulib.i']) |
|
|
|
setup (name = 'iulib', |
|
====== DIRECTORY llpy |
|
====== DIRECTORY ocrofst |
|
diff -r 329aed1e71ff ocrofstll/SConstruct |
|
--- a/ocrofstll/SConstruct Mon May 14 11:44:03 2012 +0200 |
|
+++ b/ocrofstll/SConstruct Tue Jun 12 18:25:16 2012 -0400 |
|
@@ -51,7 +51,7 @@ |
|
" -D__warn_unused_result__=__far__"+ |
|
" -D_BACKWARD_BACKWARD_WARNING_H=1") |
|
### path options |
|
-opts.Add(PathVariable('prefix', 'The installation root for OCRopus ', "/usr/local")) |
|
+opts.Add(PathVariable('prefix', 'The installation root for OCRopus ', "/usr/local/Cellar/ocropus/0.5")) |
|
opts.Add(PathVariable('iulib', 'The installation root of iulib', "/usr/local")) |
|
opts.Add(PathVariable('destdir', 'Destination root directory', "", PathVariable.PathAccept)) |
|
#opts.Add(PathVariable('leptonica', 'The installation root of leptonica', "/usr/local")) #not required |
|
@@ -205,22 +205,22 @@ |
|
################################################################ |
|
|
|
penv = env.Clone() |
|
-penv.Append(LIBS=[File("libocrofst.so")]) |
|
+penv.Append(LIBS=[File("libocrofst.dylib")]) |
|
penv.Prepend(LINKFLAGS=["-ldl"]) |
|
penv.Prepend(CPPPATH=["/usr/local/include"]) |
|
-penv.Append(CCFLAGS=["-Xlinker","-rpath=${iulib}/lib"]) #not sure about these linkers?? |
|
-penv.Append(LINKFLAGS=["-Xlinker","-rpath=${iulib}/lib"]) |
|
+#penv.Append(CCFLAGS=["-Xlinker","-rpath=${iulib}/lib"]) #not sure about these linkers?? |
|
+#penv.Append(LINKFLAGS=["-Xlinker","-rpath=${iulib}/lib"]) |
|
#for is not needed? instead need to compile our main.cc file ?? |
|
|
|
for cmd in glob('test-*.cc'): |
|
- penv.Program(cmd,LIBS=File("libocrofst.so")) |
|
+ penv.Program(cmd,LIBS=File("libocrofst.dylib")) |
|
penv.Install(destdir+bindir,re.sub('.cc$','',cmd)) |
|
|
|
#################################### |
|
### To build test-fst |
|
#################################### |
|
penv1 = Environment() |
|
-penv1.Prepend(LINKFLAGS=["/usr/local/lib/libfst.so","-ldl"]) |
|
+penv1.Prepend(LINKFLAGS=["/usr/local/lib/libfst.dylib","-ldl"]) |
|
penv1.Prepend(CPPPATH=["/usr/local/include"]) |
|
''' |
|
for cmd in glob('test-*.cc'): |
|
diff -r 329aed1e71ff setup.py |
|
--- a/setup.py Mon May 14 11:44:03 2012 +0200 |
|
+++ b/setup.py Tue Jun 12 18:25:16 2012 -0400 |
|
@@ -1,4 +1,4 @@ |
|
-import os,glob |
|
+import os,glob,sys |
|
from distutils.core import setup, Extension |
|
from numpy.distutils.misc_util import get_numpy_include_dirs |
|
|
|
@@ -6,10 +6,18 @@ |
|
|
|
baselibs = ['png','m'] |
|
|
|
+library_dirs = [] |
|
include_dirs = ['/usr/local/include'] + get_numpy_include_dirs() |
|
+if sys.platform=='darwin': |
|
+ library_dirs += ['/usr/X11/lib'] |
|
+ include_dirs += ['/usr/X11/include'] |
|
+ include_dirs += ['hack'] |
|
+ os.system("mkdir -p hack; touch hack/malloc.h") ## accomodate SWIG's lame #include <malloc.h> |
|
+ |
|
swig_opts = ["-c++"] + ["-I" + d for d in include_dirs] |
|
swiglib = os.popen("swig -swiglib").read()[:-1] |
|
|
|
+ |
|
scripts = ["ocrofst-search","ocropus-lalign","ocropus-lmodel"] |
|
scripts += glob.glob("ocropus-lm-*[a-z]") |
|
|
|
@@ -17,6 +25,7 @@ |
|
libraries = ['iulib','ocrofst']+baselibs, |
|
swig_opts = swig_opts, |
|
include_dirs = include_dirs, |
|
+ library_dirs = library_dirs, |
|
extra_link_args = ["-L.","-Locrofstll/."], |
|
sources = ['ocrofstll/ocrofstll.i']) |
|
|
|
====== DIRECTORY ocrolseg |
|
diff -r a1dc37915521 setup.py |
|
--- a/setup.py Mon Mar 05 01:34:31 2012 +0100 |
|
+++ b/setup.py Tue Jun 12 18:25:16 2012 -0400 |
|
@@ -1,10 +1,15 @@ |
|
#!/usr/bin/env python |
|
|
|
-import os |
|
+import os,sys |
|
from distutils.core import setup, Extension |
|
from numpy.distutils.misc_util import get_numpy_include_dirs |
|
|
|
include_dirs = ['/usr/local/include'] + get_numpy_include_dirs() |
|
+include_dirs = ['/usr/local/include'] + get_numpy_include_dirs() |
|
+if sys.platform=='darwin': |
|
+ include_dirs += ['hack'] |
|
+ os.system("mkdir -p hack; touch hack/malloc.h") ## accomodate SWIG's lame #include <malloc.h> |
|
+ |
|
swig_opts = ["-c++"] + ["-I" + d for d in include_dirs] |
|
|
|
ocrolseg = Extension('_ocrolseg', |
|
====== DIRECTORY ocropy |
|
diff -r 72d56fe2c4b9 ocropus |
|
--- a/ocropus Sun Jun 03 02:19:53 2012 +0200 |
|
+++ b/ocropus Tue Jun 12 18:25:16 2012 -0400 |
|
@@ -1,4 +1,4 @@ |
|
-#!/usr/bin/python |
|
+#!/usr/bin/env python |
|
|
|
### Simple command line tool driving the ocropus pipeline. |
|
|
|
====== DIRECTORY ocrorast |
|
====== DIRECTORY pyopenfst |
Regarding
TIFFHeader
, it seems that it was deprecated in favor of the three new headers, each an exact binary representation of TIFF header structures:TIFFHeaderClassic
for ClassicTIFF,TIFFHeaderBig
for BigTIFF, andTIFFHeaderCommon
for the parts of the TIFF header they both share. So it may be best to useTIFFHeaderCommon
. Maybe. Who knows. I'm still just trying to install the thing.