diff options
author | Nick White <git@njw.name> | 2019-01-03 20:15:33 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-01-03 20:15:33 +0000 |
commit | eb945de077b4e6bc56fc1fb4fc8d3f149f500480 (patch) | |
tree | 25cf780b52cc318e6f4db4341770ecc5958fdb60 | |
parent | 501fa168cf7f0efda0509724f973b1f25d4ebc58 (diff) |
Add untested general update and tesseract building rules
-rw-r--r-- | roles/devami/tasks/main.yml | 3 | ||||
-rw-r--r-- | roles/devami/tasks/tesseract.yml | 78 | ||||
-rw-r--r-- | roles/devami/tasks/update.yml | 5 |
3 files changed, 86 insertions, 0 deletions
diff --git a/roles/devami/tasks/main.yml b/roles/devami/tasks/main.yml new file mode 100644 index 0000000..cf0a946 --- /dev/null +++ b/roles/devami/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include: update.yml +- include: tesseract.yml diff --git a/roles/devami/tasks/tesseract.yml b/roles/devami/tasks/tesseract.yml new file mode 100644 index 0000000..7ad7da3 --- /dev/null +++ b/roles/devami/tasks/tesseract.yml @@ -0,0 +1,78 @@ +--- +# Installs tesseract + +- name: Install tesseract dependencies + package: name={{ item }} state=present + with_items: + - gcc-c++ + - make + - autoconf + - automake + - libtool + - pkgconfig + - libpng12-devel + - libjpeg-turbo-devel + - libtiff-devel + - zlib-devel + +- name: Install tesseract training dependencies + package: name={{ item }} state=present + with_items: + - libicu-devel + - pango-devel + - cairo-devel + +- name: Install extra tesseract development dependencies + package: name={{ item }} state=present + with_items: + - git + +- name: Clone leptonica repository + git: + repo: https://github.com/DanBloomberg/leptonica + dest: /home/ec2-user/leptonica + version: 1.77.0 + depth: 1 + +- name: Configure leptonica environ.h + lineinfile: + dest: /home/ec2-user/leptonica/src/environ.h + line: {{ item }} + insertbefore: "^#endif * LEPTONICA_ENVIRON_H" + with_items: + - "#define HAVE_FMEMOPEN 1" + - "#define HAVE_FSTATAT 1" + +- name: Build leptonica + make: + chdir: /home/ec2-user/leptonica/src + target: "-f makefile.static shared" + params: SHARED=yes + +# TODO: in due course replace this with our repo and branch +- name: Clone tesseract repository + git: + repo: https://github.com/tesseract-ocr/tesseract + dest: /home/ec2-user/tesseract + version: 4.0.0 + depth: 1 + +- name: Run autogen.sh for tesseract + command: /home/ec2-user/tesseract/autogen.sh + args: + chdir: /home/ec2-user/tesseract + creates: /home/ec2-user/tesseract/configure + +# NOTE: lept headers and libs dirs are probably incorrect +# TODO: split the shell line if possible +- name: Run configure for tesseract + shell: LIBLEPT_HEADERSDIR=$HOME/leptonica/src/ /home/ec2-user/tesseract/configure --prefix=$HOME/tessinstall/ --with-extra-libraries=$HOME/leptonica/src + args: + chdir: /home/ec2-user/tesseract + creates: /home/ec2-user/tesseract/makefile + +- name: Build and install tesseract + make: chdir=/home/ec2-user/tesseract target=install + +- name: Build and install tesseract training tools + make: chdir=/home/ec2-user/tesseract target=training-install diff --git a/roles/devami/tasks/update.yml b/roles/devami/tasks/update.yml new file mode 100644 index 0000000..99e0dcd --- /dev/null +++ b/roles/devami/tasks/update.yml @@ -0,0 +1,5 @@ +--- +# Updates the image + +- name: Update all packages + package: name=* state=latest |