commit:     aaed1d6ef2e9f1ae7b95665a2378b53f32c13e23
Author:     Vitaly Zdanevich <zdanevich.vitaly <AT> ya <DOT> ru>
AuthorDate: Sat May  4 08:20:58 2024 +0000
Commit:     Vitaly Zdanevich <zdanevich.vitaly <AT> ya <DOT> ru>
CommitDate: Sat May  4 08:20:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=aaed1d6e

x11-misc/xneur: new package, adapted from https://xneur.ru/downloads

Signed-off-by: Vitaly Zdanevich <zdanevich.vitaly <AT> ya.ru>

 x11-misc/xneur/ChangeLog                           |  60 +++++++++++
 x11-misc/xneur/Manifest                            |   1 +
 x11-misc/xneur/files/01-fix-arg-parsing.patch      |  14 +++
 x11-misc/xneur/files/enchant.patch                 | 119 +++++++++++++++++++++
 x11-misc/xneur/files/gcc-10.patch                  |  40 +++++++
 .../xneur/files/xneur-0.12.0-libnotify-0.7.patch   |  28 +++++
 x11-misc/xneur/metadata.xml                        |  14 +++
 x11-misc/xneur/xneur-0.20.0.ebuild                 | 102 ++++++++++++++++++
 8 files changed, 378 insertions(+)

diff --git a/x11-misc/xneur/ChangeLog b/x11-misc/xneur/ChangeLog
new file mode 100644
index 0000000000..8085d96711
--- /dev/null
+++ b/x11-misc/xneur/ChangeLog
@@ -0,0 +1,60 @@
+# ChangeLog for x11-misc/xneur
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+  05 May 2012; Mike Gilbert <[email protected]> xneur-0.12.0-r1.ebuild:
+  Use pkgconfig virtual.
+
+  12 Mar 2011; Alexandre Rostovtsev (tetromino) <[email protected]>
+  -xneur-0.12.0.ebuild, +xneur-0.12.0-r1.ebuild,
+  +files/xneur-0.12.0-libnotify-0.7.patch:
+  Add patch for libnotify-0.7 compatibility
+
+  01 Feb 2011; Alexandre Rostovtsev (tetromino) <[email protected]>
+  -xneur-0.11.1.ebuild, -files/xneur-0.11.1-openmp.patch,
+  +xneur-0.12.0.ebuild:
+  Version bump; libpcre dependency is now obligatory; openmp patch is no
+  longer needed.
+
+  06 Dec 2010; Peter Volkov <[email protected]> -xneur-0.10.0.ebuild,
+  +xneur-0.11.1.ebuild, +files/xneur-0.11.1-openmp.patch:
+  Version bump, thank nightwelf and Alex Rodionov for report/help.
+
+  17 Oct 2010; Peter Volkov <[email protected]> -xneur-0.9.9.ebuild,
+  +xneur-0.10.0.ebuild, metadata.xml:
+  Version bump, thank Павел aka Nightwelf for report.
+
+  06 Jul 2010; Michał Górny (sedzimir) <[email protected]>
+  xneur-0.9.9.ebuild:
+  Decrease EAPI requirement, cleanup. Correct dependencies.
+
+  01 Jun 2010; Peter Volkov <[email protected]> -xneur-0.9.7.ebuild,
+  +xneur-0.9.9.ebuild:
+  Version bump, thank Alex Rodionov for report in bug #169494.
+
+  16 Oct 2009; Peter Volkov <[email protected]> -xneur-0.9.5.ebuild,
+  -files/xneur-0.9.5-gcc44.patch, +xneur-0.9.7.ebuild:
+  Version bump. Patch substituted with shell magic. Imlib/xpm support to
+  display flag close to cursor was found slow and dropped. Spell is highly
+  suggested upstream.
+
+  26 Aug 2009; Peter Volkov <[email protected]> -xneur-0.9.4.ebuild,
+  +xneur-0.9.5.ebuild, +files/xneur-0.9.5-gcc44.patch:
+  Version bump. Dropped subversion support code from ebuild (not used anyway).
+  New USE flag: libnotify.
+
+  01 Jun 2009; Peter Volkov <[email protected]> -xneur-0.9.3.ebuild,
+  -files/xneur-0.9.3-CFLAGS.patch, -files/xneur-0.9.3-build-failure.patch,
+  +xneur-0.9.4.ebuild:
+  Version bump. Thank Jan Aniŝĉuk for the patch (bug #169494).
+
+  17 Apr 2009; Justin Lecher (jlec) <[email protected]> xneur-0.9.3.ebuild:
+  QA quotes around EAPI version
+
+  03 Apr 2009; Peter Volkov <[email protected]> +xneur-0.9.3.ebuild,
+  +files/xneur-0.9.3-CFLAGS.patch, +files/xneur-0.9.3-build-failure.patch,
+  +metadata.xml:
+  New Ebuild for bug 169494. Too many users want xneur but it still crashs and
+  has known limitations. In Sunrise everybody can easy get it and have a
+  chance to improve it.
+

diff --git a/x11-misc/xneur/Manifest b/x11-misc/xneur/Manifest
new file mode 100644
index 0000000000..1c2bf1b835
--- /dev/null
+++ b/x11-misc/xneur/Manifest
@@ -0,0 +1 @@
+DIST xneur_0.20.0.orig.tar.gz 1683789 BLAKE2B 
06bced1be509027f7940609b516a8cfb3c43858d49404672e65444d578a4419b588ce4a32eead5956a190e4c473755b25f18ea516fd425ea105e90a7ed57b10f
 SHA512 
96ca9b61d15a0072fc846becf3a842981598417b3295720bd67ac7b08660836e2814622eaef963d45389e88ca2fe1bffce476541ac23f569115a3b223e3827ee

diff --git a/x11-misc/xneur/files/01-fix-arg-parsing.patch 
b/x11-misc/xneur/files/01-fix-arg-parsing.patch
new file mode 100644
index 0000000000..703e1253ba
--- /dev/null
+++ b/x11-misc/xneur/files/01-fix-arg-parsing.patch
@@ -0,0 +1,14 @@
+--- a/src/xneur.c
++++ b/src/xneur.c
+@@ -404,6 +404,11 @@
+               }
+       }
+ 
++      if (optind < argc)
++      {
++              xneur_usage();
++              exit(EXIT_FAILURE);
++      }
+       if (opted)
+               exit(EXIT_SUCCESS);
+ }

