i2c-tools: add support to build python extension
Add a config option to build the python bindings for i2c-tools - py-smbus. The steps for building the python bindings is the same as the distutil steps that are a part of the python infrastructure. Signed-off-by: Ryan Barnett <ryanbarnett3@gmail.com> CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> CC: Baruch Siach <baruch@tkos.co.il> CC: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
37b8360a5a
commit
ea8edb9514
|
@ -10,8 +10,34 @@ I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases
|
||||||
I2C_TOOLS_LICENSE = GPLv2+, GPLv2 (py-smbus)
|
I2C_TOOLS_LICENSE = GPLv2+, GPLv2 (py-smbus)
|
||||||
I2C_TOOLS_LICENSE_FILES = COPYING
|
I2C_TOOLS_LICENSE_FILES = COPYING
|
||||||
|
|
||||||
|
# Build/install steps mirror the distutil python package type in the python package
|
||||||
|
# infrastructure
|
||||||
|
ifeq ($(BR2_PACKAGE_PYTHON),y)
|
||||||
|
I2C_TOOLS_DEPENDENCIES += python
|
||||||
|
# BASE_ENV taken from PKG_PYTHON_DISTUTILS_ENV in package/pkg-python.mk
|
||||||
|
I2C_TOOLS_PYTHON_BASE_ENV = \
|
||||||
|
$(PKG_PYTHON_DISTUTILS_ENV) \
|
||||||
|
CFLAGS="$(TARGET_CFLAGS) -I../include"
|
||||||
|
|
||||||
|
define I2C_TOOLS_BUILD_PYSMBUS
|
||||||
|
(cd $(@D)/py-smbus; \
|
||||||
|
$(I2C_TOOLS_PYTHON_BASE_ENV) \
|
||||||
|
$(HOST_DIR)/usr/bin/python setup.py build \
|
||||||
|
$(PKG_PYTHON_DISTUTILS_BUILD_OPTS))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define I2C_TOOLS_INSTALL_PYSMBUS
|
||||||
|
(cd $(@D)/py-smbus; \
|
||||||
|
$(I2C_TOOLS_PYTHON_BASE_ENV) \
|
||||||
|
$(HOST_DIR)/usr/bin/python setup.py install \
|
||||||
|
$(PKG_PYTHON_DISTUTILS_INSTALL_TARGET_OPTS))
|
||||||
|
endef
|
||||||
|
|
||||||
|
endif # BR2_PACKAGE_PYTHON
|
||||||
|
|
||||||
define I2C_TOOLS_BUILD_CMDS
|
define I2C_TOOLS_BUILD_CMDS
|
||||||
$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
|
$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
|
||||||
|
$(I2C_TOOLS_BUILD_PYSMBUS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define I2C_TOOLS_INSTALL_TARGET_CMDS
|
define I2C_TOOLS_INSTALL_TARGET_CMDS
|
||||||
|
@ -19,6 +45,7 @@ define I2C_TOOLS_INSTALL_TARGET_CMDS
|
||||||
do \
|
do \
|
||||||
$(INSTALL) -m 755 -D $(@D)/tools/$$i $(TARGET_DIR)/usr/bin/$$i; \
|
$(INSTALL) -m 755 -D $(@D)/tools/$$i $(TARGET_DIR)/usr/bin/$$i; \
|
||||||
done
|
done
|
||||||
|
$(I2C_TOOLS_INSTALL_PYSMBUS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(generic-package))
|
$(eval $(generic-package))
|
||||||
|
|
Loading…
Reference in a new issue