aboutsummaryrefslogtreecommitdiffstats
path: root/community/tesseract-ocr/APKBUILD
blob: 6cbf97f2b468b3d99ce105e92dc75c7ce3e74448 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=tesseract-ocr
pkgver=3.05.01
_tdver=3.04.00
pkgrel=3
pkgdesc="open source OCR engine"
url="https://github.com/tesseract-ocr/tesseract/releases"
arch="all"
license="Apache"
depends=""
depends_dev=""
makedepends="automake autoconf libtool leptonica-dev pango-dev icu-dev
	cairo-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/${pkgname/-*}/archive/$pkgver.tar.gz
	https://github.com/tesseract-ocr/tessdata/archive/${_tdver}/tessdata-${_tdver}.tar.gz
	"

_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

build() {
	cd "$builddir"
	./autogen.sh
	./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() {
	cd "$builddir"
	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="a49c20c98386684cd89582e57b772811204fad8e5ff18214fb0da109f73629c70845054985e31e8deeb49107fbcf56e546aff661f08eb5dd60fbf83dbe976e81  tesseract-ocr-3.05.01.tar.gz
4fbb66137c729e16c7a9e35b09916a45c1bb5ec5a7002a22647e0b10975362cb44c6d6c0c997baf25866f78749ec2d4a86317ec3fb664bd963243e230516d162  tessdata-3.04.00.tar.gz"