diff --git a/x11-misc/xneur/files/enchant.patch 
b/x11-misc/xneur/files/enchant.patch
new file mode 100644
index 0000000000..0fac5d244e
--- /dev/null
+++ b/x11-misc/xneur/files/enchant.patch
@@ -0,0 +1,119 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -158,7 +158,7 @@ if test "x$with_spell" != "xno"; then
+
+       case $with_spell in
+               enchant|yes)
+-                      PKG_CHECK_MODULES(ENCHANT, [enchant >= 1.0])
++                      PKG_CHECK_MODULES(ENCHANT, [enchant-2 >= 1.0])
+                       AC_DEFINE(WITH_ENCHANT, 1, [Define if you want enchant 
support])
+                       ;;
+               aspell)
+--- a/xneur.pc
++++ b/xneur.pc
+@@ -6,5 +6,5 @@ includedir=${prefix}/include
+ Name: xneur
+ Description: XNeur library
+ Version: 0.20.0
+-Libs: -L${exec_prefix}/lib -lxneur  -lpcre -lenchant -lpthread -ldl
++Libs: -L${exec_prefix}/lib -lxneur  -lpcre -lenchant-2 -lpthread -ldl
+ Cflags: -I${prefix}/include
+--- a/plugins/statistic/Makefile.am
++++ b/plugins/statistic/Makefile.am
+@@ -7,7 +7,7 @@ pkglib_LTLIBRARIES = libxnstatistic.la
+ libxnstatistic_la_SOURCES = \
+       statistic.c
+
+-libxnstatistic_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/lib 
@DEFAULT_CFLAGS@
++libxnstatistic_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/lib 
@ASPELL_CFLAGS@ @ENCHANT_CFLAGS@ @DEFAULT_CFLAGS@
+ libxnstatistic_la_LDFLAGS = @X11_LIBS@
+
+ libxnstatistic_la_LIBADD =
+--- a/lib/lib/xneur.h
++++ b/lib/lib/xneur.h
+@@ -29,7 +29,7 @@
+ #endif
+
+ #ifdef WITH_ENCHANT
+-#     include <enchant/enchant.h>
++#     include <enchant.h>
+ #endif
+
+ struct _window *main_window;
+--- a/lib/lib/xneurlib.c
++++ b/lib/lib/xneurlib.c
+@@ -30,7 +30,7 @@
+ #endif
+
+ #ifdef WITH_ENCHANT
+-#     include <enchant/enchant.h>
++#     include <enchant.h>
+ #endif
+
+ #include "xneur.h"
+--- a/lib/notify/Makefile.am
++++ b/lib/notify/Makefile.am
+@@ -16,7 +16,9 @@ libxnnotify_la_CFLAGS = -I@top_srcdir@/l
+                                                                               
@GSTREAMER_CFLAGS@              \
+                                                                               
@XOSD_CFLAGS@                   \
+                                                                               
@LIBNOTIFY_CFLAGS@              \
+-                                                                              
@GTK_CFLAGS@
++                                                                              
@GTK_CFLAGS@                    \
++                                                                              
@ASPELL_CFLAGS@                 \
++                                                                              
@ENCHANT_CFLAGS@
+ libxnnotify_la_LDFLAGS = -static @X11_LIBS@ @ADDITIONAL_LIBS@ \
+                                       @FREEALUT_LIBS@         \
+                                       @GSTREAMER_LIBS@        \
+--- a/lib/main/Makefile.am
++++ b/lib/main/Makefile.am
+@@ -28,6 +28,6 @@ libxnmain_la_SOURCES =               \
+       defines.h
+
+
+-libxnmain_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/misc  
-I@top_srcdir@/lib/notify -I@top_srcdir@/lib/ai -I@top_srcdir@/lib/lib 
-I@top_srcdir@/lib/rec @X11_CFLAGS@ @DEFAULT_CFLAGS@ 
-DXNEUR_PLUGIN_DIR=\""@libdir@/xneur"\"
++libxnmain_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/misc  
-I@top_srcdir@/lib/notify -I@top_srcdir@/lib/ai -I@top_srcdir@/lib/lib 
-I@top_srcdir@/lib/rec @X11_CFLAGS@ @ASPELL_CFLAGS@ @ENCHANT_CFLAGS@ 
@DEFAULT_CFLAGS@ -DXNEUR_PLUGIN_DIR=\""@libdir@/xneur"\"
+ libxnmain_la_LDFLAGS = -static @X11_LIBS@  @ADDITIONAL_LIBS@
+
+--- a/lib/ai/Makefile.am
++++ b/lib/ai/Makefile.am
+@@ -6,6 +6,6 @@ libxnai_la_SOURCES =           \
+       detection.c             \
+       detection.h
+
+-libxnai_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/misc 
-I@top_srcdir@/lib/main -I@top_srcdir@/lib/lib @X11_CFLAGS@ @ASPELL_CFLAGS@ 
@DEFAULT_CFLAGS@
++libxnai_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/misc 
-I@top_srcdir@/lib/main -I@top_srcdir@/lib/lib @X11_CFLAGS@ @ASPELL_CFLAGS@ 
@ENCHANT_CFLAGS@ @DEFAULT_CFLAGS@
+ libxnai_la_LDFLAGS = -static @X11_LIBS@ @ASPELL_LIBS@ @ADDITIONAL_LIBS@
+
+--- a/lib/config/Makefile.am
++++ b/lib/config/Makefile.am
+@@ -13,7 +13,7 @@ noinst_HEADERS =             \
+ libxnconfig_la_SOURCES =      \
+       xnconfig.c
+
+-libxnconfig_la_CFLAGS = -I@top_srcdir@/lib/misc -I@top_srcdir@/lib/main 
-I@top_srcdir@/lib/lib @DEFAULT_CFLAGS@
++libxnconfig_la_CFLAGS = -I@top_srcdir@/lib/misc -I@top_srcdir@/lib/main 
-I@top_srcdir@/lib/lib @ASPELL_CFLAGS@ @ENCHANT_CFLAGS@ @DEFAULT_CFLAGS@
+ libxnconfig_la_LIBADD = ../lib/libxneur.la @ADDITIONAL_LIBS@
+ libxnconfig_la_LDFLAGS = -version-info 20:0:0
+
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -9,7 +9,7 @@ xneur_SOURCES =                        \
+       newlang_creation.c      \
+       newlang_creation.h
+
+-xneur_CFLAGS = -I@top_srcdir@/lib/ai  -I@top_srcdir@/lib/lib  
-I@top_srcdir@/lib/config -I@top_srcdir@/lib/main -I@top_srcdir@/lib/misc 
-I@top_srcdir@/lib/notify  @X11_CFLAGS@ @DEFAULT_CFLAGS@
++xneur_CFLAGS = -I@top_srcdir@/lib/ai  -I@top_srcdir@/lib/lib  
-I@top_srcdir@/lib/config -I@top_srcdir@/lib/main -I@top_srcdir@/lib/misc 
-I@top_srcdir@/lib/notify  @X11_CFLAGS@ @ASPELL_CFLAGS@ @ENCHANT_CFLAGS@ 
@DEFAULT_CFLAGS@
+
+ xneur_LDFLAGS = -L$(top_srcdir)/lib/lib -L$(top_srcdir)/lib/ai 
-L$(top_srcdir)/lib/config -L$(top_srcdir)/lib/misc -L$(top_srcdir)/lib/main 
-L$(top_srcdir)/lib/notify  @X11_LIBS@ @ADDITIONAL_LIBS@
+
+--- a/plugins/test/Makefile.am
++++ b/plugins/test/Makefile.am
+@@ -7,7 +7,7 @@ pkglib_LTLIBRARIES = libxntest.la
+ libxntest_la_SOURCES = \
+       test.c
+
+-libxntest_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/lib 
@DEFAULT_CFLAGS@
++libxntest_la_CFLAGS = -I@top_srcdir@/lib/config -I@top_srcdir@/lib/lib 
@ASPELL_CFLAGS@ @ENCHANT_CFLAGS@ @DEFAULT_CFLAGS@
+ libxntest_la_LDFLAGS = @X11_LIBS@
+
+ libxntest_la_LIBADD =

