graphics/tesseract: Updated for version 3.01.

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
Willy Sudiarto Raharjo 2012-09-16 16:34:09 -05:00 committed by dsomero
parent eea3cc1e8c
commit cf31dae3f2
3 changed files with 35 additions and 68 deletions

View file

@ -13,9 +13,7 @@ changed by passing an alternate value on the command line.
Here is the relevant code from the build script: Here is the relevant code from the build script:
# Language pack(s) to use # Language pack(s) to use
# We'll install English by default, but you can pass another one (or all) # We'll install English by default, but you can pass another one.
# of them on the command line (space delimited). If you pass more than one # Edit the LANGNAM variable to switch to another language
# (again, space delimited), you must enclose the string in quotes. Examples: # Please use full package name on that variable (including the extension)
# TESSLANG=fra ./tesseract.SlackBuild # see https://code.google.com/p/tesseract-ocr/downloads/list for the list
# TESSLANG="deu deu-f eng fra ita nld por spa vie" ./tesseract.SlackBuild
TESSLANG=${TESSLANG:-eng} # Default to English

View file

@ -1,14 +1,5 @@
#!/bin/sh #!/bin/sh
# Slackware build script for tesseract
# Pierre Cazenave 10/11/2007.
# Updated 25/01/2009.
# Updated 08/04/2009.
# Updated 28/05/2009 for Slackware64.
# Updated 08/09/2010 Fixed language packs logic (Thanks to Ed Rozenberg)
#
# Modified by Robby Workman <rworkman@slackbuilds.org> for better
# consistency with our other scripts
# Thanks to S+*n_Pe*rm*n for a bug report from OCRopus.
# Copyright 2009-2010 Pierre Cazenave <pwcazenave {at} gmail [dot] com> # Copyright 2009-2010 Pierre Cazenave <pwcazenave {at} gmail [dot] com>
# All rights reserved. # All rights reserved.
@ -30,11 +21,25 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Pierre Cazenave 10/11/2007.
# Updated 25/01/2009.
# Updated 08/04/2009.
# Updated 28/05/2009 for Slackware64.
# Updated 08/09/2010 Fixed language packs logic (Thanks to Ed Rozenberg)
# Thanks to S+*n_Pe*rm*n for a bug report from OCRopus.
# Modified by Willy Sudiarto Raharjo <willysr@slackware-id.org>
PRGNAM=tesseract PRGNAM=tesseract
VERSION=2.04 VERSION=${VERSION:-3.01}
BUILD=${BUILD:-2} BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
# language file name
# replace this with the filename of the language you want to install
# filename differs from one language to another, so it's very unpredictable
# see https://code.google.com/p/tesseract-ocr/downloads/list for complete list
LANGNAM=${LANGNAM:-"tesseract-ocr-3.01.eng.tar.gz"
if [ -z "$ARCH" ]; then if [ -z "$ARCH" ]; then
case "$( uname -m )" in case "$( uname -m )" in
i?86) ARCH=i486 ;; i?86) ARCH=i486 ;;
@ -48,14 +53,6 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp} OUTPUT=${OUTPUT:-/tmp}
# Language pack(s) to use
# We'll install English by default, but you can pass another one (or all)
# of them on the command line (space delimited). If you pass more than one
# (again, space delimited), you must enclose the string in quotes. Examples:
# TESSLANG=fra ./tesseract.SlackBuild
# TESSLANG="deu deu-f eng eus fra ita nld por spa vie" ./tesseract.SlackBuild
TESSLANG=${TESSLANG:-"eng"} # English only
if [ "$ARCH" = "i486" ]; then if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686" SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX="" LIBDIRSUFFIX=""
@ -78,11 +75,18 @@ cd $TMP
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION cd $PRGNAM-$VERSION
chown -R root:root . chown -R root:root .
chmod -R u+w,go+r-w,a-s . find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Fix missing snprintf() # Fix missing snprintf()
patch -p1 < $CWD/svutil.cpp-include_stdio_h.diff patch -p1 < $CWD/svutil.cpp-include_stdio_h.diff
sed -i '1,1i#include <unistd.h>' viewer/svutil.cpp
./autogen.sh
CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \
./configure \ ./configure \
--prefix=/usr \ --prefix=/usr \
@ -95,42 +99,8 @@ CFLAGS="$SLKCFLAGS" \
make make
# Let's extract the desired language tarballs, with a hack for the different # Extract language name described above
# version numbers for certain language files. I shied away from wildcards as tar xvf $CWD/$LANGNAM
# they're a bit unpredictable...
for _language in $(echo "$TESSLANG") ; do
if [ "$_language" == "eus" ]; then
if [ -r $CWD/tesseract-2.04.$_language.tar.gz ]; then
tar xf $CWD/tesseract-2.04.$_language.tar.gz
SUCCESS=yes
else
echo "$CWD/tesseract-2.01.$_language.tar.gz not found."
sleep 5
fi;
elif [ "$_language" == "deu-f" -o "$_language" == "por" -o "$_language" == "vie" ]; then
if [ -r $CWD/tesseract-2.01.$_language.tar.gz ]; then
tar xf $CWD/tesseract-2.01.$_language.tar.gz
SUCCESS=yes
else
echo "$CWD/tesseract-2.01.$_language.tar.gz not found."
sleep 5
fi;
else
if [ -r $CWD/tesseract-2.00.$_language.tar.gz ]; then
tar xf $CWD/tesseract-2.00.$_language.tar.gz
SUCCESS=yes
else
echo "$CWD/tesseract-2.00.$_language.tar.gz not found."
sleep 5
fi;
fi
done
if [ ! "$SUCCESS" = "yes" ]; then
echo "No language packs were found, so this package will not work as is."
echo "See $CWD/README for more information."
exit 1
fi
make install DESTDIR=$PKG make install DESTDIR=$PKG
@ -141,7 +111,6 @@ mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README ReleaseNotes \ cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README ReleaseNotes \
$PKG/usr/doc/$PRGNAM-$VERSION $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.$TAG
find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \; find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
mkdir -p $PKG/install mkdir -p $PKG/install

View file

@ -1,12 +1,12 @@
PRGNAM="tesseract" PRGNAM="tesseract"
VERSION="2.04" VERSION="3.01"
HOMEPAGE="http://code.google.com/p/tesseract-ocr/" HOMEPAGE="http://code.google.com/p/tesseract-ocr/"
DOWNLOAD="http://tesseract-ocr.googlecode.com/files/tesseract-2.04.tar.gz \ DOWNLOAD="https://tesseract-ocr.googlecode.com/files/tesseract-3.01.tar.gz \
http://tesseract-ocr.googlecode.com/files/tesseract-2.00.eng.tar.gz" https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.01.eng.tar.gz"
MD5SUM="b44eba1a9f4892ac62e484c807fe0533 \ MD5SUM="b44eba1a9f4892ac62e484c807fe0533 \
b8291d6b3a63ce7879d688e845e341a9" b8291d6b3a63ce7879d688e845e341a9"
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""
REQUIRES="" REQUIRES="leptonica"
MAINTAINER="Pierre Cazenave" MAINTAINER="Pierre Cazenave"
EMAIL="pwcazenave <at> gmail {dot} com" EMAIL="pwcazenave <at> gmail {dot} com"