From bf6e76c2c8eaf12a538b22bc96d8073aafd74019 Mon Sep 17 00:00:00 2001 From: HungerHa <110848676+HungerHa@users.noreply.github.com> Date: Thu, 9 Jan 2025 09:09:56 +0100 Subject: [PATCH 1/4] libgpiod: build python bindings --- .../addons/addon-depends/libgpiod/package.mk | 16 ++++++++++++++-- .../patches/libgpiod_setuptools-errors.patch | 11 +++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 packages/addons/addon-depends/libgpiod/patches/libgpiod_setuptools-errors.patch diff --git a/packages/addons/addon-depends/libgpiod/package.mk b/packages/addons/addon-depends/libgpiod/package.mk index 781b8420bb8..ed70b4fe03c 100644 --- a/packages/addons/addon-depends/libgpiod/package.mk +++ b/packages/addons/addon-depends/libgpiod/package.mk @@ -7,9 +7,21 @@ PKG_SHA256="ae35329db7027c740e90c883baf27c26311f0614e6a7b115771b28188b992aec" PKG_LICENSE="GPLv2+" PKG_SITE="https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/" PKG_URL="https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain" +PKG_DEPENDS_TARGET="toolchain Python3 distutilscross:host" PKG_LONGDESC="Tools for interacting with the linux GPIO character device." PKG_TOOLCHAIN="autotools" -PKG_BUILD_FLAGS="+pic" +PKG_BUILD_FLAGS="+pic -sysroot" PKG_CONFIGURE_OPTS_TARGET="--enable-tools --disable-shared" + +post_make_target() { + ( + export PYTHONXCPREFIX="${SYSROOT_PREFIX}/usr" + export LDFLAGS+=" -L${PKG_BUILD}/.${TARGET_NAME}/lib/.libs" + export LDSHARED="${CC} -shared" + export CFLAGS+=" -fcommon -I${PKG_BUILD}/include" + export CPPFLAGS="${TARGET_CPPFLAGS} -I${SYSROOT_PREFIX}/usr/include/${PKG_PYTHON_VERSION}" + cd ../bindings/python + python3 setup.py build + ) +} diff --git a/packages/addons/addon-depends/libgpiod/patches/libgpiod_setuptools-errors.patch b/packages/addons/addon-depends/libgpiod/patches/libgpiod_setuptools-errors.patch new file mode 100644 index 00000000000..ce1f0683c80 --- /dev/null +++ b/packages/addons/addon-depends/libgpiod/patches/libgpiod_setuptools-errors.patch @@ -0,0 +1,11 @@ +--- a/bindings/python/setup.py 2024-11-12 14:29:25.000000000 +0100 ++++ b/bindings/python/setup.py 2025-01-05 17:00:00.000000000 +0100 +@@ -8,7 +8,7 @@ + from setuptools.command.build_ext import build_ext as orig_build_ext + from setuptools.command.sdist import log + from setuptools.command.sdist import sdist as orig_sdist +-from setuptools.errors import BaseError ++from distutils.errors import DistutilsError as BaseError + + LINK_SYSTEM_LIBGPIOD = getenv("LINK_SYSTEM_LIBGPIOD") == "1" + LIBGPIOD_MINIMUM_VERSION = "2.1" From fdb54d52acacbe42cd1def1b8ec15217511c7956 Mon Sep 17 00:00:00 2001 From: HungerHa <110848676+HungerHa@users.noreply.github.com> Date: Thu, 9 Jan 2025 09:10:46 +0100 Subject: [PATCH 2/4] system-tools: add libgpiod python bindings --- packages/addons/tools/system-tools/package.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/addons/tools/system-tools/package.mk b/packages/addons/tools/system-tools/package.mk index 2f9c2206c91..29bafdb53c0 100644 --- a/packages/addons/tools/system-tools/package.mk +++ b/packages/addons/tools/system-tools/package.mk @@ -3,7 +3,7 @@ PKG_NAME="system-tools" PKG_VERSION="1.0" -PKG_REV="6" +PKG_REV="7" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://libreelec.tv" @@ -137,6 +137,7 @@ addon() { # libgpiod cp -P $(get_install_dir libgpiod)/usr/bin/{gpiodetect,gpioget,gpioinfo,gpiomon,gpioset} ${ADDON_BUILD}/${PKG_ADDON_ID}/bin + cp -PR $(get_build_dir libgpiod)/bindings/python/build/lib.linux*/* ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/ # lm_sensors cp -P $(get_install_dir lm_sensors)/usr/bin/sensors ${ADDON_BUILD}/${PKG_ADDON_ID}/bin 2>/dev/null || : From 99c73bebc84f7c73d39ca833b5a9805ba9594f81 Mon Sep 17 00:00:00 2001 From: HungerHa <110848676+HungerHa@users.noreply.github.com> Date: Thu, 9 Jan 2025 09:12:17 +0100 Subject: [PATCH 3/4] rpi-tools: drop gpiod package --- packages/addons/tools/rpi-tools/package.mk | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/addons/tools/rpi-tools/package.mk b/packages/addons/tools/rpi-tools/package.mk index 64eea5dd7cc..09d62334027 100644 --- a/packages/addons/tools/rpi-tools/package.mk +++ b/packages/addons/tools/rpi-tools/package.mk @@ -3,15 +3,15 @@ PKG_NAME="rpi-tools" PKG_VERSION="1.0" -PKG_REV="1" +PKG_REV="2" PKG_ARCH="arm aarch64" PKG_LICENSE="GPL" PKG_SITE="https://libreelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain lg-gpio gpiod gpiozero colorzero lan951x-led-ctl" +PKG_DEPENDS_TARGET="toolchain lg-gpio gpiozero colorzero lan951x-led-ctl" PKG_SECTION="virtual" PKG_SHORTDESC="A bundle of tools and programs for use on the Raspberry Pi" -PKG_LONGDESC="This bundle currently includes lg-gpio, gpiod, gpiozero and lan951x-led-ctl" +PKG_LONGDESC="This bundle currently includes lg-gpio, gpiozero and lan951x-led-ctl" PKG_DISCAIMER="Raspberry Pi is a trademark of the Raspberry Pi Foundation http://www.raspberrypi.org" PKG_IS_ADDON="yes" @@ -25,8 +25,6 @@ addon() { cp -PR $(get_build_dir lg-gpio)/liblgpio.so* ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/ cp -PR $(get_build_dir lg-gpio)/PY_LGPIO/build/lib.linux*/* ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/ patchelf --add-rpath '$ORIGIN' ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/_lgpio*.so - cp -PR $(get_build_dir gpiod)/build/lib.linux*/* ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/ - patchelf --add-rpath '$ORIGIN' ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/gpiod/_ext*.so cp -PR $(get_build_dir gpiozero)/gpiozero ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/ cp -PR $(get_build_dir colorzero)/colorzero ${ADDON_BUILD}/${PKG_ADDON_ID}/lib/ From 7df85cf2fc62a41823b1e5a9834547d25894fc23 Mon Sep 17 00:00:00 2001 From: HungerHa <110848676+HungerHa@users.noreply.github.com> Date: Thu, 9 Jan 2025 09:14:40 +0100 Subject: [PATCH 4/4] gpiod: drop package --- .../rpi-tools-depends/gpiod/package.mk | 24 ------------------- .../patches/gpiod-2.2.2-setuptools.patch | 11 --------- 2 files changed, 35 deletions(-) delete mode 100644 packages/addons/addon-depends/rpi-tools-depends/gpiod/package.mk delete mode 100644 packages/addons/addon-depends/rpi-tools-depends/gpiod/patches/gpiod-2.2.2-setuptools.patch diff --git a/packages/addons/addon-depends/rpi-tools-depends/gpiod/package.mk b/packages/addons/addon-depends/rpi-tools-depends/gpiod/package.mk deleted file mode 100644 index 8e136f932e8..00000000000 --- a/packages/addons/addon-depends/rpi-tools-depends/gpiod/package.mk +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2024-present Team LibreELEC (https://libreelec.tv) - -PKG_NAME="gpiod" -PKG_VERSION="2.2.2" -PKG_SHA256="aa4571f64e1070d38e4c14c491f69637ee73e23c801d3a418dde4d5410e5d53f" -PKG_ARCH="arm aarch64" -PKG_LICENSE="LGPLv2.1" -PKG_SITE="https://pypi.org/project/gpiod/" -PKG_URL="https://files.pythonhosted.org/packages/source/g/gpiod/gpiod-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python3 distutilscross:host" -PKG_LONGDESC="These are the official Python bindings for libgpiod." -PKG_TOOLCHAIN="manual" - -pre_configure_target() { - export PYTHONXCPREFIX="${SYSROOT_PREFIX}/usr" - export LDSHARED="${CC} -shared" - export CFLAGS="${CFLAGS} -fcommon" - export CPPFLAGS="${TARGET_CPPFLAGS} -I${SYSROOT_PREFIX}/usr/include/${PKG_PYTHON_VERSION}" -} - -make_target() { - python3 setup.py build -} diff --git a/packages/addons/addon-depends/rpi-tools-depends/gpiod/patches/gpiod-2.2.2-setuptools.patch b/packages/addons/addon-depends/rpi-tools-depends/gpiod/patches/gpiod-2.2.2-setuptools.patch deleted file mode 100644 index 045e7480146..00000000000 --- a/packages/addons/addon-depends/rpi-tools-depends/gpiod/patches/gpiod-2.2.2-setuptools.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gpiod/setup.py.org 2024-11-12 14:29:25.000000000 +0100 -+++ gpiod/setup.py 2024-12-09 20:44:57.736065397 +0100 -@@ -8,7 +8,7 @@ - from setuptools.command.build_ext import build_ext as orig_build_ext - from setuptools.command.sdist import log - from setuptools.command.sdist import sdist as orig_sdist --from setuptools.errors import BaseError -+#from setuptools.errors import BaseError - - LINK_SYSTEM_LIBGPIOD = getenv("LINK_SYSTEM_LIBGPIOD") == "1" - LIBGPIOD_MINIMUM_VERSION = "2.1"