commit:     81a72b436df07cca118495976262e92792b12d7c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 10 05:41:11 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 10 05:44:30 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81a72b43

app-accessibility/brltty: add 6.6

Closes: https://bugs.gentoo.org/905695
Closes: https://bugs.gentoo.org/911229
Closes: https://bugs.gentoo.org/913019
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-accessibility/brltty/Manifest                  |   1 +
 app-accessibility/brltty/brltty-6.6.ebuild         | 224 +++++++++++++++++++++
 .../brltty/files/brltty-6.6-cython3.patch          |  41 ++++
 3 files changed, 266 insertions(+)

diff --git a/app-accessibility/brltty/Manifest 
b/app-accessibility/brltty/Manifest
index aa6a15780e20..1ce7c10b2556 100644
--- a/app-accessibility/brltty/Manifest
+++ b/app-accessibility/brltty/Manifest
@@ -1 +1,2 @@
 DIST brltty-6.5.tar.xz 3631628 BLAKE2B 
b2e5f82f15dff9a99bf3d75523f6ec48d531d413d860079af0023b9efdc07a93563226c6388cc89ce025f8d13b1635e883680f0ddb8a688ffcc4cd9c335d7aee
 SHA512 
bbfbb89b1c3ba5063ad3bc0aa97b859dd23acea1feb79dab20c57dc74ff2f26649942fcecc7030a3f70555596f4d9d35cd05616af2a8e101d4d56b4c471a6ad3
+DIST brltty-6.6.tar.xz 3684592 BLAKE2B 
c1ae05b925384f3869d3c90ccc06197da2a592691830504ff01a530da87319d463e25cd7b387805c199562be815ca4e79f3679f592f3a1107025e3aba17ec159
 SHA512 
852bfd9179570be7b0da8b1279f84bdfedc14a319988d9c2eac5a20a9ce8977f31fdee167e8e96bb411184a1d72f4cdc633944c7b3f55bddae411fc71a9e6898

