From 082f2a17ce2dc138293231d5fa5c8e8ad7781460 Mon Sep 17 00:00:00 2001 From: Matteo Bernardini Date: Mon, 24 Sep 2012 16:47:40 +0200 Subject: graphics/ocropus: Updated for version 0.6_20120920. Now a python only application Signed-off-by: Matteo Bernardini --- graphics/ocropus/README | 3 +++ graphics/ocropus/no_display.patch | 15 +++++++++++ graphics/ocropus/ocrodata-env.diff | 15 ----------- graphics/ocropus/ocropus.SlackBuild | 52 ++++++++++++++----------------------- graphics/ocropus/ocropus.info | 10 +++---- graphics/ocropus/ocroscript.1 | 43 ------------------------------ graphics/ocropus/slack-desc | 2 +- graphics/ocropus/usr-local.diff | 22 ---------------- 8 files changed, 44 insertions(+), 118 deletions(-) create mode 100644 graphics/ocropus/no_display.patch delete mode 100644 graphics/ocropus/ocrodata-env.diff delete mode 100644 graphics/ocropus/ocroscript.1 delete mode 100644 graphics/ocropus/usr-local.diff (limited to 'graphics') diff --git a/graphics/ocropus/README b/graphics/ocropus/README index 9aeb9fc26e..50b1f3c306 100644 --- a/graphics/ocropus/README +++ b/graphics/ocropus/README @@ -5,3 +5,6 @@ natural language modeling, and multi-lingual capabilities. The system is being developed with the generous support from Google and other organizations; the primary developers are at the IUPR Research Group at the DFKI Research Center. + +Note: the tarball of the sources is nearly 400 megs, so be patient when +downloading/building. diff --git a/graphics/ocropus/no_display.patch b/graphics/ocropus/no_display.patch new file mode 100644 index 0000000000..2fdae89fce --- /dev/null +++ b/graphics/ocropus/no_display.patch @@ -0,0 +1,15 @@ +See https://code.google.com/p/ocropus/issues/detail?id=365 + +diff -Naur ocropus-20120920.orig/ocropy/setup.py ocropus-20120920/ocropy/setup.py +--- ocropus-20120920.orig/ocropy/setup.py 2012-09-20 06:48:34.000000000 +0200 ++++ ocropus-20120920/ocropy/setup.py 2012-09-20 11:16:24.784307573 +0200 +@@ -4,6 +4,9 @@ + from distutils.core import setup, Extension, Command + from distutils.command.install_data import install_data + ++import matplotlib ++matplotlib.use('Agg') ++ + from ocrolib import default + modeldir = "models/" + modelfiles = default.installable diff --git a/graphics/ocropus/ocrodata-env.diff b/graphics/ocropus/ocrodata-env.diff deleted file mode 100644 index 04cfd5d9af..0000000000 --- a/graphics/ocropus/ocrodata-env.diff +++ /dev/null @@ -1,15 +0,0 @@ -Description: Respect the OCRODATA environment variable for all lua scripts. -Author: Jakub Wilk - -Index: ocropus-0.3.1/ocroscript/ocrotoplevel.cc -=================================================================== ---- ocropus-0.3.1.orig/ocroscript/ocrotoplevel.cc 2009-11-26 18:47:54.000000000 +0100 -+++ ocropus-0.3.1/ocroscript/ocrotoplevel.cc 2009-11-26 18:47:54.000000000 +0100 -@@ -471,6 +471,7 @@ - lua_call(L, 0, 0); - - // handle OCRODATA environment variable as a directory -+ if(getenv("OCRODATA")) ocroscripts = getenv("OCRODATA"); - lua_pushstring(L, ocrodata); - lua_setglobal(L, "ocrodata"); - diff --git a/graphics/ocropus/ocropus.SlackBuild b/graphics/ocropus/ocropus.SlackBuild index e8c2ce60b0..b3aa2b7e00 100644 --- a/graphics/ocropus/ocropus.SlackBuild +++ b/graphics/ocropus/ocropus.SlackBuild @@ -23,12 +23,11 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=ocropus -VERSION=${VERSION:-0.3.1} +VERSION=${VERSION:-0.6_20120920} +SRCVER=${SRCVER:-20120920} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -DIRVER=${DIRVER:-0.3} - if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i486 ;; @@ -61,45 +60,34 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM-$DIRVER -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz -cd $PRGNAM-$DIRVER +rm -rf $PRGNAM-$SRCVER +tar xvf $CWD/$PRGNAM-$SRCVER.tar.?z* +cd $PRGNAM-$SRCVER chown -R root:root . chmod -R u+w,go+r-w,a-s . -# Debian patch to fix hardcoded /usr/local paths in some source files -patch -p1 < $CWD/usr-local.diff -# Debian patch to fix behaviour of the OCRODATA environment variable -patch -p1 < $CWD/ocrodata-env.diff +# We don't need a DISPLAY, we're just packaging +patch -p1 < $CWD/no_display.patch + +# Fix some paths +sed -i "s|/usr/local/share|/usr/share|" \ + ocropy/Notebooks/ocropus-steps.ipynb \ + ocropy/ocrolib/default.py \ + ocropy/ocrolib/common.py -CFLAGS="$SLKCFLAGS" \ -CXXFLAGS="$SLKCFLAGS" \ -./configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --libdir=/usr/lib${LIBDIRSUFFIX} \ - --mandir=/usr/man \ - --docdir=/usr/doc/$PRGNAM-$VERSION \ - --with-tesseract=/usr \ - --with-iulib=/usr \ - --without-fst \ - --without-SDL \ - --without-leptonica \ - --build=$ARCH-slackware-linux +( cd ocropy +python setup.py install --root=$PKG ) -make -make install DESTDIR=$PKG +# move models in a subfolder +mkdir -p $PKG/usr/share/models +mv $PKG/usr/share/$PRGNAM/* $PKG/usr/share/models +mv $PKG/usr/share/models $PKG/usr/share/$PRGNAM/ find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -# Add Debian's manpage -mkdir -p $PKG/usr/man/man1 -gzip -9c $CWD/ocroscript.1 > $PKG/usr/man/man1/ocroscript.1.gz - mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a CHANGES COPYING DIRS INSTALL README $PKG/usr/doc/$PRGNAM-$VERSION +cp -a fraktur-boxes historic-newspaper uw3-500 $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/graphics/ocropus/ocropus.info b/graphics/ocropus/ocropus.info index c25b9cc4e0..4fea27c62f 100644 --- a/graphics/ocropus/ocropus.info +++ b/graphics/ocropus/ocropus.info @@ -1,10 +1,10 @@ PRGNAM="ocropus" -VERSION="0.3.1" -HOMEPAGE="http://sites.google.com/site/ocropus/" -DOWNLOAD="http://ocropus.googlecode.com/files/ocropus-0.3.1.tar.gz" -MD5SUM="2a1b66419ae69ef031d5e6269db15bb5" +VERSION="0.6_20120920" +HOMEPAGE="https://code.google.com/p/ocropus/" +DOWNLOAD="http://ponce.cc/slackware/sources/repo/ocropus-20120920.tar.xz" +MD5SUM="a61133bdb989e4a812dd130024830c0f" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="iulib tesseract" +REQUIRES="matplotlib pytables python-magick scipy" MAINTAINER="Pierre Cazenave" EMAIL="pwcazenave < at > gmail {dot} com" diff --git a/graphics/ocropus/ocroscript.1 b/graphics/ocropus/ocroscript.1 deleted file mode 100644 index d8087203f7..0000000000 --- a/graphics/ocropus/ocroscript.1 +++ /dev/null @@ -1,43 +0,0 @@ -.TH ocroscript 1 "June 06, 2008" -.SH NAME -ocropus \- command line OCR tool -.SH SYNOPSIS -.B ocroscript -.RI "