From 06b2156a99febb35886e84003f5f11419275ddac Mon Sep 17 00:00:00 2001 From: zdenop Date: Thu, 1 Mar 2012 12:40:04 +0000 Subject: [PATCH] fixed makemoredists; add --enable-embedded to configure git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@685 d0cd1f9f-072b-0410-8dd7-cf729c803f20 --- ccutil/Makefile.am | 7 +++++-- ccutil/scanutils.cpp | 4 ++++ ccutil/scanutils.h | 8 ++++---- configure.ac | 14 ++++++++++++++ doc/Doxyfile | 13 ++++++++----- makemoredists | 44 +++++++++++++++++++++++++------------------- 6 files changed, 60 insertions(+), 30 deletions(-) diff --git a/ccutil/Makefile.am b/ccutil/Makefile.am index c30f8db8..69d5fd9e 100644 --- a/ccutil/Makefile.am +++ b/ccutil/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = AM_CXXFLAGS = -DTESSDATA_PREFIX=@datadir@/ -EXTRA_DIST = mfcpch.cpp scanutils.cpp scanutils.h +EXTRA_DIST = mfcpch.cpp include_HEADERS = \ ambigs.h basedir.h bits16.h bitvector.h \ @@ -35,4 +35,7 @@ libtesseract_ccutil_la_SOURCES = \ unichar.cpp unicharmap.cpp unicharset.cpp unicodes.cpp \ params.cpp - +if EMBEDDED +include_HEADERS += scanutils.h +libtesseract_ccutil_la_SOURCES += scanutils.cpp +endif diff --git a/ccutil/scanutils.cpp b/ccutil/scanutils.cpp index 6ec29976..5a887e94 100644 --- a/ccutil/scanutils.cpp +++ b/ccutil/scanutils.cpp @@ -33,6 +33,8 @@ #include "scanutils.h" #include "tprintf.h" +#ifdef EMBEDDED + enum Flags { FL_SPLAT = 0x01, // Drop the value, do not assign FL_INV = 0x02, // Character-set with inverse @@ -544,3 +546,5 @@ int creat(const char *pathname, mode_t mode) { return open(pathname, O_CREAT | O_TRUNC | O_WRONLY, mode); } + +#endif // EMBEDDED \ No newline at end of file diff --git a/ccutil/scanutils.h b/ccutil/scanutils.h index fb96616f..85f4c135 100644 --- a/ccutil/scanutils.h +++ b/ccutil/scanutils.h @@ -16,8 +16,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SCANUTILS_H -#define SCANUTILS_H +#ifndef TESSERACT_CCUTIL_SCANUTILS_H_ +#define TESSERACT_CCUTIL_SCANUTILS_H_ #ifdef EMBEDDED @@ -51,6 +51,6 @@ int creat(const char *pathname, mode_t mode); // floating-point notation is not supported. double strtofloat(const char* s); -#endif +#endif // EMBEDDED -#endif +#endif // TESSERACT_CCUTIL_SCANUTILS_H_ diff --git a/configure.ac b/configure.ac index 6431ef17..fc117c71 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,20 @@ if test "$enable_graphics" = "no"; then AC_DEFINE([DISABLE_GRAPHICS], [], [Disable graphics]) fi +# check whether to build embedded version +AC_MSG_CHECKING(--enable-embedded argument) +AC_ARG_ENABLE([embedded], + [ --enable-embedded enable embedded build (default=no)], + [enable_embedded=$enableval], + [enable_embedded="no"]) +AC_MSG_RESULT($enable_embedded) +AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"]) +if test "$enable_embedded" = "yes"; then + #AC_DEFINE([EMBEDDED], [], [Embedded Mode]) + AC_SUBST([AM_CXXFLAGS], [-DEMBEDDED]) + AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) +fi + # check whether to build multiple libraries AC_MSG_CHECKING(--enable-multiple-libraries argument) AC_ARG_ENABLE([multiple-libraries], diff --git a/doc/Doxyfile b/doc/Doxyfile index 9051ce81..767fedc2 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -31,14 +31,15 @@ PROJECT_NAME = Tesseract # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 3.01 +PROJECT_NUMBER = 3.02 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = tesseract-ocr/doc/ +OUTPUT_DIRECTORY = doc/ +#OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -590,7 +591,8 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = tesseract-ocr +#INPUT = tesseract-ocr +INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -649,8 +651,9 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = tesseract-ocr/vs2008 \ - tesseract-ocr/vs2010 +#EXCLUDE = tesseract-ocr/vs2008 \ +# tesseract-ocr/vs2010 +EXCLUDE = vs2008 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded diff --git a/makemoredists b/makemoredists index 6dfb3aaa..d34938b6 100755 --- a/makemoredists +++ b/makemoredists @@ -1,13 +1,12 @@ #!/bin/bash -# Requirement: tesseract directory name must be "tesseract-ocr" otherwise -# script will not work +# Requirement: tesseract directory name should be "tesseract-3.02" -# get version information -version=`grep PACKAGE_VERSION= configure | sed -e "s/PACKAGE_VERSION=//" | sed -e "s/'//g"` -ver=tesseract-ocr-$version +source_dir=${PWD##*/} +ver=$source_dir excld="exclude.txt" + cd .. -echo Output for $ver is in `pwd`... +echo Output for $source_dir is in `pwd` ... # create language files packages if [ -f $excld ] @@ -16,23 +15,30 @@ then rm -f $excld fi -for l in tesseract-ocr/tessdata/*.traineddata +for l in $source_dir/tessdata/*.traineddata do - echo Creating language package for `basename "$l" .traineddata`... - chmod 644 ${l%%.*}.* - tar --group root --owner root -chozf $ver.`basename "$l" .traineddata`.tar.gz ${l%%.*}.* - echo ${l%%.*}.* | tr " " "\n" >>$excld + filename=`basename "$l"` + lang=${filename%.*} + echo Creating language package for `basename "$l"`... + chmod 644 $source_dir/tessdata/*$lang* + tar --group root --owner root -chozf $ver.`basename "$l" .traineddata`.tar.gz $source_dir/tessdata/*$lang* + echo $source_dir/tessdata/*$lang* | tr " " "\n" >>$excld done -# create linux source package -tar -chzf tesseract-ocr-$version.tar.gz --exclude=.svn --exclude=vs2008 --exclude=vs2010 -X $excld tesseract-ocr/* -rm -f $excld - # Windows build relevant files name=$ver-win_vs # Let's be nice and use common windows packager ;-) -zip $name.zip tesseract-ocr/vs2008/* tesseract-ocr/vs2008/include/* tesseract-ocr/vs2008/include/leptonica/* tesseract-ocr/vs2008/port/* tesseract-ocr/vs2008/lib/* tesseract-ocr/vs2010/* tesseract-ocr/vs2010/include/* tesseract-ocr/vs2010/include/leptonica/* tesseract-ocr/vs2010/port/* +zip -9 -r --exclude=*.svn* $name.zip $source_dir/vs2008/ -# create doc -doxygen tesseract-ocr/doc/Doxyfile -tar -chzf $ver-doc-html.tar.gz tesseract-ocr/doc/html/* +# create linux source package +echo Creating linux source package $ver.tar.gz ... +tar -chzf $ver.tar.gz --exclude=.svn --exclude=debian --exclude=doc/html --exclude=po/ --exclude=makemoredists --exclude=vs2008 -X $excld $source_dir/* + +# create doc and package doc +cd $source_dir +doxygen doc/Doxyfile +cd .. +tar -chzf $ver-doc-html.tar.gz $source_dir/doc/html/* + +rm -f $excld +cd $source_dir \ No newline at end of file