package/libgpiod2: new package

Due to a significant api change as well as more recent kernel version
requirements, we introduce a separate package for version 2.0 and higher.
The new package is incompatible to libgpiod 1.x. This allows for iteratively
updating all dependent packages without breaking anything as a result.

For now we will have libgpiod2 depend on !libgpiod. However, in the
future, it might be preferable to have it the other way around,
such that packages, which select libgpiod2 don't have to also add the
the !libgpiod dependency.

Python bindings fail to build, so they are unconditionally disabled.
setup.py when called from Makefile tries to do native compilation
instead of cross-compilation, which fails at link time with
/usr/bin/ld: skipping incompatible ../../lib/.libs//libgpiod.so when searching for -lgpiod

Note that this package does not correspond to the debian libgpiod2 package,
which currently uses only version 1.6.3

Signed-off-by: Boerge Struempfel <bstruempfel@ultratronik.de>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Boerge Struempfel 2024-01-23 16:58:24 +01:00 committed by Arnout Vandecappelle
parent 087115b96a
commit 57391fad2e
5 changed files with 71 additions and 0 deletions

View File

@ -531,6 +531,9 @@ N: Bilal Wasim <bilalwasim676@gmail.com>
F: board/chromebook/elm/
F: configs/chromebook_elm_defconfig
N: Boerge Struempfel <boerge.struempfel@gmail.com>
F: package/libgpiod2/
N: Bogdan Radulescu <bogdan@nimblex.net>
F: package/iftop/
F: package/ncdu/

View File

@ -1751,6 +1751,7 @@ menu "Hardware handling"
source "package/libftdi1/Config.in"
source "package/libgphoto2/Config.in"
source "package/libgpiod/Config.in"
source "package/libgpiod2/Config.in"
source "package/libgudev/Config.in"
source "package/libhid/Config.in"
source "package/libiio/Config.in"

View File

@ -0,0 +1,30 @@
config BR2_PACKAGE_LIBGPIOD2
bool "libgpiod2"
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_10
depends on !BR2_PACKAGE_LIBGPIOD
help
This is a C library that abstracts the GPIO character
device operations on linux.
This package is the continuation of the libgpiod package
for versions 2.0 and above.
Note that a kernel of 5.10 or above is required for the
ioctls to work.
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
if BR2_PACKAGE_LIBGPIOD2
config BR2_PACKAGE_LIBGPIOD2_TOOLS
bool "install tools"
help
Include a set of command-line tools for managing GPIOs.
endif
comment "libgpiod2 needs kernel headers >= 5.10"
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_10
comment "libgpiod2 is incompatible with libgpiod"
depends on BR2_PACKAGE_LIBGPIOD

View File

@ -0,0 +1,4 @@
# From https://www.kernel.org/pub/software/libs/libgpiod/sha256sums.asc
sha256 fa4024a080121c958502f9a46a5bda44bea85e7a4dd7fcb3dead463b6fc4261c libgpiod-2.1.tar.xz
# Hash for license file
sha256 eb17a56966db5d986bec449ee44ed61f01f9e3fafa952e527db67a8f9594fd11 COPYING

View File

@ -0,0 +1,33 @@
################################################################################
#
# libgpiod2
#
################################################################################
# Be careful when bumping versions.
# Dependency on kernel header versions may change.
LIBGPIOD2_VERSION = 2.1
LIBGPIOD2_SOURCE = libgpiod-$(LIBGPIOD2_VERSION).tar.xz
LIBGPIOD2_SITE = https://www.kernel.org/pub/software/libs/libgpiod
LIBGPIOD2_LICENSE = LGPL-2.1+
LIBGPIOD2_LICENSE_FILES = COPYING
LIBGPIOD2_INSTALL_STAGING = YES
LIBGPIOD2_DEPENDENCIES = host-pkgconf host-autoconf-archive
LIBGPIOD2_CONF_OPTS = \
--disable-bindings-python \
--disable-examples \
--disable-tests
ifeq ($(BR2_PACKAGE_LIBGPIOD2_TOOLS),y)
LIBGPIOD2_CONF_OPTS += --enable-tools
else
LIBGPIOD2_CONF_OPTS += --disable-tools
endif
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
LIBGPIOD2_CONF_OPTS += --enable-bindings-cxx
else
LIBGPIOD2_CONF_OPTS += --disable-bindings-cxx
endif
$(eval $(autotools-package))