xref: /OK3568_Linux_fs/buildroot/package/lirc-tools/0001-Fix-build-without-Python.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 71f329d997d949d3c12d62d2f1473a1c99ee49b0 Mon Sep 17 00:00:00 2001
2From: Baruch Siach <baruch@tkos.co.il>
3Date: Sun, 27 Aug 2017 21:30:37 +0300
4Subject: [PATCH] Fix build without Python
5
6Don't define HAVE_PYTHON35 when PYTHON_LIBS is empty.
7
8Also, don't build Python dependent code when HAVE_PYTHON35 is not
9defined.
10
11This fixes build failures like:
12
13Makefile:1616: recipe for target 'python-pkg/dist/lirc-0.10.0.tar.gz' failed
14make[3]: *** [python-pkg/dist/lirc-0.10.0.tar.gz] Error 1
15python-pkg/lirc/_client.c:1:20: fatal error: Python.h: No such file or directory
16 #include <Python.h>
17                    ^
18
19Signed-off-by: Baruch Siach <baruch@tkos.co.il>
20---
21Upstream status: commit 74a2bcab6b
22
23 Makefile.am  | 2 ++
24 configure.ac | 3 ++-
25 2 files changed, 4 insertions(+), 1 deletion(-)
26
27diff --git a/Makefile.am b/Makefile.am
28index 9f3dd14340cc..d8164fcd44cf 100644
29--- a/Makefile.am
30+++ b/Makefile.am
31@@ -104,6 +104,7 @@ dist_py_pkg_doc_DATA    = python-pkg/doc/Doxyfile \
32
33 libpython               = $(libdir)/python$(PYTHON_VERSION)
34 pydir                   = $(libpython)/site-packages/lirc
35+if HAVE_PYTHON35
36 py_LTLIBRARIES          = python-pkg/lib/_client.la
37 python_pkg_lib__client_la_SOURCES = \
38                           python-pkg/lirc/_client.c
39@@ -116,6 +117,7 @@ python_pkg_lib__client_la_LDFLAGS  = \
40                           $(PYTHON_LIBS)
41 python_pkg_lib__client_la_LIBADD = \
42                           lib/liblirc_client.la
43+endif
44
45 pylint: .phony
46 	$(MAKE) -C tools pylint
47diff --git a/configure.ac b/configure.ac
48index 4108688433f8..07d901deafdf 100644
49--- a/configure.ac
50+++ b/configure.ac
51@@ -50,7 +50,8 @@ test -z "$PYTHON_LIBS" && \
52 test -n "$PYTHON_LIBS" || \
53     AC_MSG_WARN([No python package found (missing devel package?)])
54 python_version_nodots=$(echo $PYTHON_VERSION | tr -d '.')
55-AM_CONDITIONAL(HAVE_PYTHON35, [test $python_version_nodots -ge 35])
56+AM_CONDITIONAL(HAVE_PYTHON35, [test -n "$PYTHON_LIBS" && \
57+			       test $python_version_nodots -ge 35])
58 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
59
60
61--
622.14.1
63
64