aboutsummaryrefslogtreecommitdiffstats
path: root/community/tesseract-ocr/APKBUILD
blob: aef22c93d1adc2853fd5f0df562e40c5c9603d65 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=tesseract-ocr
pkgver=4.1.1
_tdver=4.0.0
pkgrel=1
pkgdesc="open source OCR engine"
url="https://github.com/tesseract-ocr/tesseract/releases"
arch="all"
license="Apache"
makedepends="automake autoconf libtool leptonica-dev pango-dev icu-dev
	cairo-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/tesseract-ocr/tesseract/archive/$pkgver.tar.gz
	https://github.com/tesseract-ocr/tessdata/archive/${_tdver}/tessdata-${_tdver}.tar.gz
	include-time-h.patch
	"
_langs="afr ara aze bel ben bul cat ces chi_sim chi_tra chr dan deu ell
enm epo equ est eus fin fra frk frm glg grc heb hin hrv hun ind isl ita
ita_old jpn kan kor lav lit mal mkd mlt msa nld nor pol por ron rus slk
slv spa spa_old sqi srp swa swe tam tel tgl tha tur ukr vie"

for _lang in $_langs; do
	subpackages="$subpackages $pkgname-data-$_lang:_lang_data:noarch"
done

builddir="$srcdir"/${pkgname/-*}-$pkgver

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-static
	make
	make training
}

package() {
	make DESTDIR="$pkgdir" install
	make DESTDIR="$pkgdir" training-install
	install -D "$srcdir"/tessdata-$_tdver/eng.* \
		"$srcdir"/tessdata-$_tdver/osd.* \
		"$srcdir"/tessdata-$_tdver/equ.* \
		"$pkgdir"/usr/share/tessdata/
}

_lang_data() {
	local lang="${subpkgname#$pkgname-data-}"
	pkgdesc="Tesseract language data for $lang"
	depends="$pkgname"
	mkdir -p "$subpkgdir"/usr/share/tessdata
	mv "$srcdir"/tessdata-$_tdver/$lang.* \
		"$subpkgdir"/usr/share/tessdata/
}

sha512sums="017723a2268be789fe98978eed02fd294968cc8050dde376dee026f56f2b99df42db935049ae5e72c4519a920e263b40af1a6a40d9942e66608145b3131a71a2  tesseract-ocr-4.1.1.tar.gz
cd71bb99d44eefb53b359ba64b472c509fff773b2737a8d51e10d5d52d9a3a7ff870d470b1c72a7c78be3263b5ecfbb58a6eab13cf7128d8599681676cdcef6b  tessdata-4.0.0.tar.gz
3cc100bfa4eccac4123311c90626e747576b9d4b8b998f5e12bf6b2b9b0ffd8d9ea0160d11747e09d00283c4f782147c9b97c7b5c31679fb44784c2314de3cab  include-time-h.patch"