Browse Source

tesseract: update to 4.1.1

Switch to AUTORELEASE for simplicity.

Add libarchive dependency since it's now used.

Build with ninja for faster compilation.

Refresh SIMD CMake patch and add musl patch.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
lilik-openwrt-22.03
Rosen Penev 4 years ago
parent
commit
c4981cd87e
3 changed files with 30 additions and 47 deletions
  1. +5
    -6
      utils/tesseract/Makefile
  2. +15
    -41
      utils/tesseract/patches/010-cmake.patch
  3. +10
    -0
      utils/tesseract/patches/020-musl.patch

+ 5
- 6
utils/tesseract/Makefile View File

@ -7,22 +7,21 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=tesseract
PKG_VERSION:=4.0.0
PKG_RELEASE:=2
PKG_VERSION:=4.1.1
PKG_RELEASE:=$(AUTORELEASE)
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_HASH:=2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb
PKG_MAINTAINER:=Valentin Kivachuk <vk18496@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_PARALLEL:=1
CMAKE_BINARY_SUBDIR:=openwrt-build
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
include ../../devel/ninja/ninja-cmake.mk
define Package/tesseract
MENU:=1
@ -30,7 +29,7 @@ define Package/tesseract
CATEGORY:=Utilities
TITLE:=Tesseract Open Source OCR Engine
URL:=https://github.com/tesseract-ocr/tesseract
DEPENDS:=+libleptonica +libpthread +libstdcpp
DEPENDS:=+libleptonica +libarchive +libpthread +libstdcpp
endef
TARGET_CFLAGS:=$(filter-out -O%,$(TARGET_CFLAGS)) -O3


+ 15
- 41
utils/tesseract/patches/010-cmake.patch View File

@ -1,44 +1,18 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -224,41 +224,6 @@ set(tesseract_src ${tesseract_src}
src/api/pdfrenderer.cpp
)
-if (WIN32)
- if (MSVC)
- include_directories(src/vs2010/tesseract)
- set(tesseract_hdr
- ${tesseract_hdr}
- ${CMAKE_CURRENT_SOURCE_DIR}/src/vs2010/tesseract/resource.h)
- set(tesseract_rsc ${CMAKE_BINARY_DIR}/vs2010/tesseract/libtesseract.rc)
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductsse.cpp
- PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixsse.cpp
- PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductavx.cpp
- PROPERTIES COMPILE_FLAGS "/arch:AVX")
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixavx2.cpp
- PROPERTIES COMPILE_FLAGS "/arch:AVX2")
@@ -252,15 +252,6 @@ set(AVX2_OPT OFF)
set(FMA_OPT OFF)
set(SSE41_OPT OFF)
set(MARCH_NATIVE_OPT OFF)
-foreach(flag ${_enable_vector_unit_list}) # from OptimizeForArchitecture()
- string(TOUPPER "${flag}" flag)
- string(REPLACE "\." "_" flag "${flag}")
- set(simd_flags "${simd_flags} -D${flag}")
- string(REPLACE "_" "" flag "${flag}")
- if("${flag}" MATCHES "AVX|AVX2|FMA|SSE41")
- set("${flag}_OPT" ON)
- endif()
-else()
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductsse.cpp
- PROPERTIES COMPILE_FLAGS "-msse4.1")
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixsse.cpp
- PROPERTIES COMPILE_FLAGS "-msse4.1")
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/dotproductavx.cpp
- PROPERTIES COMPILE_FLAGS "-mavx")
- set_source_files_properties(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/arch/intsimdmatrixavx2.cpp
- PROPERTIES COMPILE_FLAGS "-mavx2")
-endif()
-
add_library (libtesseract ${LIBRARY_TYPE} ${tesseract_src} ${tesseract_hdr}
${tesseract_rsc}
)
-endforeach(flag)
if (NOT MSVC)
set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -O3 -ffast-math")
endif()

+ 10
- 0
utils/tesseract/patches/020-musl.patch View File

@ -0,0 +1,10 @@
--- a/src/ccutil/ocrclass.h
+++ b/src/ccutil/ocrclass.h
@@ -28,6 +28,7 @@
#include <chrono>
#include <ctime>
+#include <sys/time.h>
#ifdef _WIN32
#include <winsock2.h> // for timeval
#endif

Loading…
Cancel
Save