From eb945de077b4e6bc56fc1fb4fc8d3f149f500480 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 3 Jan 2019 20:15:33 +0000 Subject: Add untested general update and tesseract building rules --- roles/devami/tasks/main.yml | 3 ++ roles/devami/tasks/tesseract.yml | 78 ++++++++++++++++++++++++++++++++++++++++ roles/devami/tasks/update.yml | 5 +++ 3 files changed, 86 insertions(+) create mode 100644 roles/devami/tasks/main.yml create mode 100644 roles/devami/tasks/tesseract.yml create mode 100644 roles/devami/tasks/update.yml (limited to 'roles') 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 -- cgit v1.2.1-24-ge1ad