summaryrefslogtreecommitdiff
path: root/graphics/tesseract/tesseract.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/tesseract/tesseract.SlackBuild')
-rw-r--r--graphics/tesseract/tesseract.SlackBuild85
1 files changed, 27 insertions, 58 deletions
diff --git a/graphics/tesseract/tesseract.SlackBuild b/graphics/tesseract/tesseract.SlackBuild
index 92c3b990af..846fb6a807 100644
--- a/graphics/tesseract/tesseract.SlackBuild
+++ b/graphics/tesseract/tesseract.SlackBuild
@@ -1,14 +1,5 @@
#!/bin/sh
-
-# 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.
+# Slackware build script for tesseract
# Copyright 2009-2010 Pierre Cazenave <pwcazenave {at} gmail [dot] com>
# All rights reserved.
@@ -30,11 +21,25 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# 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
-VERSION=2.04
-BUILD=${BUILD:-2}
+VERSION=${VERSION:-3.01}
+BUILD=${BUILD:-1}
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
case "$( uname -m )" in
i?86) ARCH=i486 ;;
@@ -48,14 +53,6 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
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
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
@@ -78,11 +75,18 @@ cd $TMP
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
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()
patch -p1 < $CWD/svutil.cpp-include_stdio_h.diff
+sed -i '1,1i#include <unistd.h>' viewer/svutil.cpp
+
+./autogen.sh
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
@@ -95,42 +99,8 @@ CFLAGS="$SLKCFLAGS" \
make
-# Let's extract the desired language tarballs, with a hack for the different
-# version numbers for certain language files. I shied away from wildcards as
-# 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
+# Extract language name described above
+tar xvf $CWD/$LANGNAM
make install DESTDIR=$PKG
@@ -141,7 +111,6 @@ mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README ReleaseNotes \
$PKG/usr/doc/$PRGNAM-$VERSION
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 {} \;
mkdir -p $PKG/install