--- # 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