pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

yasr: add yasr-0.0.0.144



Module Name:	pkgsrc-wip
Committed By:	adr <adr%sdf.org@localhost>
Pushed By:	adr
Date:		Thu Feb 29 21:33:33 2024 +0000
Changeset:	e72c79efbeaef109a337c539e1a2832743059984

Added Files:
	yasr/COMMIT_MSG
	yasr/DESCR
	yasr/Makefile
	yasr/PLIST
	yasr/distinfo
	yasr/patches/patch-meson.build
	yasr/patches/patch-yasr_main.c
	yasr/patches/patch-yasr_tts.c
	yasr/patches/patch-yasr_yasr.conf

Log Message:
yasr: add yasr-0.0.0.144

YASR ("Yet Another Screen Reader") is an attempt at a lightweight,
portable screen reader. It works by opening a shell in a pty and
intercepting all user input/output, maintaining a window of what
should be on the screen by looking at the codes and text sent to the
screen. It thus uses no Linuxisms such as /dev/vcsa0 and does not
necessarily need to be setuid root (the only requirement being that
the user be able to access the tts device).

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e72c79efbeaef109a337c539e1a2832743059984

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 yasr/COMMIT_MSG                   |   3 +
 yasr/DESCR                        |   7 ++
 yasr/Makefile                     |  19 ++++++
 yasr/PLIST                        |   6 ++
 yasr/distinfo                     |   9 +++
 yasr/patches/patch-meson.build    |  15 +++++
 yasr/patches/patch-yasr_main.c    | 137 ++++++++++++++++++++++++++++++++++++++
 yasr/patches/patch-yasr_tts.c     |  47 +++++++++++++
 yasr/patches/patch-yasr_yasr.conf |  23 +++++++
 9 files changed, 266 insertions(+)

