Fix tesseract package (#24304)

This PR fixes the tesseract package
- add missing dependencies
- build documentation
- build and install java component
- build and install training component
This commit is contained in:
Glenn Johnson 2021-07-26 00:49:58 -05:00 committed by GitHub
parent d6432e9718
commit 63e04ce220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 4 deletions

View file

@ -0,0 +1,28 @@
--- a/java/Makefile.am 2019-12-26 08:21:51.000000000 -0600
+++ b/java/Makefile.am 2021-06-11 17:30:44.522469994 -0500
@@ -36,11 +36,11 @@
com/google/scrollview/ScrollView.class
SCROLLVIEW_LIBS = \
- piccolo2d-core-3.0.jar \
- piccolo2d-extras-3.0.jar \
+ piccolo2d-core-3.0.1.jar \
+ piccolo2d-extras-3.0.1.jar \
jaxb-api-2.3.1.jar
-CLASSPATH = piccolo2d-core-3.0.jar:piccolo2d-extras-3.0.jar:jaxb-api-2.3.1.jar
+CLASSPATH = piccolo2d-core-3.0.1.jar:piccolo2d-extras-3.0.1.jar:jaxb-api-2.3.1.jar
ScrollView.jar : $(SCROLLVIEW_CLASSES)
$(JAR) cfm $@ $(srcdir)/Manifest.txt com/google/scrollview/*.class \
@@ -51,8 +51,8 @@
.PHONY: fetch-jars
fetch-jars $(SCROLLVIEW_LIBS):
- curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-core/3.0/piccolo2d-core-3.0.jar > piccolo2d-core-3.0.jar
- curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-extras/3.0/piccolo2d-extras-3.0.jar > piccolo2d-extras-3.0.jar
+ curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-core/3.0.1/piccolo2d-core-3.0.1.jar > piccolo2d-core-3.0.1.jar
+ curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-extras/3.0.1/piccolo2d-extras-3.0.1.jar > piccolo2d-extras-3.0.1.jar
curl -L http://search.maven.org/remotecontent?filepath=javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar > jaxb-api-2.3.1.jar
.PHONY: install-jars

View file

@ -16,14 +16,69 @@ class Tesseract(AutotoolsPackage):
version('4.1.0', sha256='5c5ed5f1a76888dc57a83704f24ae02f8319849f5c4cf19d254296978a1a1961')
version('4.0.0', sha256='a1f5422ca49a32e5f35c54dee5112b11b99928fc9f4ee6695cdc6768d69f61dd')
# do not fetch the jar files from Makefile
patch('java_Makefile.patch')
jars = [
'piccolo2d-core-3.0.1',
'piccolo2d-extras-3.0.1',
'jaxb-api-2.3.1'
]
resource(
name=jars[0],
url='https://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-core/3.0.1/piccolo2d-core-3.0.1.jar',
sha256='9acad723136ddb996e96f5d488b9b046753a1d4c60ea639d5e3f9701deaf60ad',
placement=jars[0],
expand=False,
)
resource(
name=jars[1],
url='https://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-extras/3.0.1/piccolo2d-extras-3.0.1.jar',
sha256='ba45f343e9ebc06c9b4ce165c8bb539b11cbf59e93d1df48489ab173f74375a8',
placement=jars[1],
expand=False,
)
resource(
name=jars[2],
url='http://search.maven.org/remotecontent?filepath=javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar',
sha256='88b955a0df57880a26a74708bc34f74dcaf8ebf4e78843a28b50eae945732b06',
placement=jars[2],
expand=False,
)
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('m4', type='build')
depends_on('doxygen', type='build')
depends_on('asciidoc', type='build')
depends_on('libxslt', type='build')
depends_on('pkgconfig', type='build')
depends_on('leptonica')
depends_on('libarchive')
depends_on('curl')
depends_on('icu4c')
depends_on('cairo')
depends_on('pango')
depends_on('java')
@when('@:4.0.0')
def configure_args(self):
args = ['LDFLAGS=-lz']
return args
def autoreconf(self, spec, prefix):
autogen = Executable(join_path('.', 'autogen.sh'))
autogen()
def setup_run_environment(self, env):
env.set('SCROLLVIEW_PATH', prefix.share.tessdata)
@run_after('install')
def training(self):
make('training')
make('training-install')
# move the jar files to the java directory
for jar in self.jars:
src = '{0}/{1}/{2}.jar'.format(self.stage.source_path, jar, jar)
dest = '{0}/java/{1}.jar'.format(self.stage.source_path, jar)
copy(src, dest)
with working_dir('java'):
make('install-jars')