[packages/presage] - disable (Xevie dependent) gpresagemate by default, updated to build in current environment; releas

qboosh qboosh at pld-linux.org
Sat Oct 26 15:45:56 CEST 2024


commit 8691f54c24ff0bee5d0a0a6d3afad7711cc32da7
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Oct 26 15:09:02 2024 +0200

    - disable (Xevie dependent) gpresagemate by default, updated to build in current environment; release 3

 presage-build.patch  |  11 +++
 presage-c++17.patch  | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++
 presage-format.patch |  47 ++++++++++++
 presage.spec         |  22 +++++-
 4 files changed, 284 insertions(+), 3 deletions(-)
---
diff --git a/presage.spec b/presage.spec
index 3dd64fd..98b078e 100644
--- a/presage.spec
+++ b/presage.spec
@@ -3,12 +3,13 @@
 %bcond_without	apidocs		# API documentation
 %bcond_without	ngram		# ARPA ngram language model
 %bcond_without	static_libs	# static library
+%bcond_with	xevie		# Xevie based gpresagemate app
 #
 Summary:	Presage - the intelligent predictive text entry system
 Summary(pl.UTF-8):	Presage - inteligentny, przewidujący system wprowadzania tekstu
 Name:		presage
 Version:	0.9.1
-Release:	2
+Release:	3
 License:	GPL v2+
 Group:		Libraries
 Source0:	http://downloads.sourceforge.net/presage/%{name}-%{version}.tar.gz
@@ -17,6 +18,8 @@ Patch0:		%{name}-link.patch
 Patch1:		%{name}-configure.patch
 Patch2:		%{name}-build.patch
 Patch3:		%{name}-cmuclmtk.patch
+Patch4:		%{name}-c++17.patch
+Patch5:		%{name}-format.patch
 URL:		http://presage.sourceforge.net/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	automake >= 1:1.9
@@ -40,7 +43,7 @@ BuildRequires:	sqlite3-devel >= 3
 BuildRequires:	swig-python >= 2.0
 BuildRequires:	tinyxml-devel
 BuildRequires:	xorg-lib-libX11-devel
-BuildRequires:	xorg-lib-libXevie-devel
+%{?with_xevie:BuildRequires:	xorg-lib-libXevie-devel}
 Requires:	%{name}-libs = %{version}-%{release}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -136,13 +139,17 @@ Requires:	%{name} = %{version}-%{release}
 
 %description gtk
 GTK+ presage applications:
+%if %{with xevie}
 - gpresagemate: user input predictions using XEvIE extension
+%endif
 - gprompter: intelligent predictive GTK+ text editor
 
 %description gtk -l pl.UTF-8
 Aplikacje presage oparte na GTK+:
+%if %{with xevie}
 - gpresagemate - przewidywanie wejścia użytkownika z wykorzystaniem
   rozszerzenia XEvIE
+%endif
 - gprompter - inteligenty, przewidujący edytor tekstu oparty na GTK+
 
 %package -n python-presage
@@ -194,8 +201,13 @@ bibliotekę wxPython.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
+%patch5 -p1
 
-%{__sed} -i -e '1s,/usr/bin/env python,%{__python},' apps/dbus/{presage_dbus_python_demo,presage_dbus_service,presage_dbus_service.py}
+%{__sed} -i -e '1s,/usr/bin/env python,%{__python},' \
+	apps/dbus/{presage_dbus_python_demo.in,presage_dbus_service,presage_dbus_service.py}
+%{__sed} -i -e '1s,/usr/bin/python$,%{__python},' \
+	apps/python/pypresagemate.in
 
 %build
 %{__libtoolize}
@@ -204,7 +216,9 @@ bibliotekę wxPython.
 %{__autoheader}
 %{__automake}
 %configure \
+	PYTHON=%{__python} \
 	%{!?with_apidocs:--disable-documentation} \
+	%{!?with_xevie:--disable-gpresagemate} \
 	%{!?with_static_libs:--disable-static}
 %{__make}
 
@@ -290,7 +304,9 @@ rm -rf $RPM_BUILD_ROOT
 
 %files gtk
 %defattr(644,root,root,755)
+%if %{with xevie}
 %attr(755,root,root) %{_bindir}/gpresagemate
+%endif
 %attr(755,root,root) %{_bindir}/gprompter
 %{_desktopdir}/gprompter.desktop
 %{_iconsdir}/hicolor/scalable/apps/gprompter.svg
diff --git a/presage-build.patch b/presage-build.patch
index 6c60ebc..14c6fc5 100644
--- a/presage-build.patch
+++ b/presage-build.patch
@@ -135,3 +135,14 @@
  
      '\0' };
  
