rpms/lyx/devel lyx-1.6.4-enchant.patch, NONE, 1.1 lyx.spec, 1.99, 1.100
Rex Dieter
rdieter at fedoraproject.org
Thu Sep 17 18:14:26 UTC 2009
- Previous message (by thread): rpms/xdotool/devel .cvsignore, 1.4, 1.5 sources, 1.4, 1.5 xdotool.spec, 1.8, 1.9 xdotool-20071230-prefix.patch, 1.1, NONE xdotool-20090330-prefix.patch, 1.1, NONE
- Next message (by thread): rpms/moblin-panel-applications/devel .cvsignore, 1.2, 1.3 moblin-panel-applications.spec, 1.1, 1.2 sources, 1.2, 1.3 import.log, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: rdieter
Update of /cvs/pkgs/rpms/lyx/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26904
Modified Files:
lyx.spec
Added Files:
lyx-1.6.4-enchant.patch
Log Message:
* Thu Sep 17 2009 Rex Dieter <rdieter at fedoraproject.org> - 1.6.4-2
- use enchant instead of aspell (#524046)
lyx-1.6.4-enchant.patch:
config.h.in | 3
config/spell.m4 | 33 ++++++++-
src/Enchant.cpp | 122 ++++++++++++++++++++++++++++++++++
src/Enchant.h | 78 +++++++++++++++++++++
src/Makefile.am | 9 +-
src/frontends/qt4/GuiPrefs.cpp | 6 +
src/frontends/qt4/GuiSpellchecker.cpp | 9 +-
src/frontends/qt4/GuiView.cpp | 2
8 files changed, 251 insertions(+), 11 deletions(-)
--- NEW FILE lyx-1.6.4-enchant.patch ---
diff -ru lyx-1.6.4.orig/config/spell.m4 lyx-1.6.4/config/spell.m4
--- lyx-1.6.4.orig/config/spell.m4 2009-09-17 14:50:06.000000000 +0100
+++ lyx-1.6.4/config/spell.m4 2009-09-17 15:30:52.000000000 +0100
@@ -1,3 +1,23 @@
+# Macro to add for using enchant spellchecker libraries! -*- sh -*-
+AC_DEFUN([CHECK_WITH_ENCHANT],
+[
+ lyx_use_enchant=true
+ AC_ARG_WITH(enchant, AC_HELP_STRING([--with-enchant],[use Enchant libraries]))
+ test "$with_enchant" = "no" && lyx_use_enchant=false
+
+ if $lyx_use_enchant; then
+ PKG_CHECK_MODULES([ENCHANT], [enchant], [], [lyx_use_aspell=false])
+ AC_MSG_CHECKING([whether to use enchant])
+ if $lyx_use_enchant ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(USE_ENCHANT, 1, [Define as 1 to use the enchant library])
+ lyx_flags="$lyx_flags use-enchant"
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ ])
+
# Macro to add for using aspell spellchecker libraries! -*- sh -*-
# Only checks for "new" aspell, > 0.50
AC_DEFUN([CHECK_WITH_ASPELL],
@@ -50,14 +70,18 @@
### Check if we want spell libraries, prefer new aspell
AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
[
+ lyx_use_enchant=false
lyx_use_aspell=false
lyx_use_pspell=false
lyx_use_ispell=false
- dnl Prefer use of the aspell library over pspell.
- CHECK_WITH_ASPELL
- if $lyx_use_aspell ; then : ; else
- CHECK_WITH_PSPELL
+ dnl Prefer in order of enchant, aspell, pspell
+ CHECK_WITH_ENCHANT
+ if $lyx_use_enchant ; then : ; else
+ CHECK_WITH_ASPELL
+ if $lyx_use_aspell ; then : ; else
+ CHECK_WITH_PSPELL
+ fi
fi
dnl check for the ability to communicate through unix pipes
@@ -76,6 +100,7 @@
AC_MSG_RESULT(no)
fi
+ AM_CONDITIONAL(USE_ENCHANT, $lyx_use_enchant)
AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
AM_CONDITIONAL(USE_PSPELL, $lyx_use_pspell)
AM_CONDITIONAL(USE_ISPELL, $lyx_use_ispell)
diff -ru lyx-1.6.4.orig/config.h.in lyx-1.6.4/config.h.in
--- lyx-1.6.4.orig/config.h.in 2009-09-17 14:50:03.000000000 +0100
+++ lyx-1.6.4/config.h.in 2009-09-17 16:17:58.000000000 +0100
@@ -503,6 +503,9 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
+/* Define as 1 to use the enchant library */
+#undef USE_ENCHANT
+
/* Define as 1 to use the aspell library */
#undef USE_ASPELL
diff -ru lyx-1.6.4.orig/src/frontends/qt4/GuiPrefs.cpp lyx-1.6.4/src/frontends/qt4/GuiPrefs.cpp
--- lyx-1.6.4.orig/src/frontends/qt4/GuiPrefs.cpp 2009-09-17 14:51:03.000000000 +0100
+++ lyx-1.6.4/src/frontends/qt4/GuiPrefs.cpp 2009-09-17 16:15:33.000000000 +0100
@@ -1129,6 +1129,9 @@
spellCommandCO->addItem(qt_("ispell"));
spellCommandCO->addItem(qt_("aspell"));
spellCommandCO->addItem(qt_("hspell"));
+#ifdef USE_ENCHANT
+ spellCommandCO->addItem(qt_("enchant (library)"));
+#else
#ifdef USE_PSPELL
spellCommandCO->addItem(qt_("pspell (library)"));
#else
@@ -1136,6 +1139,7 @@
spellCommandCO->addItem(qt_("aspell (library)"));
#endif
#endif
+#endif
}
@@ -1180,7 +1184,7 @@
}
if (rc.use_spell_lib) {
-#if defined(USE_ASPELL) || defined(USE_PSPELL)
+#if defined(USE_ENCHANT) || defined(USE_ASPELL) || defined(USE_PSPELL)
spellCommandCO->setCurrentIndex(3);
#endif
}
diff -ru lyx-1.6.4.orig/src/frontends/qt4/GuiSpellchecker.cpp lyx-1.6.4/src/frontends/qt4/GuiSpellchecker.cpp
--- lyx-1.6.4.orig/src/frontends/qt4/GuiSpellchecker.cpp 2009-09-17 14:51:09.000000000 +0100
+++ lyx-1.6.4/src/frontends/qt4/GuiSpellchecker.cpp 2009-09-17 16:20:19.000000000 +0100
@@ -32,7 +32,9 @@
#include <QListWidgetItem>
-#if defined(USE_ASPELL)
+#if defined(USE_ENCHANT)
+# include "Enchant.h"
+#elif defined(USE_ASPELL)
# include "ASpell_local.h"
#elif defined(USE_PSPELL)
# include "PSpell.h"
@@ -205,7 +207,10 @@
? lyxrc.isp_alt_lang
: bp.language->code();
-#if defined(USE_ASPELL)
+#if defined(USE_ENCHANT)
+ if (lyxrc.use_spell_lib)
+ return new Enchant(bp, lang);
+#elif defined(USE_ASPELL)
if (lyxrc.use_spell_lib)
return new ASpell(bp, lang);
#elif defined(USE_PSPELL)
diff -ru lyx-1.6.4.orig/src/frontends/qt4/GuiView.cpp lyx-1.6.4/src/frontends/qt4/GuiView.cpp
--- lyx-1.6.4.orig/src/frontends/qt4/GuiView.cpp 2009-09-17 14:51:12.000000000 +0100
+++ lyx-1.6.4/src/frontends/qt4/GuiView.cpp 2009-09-17 16:14:11.000000000 +0100
@@ -1221,7 +1221,7 @@
else if (name == "latexlog")
enable = FileName(buf->logName()).isReadableFile();
else if (name == "spellchecker")
-#if defined (USE_ASPELL) || defined (USE_ISPELL) || defined (USE_PSPELL)
+#if defined (USE_ENCHANT) || defined (USE_ASPELL) || defined (USE_ISPELL) || defined (USE_PSPELL)
enable = !buf->isReadonly();
#else
enable = false;
diff -ru lyx-1.6.4.orig/src/Makefile.am lyx-1.6.4/src/Makefile.am
--- lyx-1.6.4.orig/src/Makefile.am 2009-09-17 14:50:37.000000000 +0100
+++ lyx-1.6.4/src/Makefile.am 2009-09-17 15:30:06.000000000 +0100
@@ -4,7 +4,7 @@
DISTCLEANFILES += config.h libintl.h
-AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src $(BOOST_INCLUDES)
+AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src $(BOOST_INCLUDES) $(ENCHANT_CFLAGS)
if BUILD_CLIENT_SUBDIR
CLIENT = client
@@ -19,7 +19,7 @@
paper.h \
pch.h
-OTHERLIBS = $(BOOST_LIBS) $(INTLLIBS) $(MYTHES_LIBS) $(AIKSAURUS_LIBS) @LIBS@ $(SOCKET_LIBS) $(LIBPSAPI)
+OTHERLIBS = $(BOOST_LIBS) $(INTLLIBS) $(MYTHES_LIBS) $(AIKSAURUS_LIBS) $(ENCHANT_LIBS) @LIBS@ $(SOCKET_LIBS) $(LIBPSAPI)
noinst_LTLIBRARIES = liblyxcore.la
bin_PROGRAMS = lyx
@@ -45,6 +45,9 @@
BUILT_SOURCES = $(PCH_FILE)
+if USE_ENCHANT
+ENCHANT = Enchant.cpp Enchant.h
+endif
if USE_ASPELL
ASPELL = ASpell.cpp ASpell_local.h
endif
@@ -61,7 +64,7 @@
# and in fact libtools seems not able to do that.
lyx_SOURCES = \
main.cpp \
- $(ASPELL) $(PSPELL) $(ISPELL) SpellBase.cpp \
+ $(ENCHANT) $(ASPELL) $(PSPELL) $(ISPELL) SpellBase.cpp \
BiblioInfo.h \
BiblioInfo.cpp \
Box.cpp \
--- /dev/null 2009-08-27 15:49:18.766015946 +0100
+++ lyx-1.6.4/src/Enchant.h 2009-09-17 15:52:54.000000000 +0100
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+/**
+ * \file Enchant.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Caolán McNamara
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef LYX_ENCHANT_H
+#define LYX_ENCHANT_H
+
+#include "SpellBase.h"
+
+#include <map>
+#include <string>
+
+namespace enchant {
+ class Dict;
+}
+
+namespace lyx {
+
+class BufferParams;
+
+
+class Enchant : public SpellBase {
+public:
+ /**
+ * Initialise the spellchecker with the given buffer params and language.
+ */
+ Enchant(BufferParams const & params, std::string const & lang);
+
+ virtual ~Enchant();
+
+ /**
+ * return true if the spellchecker instance still exists
+ * Always true for enchant, since there is no separate process
+ */
+ virtual bool alive() { return true; }
+
+ /// check the given word and return the result
+ virtual enum Result check(WordLangTuple const &);
+
+ /// insert the given word into the personal dictionary
+ virtual void insert(WordLangTuple const &);
+
+ /// accept the given word temporarily
+ virtual void accept(WordLangTuple const &);
+
+ /// return the next near miss after a SUGGESTED_WORDS result
+ virtual docstring const nextMiss();
+
+ /// give an error message on messy exit
+ virtual docstring const error();
+
+private:
+ /// add a speller of the given language
+ void addSpeller(std::string const & lang);
+
+ struct Speller {
+ enchant::Dict* speller;
+ };
+
+ typedef std::map<std::string, Speller> Spellers;
+
+ /// the spellers
+ Spellers spellers_;
+
+ std::vector<std::string> els;
+};
+
+
+} // namespace lyx
+
+#endif // LYX_ENCHANT_H
--- /dev/null 2009-08-27 15:49:18.766015946 +0100
+++ lyx-1.6.4/src/Enchant.cpp 2009-09-17 16:03:24.000000000 +0100
@@ -0,0 +1,122 @@
+/**
+ * \file Enchant.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Caolán McNamara
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "support/debug.h"
+
+#include <enchant++.h>
+
+#include "Enchant.h"
+#include "LyXRC.h"
+#include "WordLangTuple.h"
+
+#include "support/lassert.h"
+
+using namespace std;
+
+namespace lyx {
+
+Enchant::Enchant(BufferParams const &, string const & lang)
+{
+ addSpeller(lang);
+}
+
+
+Enchant::~Enchant()
+{
+ Spellers::iterator it = spellers_.begin();
+ Spellers::iterator end = spellers_.end();
+
+ for (; it != end; ++it) {
+ delete it->second.speller;
+ }
+}
+
+
+void Enchant::addSpeller(string const & lang)
+{
+ enchant::Broker * instance = enchant::Broker::instance();
+ enchant::Dict * dict = instance->request_dict(lang);
+
+ if (dict) {
+ Speller m;
+ m.speller = dict;
+ spellers_[lang] = m;
+ }
+}
+
+
+Enchant::Result Enchant::check(WordLangTuple const & word)
+{
+ Result res = UNKNOWN_WORD;
+
+ Spellers::iterator it = spellers_.find(word.lang_code());
+ if (it == spellers_.end()) {
+ addSpeller(word.lang_code());
+ it = spellers_.find(word.lang_code());
+ // FIXME
+ if (it == spellers_.end())
+ return res;
+ }
+
+ enchant::Dict * m = it->second.speller;
+
+ std::string utf8word(to_utf8(word.word()));
+
+ if (m->check(utf8word))
+ return OK;
+
+ m->suggest(utf8word, els);
+ if (els.empty())
+ res = UNKNOWN_WORD;
+ else
+ res = SUGGESTED_WORDS;
+
+ return res;
+}
+
+
+void Enchant::insert(WordLangTuple const & word)
+{
+ Spellers::iterator it = spellers_.find(word.lang_code());
+ if (it != spellers_.end())
+ it->second.speller->add(to_utf8(word.word()));
+}
+
+
+void Enchant::accept(WordLangTuple const & word)
+{
+ Spellers::iterator it = spellers_.find(word.lang_code());
+ if (it != spellers_.end())
+ it->second.speller->add_to_session(to_utf8(word.word()));
+}
+
+
+docstring const Enchant::nextMiss()
+{
+ docstring str;
+
+ if (!els.empty()) {
+ str = from_utf8(els.front());
+ els.erase(els.begin());
+ }
+
+ return str;
+}
+
+
+docstring const Enchant::error()
+{
+ return docstring();
+}
+
+
+} // namespace lyx
Index: lyx.spec
===================================================================
RCS file: /cvs/pkgs/rpms/lyx/devel/lyx.spec,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -p -r1.99 -r1.100
--- lyx.spec 22 Aug 2009 18:07:28 -0000 1.99
+++ lyx.spec 17 Sep 2009 18:14:26 -0000 1.100
@@ -24,7 +24,7 @@ BuildRequires: fontpackages-devel
Summary: WYSIWYM (What You See Is What You Mean) document processor
Name: lyx
Version: 1.6.4
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv2+
Group: Applications/Publishing
@@ -35,6 +35,10 @@ BuildRoot: %{_tmppath}/%{name}-%{version
Patch1: lyx-1.6.4-xdg_open.patch
+## upstreamed patches
+# http://bugzilla.redhat.com/524046 , http://www.lyx.org/trc/ticket/6226
+Patch50: lyx-1.6.4-enchant.patch
+
Source1: lyxrc.dist
Source10: lyx.desktop
@@ -42,7 +46,8 @@ Source10: lyx.desktop
%if 0%{?_with_aiksaurus:1}
BuildRequires: aiksaurus-devel
%endif
-BuildRequires: aspell-devel
+# enchant support, via patch50, needs reauto*foo'ing
+BuildRequires: enchant-devel automake libtool
%if 0%{?_without_included_boost:1}
BuildRequires: boost-devel
%endif
@@ -115,6 +120,7 @@ and let the computer take care of the re
%package common
Summary: Common files of %{name}
+Group: Applications/Publishing
Requires: %{name} = %{version}-%{release}
%{?build_noarch}
%description common
@@ -123,6 +129,7 @@ Requires: %{name} = %{version}-%{release
%package -n %{fontname}-fonts-compat
Summary: Lyx/MathML fonts compatibility package
License: Copyright only and GPL+
+Group: Applications/Publishing
Obsoletes: mathml-fonts < 1.0-50
Provides: mathml-fonts = 1.0-50
Provides: %{fontname}-fonts = %{version}-%{release}
@@ -143,6 +150,7 @@ do not reference it or depend on it in a
%package -n %{fontname}-fonts-common
Summary: Common files of %{fontname}-fonts
+Group: Applications/Publishing
# The actual license says "The author of these fonts, Basil K. Malyshev, has
# kindly granted permission to use and modify these fonts."
# One of the font files (wasy10) is separately licensed GPL+.
@@ -154,6 +162,7 @@ This package consists of files used by o
%package -n %{fontname}-cmex10-fonts
Summary: Cmex10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -162,6 +171,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-cmmi10-fonts
Summary: Cmmi10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -170,6 +180,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-cmr10-fonts
Summary: Cmr10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -178,6 +189,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-cmsy10-fonts
Summary: Cmsy10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -186,6 +198,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-esint10-fonts
Summary: Esint10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -194,6 +207,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-eufm10-fonts
Summary: Eufm10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -202,6 +216,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-msam10-fonts
Summary: Msam10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -210,6 +225,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-msbm10-fonts
Summary: Msbm10 fonts
+Group: Applications/Publishing
License: Copyright only
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -218,6 +234,7 @@ Requires: %{fontname}-fonts-common = %{v
%package -n %{fontname}-wasy10-fonts
Summary: Wasy10 fonts
+Group: Applications/Publishing
License: GPL+
Requires: %{fontname}-fonts-common = %{version}-%{release}
%{?build_noarch}
@@ -229,6 +246,10 @@ Requires: %{fontname}-fonts-common = %{v
%setup -q -n %{name}-%{version}%{?pre}
%patch1 -p1 -b .xdg_open
+%patch50 -p1 -b .enchant
+
+# needed by patch50
+./autogen.sh
%build
@@ -238,7 +259,7 @@ Requires: %{fontname}-fonts-common = %{v
--disable-rpath \
--enable-build-type=release \
--enable-optimization="%{optflags}" \
- --with-aspell \
+ --with-enchant \
--with-qt4-dir=`pkg-config --variable=prefix QtCore` \
%{?_with_aiksaurus} \
%{?_without_included_boost}
@@ -425,6 +446,9 @@ fc-cache %{_fontdir} 2> /dev/null ||:
%changelog
+* Thu Sep 17 2009 Rex Dieter <rdieter at fedoraproject.org> - 1.6.4-2
+- use enchant instead of aspell (#524046)
+
* Sat Aug 22 2009 Rex Dieter <rdieter at fedoraproject.org> - 1.6.4-1
- lyx-1.6.4
- handle fonts manually (now EPEL-5 compatible)
- Previous message (by thread): rpms/xdotool/devel .cvsignore, 1.4, 1.5 sources, 1.4, 1.5 xdotool.spec, 1.8, 1.9 xdotool-20071230-prefix.patch, 1.1, NONE xdotool-20090330-prefix.patch, 1.1, NONE
- Next message (by thread): rpms/moblin-panel-applications/devel .cvsignore, 1.2, 1.3 moblin-panel-applications.spec, 1.1, 1.2 sources, 1.2, 1.3 import.log, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list