updated on Thu Jan 26 00:18:00 UTC 2012
[aur-mirror.git] / ocropus-hg / PKGBUILD
blob6df0bcb257f4d4e7391f2ff845d628cc14a482b0
1 # Contributor: Ilya Mezhirov <mezhirov@iupr.com>
3 pkgname=ocropus-hg
4 pkgver=14
5 pkgrel=2
6 pkgdesc="An OCR system for documents and books"
7 arch=('i686' 'x86_64')
8 url="http://code.google.com/p/ocropus/"
9 license=('APACHE')
10 makedepends=('mercurial' 'scons' 'swig')
11 depends=('giflib' 'sqlite3' 'pyopenfst-hg' 'python2' 'python2-numpy' 'sdl_gfx'
12          'sdl_image' 'libjpeg-turbo')
13 conflicts=('ocropus' 'iulib' 'iulib-hg' 'ocrofst' 'ocropy' 'ocropy-hg'
14            'ocroswig' 'ocroswig-hg')
15 source=(ocrolseg.patch ocrorast.patch ocrofst.patch)
16 options=()
17 md5sums=('dae6a79a8832f9d28414ba45febb404a'
18          '54719c4601bdd57fa2c37615f2dc2a1f'
19          'a6d347a6be6e0f16b7752e7c3ae720d8')
21 _hgroot="https://ocropus.googlecode.com/hg"
22 _hgrepo="ocropus"
24 _incdir="$pkgdir/usr/include"
25 _libdir="$pkgdir/usr/lib"
26 _swigopts=-I"$pkgdir/$(swig -swiglib)"
28 run_make() {
29     make CXX="g++ -I$_incdir -L$_libdir" $@
32 run_scons() {
33     scons iulib="$pkgdir/usr" prefix="$pkgdir/usr" sdl=1 || exit
34     scons iulib="$pkgdir/usr" prefix="$pkgdir/usr" sdl=1 install
37 py_ext() {
38     SWIG_OPTS=$_swigopts python2 setup.py build_ext \
39         --include-dirs "$_incdir" \
40         --library-dirs "$_libdir" || exit
41     python2 setup.py install --root "$pkgdir"
45 build() {
46     cd "$srcdir"
47     msg "Connecting to Mercurial server...."
49     if [ -d $_hgrepo ] ; then
50         cd $_hgrepo
51         hg pull -u || return 1
52         msg "The local files are updated."
53     else
54         hg clone $_hgroot $_hgrepo || return 1
55     fi
57     msg "Mercurial checkout done or server timeout"
59     rm -rf "$srcdir/$_hgrepo-build"
60     cp -r "$srcdir/$_hgrepo" "$srcdir/$_hgrepo-build"
61     cd "$srcdir/$_hgrepo-build"
63     ##############################################
64     patch -N -p1 -i "$srcdir/ocrolseg.patch"
65     patch -N -p1 -i "$srcdir/ocrorast.patch"
66     patch -N -p1 -i "$srcdir/ocrofst.patch"
67     ##############################################
69     cd iulib
70     run_scons || exit
71     cd pyswig
72     py_ext || exit
73     cd ../..
75     cd ocrolseg
76     run_make libocrolseg.a || exit
77     py_ext || exit
78     cd ..
80     cd ocrorast
81     run_make || exit
82     py_ext || exit
83     cd ..
85     cd ocropy
86     py_ext || exit
87     cd ..
89     cd ocrofst
90     run_scons || exit
91     py_ext || exit
92     rm $pkgdir/usr/bin/test-main
93     cd ..