[packages] i2c-tools: Package also the python bindings
[packages.git] / utils / i2c-tools / Makefile
1 #
2 # Copyright (C) 2007-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=i2c-tools
12 PKG_VERSION:=3.0.2
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://dl.lm-sensors.org/i2c-tools/releases/
17 PKG_MD5SUM:=b546345ac19db56719dea6b8199f11e0
18
19 PKG_BUILD_DEPENDS:=python
20
21 include $(INCLUDE_DIR)/package.mk
22 $(call include_mk, python-package.mk)
23
24 define Package/i2c-tools
25   SECTION:=utils
26   CATEGORY:=Utilities
27   TITLE:=I2C tools for Linux
28   DEPENDS:=@LINUX_2_6
29   URL:=http://www.lm-sensors.org/wiki/I2CTools
30 endef
31
32 define Package/python-smbus
33   SUBMENU:=Python
34   SECTION:=lang
35   CATEGORY:=Languages
36   TITLE:=Python bindings for the SMBUS
37   URL:=http://www.lm-sensors.org/wiki/I2CTools
38   DEPENDS:= +python-mini +i2c-tools
39 endef
40
41 define Package/i2c-tools/description
42  This package contains an heterogeneous set of I2C tools for Linux. These tools
43  were originally part of the lm-sensors package.
44  Includes:
45  - i2cdetect
46  - i2cdump
47  - i2cget
48  - i2cset
49 endef
50
51 define Package/python-smbus/description
52  This package contains an heterogeneous set of I2C tools for Linux. 
53  
54  This package contain the python bindings for Linux SMBus access through i2c-dev.
55 endef
56
57 TARGET_CPPFLAGS += -I$(LINUX_DIR)/include
58
59 define Build/Compile
60         $(MAKE) -C $(PKG_BUILD_DIR) \
61                 LINUX="$(LINUX_DIR)" \
62                 CC="$(TARGET_CC)" \
63                 STAGING_DIR="$(STAGING_DIR)"
64         $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
65         $(call Build/Compile/PyMod,./py-smbus/, \
66                 install --prefix="$(PKG_INSTALL_DIR)/usr", \
67         )
68 endef
69
70 define Package/i2c-tools/install
71         $(INSTALL_DIR) $(1)/usr/sbin
72         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
73         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
74         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
75         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
76 endef
77
78 define PyPackage/python-smbus/filespec
79 +|$(PYTHON_PKG_DIR)/smbus.so
80 endef
81
82 $(eval $(call BuildPackage,i2c-tools))
83 $(eval $(call PyPackage,python-smbus))
84 $(eval $(call BuildPackage,python-smbus))