diff --git a/x11-misc/xneur/files/gcc-10.patch 
b/x11-misc/xneur/files/gcc-10.patch
new file mode 100644
index 0000000000..f3d2f97e63
--- /dev/null
+++ b/x11-misc/xneur/files/gcc-10.patch
@@ -0,0 +1,40 @@
+--- a/lib/main/program.c
++++ b/lib/main/program.c
+@@ -315,7 +315,7 @@
+ 
+       p->buffer->save_and_clear(p->buffer, p->last_window);
+       p->correction_buffer->clear(p->correction_buffer);
+-      p->correction_action = ACTION_NONE;
++      p->correction_action = CORRECTION_NONE;
+ 
+       if (status == FOCUS_NONE)
+               return;
+@@ -426,7 +426,7 @@
+                               p->correction_buffer = 
buffer_init(xconfig->handle, main_window->keymap);
+                               p->correction_buffer->handle = xconfig->handle;
+                               p->correction_buffer->keymap = 
main_window->keymap;
+-                              p->correction_action = ACTION_NONE;
++                              p->correction_action = CORRECTION_NONE;
+ 
+                               //log_message (DEBUG, _("Now layouts count 
%d"), xconfig->handle->total_languages);
+                               log_message(LOG, _("Keyboard layouts present in 
system:"));
+@@ -609,7 +609,7 @@
+                                               //{
+                                                       
p->buffer->save_and_clear(p->buffer, p->focus->owner_window);
+                                                       
p->correction_buffer->clear(p->correction_buffer);
+-                                                      p->correction_action = 
ACTION_NONE;
++                                                      p->correction_action = 
CORRECTION_NONE;
+                                                       if 
((Window)p->focus->get_focused_window(p->focus) != 
(Window)p->focus->owner_window)
+                                                       {
+                                                               p->update(p);
+--- a/lib/lib/xneur.h
++++ b/lib/lib/xneur.h
+@@ -32,7 +32,7 @@
+ #     include <enchant.h>
+ #endif
+ 
+-struct _window *main_window;
++extern struct _window *main_window;
+ 
+ struct _xneur_language
+ {

diff --git a/x11-misc/xneur/files/xneur-0.12.0-libnotify-0.7.patch 
b/x11-misc/xneur/files/xneur-0.12.0-libnotify-0.7.patch
new file mode 100644
index 0000000000..080dcc6807
--- /dev/null
+++ b/x11-misc/xneur/files/xneur-0.12.0-libnotify-0.7.patch
@@ -0,0 +1,28 @@
+diff -ru xneur-0.12.0-orig/lib/notify/popup.c xneur-0.12.0/lib/notify/popup.c
+--- xneur-0.12.0-orig/lib/notify/popup.c       2011-01-27 05:25:42.000000000 
-0500
++++ xneur-0.12.0/lib/notify/popup.c    2011-03-12 02:21:20.411001315 -0500
+@@ -27,6 +27,10 @@
+ 
+ #include <libnotify/notify.h>
+ 
++#ifndef NOTIFY_CHECK_VERSION /* macro did not exist before libnotify-0.5.2 */
++#  define NOTIFY_CHECK_VERSION(x,y,z) 0
++#endif
++
+ #include <pthread.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -73,8 +77,12 @@
+               popup_body->header = popup_body->content;
+               popup_body->content = NULL;
+       }
+-      
++
++#if NOTIFY_CHECK_VERSION(0,7,0)
++      NotifyNotification *notify = 
notify_notification_new(popup_body->header, popup_body->content, icon);
++#else
+       NotifyNotification *notify = 
notify_notification_new(popup_body->header, popup_body->content, icon, NULL);
++#endif
+ 
+       notify_notification_set_category(notify, type);
+       notify_notification_set_urgency(notify, urgency);

diff --git a/x11-misc/xneur/metadata.xml b/x11-misc/xneur/metadata.xml
new file mode 100644
index 0000000000..9976b4f217
--- /dev/null
+++ b/x11-misc/xneur/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type='person' proxied='yes'>
+               <email>[email protected]</email>
+               <name>Vitaly Zdanevich</name>
+       </maintainer>
+       <use>
+               <flag name='aplay'>Use aplay from 
<pkg>media-sound/alsa-utils</pkg> for playing sounds</flag>
+       </use>
+       <upstream>
+               <remote-id 
type='github'>AndrewCrewKuznetsov/xneur-devel</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/x11-misc/xneur/xneur-0.20.0.ebuild 
b/x11-misc/xneur/xneur-0.20.0.ebuild
new file mode 100644
index 0000000000..45ca475484
--- /dev/null
+++ b/x11-misc/xneur/xneur-0.20.0.ebuild
@@ -0,0 +1,102 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# This ebuild is mostly from 
https://github.com/Sabayon/for-gentoo/blob/338c13c74bfdfafcc0f723482c05a0ddb591704e/x11-misc/xneur/xneur-0.20.0.ebuild
+
+EAPI=8
+
+inherit autotools xdg
+
+DESCRIPTION="Inplace conversion of text typed in a wrong keyboard layout, like 
Punto Switcher"
+HOMEPAGE="http://www.xneur.ru/";
+SRC_URI="https://github.com/AndrewCrewKuznetsov/$PN-devel/raw/master/dists/$PV/xneur_$PV.orig.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="aplay debug gstreamer keylogger libnotify nls openal openmp xosd +spell"
+
+PATCHES=(
+       "$FILESDIR/enchant.patch"
+       "$FILESDIR/01-fix-arg-parsing.patch"
+       "$FILESDIR/gcc-10.patch"
+)
+
+COMMON_DEPEND=">=dev-libs/libpcre-5.0
+       sys-libs/zlib
+       >=x11-libs/libX11-1.1
+       x11-libs/libXtst
+       gstreamer? ( >=media-libs/gstreamer-0.10.6 )
+       !gstreamer? (
+               openal? ( >=media-libs/freealut-1.0.1 )
+               !openal? (
+                       aplay? ( >=media-sound/alsa-utils-1.0.17 ) ) )
+       libnotify? ( >=x11-libs/libnotify-0.4.0 )
+       spell? ( app-text/enchant )
+       xosd? ( x11-libs/xosd )"
+RDEPEND="${COMMON_DEPEND}
+       gstreamer? (
+               media-libs/gst-plugins-good
+       )
+       nls? ( virtual/libintl )"
+DEPEND="${COMMON_DEPEND}
+       virtual/pkgconfig
+       openmp? ( sys-devel/gcc[openmp] )
+       nls? ( sys-devel/gettext )"
+
+src_prepare() {
+       # Fixes error/warning: no newline at end of file
+       # find -name '*.c' -exec sed -i -e '${/[^ ]/s:$:\n:}' {} + || die
+       # rm -f m4/{lt~obsolete,ltoptions,ltsugar,ltversion,libtool}.m4 \
+       #       ltmain.sh aclocal.m4 || die
+
+       sed -i -e "s/-Werror -g0//" configure || die
+       sed -i -e "s/-Werror -g0//" configure.ac || die
+       # epatch "${FILESDIR}/${P}-libnotify-0.7.patch"
+       default
+       eautoreconf
+}
+
+src_configure() {
+       myconf="--with-gtk=gtk3"
+
+       if use gstreamer; then
+               elog "Using gstreamer for sound output."
+               myconf="--with-sound=gstreamer"
+       elif use openal; then
+               elog "Using openal for sound output."
+               myconf="--with-sound=openal"
+       elif use aplay; then
+               elog "Using aplay for sound output."
+               myconf="--with-sound=aplay"
+       else
+               elog "Sound support disabled."
+               myconf="--with-sound=no"
+       fi
+
+       econf ${myconf} \
+               $(use_with debug) \
+               $(use_enable nls) \
+               $(use_with spell) \
+               $(use_with xosd) \
+               $(use_with libnotify) \
+               $(use_with keylogger)
+}
+
+src_install() {
+       emake DESTDIR="${D}" install || die
+       dodoc AUTHORS ChangeLog README NEWS TODO || die
+}
+
+pkg_postinst() {
+       xdg_icon_cache_update
+
+       # TODO add gxneur, but I have no tray to check it
+       #elog "This is command line tool. If you are looking for GUI frontend 
just"
+       #elog "emerge gxneur, which uses xneur transparently as backend."
+       #elog ""
+       elog "It is recommended to install dictionary for your language"
+       elog "(myspell or aspell), for example app-dicts/aspell-ru."
+       elog ""
+       ewarn "Note: if xneur became slow, try to comment out AddBind options 
in config file."
+}

Reply via email to