diff --git a/app-accessibility/brltty/brltty-6.6.ebuild 
b/app-accessibility/brltty/brltty-6.6.ebuild
new file mode 100644
index 000000000000..c01143a96851
--- /dev/null
+++ b/app-accessibility/brltty/brltty-6.6.ebuild
@@ -0,0 +1,224 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+FINDLIB_USE="ocaml"
+JAVA_PKG_WANT_SOURCE="1.8"
+JAVA_PKG_WANT_TARGET="1.8"
+
+inherit findlib toolchain-funcs java-pkg-opt-2 autotools python-r1 tmpfiles
+
+DESCRIPTION="Daemon that provides access to the Linux/Unix console for a blind 
person"
+HOMEPAGE="https://brltty.app/";
+SRC_URI="https://brltty.app/archive/${P}.tar.xz";
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+IUSE="+api +beeper bluetooth doc +fm gpm iconv icu
+               java louis +midi ncurses nls ocaml +pcm policykit python
+               usb systemd +speech tcl xml X"
+REQUIRED_USE="doc? ( api )
+       java? ( api )
+       ocaml? ( api )
+       python? ( api ${PYTHON_REQUIRED_USE} )
+       tcl? ( api )"
+
+DEPEND="
+       acct-group/brltty
+       acct-user/brltty
+       dev-libs/libpcre2[pcre32]
+       bluetooth? (
+               sys-apps/dbus
+               net-wireless/bluez
+       )
+       gpm? ( >=sys-libs/gpm-1.20 )
+       iconv? ( virtual/libiconv )
+       icu? ( dev-libs/icu:= )
+       louis? ( dev-libs/liblouis:= )
+       midi? ( media-libs/alsa-lib )
+       ncurses? ( sys-libs/ncurses:0= )
+       pcm? ( media-libs/alsa-lib )
+       policykit? ( sys-auth/polkit )
+       python? ( ${PYTHON_DEPS} )
+       speech? (
+               app-accessibility/espeak-ng
+               app-accessibility/flite
+               app-accessibility/speech-dispatcher
+       )
+       systemd? ( sys-apps/systemd )
+       tcl? ( >=dev-lang/tcl-8.6.13-r1:= )
+       usb? ( virtual/libusb:1 )
+       xml? ( dev-libs/expat )
+       X? (
+               app-accessibility/at-spi2-core:2
+               sys-apps/dbus
+               x11-libs/libX11
+               x11-libs/libXaw
+               x11-libs/libXfixes
+               x11-libs/libXt
+               x11-libs/libXtst
+       )"
+RDEPEND="${DEPEND}
+       java? ( >=virtual/jre-1.8:* )
+"
+BDEPEND="
+       virtual/pkgconfig
+       java? ( >=virtual/jdk-1.8:* )
+       nls? ( virtual/libintl )
+       python? ( dev-python/cython[${PYTHON_USEDEP}] )
+"
+
+HTML_DOCS=( "${S}"/Documents/Manual-BrlAPI/. )
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-6.4-respect-AR.patch
+       "${FILESDIR}"/${P}-cython3.patch
+)
+
+src_prepare() {
+       default
+
+       java-pkg-opt-2_src_prepare
+
+       # We run eautoconf instead of using eautoreconf because brltty uses
+       # a custom build system that uses autoconf without the rest of the
+       # autotools.
+       eautoconf
+       use python && python_copy_sources
+}
+
+src_configure() {
+       tc-export AR LD PKG_CONFIG
+
+       export JAVAC=""
+       export JAVA_JNI_FLAGS=""
+       if use java; then
+               export JAVA_HOME="$(java-config -g JAVA_HOME)"
+               export JAVAC_HOME="${JAVA_HOME}/bin"
+               export JAVA_JNI_FLAGS="$(java-pkg_get-jni-cflags)"
+               export JAVAC="$(java-pkg_get-javac) -encoding UTF-8 
$(java-pkg_javac-args)"
+       fi
+
+       # Override bindir for backward compatibility.
+       # Also override localstatedir so that the lib/brltty directory is 
installed
+       # correctly.
+       # Disable stripping since we do that ourselves.
+       local myconf=(
+               --bindir="${EPREFIX}"/bin
+               --htmldir="${EPREFIX}"/usr/share/doc/"${P}"/html
+               --localstatedir="${EPREFIX}"/var
+               --runstatedir="${EPREFIX}"/run
+               # the next two lines should be removed once support is added.
+               --disable-emacs-bindings
+               --disable-lua-bindings
+               # Python bindings are built separately per-impl
+               --disable-python-bindings
+               --disable-stripping
+               --with-updatable-directory="${EPREFIX}"/var/lib/brltty
+               --with-writable-directory="${EPREFIX}"/run/brltty
+               --with-privilege-parameters=lx:user=brltty
+               $(use_enable api)
+               $(use_with beeper beep-package)
+#              $(use_enable emacs emacs-bindings)
+               $(use_with fm fm-package)
+               $(use_enable gpm)
+               $(use_enable iconv)
+               $(use_enable icu)
+               $(use_enable java java-bindings)
+               $(use_enable louis liblouis)
+#              $(use_enable lua lua-bindings)
+               $(use_with midi midi-package)
+               $(use_enable nls i18n)
+               $(use_enable ocaml ocaml-bindings)
+               $(use_with pcm pcm-package)
+               $(use_enable policykit polkit)
+               $(use_enable python python-bindings)
+               $(use_enable speech speech-support)
+               $(use_with systemd service-package)
+               $(use_enable tcl tcl-bindings)
+               $(use_enable xml expat)
+               $(use_enable X x)
+               $(use_with bluetooth bluetooth-package)
+               $(use_with ncurses curses)
+               $(use_with usb usb-package)
+       )
+       # disable espeak since we use espeak-ng
+       use speech && myconf+=( --with-speech-driver=-es )
+
+       econf "${myconf[@]}"
+
+       if use python; then
+               python_configure() {
+                       econf "${myconf[@]}" --enable-python-bindings 
PYTHON="${PYTHON}"
+               }
+               python_foreach_impl run_in_build_dir python_configure
+       fi
+}
+
+src_compile() {
+       emake -j1 JAVA_JNI_FLAGS="${JAVA_JNI_FLAGS}" JAVAC="${JAVAC}"
+
+       if use python; then
+               python_build() {
+                       emake -C "${BUILD_DIR}"/Bindings/Python -j1
+               }
+               python_foreach_impl run_in_build_dir python_build
+       fi
+}
+
+src_install() {
+       if use ocaml; then
+               findlib_src_preinst
+       fi
+
+       emake -j1 INSTALL_ROOT="${D}" OCAML_LDCONF= install
+
+       if use python; then
+               python_install() {
+                       emake -C "${BUILD_DIR}"/Bindings/Python -j1 
INSTALL_ROOT="${D}" install
+               }
+               python_foreach_impl run_in_build_dir python_install
+       fi
+
+       if use java; then
+               java-pkg_doso Bindings/Java/libbrlapi_java.so
+               java-pkg_dojar Bindings/Java/brlapi.jar
+       fi
+
+       insinto /etc
+       doins Documents/brltty.conf
+       newinitd "${FILESDIR}"/brltty.initd brltty
+       pushd Autostart/Systemd 1> /dev/null || die
+       emake -j1 INSTALL_ROOT="${ED}" install
+       popd || die
+       pushd Autostart/Udev 1> /dev/null || die
+       emake -j1 INSTALL_ROOT="${ED}" install
+       popd || die
+
+       dodoc Documents/{CONTRIBUTORS,ChangeLog,HISTORY,README*,TODO}
+       if use doc; then
+               HTML_DOCS="doc/Manual-BRLTTY" einstalldocs
+       fi
+
+       keepdir /var/lib/BrlAPI
+       rm -fr "${ED}/run" || die
+       find "${ED}" -name '*.a' -delete || die
+}
+
+pkg_postinst() {
+       tmpfiles_process ${PN}.conf
+
+       elog "please be sure ${EROOT}/etc/brltty.conf is correct for your 
system."
+       elog
+       elog "To make brltty start on boot on an OpenRC system, type this 
command:"
+       elog "# rc-update add brltty boot"
+       elog
+       elog "If you are using systemd, type this command:"
+       elog "# systemctl daemon-reload"
+       elog
+       elog "Please reload udev by typing:"
+       elog "# udevadm control --reload"
+}

