Browse Source

Merge pull request #8589 from vk496/tesseract

tesseract: leptonica: add package
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by GitHub
parent
commit
c8734591ca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 170 additions and 0 deletions
  1. +53
    -0
      libs/leptonica/Makefile
  2. +60
    -0
      utils/tessdata/Makefile
  3. +57
    -0
      utils/tesseract/Makefile

+ 53
- 0
libs/leptonica/Makefile View File

@ -0,0 +1,53 @@
#
# Copyright (C) 2019 Valentín Kivachuk <vk18496@gmail.com>
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=leptonica
PKG_VERSION:=1.78.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.leptonica.org/source/
PKG_HASH:=e2ed2e81e7a22ddf45d2c05f0bc8b9ae7450545d995bfe28517ba408d14a5a88
PKG_MAINTAINER:=Valentín Kivachuk <vk18496@gmail.com>
PKG_LICENSE:=BSD-2-Clause
PKG_LICENSE_FILES:=leptonica-license.txt
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libleptonica
SECTION:=libs
CATEGORY:=Libraries
TITLE:=A library for efficient image processing and image analysis operations
URL:=http://www.leptonica.org/
DEPENDS:=+giflib +libjpeg +libpng +libtiff +zlib
endef
TARGET_CFLAGS:=$(filter-out -O%,$(TARGET_CFLAGS)) -O3
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/leptonica $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/liblept.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lept.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libleptonica/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/liblept.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libleptonica))

+ 60
- 0
utils/tessdata/Makefile View File

@ -0,0 +1,60 @@
# Copyright (C) 2019 Valentín Kivachuk <vk18496@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=tessdata
PKG_VERSION:=4.0.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/tesseract-ocr/tessdata/tar.gz/$(PKG_VERSION)?
PKG_HASH:=38c637d3a1763f6c3d32e8f1d979f045668676ec5feb8ee1869ee77cedd31b08
PKG_MAINTAINER:=Valentín Kivachuk <vk18496@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
#No need to extract 1,5GB...
PKG_UNPACK:=
include $(INCLUDE_DIR)/package.mk
ALLTESSERACTLANG:=afr amh ara asm aze aze_cyrl bel ben bod bos bre bul cat ceb ces chi_sim chi_sim_vert chi_tra chi_tra_vert chr cos cym dan dan_frak deu deu_frak div dzo ell eng enm epo equ est eus fao fas fil fin fra frk frm fry gla gle glg grc guj hat heb hin hrv hun hye iku ind isl ita ita_old jav jpn jpn_vert kan kat kat_old kaz khm kir kor kor_vert kur kur_ara lao lat lav lit ltz mal mar mkd mlt mon mri msa mya nep nld nor oci ori osd pan pol por pus que ron rus san sin slk slk_frak slv snd spa spa_old sqi srp srp_latn sun swa swe syr tam tat tel tgk tgl tha tir ton tur uig ukr urd uzb uzb_cyrl vie yid yor
define Build/Compile
endef
define Build/Install
endef
define Package/tesseract-data-default
SUBMENU:=Tesseract
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=tesseract
endef
define generate-tesseract-data-package
define Package/tesseract-data-$(1)
TITLE:=Tesseract training data for $(1) language
$(call Package/tesseract-data-default)
endef
define Package/tesseract-data-$(1)/install
$(INSTALL_DIR) $$(1)/usr/share/tessdata
$(TAR) --strip=1 -C $$(1)/usr/share/tessdata/ -xvf $(DL_DIR)/$(PKG_NAME)-$(PKG_VERSION).tar.gz $(PKG_NAME)-$(PKG_VERSION)/$(1).traineddata
endef
endef
$(foreach LANG,$(ALLTESSERACTLANG),$(eval $(call generate-tesseract-data-package,$(LANG))))
$(foreach LANG,$(ALLTESSERACTLANG),$(eval $(call BuildPackage,tesseract-data-$(LANG))))

+ 57
- 0
utils/tesseract/Makefile View File

@ -0,0 +1,57 @@
# Copyright (C) 2019 Valentin Kivachuk <vk18496@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=tesseract
PKG_VERSION:=4.0.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/tesseract-ocr/tesseract/tar.gz/$(PKG_VERSION)?
PKG_HASH:=a1f5422ca49a32e5f35c54dee5112b11b99928fc9f4ee6695cdc6768d69f61dd
PKG_MAINTAINER:=Valentin Kivachuk <vk18496@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
define Package/tesseract
MENU:=1
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Tesseract Open Source OCR Engine
URL:=https://github.com/tesseract-ocr/tesseract
DEPENDS:=+libleptonica +libpthread +libstdcpp
endef
TARGET_CFLAGS:=$(filter-out -O%,$(TARGET_CFLAGS)) -O3
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/tesseract $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtesseract.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/tesseract.pc $(1)/usr/lib/pkgconfig/
endef
define Package/tesseract/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/share
$(CP) $(PKG_INSTALL_DIR)/usr/share/* $(1)/usr/share/
endef
$(eval $(call BuildPackage,tesseract))

Loading…
Cancel
Save