From 083adf038a0c365fdd6b0acd1a2b6e460bb9658b Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sat, 16 Nov 2024 09:27:06 -0500 Subject: [PATCH] brltty: rebuild for python3-3.13 --- srcpkgs/brltty/patches/python3-bindings.patch | 28 ++++++++++++++++++ srcpkgs/brltty/template | 29 +++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/brltty/patches/python3-bindings.patch diff --git a/srcpkgs/brltty/patches/python3-bindings.patch b/srcpkgs/brltty/patches/python3-bindings.patch new file mode 100644 index 00000000000..ef977ee8e25 --- /dev/null +++ b/srcpkgs/brltty/patches/python3-bindings.patch @@ -0,0 +1,28 @@ +Python bindings will be built directly in the xbps-src template. + +--- a/Bindings/Python/Makefile.in ++++ b/Bindings/Python/Makefile.in +@@ -45,10 +45,7 @@ + all: $(PYTHON_API) + + $(PYTHON_API): brlapi.auto.c $(API_HDRS) brlapi +- set -- $(V_setup) build --build-temp .; \ +- [ "@host_os@" != "mingw32" ] || set -- "$${@}" --compiler mingw32; \ +- "$(PYTHON)" ./setup.py "$${@}" +- [ "@host_os@" != "mingw32" ] || "$(PYTHON)" ./setup.py $(V_setup) bdist_wininst --skip-build ++ echo "To be built directly..." + + brlapi.auto.c: $(SRC_DIR)/brlapi.pyx $(SRC_DIR)/c_brlapi.pxd constants.auto.pyx + "$(CYTHON)" -$(PYTHON_VERSION) -I. -o $@ $(SRC_DIR)/brlapi.pyx +@@ -62,10 +59,7 @@ + INSTALLED_FILES = installed-files + + install: all +- set -- $(V_setup) install --skip-build --record "$(INSTALLED_FILES)"; \ +- [ -z "$(PYTHON_DESTDIR)" ] || set -- "$${@}" --root "$(PYTHON_DESTDIR)"; \ +- [ -z "$(PYTHON_PREFIX)" ] || set -- "$${@}" --prefix "$(PYTHON_PREFIX)"; \ +- "$(PYTHON)" ./setup.py "$${@}" ++ echo "To be installed directly..." + + uninstall: + [ ! -f "$(INSTALLED_FILES)" ] || rm -f -- `$(AWK) '{printf "%s%s ", "$(PYTHON_DESTDIR)", $$0}' "$(INSTALLED_FILES)"` diff --git a/srcpkgs/brltty/template b/srcpkgs/brltty/template index c92b681ea57..c29190d18a0 100644 --- a/srcpkgs/brltty/template +++ b/srcpkgs/brltty/template @@ -1,9 +1,8 @@ # Template file for 'brltty' pkgname=brltty version=6.4 -revision=11 +revision=12 build_style=gnu-configure -build_helper=python3 configure_args="--enable-gpm --with-screen-driver=lx,sc --with-tables-directory=/usr/share/brltty PYTHON=/usr/bin/python3" hostmakedepends="pkg-config python3-Cython" @@ -29,6 +28,7 @@ pre_configure() { *-musl) # There is no ldconfig in musl libc sed -e "s;/sbin/ldconfig -n;echo;" -i configure ;; esac + export PYTHON_LIBS="-L${XBPS_CROSS_BASE}/usr/lib -lpython${py3_ver}${py3_abiver}" export PYTHON_CPPFLAGS="-I${XBPS_CROSS_BASE}/${py3_inc}" } @@ -40,8 +40,31 @@ post_configure() { esac } +post_build() { + # brltty has two problems with the xbps-src cross environment: + # + # - brltty has a lock.h that will be overshadowed by Python's lock.h + # when the build helper overrides CFLAGS to prefer the cross root + # + # - The brltty build process drops critical environment variables for + # cross compilation of Python exctensions + # + # To work around this, just manually build the Python package. + + cd Bindings/Python + . "${XBPS_BUILDHELPERDIR}/python3.sh" + python3 setup.py build --build-temp . +} + do_install() { - make INSTALL_ROOT=${DESTDIR} install + make INSTALL_ROOT="${DESTDIR}" install + + local _inst_args=( + --skip-build --record=installed-files --root="${DESTDIR}" --prefix=/usr + ) + + ( cd Bindings/Python && python3 ./setup.py install "${_inst_args[@]}" ) + vsv brltty vsconf Documents/brltty.conf vdoc Documents/ChangeLog