[mingw-tesseract] Initial import

Sandro Mani smani at fedoraproject.org
Thu Jul 11 11:27:45 UTC 2013


commit 7f1f8276be5ba4a8289342485ffb7b9ed0355daa
Author: Sandro Mani <manisandro at gmail.com>
Date:   Thu Jul 11 13:27:34 2013 +0200

    Initial import

 .gitignore                    |    1 +
 mingw-tesseract.spec          |  156 +++++++++++++++++++++++++++++++++++++++++
 sources                       |    1 +
 tesseract-ocr_blob.patch      |   14 ++++
 tesseract-ocr_precision.patch |   12 +++
 tesseract_leptonica.patch     |   36 ++++++++++
 tesseract_pkgconfig.patch     |   14 ++++
 7 files changed, 234 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..b0e3acd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/tesseract-ocr-3.02.02.tar.gz
diff --git a/mingw-tesseract.spec b/mingw-tesseract.spec
new file mode 100644
index 0000000..df9543a
--- /dev/null
+++ b/mingw-tesseract.spec
@@ -0,0 +1,156 @@
+%{?mingw_package_header}
+
+%global pkgname tesseract
+
+Name:          mingw-%{pkgname}
+Version:       3.02.02
+Release:       3%{?dist}
+Summary:       MinGW Windows tesseract-ocr library
+Group:         Development/Libraries
+License:       ASL 2.0
+BuildArch:     noarch
+URL:           http://code.google.com/p/tesseract-ocr/
+Source0:       http://tesseract-ocr.googlecode.com/files/tesseract-ocr-%{version}.tar.gz
+# Fix pkg-config file (is already upstream)
+Patch0:        tesseract_pkgconfig.patch
+# Use pkg-config to find leptonica
+Patch1:        tesseract_leptonica.patch
+# BLOB is already defined in MinGW headers
+Patch2:        tesseract-ocr_blob.patch
+# Loss of precision in reinterpret_cast
+Patch3:        tesseract-ocr_precision.patch
+
+# Needed for Patch1
+BuildRequires: autoconf automake libtool
+
+BuildRequires: mingw32-filesystem >= 95
+BuildRequires: mingw32-gcc
+BuildRequires: mingw32-binutils
+BuildRequires: mingw32-libtiff
+BuildRequires: mingw32-leptonica
+
+BuildRequires: mingw64-filesystem >= 95
+BuildRequires: mingw64-gcc
+BuildRequires: mingw64-binutils
+BuildRequires: mingw64-libtiff
+BuildRequires: mingw64-leptonica
+
+
+%description
+MinGW Windows tesseract-ocr library.
+
+
+%package -n mingw32-%{pkgname}
+Summary:       MinGW Windows tesseract-ocr library
+
+%description -n mingw32-%{pkgname}
+MinGW Windows tesseract-ocr library.
+
+
+%package -n mingw32-%{pkgname}-static
+Summary:       Static version of the MinGW Windows tesseract-ocr library
+Requires:      mingw32-%{pkgname} = %{version}-%{release}
+
+%description -n mingw32-%{pkgname}-static
+Static version of the MinGW Windows tesseract-ocr library.
+
+
+%package -n mingw32-%{pkgname}-tools
+Summary:       MinGW Windows tesseract-ocr library tools
+Requires:      mingw32-%{pkgname} = %{version}-%{release}
+
+%description -n mingw32-%{pkgname}-tools
+MinGW Windows tesseract-ocr library tools.
+
+
+%package -n mingw64-%{pkgname}
+Summary:       MinGW Windows tesseract-ocr library
+
+%description -n mingw64-%{pkgname}
+MinGW Windows tesseract-ocr library.
+
+
+%package -n mingw64-%{pkgname}-static
+Summary:       Static version of the MinGW Windows tesseract-ocr library
+Requires:      mingw64-%{pkgname} = %{version}-%{release}
+
+%description -n mingw64-%{pkgname}-static
+Static version of the MinGW Windows tesseract-ocr library.
+
+
+%package -n mingw64-%{pkgname}-tools
+Summary:       MinGW Windows tesseract-ocr library tools
+Requires:      mingw64-%{pkgname} = %{version}-%{release}
+
+%description -n mingw64-%{pkgname}-tools
+MinGW Windows tesseract-ocr library tools.
+
+
+%{?mingw_debug_package}
+
+
+%prep
+%setup -q -n tesseract-ocr
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+
+
+%build
+# Needed for Patch1
+autoreconf -i
+%mingw_configure
+%mingw_make %{?_smp_mflags}
+
+
+%install
+%mingw_make DESTDIR=%{buildroot} install
+
+# Delete *.la files
+find %{buildroot} -name '*.la' -exec rm -f {} ';'
+
+# Delete man files
+rm -rf %{buildroot}%{mingw32_mandir}
+rm -rf %{buildroot}%{mingw64_mandir}
+
+
+%files -n mingw32-%{pkgname}
+%doc AUTHORS ChangeLog COPYING NEWS README
+%{mingw32_bindir}/libtesseract-3.dll
+%{mingw32_includedir}/tesseract/
+%{mingw32_libdir}/libtesseract.dll.a
+%{mingw32_libdir}/pkgconfig/tesseract.pc
+%{mingw32_datadir}/tessdata/
+
+%files -n mingw32-%{pkgname}-static
+%{mingw32_libdir}/libtesseract.a
+
+%files -n mingw32-%{pkgname}-tools
+%{mingw32_bindir}/*.exe
+
+%files -n mingw64-%{pkgname}
+%doc AUTHORS ChangeLog COPYING NEWS README
+%{mingw64_bindir}/libtesseract-3.dll
+%{mingw64_includedir}/tesseract/
+%{mingw64_libdir}/libtesseract.dll.a
+%{mingw64_libdir}/pkgconfig/tesseract.pc
+%{mingw64_datadir}/tessdata/
+
+%files -n mingw64-%{pkgname}-static
+%{mingw64_libdir}/libtesseract.a
+
+%files -n mingw64-%{pkgname}-tools
+%{mingw64_bindir}/*.exe
+
+
+%changelog
+* Thu Jul 11 2013 Sandro Mani <manisandro at gmail.com> - 3.02.02-3
+- Fix Source0 URL
+
+* Sun May 19 2013 Sandro Mani <manisandro at gmail.com> - 3.02.02-2
+- Remove mingw_build_win32/64 macros
+- Properly version mingw32-filesystem BuildRequires
+
+* Wed May 08 2013 Sandro Mani <manisandro at gmail.com> - 3.02.02-1
+- Initial Fedora package
diff --git a/sources b/sources
index e69de29..e0ab651 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+26adc8154f0e815053816825dde246e6  tesseract-ocr-3.02.02.tar.gz
diff --git a/tesseract-ocr_blob.patch b/tesseract-ocr_blob.patch
new file mode 100644
index 0000000..abba110
--- /dev/null
+++ b/tesseract-ocr_blob.patch
@@ -0,0 +1,14 @@
+diff -rupN tesseract-ocr/ccutil/platform.h tesseract-ocr-new/ccutil/platform.h
+--- tesseract-ocr/ccutil/platform.h	2012-10-09 19:12:17.000000000 +0200
++++ tesseract-ocr-new/ccutil/platform.h	2013-05-08 12:41:47.597558595 +0200
+@@ -24,10 +24,6 @@
+ #ifdef _WIN32
+ #ifdef __GNUC__
+ #define ultoa _ultoa
+-typedef struct _BLOB {
+-  unsigned int cbSize;
+-  char *pBlobData;
+-} BLOB, *LPBLOB;
+ #endif  /* __GNUC__ */
+ #define SIGNED
+ #define snprintf _snprintf
diff --git a/tesseract-ocr_precision.patch b/tesseract-ocr_precision.patch
new file mode 100644
index 0000000..8007dce
--- /dev/null
+++ b/tesseract-ocr_precision.patch
@@ -0,0 +1,12 @@
+diff -rupN tesseract-ocr/cube/tess_lang_mod_edge.h tesseract-ocr-new/cube/tess_lang_mod_edge.h
+--- tesseract-ocr/cube/tess_lang_mod_edge.h	2012-02-02 21:21:45.000000000 +0100
++++ tesseract-ocr-new/cube/tess_lang_mod_edge.h	2013-05-08 12:55:52.787992261 +0200
+@@ -177,7 +177,7 @@ class TessLangModEdge : public LangModEd
+   // to quickly lookup exisiting edges to converge during search
+   inline unsigned int Hash() const {
+     return static_cast<unsigned int>(((start_edge_ | end_edge_) ^
+-      ((reinterpret_cast<unsigned long int>(dawg_)))) ^
++      ((reinterpret_cast<intptr_t>(dawg_)))) ^
+       ((unsigned int)edge_mask_) ^
+       class_id_);
+   }
diff --git a/tesseract_leptonica.patch b/tesseract_leptonica.patch
new file mode 100644
index 0000000..ce5726e
--- /dev/null
+++ b/tesseract_leptonica.patch
@@ -0,0 +1,36 @@
+diff -rupN tesseract-ocr/configure.ac tesseract-ocr-new/configure.ac
+--- tesseract-ocr/configure.ac	2012-10-26 19:03:06.000000000 +0200
++++ tesseract-ocr-new/configure.ac	2013-05-08 12:21:38.026680312 +0200
+@@ -395,29 +395,9 @@ AC_CHECK_FUNCS(acos asin)
+ # ----------------------------------------
+ 
+ # Check location of leptonica/liblept headers.
+-AC_MSG_CHECKING(for leptonica)
+-AC_ARG_VAR(LIBLEPT_HEADERSDIR,[Leptonica headers directory])
+-
+-have_lept=no
+-if test "$LIBLEPT_HEADERSDIR" = "" ; then
+-  LIBLEPT_HEADERSDIR="/usr/local/include /usr/include"
+-fi
+-for incd in $LIBLEPT_HEADERSDIR
+-do
+-  for lept in . leptonica liblept
+-  do
+-    if test -r "$incd/$lept/allheaders.h" ; then
+-      CPPFLAGS="$CPPFLAGS -I$incd/$lept"
+-      have_lept=yes
+-    fi
+-  done
+-done
+-if test "$have_lept" = yes ; then
+-  AC_MSG_RESULT(yes)
+-  AC_CHECK_LIB(lept,pixCreate,[], AC_MSG_ERROR([leptonica library missing]))
+-else
+-  AC_MSG_ERROR([leptonica not found])
+-fi
++PKG_CHECK_MODULES(LIBLEPT, [lept])
++CPPFLAGS="$CPPFLAGS $LIBLEPT_CFLAGS"
++AC_CHECK_LIB(lept,pixCreate,[], AC_MSG_ERROR([leptonica library missing]))
+ 
+ # ----------------------------------------
+ # Final Tasks and Output
diff --git a/tesseract_pkgconfig.patch b/tesseract_pkgconfig.patch
new file mode 100644
index 0000000..35a32f2
--- /dev/null
+++ b/tesseract_pkgconfig.patch
@@ -0,0 +1,14 @@
+diff -rupN tesseract-ocr/tesseract.pc.in tesseract-ocr-new/tesseract.pc.in
+--- tesseract-ocr/tesseract.pc.in	2012-09-29 13:44:44.000000000 +0200
++++ tesseract-ocr-new/tesseract.pc.in	2013-01-02 01:19:23.000000000 +0100
+@@ -10,6 +10,7 @@ Name: @PACKAGE_NAME@
+ Description: An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.
+ URL: https://code.google.com/p/tesseract-ocr
+ Version: @VERSION@
+-# Requires: lept  ## leptonica do not provide lept.pc
+-Libs: -L${libdir} -ltesseract @LDFLAGS@ @LIBS@
+-Cflags: -I${includedir} @CFLAGS@ @CPPFLAGS@ @CXXFLAGS@ @DEFS@
++Requires.private: lept
++Libs: -L${libdir} -ltesseract
++Libs.private: -lpthread
++Cflags: -I${includedir}


More information about the scm-commits mailing list