+--- presage-0.9.1/apps/gtk/gprompter/scintilla/gtk/ScintillaGTK.cxx.orig	2015-04-21 13:31:43.000000000 +0200
++++ presage-0.9.1/apps/gtk/gprompter/scintilla/gtk/ScintillaGTK.cxx	2024-10-26 14:38:10.956803818 +0200
+@@ -1626,7 +1626,7 @@ void ScintillaGTK::ReceivedDrop(GtkSelec
+ 		drop.push_back('\0');
+ 		NotifyURIDropped(&drop[0]);
+ 	} else if ((TypeOfGSD(selection_data) == GDK_TARGET_STRING) || (TypeOfGSD(selection_data) == atomUTF8)) {
+-		if (TypeOfGSD(selection_data) > 0) {
++		if (LengthOfGSD(selection_data) > 0) {
+ 			SelectionText selText;
+ 			GetGtkSelectionText(selection_data, selText);
+ 			DropAt(posDrop, selText.Data(), selText.Length(), false, selText.rectangular);
diff --git a/presage-c++17.patch b/presage-c++17.patch
new file mode 100644
index 0000000..6d6f387
--- /dev/null
+++ b/presage-c++17.patch
@@ -0,0 +1,207 @@
+--- presage-0.9.1/src/lib/presage.h.orig	2015-02-09 12:45:19.000000000 +0100
++++ presage-0.9.1/src/lib/presage.h	2024-10-26 14:21:31.014370037 +0200
+@@ -112,7 +112,7 @@ public:
+      * 
+      * Presage does not take ownership of the callback object.
+      */
+-    Presage(PresageCallback* callback) throw (PresageException);
++    Presage(PresageCallback* callback);
+ 
+ 
+     /** Creates and initializes presage with supplied configuration.
+@@ -122,7 +122,7 @@ public:
+      *
+      * Presage does not take ownership of the callback object.
+      */
+-    Presage(PresageCallback* callback, const std::string config) throw (PresageException);
++    Presage(PresageCallback* callback, const std::string config);
+ 
+ 
+     /** Destroys presage.
+@@ -138,7 +138,7 @@ public:
+      * context.
+      *
+      */
+-    std::vector<std::string> predict() throw (PresageException);
++    std::vector<std::string> predict();
+ 
+     /** \brief Obtain a prediction that matches the supplied token
+      *         filter.
+@@ -153,7 +153,7 @@ public:
+      * of the filter tokens.
+      *
+      */
+-    std::multimap<double, std::string> predict(std::vector<std::string> filter) throw (PresageException);
++    std::multimap<double, std::string> predict(std::vector<std::string> filter);
+ 
+     /** \brief Learn from text offline.
+      *
+@@ -167,7 +167,7 @@ public:
+      * \param text a text string to learn from.
+      *
+      */
+-    void learn(const std::string text) const throw (PresageException);
++    void learn(const std::string text) const;
+ 
+     /** \brief Callback getter/setter.
+      *
+@@ -176,7 +176,7 @@ public:
+      *
+      * \return pointer to previously used callback
+      */
+-    PresageCallback* callback(PresageCallback* callback) throw (PresageException);
++    PresageCallback* callback(PresageCallback* callback);
+ 
+     /** \brief Request presage to return the completion string for the given predicted token.
+      *
+@@ -190,26 +190,26 @@ public:
+      *
+      * \return completion string
+      */
+-    std::string completion(std::string str) throw (PresageException);
++    std::string completion(std::string str);
+ 
+     /** \brief Returns the text entered so far.
+      *
+      * \return context, text entered so far.
+      */
+-    std::string context() const throw (PresageException);
++    std::string context() const;
+ 
+     /** \brief Returns true if a context change occured.
+      *
+      * \return true if a context change occured after the last update
+      * or predict calls, or false otherwise.
+      */
+-    bool context_change() const throw (PresageException);
++    bool context_change() const;
+ 
+     /** \brief Returns the current prefix.
+      *
+      * \return prefix
+      */
+-    std::string prefix() const throw (PresageException);
++    std::string prefix() const;
+ 
+     /** \brief Gets the value of specified configuration variable.
+      *
+@@ -218,7 +218,7 @@ public:
+      *
+      * \return value assigned to configuration variable.
+      */
+-    std::string config(const std::string variable) const throw (PresageException);
++    std::string config(const std::string variable) const;
+ 
+     /** \brief Sets the value of specified configuration variable.
+      *
+@@ -227,7 +227,7 @@ public:
+      * from the configuration file in use.
+      *
+      */
+-    void config(const std::string variable, const std::string value) const throw (PresageException);
++    void config(const std::string variable, const std::string value) const;
+ 
+     /** \brief Save current configuration to file.
+      *
+@@ -236,7 +236,7 @@ public:
+      * active XML profile.
+      *
+      */
+-    void save_config() const throw (PresageException);
++    void save_config() const;
+ 
+     /*
+      * Presage public API ends here
+--- presage-0.9.1/src/lib/presage.cpp.orig	2015-02-25 16:20:39.000000000 +0100
++++ presage-0.9.1/src/lib/presage.cpp	2024-10-26 14:22:09.537925820 +0200
+@@ -31,7 +31,6 @@
+ #include "core/predictorActivator.h"
+ 
+ Presage::Presage (PresageCallback* callback)
+-    throw (PresageException)
+ {
+     profileManager = new ProfileManager();
+     configuration = profileManager->get_configuration();
+@@ -42,7 +41,6 @@ Presage::Presage (PresageCallback* callb
+ }
+ 
+ Presage::Presage (PresageCallback* callback, const std::string config_filename)
+-    throw (PresageException)
+ {
+     profileManager = new ProfileManager(config_filename);
+     configuration = profileManager->get_configuration();
+@@ -62,7 +60,6 @@ Presage::~Presage()
+ }
+ 
+ std::vector<std::string> Presage::predict ()
+-    throw (PresageException)
+ {
+     std::vector<std::string> result;
+ 
+@@ -88,7 +85,6 @@ std::vector<std::string> Presage::predic
+ }
+ 
+ std::multimap<double, std::string> Presage::predict (std::vector<std::string> filter)
+-    throw (PresageException)
+ {
+     std::multimap<double, std::string> result;
+ 
+@@ -137,20 +133,17 @@ std::multimap<double, std::string> Presa
+ }
+ 
+ void Presage::learn(const std::string text) const
+-    throw (PresageException)
+ {
+     contextTracker->learn(text); // TODO: can pass additional param to
+ 				 // learn to specify offline learning
+ }
+ 
+ PresageCallback* Presage::callback (PresageCallback* callback)
+-    throw (PresageException)
+ {
+     return const_cast<PresageCallback*>(contextTracker->callback(callback));
+ }
+ 
+ std::string Presage::completion (const std::string str)
+-    throw (PresageException)
+ {
+     // There are two types of completions: normal and erasing.
+     // normal_completion  = prefix + remainder
+@@ -198,37 +191,31 @@ std::string Presage::completion (const s
+ }
+ 
+ std::string Presage::context () const
+-    throw (PresageException)
+ {
+     return contextTracker->getPastStream();
+ }
+ 
+ bool Presage::context_change () const
+-    throw (PresageException)
+ {
+     return contextTracker->contextChange();
+ }
+ 
+ std::string Presage::prefix () const
+-    throw (PresageException)
+ {
+     return contextTracker->getPrefix();
+ }
+ 
+ std::string Presage::config (const std::string variable) const
+-    throw (PresageException)
+ {
+     return configuration->find (variable)->get_value ();
+ }
+ 
+ void Presage::config (const std::string variable, const std::string value) const
+-    throw (PresageException)
+ {
+     configuration->insert (variable, value);
+ }
+ 
+ void Presage::save_config () const
+-    throw (PresageException)
+ {
+     profileManager->save_profile ();
+ }
diff --git a/presage-format.patch b/presage-format.patch
new file mode 100644
index 0000000..f724aab
--- /dev/null
+++ b/presage-format.patch
@@ -0,0 +1,47 @@
+--- presage-0.9.1/src/tools/presageDemo.cpp.orig	2012-05-25 10:50:55.000000000 +0200
++++ presage-0.9.1/src/tools/presageDemo.cpp	2024-10-26 14:27:16.673032668 +0200
+@@ -173,7 +173,7 @@ int main(int argc, char** argv)
+ 	    // key corresponding to desired token. selecting
+ 	    // suggestion.
+ 	    std::string message = "Last selected word: " + words[c - KEY_F0 - 1];
+-	    mvprintw(LINES - 3, 0, message.c_str());
++	    mvprintw(LINES - 3, 0, "%s", message.c_str());
+             clrtoeol();
+ 	    move(LINES, COLS);
+ 
+@@ -213,7 +213,7 @@ void draw_context_win(WINDOW* win, std::
+ {
+     wclear( win );
+     box( win, 0, 0 );
+-    mvwprintw( win, 1, 1, str.c_str() );
++    mvwprintw( win, 1, 1, "%s", str.c_str() );
+     wrefresh( win );
+ }
+ 
+@@ -226,7 +226,7 @@ void drawMsgWin( WINDOW* win, std::vecto
+     int i = 1;
+     std::vector<std::string>::const_iterator j = words.begin();
+     while( j != words.end() ) {
+-	mvwprintw( win, i, 1, j->c_str() );
++	mvwprintw( win, i, 1, "%s", j->c_str() );
+ 	i++;
+ 	j++;
+     }
+@@ -241,7 +241,7 @@ void draw_function_keys(WINDOW* win)
+     for (int i = 1; i <= atoi(suggestions.c_str()); i++) {
+         std::stringstream ss;
+         ss << 'F' << i;
+-        mvwprintw(win, i, 1, ss.str().c_str());
++        mvwprintw(win, i, 1, "%s", ss.str().c_str());
+     }
+     wrefresh(win);
+ }
+@@ -291,7 +291,7 @@ void draw_previous_suggestions(std::vect
+ 	     strit != listit->end();
+ 	     strit++) {
+ 	    
+-	    mvwprintw(win, line, 1, strit->c_str());
++	    mvwprintw(win, line, 1, "%s", strit->c_str());
+ 	    line++;
+ 	}
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/presage.git/commitdiff/8691f54c24ff0bee5d0a0a6d3afad7711cc32da7



More information about the pld-cvs-commit mailing list