packages: zinnia/Makefile.tomoe (NEW), zinnia/tomoe2s.pl (NEW), zinnia/zinn...

baggins baggins at pld-linux.org
Thu Jul 21 22:53:48 CEST 2011


Author: baggins                      Date: Thu Jul 21 20:53:48 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- initial revision

---- Files affected:
packages/zinnia:
   Makefile.tomoe (NONE -> 1.1)  (NEW), tomoe2s.pl (NONE -> 1.1)  (NEW), zinnia-gcc.patch (NONE -> 1.1)  (NEW), zinnia.spec (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/zinnia/Makefile.tomoe
diff -u /dev/null packages/zinnia/Makefile.tomoe:1.1
--- /dev/null	Thu Jul 21 22:53:48 2011
+++ packages/zinnia/Makefile.tomoe	Thu Jul 21 22:53:43 2011
@@ -0,0 +1,20 @@
+TOMOE_MODEL_PATH = /usr/share/tomoe/recognizer/
+
+build: handwriting-ja.model handwriting-zh_CN.model tomoe2s.pl
+
+handwriting-ja.model: $(TOMOE_MODEL_PATH)/handwriting-ja.xml
+	perl tomoe2s.pl $(TOMOE_MODEL_PATH)/handwriting-ja.xml > handwriting-ja.s
+	LD_LIBRARY_PATH=.libs/ ./zinnia_learn handwriting-ja.s handwriting-ja.model
+	LD_LIBRARY_PATH=.libs/ ./zinnia_convert handwriting-ja.model.txt handwriting-ja.model
+
+handwriting-zh_CN.model: $(TOMOE_MODEL_PATH)/handwriting-zh_CN.xml
+	perl tomoe2s.pl $(TOMOE_MODEL_PATH)/handwriting-zh_CN.xml > handwriting-zh_CN.s
+	LD_LIBRARY_PATH=.libs/ ./zinnia_learn handwriting-zh_CN.s handwriting-zh_CN.model
+	LD_LIBRARY_PATH=.libs/ ./zinnia_convert handwriting-zh_CN.model.txt handwriting-zh_CN.model
+
+
+install: build
+	install -d  $(DESTDIR)/usr/share/zinnia//model/tomoe
+	install -m 0644 -p handwriting-ja.model handwriting-zh_CN.model $(DESTDIR)/usr/share/zinnia//model/tomoe
+
+

================================================================
Index: packages/zinnia/tomoe2s.pl
diff -u /dev/null packages/zinnia/tomoe2s.pl:1.1
--- /dev/null	Thu Jul 21 22:53:48 2011
+++ packages/zinnia/tomoe2s.pl	Thu Jul 21 22:53:43 2011
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use utf8;
+my $value;
+my $stroke;
+my $strokes;
+
+while (<>) {
+    if (/<character>/) {
+	while (<>) {
+	    if (/<utf8>([^<]+)<\/utf8>/) {
+		$value = $1;
+		$value =~ s/^&#x//;
+		$value = pack("U", hex($value));
+		utf8::encode($value);
+		$stroke = "";
+		$strokes = "";
+	    } elsif (/<point x=\"(\d+)\" y=\"(\d+)\"/) {
+		my $x = $1;
+		my $y = $2;
+#		print "$x $y\n";
+		$stroke .= "($x $y)";
+	    } elsif (/<\/stroke>/) {
+		$strokes .= "($stroke)";
+		$stroke = "";
+	    } elsif (/<\/character>/) {
+                if ($value !~ /[\(\)]/) {
+                    print "(character (value $value)(width 1000)(height 1000)(strokes $strokes))\n";
+                }
+		$value = "";
+		last;
+	    }
+	}
+    }
+}

================================================================
Index: packages/zinnia/zinnia-gcc.patch
diff -u /dev/null packages/zinnia/zinnia-gcc.patch:1.1
--- /dev/null	Thu Jul 21 22:53:48 2011
+++ packages/zinnia/zinnia-gcc.patch	Thu Jul 21 22:53:43 2011
@@ -0,0 +1,36 @@
+diff -p -up zinnia-0.05/perl/Makefile.PL.bindings zinnia-0.05/perl/Makefile.PL
+--- zinnia-0.05/perl/Makefile.PL.bindings	2008-09-13 18:59:36.000000000 +0200
++++ zinnia-0.05/perl/Makefile.PL	2009-11-19 14:17:39.000000000 +0100
+@@ -3,8 +3,8 @@ WriteMakefile(
+     'NAME'		=> 'zinnia',
+     'CC'                => 'c++',
+     'LD'                => 'c++',
+-    'INC'               => '',
+-    'LIBS'              => '-lzinnia',
++    'INC'               => '-I../',
++    'LIBS'              => '-L../.libs -lzinnia',
+ #    'VERSION'	        => '0.1',
+     'OBJECT'            => 'zinnia_wrap.o' 
+ );
+diff -p -up zinnia-0.05/perl/zinnia_wrap.cxx.bindings zinnia-0.05/perl/zinnia_wrap.cxx
+--- zinnia-0.05/perl/zinnia_wrap.cxx.bindings	2009-05-31 06:39:39.000000000 +0200
++++ zinnia-0.05/perl/zinnia_wrap.cxx	2009-11-19 14:18:46.000000000 +0100
+@@ -11,6 +11,7 @@
+ #define SWIGPERL
+ #define SWIG_CASTRANK_MODE
+ 
++#include <cstring>
+ 
+ #ifdef __cplusplus
+ /* SwigValueWrapper is described in swig.swg */
+diff -p -up zinnia-0.05/python/zinnia_wrap.cxx.bindings zinnia-0.05/python/zinnia_wrap.cxx
+--- zinnia-0.05/python/zinnia_wrap.cxx.bindings	2009-05-31 06:39:41.000000000 +0200
++++ zinnia-0.05/python/zinnia_wrap.cxx	2009-11-19 14:19:10.000000000 +0100
+@@ -11,6 +11,7 @@
+ #define SWIGPYTHON
+ #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
+ 
++#include <cstring>
+ 
+ #ifdef __cplusplus
+ /* SwigValueWrapper is described in swig.swg */

================================================================
Index: packages/zinnia/zinnia.spec
diff -u /dev/null packages/zinnia/zinnia.spec:1.1
--- /dev/null	Thu Jul 21 22:53:48 2011
+++ packages/zinnia/zinnia.spec	Thu Jul 21 22:53:43 2011
@@ -0,0 +1,222 @@
+# $Revision$, $Date$
+#
+# Conditional build:
+%bcond_without	static_libs	# don't build static libraries
+#
+%include	/usr/lib/rpm/macros.perl
+Summary:	Online handwriting recognition system with machine learning
+Name:		zinnia
+Version:	0.06
+Release:	1
+License:	BSD
+Group:		Libraries
+Source0:	http://downloads.sourceforge.net/zinnia/%{name}-%{version}.tar.gz
+# Source0-md5:	5ed6213e2b879465783087a0cf6d5fa0
+# http://zinnia.svn.sourceforge.net/viewvc/zinnia/zinnia/tomoe2s.pl
+Source1:	tomoe2s.pl
+Source2:	Makefile.tomoe
+Patch0:		%{name}-gcc.patch
+URL:		http://zinnia.sourceforge.net/
+BuildRequires:	db-devel
+BuildRequires:	perl(ExtUtils::MakeMaker)
+BuildRequires:	perl-devel >= 1:5.8.0
+BuildRequires:	python-devel
+BuildRequires:	rpm-perlprov >= 4.1-13
+BuildRequires:	tomoe
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Zinnia provides a simple, customizable, and portable dynamic OCR
+system for hand-written input, based on Support Vector Machines.
+
+Zinnia simply receives user pen strokes as coordinate data and outputs
+the best matching characters sorted by SVM confidence. To maintain
+portability, it has no rendering functionality. In addition to
+recognition, Zinnia provides a training module capable of creating
+highly efficient handwriting recognition models.
+
+This package contains the shared libraries.
+
+%package devel
+Summary:	Development files for zinnia
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+This package contains libraries and header files for developing
+applications that use zinnia.
+
+%package utils
+Summary:	Utils for the zinnia library
+Group:		Applications/System
+Requires:	%{name} = %{version}-%{release}
+
+%description utils
+This package provides utilities for zinnia library that use zinnia.
+
+%package static
+Summary:	Static zinnia library
+Summary(pl.UTF-8):	Statyczna biblioteka zinnia
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static zinnia library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka zinnia.
+
+%package doc
+Summary:	Documents for the zinnia library
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description doc
+This package provide documents for zinnia library that use zinnia.
+
+%package -n perl-zinnia
+Summary:	Perl bindings for zinnia
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description -n perl-zinnia
+This package contains perl bindings for zinnia.
+
+%package -n python-zinnia
+Summary:	Python bindings for zinnia
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description -n python-zinnia
+This package contains python bindings for zinnia.
+
+%package tomoe
+Summary:	Tomoe model file for zinnia
+Group:		Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description tomoe
+This package contains tomoe model files for zinnia.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%{__rm} python/zinnia.pyc
+
+cp %{SOURCE1} .
+cp %{SOURCE2} .
+
+iconv -f latin1 -t utf8 doc/zinnia.css > doc/zinnia.css.utf8
+mv -f doc/zinnia.css.utf8 doc/zinnia.css
+
+%build
+%configure
+
+%{__make} \
+	CFLAGS="%{rpmcflags}" \
+	CXXFLAGS="%{rpmcxxflags}" \
+	LDFLAGS="%{rpmldflags}"
+
+%{__make} -f Makefile.tomoe build
+
+cd perl
+%{__perl} Makefile.PL \
+	INSTALLDIRS=vendor
+
+%{__make} \
+	CC="%{__cc}"
+	OPTIMIZE="%{rpmcflags}"
+cd ..
+
+cd python
+CC="%{__cc}" \
+CFLAGS="-I../ %{rpmcflags}" \
+LDFLAGS="-L../.libs %{rpmldflags}" \
+%{__python} setup.py build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%{__make} -f Makefile.tomoe install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+cd perl
+%{__make} pure_install \
+	DESTDIR=$RPM_BUILD_ROOT
+cd ..
+
+cd python
+%{__python} setup.py install \
+	--skip-build \
+	--optimize=2 \
+	--root=$RPM_BUILD_ROOT
+
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc README
+%attr(755,root,root) %{_libdir}/libzinnia.so.*.*.*
+%attr(755,root,root) %{_libdir}/libzinnia.so.[0-9]
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libzinnia.so
+%{_includedir}/zinnia*
+%{_pkgconfigdir}/zinnia.pc
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libzinnia.a
+%endif
+
+%files utils
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/zinnia
+%attr(755,root,root) %{_bindir}/zinnia_convert
+%attr(755,root,root) %{_bindir}/zinnia_learn
+
+%files doc
+%defattr(644,root,root,755)
+%doc doc/*
+
+%files -n perl-zinnia
+%defattr(644,root,root,755)
+%dir %{perl_vendorarch}/auto/zinnia
+%attr(755,root,root) %{perl_vendorarch}/auto/zinnia/zinnia.so
+%{perl_vendorarch}/zinnia.pm
+
+%files -n python-zinnia
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py_sitedir}/_zinnia.so
+%{py_sitedir}/zinnia.py*
+%{py_sitedir}/zinnia*.egg-info
+
+%files tomoe
+%defattr(644,root,root,755)
+%dir %{_datadir}/zinnia
+%dir %{_datadir}/zinnia/model
+%dir %{_datadir}/zinnia/model/tomoe
+%{_datadir}/zinnia/model/tomoe/handwriting-ja.model
+%{_datadir}/zinnia/model/tomoe/handwriting-zh_CN.model
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2011/07/21 20:53:43  baggins
+- initial revision
+
================================================================


More information about the pld-cvs-commit mailing list