diff --git a/app-accessibility/brltty/files/brltty-6.6-cython3.patch 
b/app-accessibility/brltty/files/brltty-6.6-cython3.patch
new file mode 100644
index 000000000000..01a860a4d646
--- /dev/null
+++ b/app-accessibility/brltty/files/brltty-6.6-cython3.patch
@@ -0,0 +1,41 @@
+https://bugs.gentoo.org/913019
+https://github.com/brltty/brltty/commit/e6707d5e094dc36db4319ce4d052a6ad568a5d26
+
+From e6707d5e094dc36db4319ce4d052a6ad568a5d26 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <[email protected]>
+Date: Tue, 15 Aug 2023 16:29:13 +0200
+Subject: [PATCH] brlapi: Fix python crash on connection error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From Lukáš Tyrychtr:
+“
+Cython 3.0 started using the new Python object finalization APIs from PEP 442
+”
+
+This means that __del__ gets called even when raising an exception from
+__init__, while it was not before. To cope with both behaviors, we can
+set self.h to NULL to determine whether it still exists or not.
+
+Thanks Lukáš Tyrychtr for the investigation and patch draft!
+--- a/Bindings/Python/brlapi.pyx
++++ b/Bindings/Python/brlapi.pyx
+@@ -453,6 +453,7 @@ cdef class Connection:
+               c_brlapi.brlapi_protocolExceptionInit(self.h)
+               if self.fd == -1:
+                       c_brlapi.free(self.h)
++                      self.h = NULL
+                       raise ConnectionError(self.settings.host, 
self.settings.auth)
+ 
+       def closeConnection(self):
+@@ -465,7 +466,8 @@ cdef class Connection:
+               """Release resources used by the connection"""
+               if self.fd != -1:
+                       c_brlapi.brlapi__closeConnection(self.h)
+-              c_brlapi.free(self.h)
++              if self.h != NULL:
++                      c_brlapi.free(self.h)
+ 
+       property host:
+               """To get authorized to connect, libbrlapi has to tell the 
BrlAPI server a secret key, for security reasons. This is the path to the file 
which holds it; it will hence have to be readable by the application."""

Reply via email to