kumquat-buildroot/package/lirc-tools/lirc-tools.mk
Thomas Petazzoni f75239d1b5 package/pkg-python: use host-python3-setuptools when needed
When a package uses "setuptools" as its <pkg>_SETUP_TYPE, we currently
add a dependency on host-python-setuptools. This means that:

 (1) When BR2_PACKAGE_PYTHON=y, the default host Python version is
     Python 2.x, and host-python-setuptools is installed for
     host-python.

 (2) When BR2_PACKAGE_PYTHON3=y, the default host Python version is
     Python 3.x, and host-python-setuptools is installed for
     host-python3.

 (3) When no target Python interpreter is selected, the default host
     Python version is Python 2.x, and host-python-setuptools is
     installed for host-python.

Situations (1) and (3) are problematic for host Python packages that
need Python 3.x. Such packages use <pkg>_NEEDS_HOST_PYTHON = python3,
but if they use setuptools as their setup type, they will not find
setuptools installed for host-python3 in situations (1) and (3)
described above.

We currently have a single package that sets <pkg>_NEEDS_HOST_PYTHON =
python3: host-meson. host-meson generally works because if setuptools
is not found, it falls back to distutils, which is part of the
standard Python library. However, if there is a setuptools version
installed system-wide, it may be picked up, but may not necessarily be
the same version as Buildroot setuptools, potentially causing
problems.

This commit makes the necessary change to the python-package
infrastructure to fix this behavior, by identifying the following
cases:

 - When a host Python package says <pkg>_NEEDS_HOST_PYTHON = python3,
   then we know it wants setuptools installed for host-python3, so we
   use host-python3-setuptools.

 - When a host Python package says <pkg>_NEEDS_HOST_PYTHON = python2,
   then we known it wants setuptools installed for host-python, so we
   use host-python-setuptools.

 - When BR2_PACKAGE_PYTHON3=y, and we have a target package, or a host
   package with no NEEDS_HOST_PYTHON option, then we want setuptools
   installed for host-python3, so we use host-python3-setuptools.

 - When BR2_PACKAGE_PYTHON=y or no target interpreter is enabled at
   all, and we have a target package, or a host package with no
   NEEDS_HOST_PYTHON option, then we want setuptools for host-python,
   so we use host-python-setuptools.

To make this happen, we use host-python3-setuptools introduced in a
previous commit, but we also change host-python-setuptools to force
its installation for host-python. The latter is needed if you build
with BR2_PACKAGE_PYTHON3=y but want to install a Python-based package
that has NEEDS_HOST_PYTHON=python2.

There is one single package that needs be adjusted following this:
lirc-tools, because it is not using the python-package
infrastructure. It directly depends on host-python-setuptools, which
no longer works because host-python-setuptools now only installs for
Python 2.x, while lirc-tools Python binding only supports Python
3.x. Switching to host-python3-setuptools solves this problem.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Reviewed-by: Asaf Kahlon <asafka7@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-01-01 11:16:10 +01:00

59 lines
1.6 KiB
Makefile

################################################################################
#
# lirc-tools
#
################################################################################
LIRC_TOOLS_VERSION = 0.10.1
LIRC_TOOLS_SOURCE = lirc-$(LIRC_TOOLS_VERSION).tar.bz2
LIRC_TOOLS_SITE = http://downloads.sourceforge.net/project/lirc/LIRC/$(LIRC_TOOLS_VERSION)
LIRC_TOOLS_LICENSE = GPL-2.0+
LIRC_TOOLS_LICENSE_FILES = COPYING
LIRC_TOOLS_DEPENDENCIES = host-libxslt host-pkgconf host-python3
LIRC_TOOLS_INSTALL_STAGING = YES
# Patching configure.ac and Makefile.am
LIRC_TOOLS_AUTORECONF = YES
LIRC_TOOLS_CONF_ENV = XSLTPROC=yes HAVE_WORKING_POLL=yes
LIRC_TOOLS_CONF_OPTS = --without-x --enable-devinput --enable-uinput
ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4),y)
LIRC_TOOLS_CONF_ENV += \
DEVINPUT_HEADER=$(STAGING_DIR)/usr/include/linux/input-event-codes.h
else
LIRC_TOOLS_CONF_ENV += \
DEVINPUT_HEADER=$(STAGING_DIR)/usr/include/linux/input.h
endif
ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
LIRC_TOOLS_DEPENDENCIES += udev
endif
ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
LIRC_TOOLS_DEPENDENCIES += alsa-lib
endif
ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
LIRC_TOOLS_DEPENDENCIES += libusb-compat
endif
ifeq ($(BR2_PACKAGE_PORTAUDIO),y)
LIRC_TOOLS_DEPENDENCIES += portaudio
endif
ifeq ($(BR2_PACKAGE_LIBFTDI1),y)
LIRC_TOOLS_DEPENDENCIES += libftdi1
endif
ifeq ($(BR2_PACKAGE_PYTHON3),y)
LIRC_TOOLS_DEPENDENCIES += python3 host-python3-setuptools
LIRC_TOOLS_MAKE_ENV += SETUPTOOLS_ENV="$(PKG_PYTHON_SETUPTOOLS_ENV)"
endif
define LIRC_TOOLS_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 package/lirc-tools/S25lircd \
$(TARGET_DIR)/etc/init.d/S25lircd
endef
$(eval $(autotools-package))