diff mbox series

[meta-oe] libgpiod: fix python bindings build

Message ID 20230125081731.6157-1-brgl@bgdev.pl
State Under Review
Headers show
Series [meta-oe] libgpiod: fix python bindings build | expand

Commit Message

Bartosz Golaszewski Jan. 25, 2023, 8:17 a.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

It seems that automake's AM_PATH_PYTHON() macro no longer sets the
$PYTHON variable. This means the python bindings build for libgpiod has
been broken for some time. As we know which version we're using -
python3 - let's hardcode it in configure.ac. For now add a patch that's
been merged upstream and once a new bugfix release is out, we'll remove
it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 ...-don-t-expect-automake-to-set-PYTHON.patch | 37 +++++++++++++++++++
 .../libgpiod/libgpiod_1.6.3.bb                |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch

Comments

Ferry Toth Feb. 9, 2023, 9:09 p.m. UTC | #1
Op 25-01-2023 om 09:17 schreef Bartosz Golaszewski:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> It seems that automake's AM_PATH_PYTHON() macro no longer sets the
> $PYTHON variable. This means the python bindings build for libgpiod has
> been broken for some time. As we know which version we're using -

I have in my conf file:
# Build python bindings for libgpiod
PACKAGECONFIG:append:pn-libgpiod = " python3"

and it work ok on Kirkstone which builds automake-native 1.16.5.
Which version is causing you trouble?

> python3 - let's hardcode it in configure.ac. For now add a patch that's
> been merged upstream and once a new bugfix release is out, we'll remove
> it.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>   ...-don-t-expect-automake-to-set-PYTHON.patch | 37 +++++++++++++++++++
>   .../libgpiod/libgpiod_1.6.3.bb                |  1 +
>   2 files changed, 38 insertions(+)
>   create mode 100644 meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch
> 
> diff --git a/meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch b/meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch
> new file mode 100644
> index 000000000..a3dc38188
> --- /dev/null
> +++ b/meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch
> @@ -0,0 +1,37 @@
> +From 3c461786feb1d5aa1ed2a911942a5f9fbc8b8086 Mon Sep 17 00:00:00 2001
> +From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> +Date: Tue, 24 Jan 2023 17:38:43 +0100
> +Subject: [libgpiod v1.6.x][PATCH] build: don't expect automake to set $PYTHON
> +
> +It seems that the implementation of AM_PATH_PYTHON() changed in automake
> +recently and no longer sets $PYTHON variable which breaks the build on
> +some systems.
> +
> +We know we use python3 so use python3-config explicitly.
> +
> +Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> +---
> +Upstream-Status: Accepted
> +
> + configure.ac | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 3149384..0460810 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -204,9 +204,9 @@ then
> + 		AC_MSG_ERROR([python3-config not found - needed for python bindings])
> + 	fi
> + 	AS_IF([test -z "$PYTHON_CPPFLAGS"],
> +-		[AC_SUBST(PYTHON_CPPFLAGS, [`$PYTHON-config --includes`])])
> ++		[AC_SUBST(PYTHON_CPPFLAGS, [`python3-config --includes`])])
> + 	AS_IF([test -z "$PYTHON_LIBS"],
> +-		[AC_SUBST(PYTHON_LIBS, [`$PYTHON-config --libs`])])
> ++		[AC_SUBST(PYTHON_LIBS, [`python3-config --libs`])])
> + fi
> +
> + AC_CHECK_PROG([has_doxygen], [doxygen], [true], [false])
> +--
> +2.37.2
> +
> diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
> index 3e6e5d567..5164e7e02 100644
> --- a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
> +++ b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
> @@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
>   SRC_URI = " \
>       https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \
>       file://run-ptest \
> +    file://0001-build-don-t-expect-automake-to-set-PYTHON.patch \
>   "
>   
>   SRC_URI[md5sum] = "28e79f6f70fee1da9079558d8b7b3736"
> 
> 
> 
> 
>
Bartosz Golaszewski Feb. 9, 2023, 9:30 p.m. UTC | #2
On Thu, Feb 9, 2023 at 10:09 PM Ferry Toth <fntoth@gmail.com> wrote:
>
> Op 25-01-2023 om 09:17 schreef Bartosz Golaszewski:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > It seems that automake's AM_PATH_PYTHON() macro no longer sets the
> > $PYTHON variable. This means the python bindings build for libgpiod has
> > been broken for some time. As we know which version we're using -
>
> I have in my conf file:
> # Build python bindings for libgpiod
> PACKAGECONFIG:append:pn-libgpiod = " python3"
>
> and it work ok on Kirkstone which builds automake-native 1.16.5.
> Which version is causing you trouble?

It builds on kirkstone but doesn't build on master (not sure which
subsequent branch first failed) without that change. I can see the
automake version didn't change but for libgpiod v2 we moved away from
automake python support in favor of setup.py so I don't want to spend
too much time on it unnecessarily. I just noticed that
AM_PATH_PYTHON() no longer sets the PYTHON variable for some reason.
AFAIK python support in autotools is quite wonky anyway so good
riddance for libgpiod v2.

Bart
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch b/meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch
new file mode 100644
index 000000000..a3dc38188
--- /dev/null
+++ b/meta-oe/recipes-support/libgpiod/files/0001-build-don-t-expect-automake-to-set-PYTHON.patch
@@ -0,0 +1,37 @@ 
+From 3c461786feb1d5aa1ed2a911942a5f9fbc8b8086 Mon Sep 17 00:00:00 2001
+From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+Date: Tue, 24 Jan 2023 17:38:43 +0100
+Subject: [libgpiod v1.6.x][PATCH] build: don't expect automake to set $PYTHON
+
+It seems that the implementation of AM_PATH_PYTHON() changed in automake
+recently and no longer sets $PYTHON variable which breaks the build on
+some systems.
+
+We know we use python3 so use python3-config explicitly.
+
+Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+---
+Upstream-Status: Accepted
+
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 3149384..0460810 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -204,9 +204,9 @@ then
+ 		AC_MSG_ERROR([python3-config not found - needed for python bindings])
+ 	fi
+ 	AS_IF([test -z "$PYTHON_CPPFLAGS"],
+-		[AC_SUBST(PYTHON_CPPFLAGS, [`$PYTHON-config --includes`])])
++		[AC_SUBST(PYTHON_CPPFLAGS, [`python3-config --includes`])])
+ 	AS_IF([test -z "$PYTHON_LIBS"],
+-		[AC_SUBST(PYTHON_LIBS, [`$PYTHON-config --libs`])])
++		[AC_SUBST(PYTHON_LIBS, [`python3-config --libs`])])
+ fi
+ 
+ AC_CHECK_PROG([has_doxygen], [doxygen], [true], [false])
+-- 
+2.37.2
+
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
index 3e6e5d567..5164e7e02 100644
--- a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
+++ b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
@@ -7,6 +7,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
 SRC_URI = " \
     https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \
     file://run-ptest \
+    file://0001-build-don-t-expect-automake-to-set-PYTHON.patch \
 "
 
 SRC_URI[md5sum] = "28e79f6f70fee1da9079558d8b7b3736"