xref: /OK3568_Linux_fs/buildroot/package/tesseract-ocr/tesseract-ocr.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# tesseract-ocr
4#
5################################################################################
6
7TESSERACT_OCR_VERSION = 4.1.1
8TESSERACT_OCR_DATA_VERSION = 4.0.0
9TESSERACT_OCR_SITE = $(call github,tesseract-ocr,tesseract,$(TESSERACT_OCR_VERSION))
10TESSERACT_OCR_LICENSE = Apache-2.0
11TESSERACT_OCR_LICENSE_FILES = LICENSE
12
13# Source from github, no configure script provided
14TESSERACT_OCR_AUTORECONF = YES
15
16# cairo, pango and icu are optional dependencies, but only needed for
17# building training tools, which are only built explicitly with "make
18# training", which is not done by this package.
19TESSERACT_OCR_DEPENDENCIES = leptonica host-pkgconf
20TESSERACT_OCR_INSTALL_STAGING = YES
21TESSERACT_OCR_CONF_ENV = \
22	ac_cv_prog_have_asciidoc=false \
23	LIBLEPT_HEADERSDIR=$(STAGING_DIR)/usr/include/leptonica
24TESSERACT_OCR_CONF_OPTS = \
25	--disable-opencl
26
27# Language data files download
28ifeq ($(BR2_PACKAGE_TESSERACT_OCR_LANG_ENG),y)
29TESSERACT_OCR_DATA_FILES += eng.traineddata
30endif
31
32ifeq ($(BR2_PACKAGE_TESSERACT_OCR_LANG_FRA),y)
33TESSERACT_OCR_DATA_FILES += fra.traineddata
34endif
35
36ifeq ($(BR2_PACKAGE_TESSERACT_OCR_LANG_DEU),y)
37TESSERACT_OCR_DATA_FILES += deu.traineddata
38endif
39
40ifeq ($(BR2_PACKAGE_TESSERACT_OCR_LANG_SPA),y)
41TESSERACT_OCR_DATA_FILES += spa.traineddata
42endif
43
44ifeq ($(BR2_PACKAGE_TESSERACT_OCR_LANG_CHI_SIM),y)
45TESSERACT_OCR_DATA_FILES += chi_sim.traineddata
46endif
47
48ifeq ($(BR2_PACKAGE_TESSERACT_OCR_LANG_CHI_TRA),y)
49TESSERACT_OCR_DATA_FILES += chi_tra.traineddata
50endif
51
52TESSERACT_OCR_EXTRA_DOWNLOADS = \
53	$(addprefix https://github.com/tesseract-ocr/tessdata/raw/$(TESSERACT_OCR_DATA_VERSION)/,\
54		$(TESSERACT_OCR_DATA_FILES))
55
56# Language data files installation
57define TESSERACT_OCR_INSTALL_LANG_DATA
58	$(foreach langfile,$(TESSERACT_OCR_DATA_FILES), \
59		$(INSTALL) -D -m 0644 $(TESSERACT_OCR_DL_DIR)/$(langfile) \
60			$(TARGET_DIR)/usr/share/tessdata/$(langfile)
61	)
62endef
63
64TESSERACT_OCR_POST_INSTALL_TARGET_HOOKS += TESSERACT_OCR_INSTALL_LANG_DATA
65
66$(eval $(autotools-package))
67