diffs:
diff --git a/yasr/COMMIT_MSG b/yasr/COMMIT_MSG
new file mode 100644
index 0000000000..c2c80b8b73
--- /dev/null
+++ b/yasr/COMMIT_MSG
@@ -0,0 +1,3 @@
+audio/yasr: Add yasr version 0.0.0.144
+
+Packaged in wip by adr
diff --git a/yasr/DESCR b/yasr/DESCR
new file mode 100644
index 0000000000..0c14f7b9a9
--- /dev/null
+++ b/yasr/DESCR
@@ -0,0 +1,7 @@
+YASR ("Yet Another Screen Reader") is an attempt at a lightweight,
+portable screen reader. It works by opening a shell in a pty and
+intercepting all user input/output, maintaining a window of what
+should be on the screen by looking at the codes and text sent to the
+screen. It thus uses no Linuxisms such as /dev/vcsa0 and does not
+necessarily need to be setuid root (the only requirement being that
+the user be able to access the tts device).
diff --git a/yasr/Makefile b/yasr/Makefile
new file mode 100644
index 0000000000..a5d6dcd8ff
--- /dev/null
+++ b/yasr/Makefile
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile,v 1.1 2024/02/25 22:00:09 wiz Exp $
+
+COMMITS=	144
+DISTNAME=	yasr-0.0.0.${COMMITS}
+CATEGORIES=	audio
+MASTER_SITES=	${MASTER_SITE_GITHUB:=mgorse/}
+GITHUB_TAG=	f60db19350542e6f4b7d268a310b9f2b9f3076c0
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/mgorse/yasr
+COMMENT=	Lightweight and portable screen reader
+LICENSE=	gnu-gpl-v2
+
+USE_LANGUAGES=	c
+USE_TOOLS=	pkg-config msgfmt xgettext
+
+.include "../../devel/meson/build.mk"
+.include "../../audio/speech-dispatcher/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/yasr/PLIST b/yasr/PLIST
new file mode 100644
index 0000000000..29c50a9bba
--- /dev/null
+++ b/yasr/PLIST
@@ -0,0 +1,6 @@
+@comment $NetBSD$
+bin/yasr
+man/man1/yasr.1
+share/locale/es/LC_MESSAGES/yasr.mo
+share/locale/fr/LC_MESSAGES/yasr.mo
+share/yasr/yasr.conf
diff --git a/yasr/distinfo b/yasr/distinfo
new file mode 100644
index 0000000000..976f7f731f
--- /dev/null
+++ b/yasr/distinfo
@@ -0,0 +1,9 @@
+$NetBSD$
+
+BLAKE2s (yasr-0.0.0.144-f60db19350542e6f4b7d268a310b9f2b9f3076c0.tar.gz) = 72d9fca67181fbc0761515cf44ab01e07f97e4f90863d54df2bb614a7cd88a6c
+SHA512 (yasr-0.0.0.144-f60db19350542e6f4b7d268a310b9f2b9f3076c0.tar.gz) = 1a97f4d18586e9e72a01b05b0c6240a7e346b44d920771d662a0cbf9cba26467732d5681f391938d01cf0bd9e269bf0879fd7fcbf48f9678b5eafa30cbecca63
+Size (yasr-0.0.0.144-f60db19350542e6f4b7d268a310b9f2b9f3076c0.tar.gz) = 99434 bytes
+SHA1 (patch-meson.build) = 81c27075691073e33799681441e4662275e62d3a
+SHA1 (patch-yasr_main.c) = b26fcea7e5f62f528cb90cddb6e9af2e9e8cbb3e
+SHA1 (patch-yasr_tts.c) = 67656ad2e02a734deb136c56bf3e2ea79989b005
+SHA1 (patch-yasr_yasr.conf) = 73157a2dec79cb39050a4617af99e59349ca9531
diff --git a/yasr/patches/patch-meson.build b/yasr/patches/patch-meson.build
new file mode 100644
index 0000000000..a0db0ce8d0
--- /dev/null
+++ b/yasr/patches/patch-meson.build
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add test for necessary headers
+
+--- meson.build.orig	2023-04-08 21:22:57.000000000 +0000
++++ meson.build
+@@ -26,7 +26,7 @@ localedir = join_paths(prefix, get_optio
+ conf.set_quoted('LOCALEDIR', localedir)
+ 
+ foreach h : [ 'fcntl.h', 'sys/ioctl.h', 'sys/time.h', 'unistd.h',  'utmpx.h',
+-  'pty.h', 'locale.h']
++  'util.h', 'libutil.h', 'pty.h', 'locale.h']
+   if cc.check_header(h)
+     conf.set('HAVE_@0@'.format(h.underscorify().to_upper()), 1)
+   endif
diff --git a/yasr/patches/patch-yasr_main.c b/yasr/patches/patch-yasr_main.c
new file mode 100644
index 0000000000..d143ee7ac8
--- /dev/null
+++ b/yasr/patches/patch-yasr_main.c
@@ -0,0 +1,137 @@
+$NetBSD$
+
+Remove non-portable use of WCHAR_T in iconv code.
+Remove the enforcing of UTF-8
+Fix a bug speaking a char when cursor-right is input after space
+
+--- yasr/main.c.orig	2023-04-08 21:22:57.000000000 +0000
++++ yasr/main.c
+@@ -33,8 +33,6 @@
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <langinfo.h>
+-#include <iconv.h>
+-iconv_t ih_inp;
+ static int cpid;
+ static int size, wsize;
+ static int master, slave;
+@@ -307,23 +305,10 @@ is_separator (int ch)
+ static int
+ getkey_buf ()
+ {
+-  char *b1, *b2;
+-  size_t s1, s2;
+   wchar_t ch;
+   int key;
+   int result;
+-
+-  s1 = size;
+-  s2 = sizeof (wchar_t);
+-  b1 = (char *) buf;
+-  b2 = (char *) &ch;
+-  iconv (ih_inp, NULL, NULL, NULL, NULL);
+-  result = iconv (ih_inp, &b1, &s1, &b2, &s2);
+-  if (result != -1)
+-  {
+-    if (!s1)
+-      return ch;
+-  }
++ 
+   key = (int) buf[0];
+   if (size > 1)
+   {
+@@ -361,6 +346,7 @@ getinput ()
+     finish (0);
+   }
+   key = getkey_buf ();
++
+   if (key == ui.disable)
+   {
+     if (ui.disabled)
+@@ -561,8 +547,10 @@ static char *bytes_left_start;
+ static void
+ read_buf (int leave)
+ {
+-  char *b1, *b2;
+-  size_t s1, s2;
++  int i;
++  char *b1;
++  wchar_t *b2;
++  size_t s1;
+   if (bytes_left)
+   {
+     memcpy (buf, bytes_left_start, bytes_left);
+@@ -578,17 +566,16 @@ read_buf (int leave)
+   buf[size] = 0;
+   bytes_left = 0;
+   b1 = (char *) buf;
+-  b2 = (char *) (wide_buf + leave);
++  b2 = wide_buf + leave;
+   if (leave)
+-    memcpy (wide_buf, wide_buf + wsize - leave,
++    memcpy (wide_buf
++	    , wide_buf + wsize - leave,
+ 	    sizeof (wchar_t) * (wsize - leave));
+   s1 = size;
+-  s2 = (255 - leave) * sizeof (wchar_t);
+   while (s1 > 0)
+   {
+-
+-    iconv (ih_inp, NULL, NULL, NULL, NULL);
+-    if (iconv (ih_inp, &b1, &s1, &b2, &s2) == (size_t) -1)
++    i = mbtowc (b2, b1, s1);
++    if (i == -1)
+     {
+       if (errno == EINVAL)	/* incomplete sequence at end of buffer */
+       {
+@@ -599,10 +586,13 @@ read_buf (int leave)
+       b1++;
+       s1--;
+     }
++    ++b2;
++    b1 += i;
++    s1 -= i;
+   }
+   bytes_left = s1;
+   bytes_left_start = b1;
+-  wsize = (wchar_t *) b2 - wide_buf;
++  wsize = b2 - wide_buf;
+   wide_buf[wsize] = 0;
+ }
+ 
+@@ -1253,6 +1243,7 @@ getoutput ()
+       tts.oflag = oldoflag;
+     }
+   }
++
+   if (ch == 13 || ch == 10 || ch == 32)
+   {
+     tts_flush ();
+@@ -1268,7 +1259,8 @@ getoutput ()
+   {
+     tts_flush ();
+   }
+-  if (tts.oflag || kbuf[0] == 13 || kbuf[0] == 3 || ui.silent)
++  /* Workaround cursor move right after space... */
++  if ((tts.oflag || kbuf[0] == 13 || kbuf[0] == 3 || ui.silent) && kbuf[0] != 0x1b5b43)
+   {
+     tts.oflag = stathit = 0;
+     oldcr = win->cr;
+@@ -1470,17 +1462,6 @@ main (int argc, char *argv[])
+   bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+   textdomain (GETTEXT_PACKAGE);
+   strcpy (charmap, nl_langinfo (CODESET));
+-  if (!strcmp (charmap, "ANSI_X3.4-1968"))
+-    strcpy (charmap, "UTF-8");
+-
+-  ih_inp = iconv_open ("WCHAR_T", charmap);
+-  if (ih_inp == (iconv_t) - 1)
+-  {
+-    fprintf (stderr, "Codeset %s not supported\n", charmap);
+-    exit (1);
+-  }
+-
+-
+ #endif
+ 
+   if (argv[0][0] == '-')
diff --git a/yasr/patches/patch-yasr_tts.c b/yasr/patches/patch-yasr_tts.c
new file mode 100644
index 0000000000..ad0b3f62b6
--- /dev/null
+++ b/yasr/patches/patch-yasr_tts.c
@@ -0,0 +1,47 @@
+$NetBSD$
+
+Remove non-portable use of WCHAR_T in iconv code.
+Fix comment's alignment.
+
+--- yasr/tts.c.orig	2023-04-08 21:22:57.000000000 +0000
++++ yasr/tts.c
+@@ -674,21 +674,22 @@ tts_saychar (wchar_t ch)
+       tts_printf_ll ("CHAR %c\r\n", ch);
+ #else
+     else if (ch < 0x80)
+-    {
+       tts_printf_ll ("CHAR %c\r\n", ch);
+-    }
+     else
+     {
+-      char buf[8], *cin, *cout;
++      char tmpbuf[MB_CUR_MAX], buf[MB_CUR_MAX], *cin, *cout;
+       size_t l1, l2;
+       iconv_t cd;
+-      cd = iconv_open ("UTF-8", "WCHAR_T");
++      cd = iconv_open ("UTF-8", nl_langinfo (CODESET));
+       if (cd == (iconv_t) - 1)
+ 	return;
+-      l1 = sizeof (wchar_t);
+-      l2 = 7;
+-      cin = (char *) &ch;
++      l1 = wctomb (tmpbuf, ch);
++      if (l1 == -1)
++	return;
++      l2 = sizeof (buf) - 1;
++      cin = tmpbuf;
+       cout = buf;
++      
+       iconv (cd, &cin, &l1, &cout, &l2);
+       iconv_close (cd);
+       *cout = 0;
+@@ -704,7 +705,8 @@ tts_saychar (wchar_t ch)
+     return;
+   }
+   if (!synth[tts.synth].charoff)
+-  {				/* assume on string does everything */
++  {
++    /* assume on string does everything */
+     (void) sprintf (ttsbuf, synth[tts.synth].charon, ch);
+     tts_send (ttsbuf, strlen (ttsbuf));
+     return;
diff --git a/yasr/patches/patch-yasr_yasr.conf b/yasr/patches/patch-yasr_yasr.conf
new file mode 100644
index 0000000000..875bd7386f
--- /dev/null
+++ b/yasr/patches/patch-yasr_yasr.conf
@@ -0,0 +1,23 @@
+$NetBSD$
+
+Replace bash with sh.
+Fix eflite path.
+
+--- yasr/yasr.conf.orig	2024-02-29 21:20:52.966066354 +0000
++++ yasr/yasr.conf
+@@ -59,13 +59,13 @@ cursor tracking=full
+ synthesizer=speech dispatcher
+ #synthesizer port=S0
+ #synthesizer port=l0
+-#synthesizer port=|/usr/local/bin/eflite
++#synthesizer port=|/usr/pkg/bin/eflite
+ # Below line communicates with speech-dispatcher via TCP if yasr was not
+ # built with libspeechd support. Note that speech-dispatcher no longer
+ # enables TCP by default.
+ #synthesizer port=127.0.0.1:6560
+ key echo=off
+-shell=/bin/bash
++shell=/bin/sh
+ special=off
+ up and down arrows=speak line
+ DisableKey=6925


Home | Main Index | Thread Index | Old Index