forked from OCR-D/ocrd_tesserocr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
87 lines (70 loc) · 1.88 KB
/
Makefile
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
export
SHELL = /bin/bash
PYTHON = python
PIP = pip
LOG_LEVEL = INFO
PYTHONIOENCODING=utf8
# Docker container tag
DOCKER_TAG = 'ocrd/tesserocr'
# BEGIN-EVAL makefile-parser --make-help Makefile
help:
@echo ""
@echo " Targets"
@echo ""
@echo " deps-ubuntu Dependencies for deployment in an ubuntu/debian linux"
@echo " patch-header Add default parameter to regain downward compatibility
@echo " deps-pip Install python deps via pip"
@echo " deps-pip-test Install testing deps via pip"
@echo " install Install"
@echo " docker Build docker image"
@echo " test Run test"
@echo " repo/assets Clone OCR-D/assets to ./repo/assets"
@echo " assets Setup test assets"
@echo " assets-clean Remove symlinks in test/assets"
@echo ""
@echo " Variables"
@echo ""
@echo " DOCKER_TAG Docker container tag"
# END-EVAL
# Dependencies for deployment in an ubuntu/debian linux
deps-ubuntu:
sudo apt-get install -y \
libxml2-utils \
libimage-exiftool-perl \
libtesseract-dev \
libleptonica-dev \
tesseract-ocr-eng
# Add default parameter to regain downward compatibility
.PHONY: patch-header
patch-header:
sed -i 's/, bool textonly[)];/, bool textonly = false);/g' /usr/include/tesseract/renderer.h
# Install python deps via pip
deps-pip:
$(PIP) install -r requirements.txt
# Install testing deps via pip
deps-pip-test:
$(PIP) install -r requirements_test.txt
# Install
install:
$(PIP) install .
# Build docker image
docker:
docker build -t $(DOCKER_TAG) .
.PHONY: test
# Run test
test:
$(PYTHON) -m pytest test
#
# Assets
#
# Clone OCR-D/assets to ./repo/assets
repo/assets:
mkdir -p $(dir $@)
git clone https://github.com/OCR-D/assets "$@"
# Setup test assets
assets: repo/assets
mkdir -p test/assets
cp -r -t test/assets repo/assets/data/*
# Remove symlinks in test/assets
assets-clean:
rm -rf test/assets