summaryrefslogtreecommitdiff
path: root/community/tesseract/PKGBUILD
blob: 81ef0cae8b72dac6d137f164cb9b8b60259f6130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# $Id: PKGBUILD 79036 2012-10-29 09:23:46Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Andreas Hauser <andy-aur@splashground.de>

# chinese requires two files
_langs=(ind swe ron slv srp tgl tur hun fin ita nld jpn vie spa ukr fra slk
kor ell rus por bul lav lit pol dan-frak deu dan ces cat eng chi_tra chi_sim)

pkgbase=tesseract
pkgname=(tesseract $(for l in ${_langs[@]}; do echo tesseract-data-${l}; done))
pkgver=3.02.02
pkgrel=1
pkgdesc="An OCR programm"
arch=(i686 x86_64)
url="http://code.google.com/p/tesseract-ocr"
license=("APACHE")
depends=(libpng libtiff libjpeg zlib giflib gcc-libs leptonica)
source=(http://tesseract-ocr.googlecode.com/files/$pkgname-$pkgver.tar.gz
        $(for l in ${_langs[@]}; do
        echo http://tesseract-ocr.googlecode.com/files/${l}.traineddata.gz
        done))
md5sums=('3d57ee5777fa998632ad0693c13a0e9e'
         'f4ae2e5668f693cc51c6e3c3f57a8f1d'
         '3787ff0fc1a07517203466830f6f868e'
         '7b50075692e7a07ac8f59e0cde51cfb9'
         'defc498fa09480ef0052fde79f4f84e5'
         'c1e0f0ef07d26a72063802370bbfe2c9'
         'af86cab0da52fff7e83f9c7668617a21'
         'b0f4798bf1f9ee541ae73aff49f08821'
         '966fa3ebe24d7dfade951e0a4a9f52b5'
         '33812ef03197dce20b8c888409d8541a'
         '9a307661a010703cd2bb265a3da5eaff'
         '89992f69802b9f4a36fec40efd95c503'
         'cad3dd7c9401fa0676bf195456ba0c14'
         'af75c7a696b18a1d2e4f7e21a222cf95'
         'dd9078211127189995504f034468fcd6'
         '56a82ac3994f0552d54fd14ff5ed6817'
         'e6000550883684b5e93b7e0a21016287'
         '2e7fbf80215b38f423dcf78e396b92d7'
         '909b811739b2e7d51cc3ca109998353a'
         '0d3a21c18f752eb058e7b854c37b7a69'
         'c477b7faddc044a4595135d0378be34c'
         'd0b59fcfd80f9e09be890647ae93f00d'
         'a7501f9a48bc7ef2fa50cba8b8f0c7b1'
         '1f366f55e5e0725deb751ec847bf42dc'
         '1b4460ab998151f1ed8e48928ded58be'
         'c3d6447245663138f1d3aa4567c72192'
         'cfa8a81df6a34940604fafa7353ffc43'
         'be81a761f61800f6d39393a31435fff3'
         '7aaeb321dbf069d14d2601dc36d3dddc'
         '2e97c952075064834f1cad6a133970fa'
         '308099b2b95834916ec410191c86cd48'
         'd91041ad156cf2db36664e91ef799451'
         '06fce5f5c0221286eab591819406d91e'
         '127e0b742b615d81c3b97a555acd8285')

build() {
  cd $srcdir/$pkgname-$pkgver
  sed -i '1,1i#include <unistd.h>' viewer/svutil.cpp
  [ -f Makefile.in ] || { aclocal && automake; }
  [ -f Makefile ] || ./configure --prefix=/usr
  make
}

package_tesseract() {
  install=tesseract.install
  optdepends=($(for l in ${_langs[@]}; do echo tesseract-data-${l}; done))

  cd $srcdir/$pkgname-$pkgver
  make DESTDIR=$pkgdir install
  mkdir -p $pkgdir/usr/share/tessdata
}

# Declare the package functions for data
for l in ${_langs[@]}; do
    eval "
package_tesseract-data-${l}(){
    pkgdesc=\"Tesseract OCR data ($l)\"
    depends=('tesseract')
    groups=('tesseract-data')

    mkdir -p \$pkgdir/usr/share/tessdata
    cp \$srcdir/${l}.traineddata \$pkgdir/usr/share/tessdata/
    find \$pkgdir/usr/share/tessdata -type f -exec chmod 0644 {} \;
}
    "
done