9ef752baaad70bd93b0700c9f1fc39f328f3aba0
[packages.git] / utils / i2c-tools / Makefile
1 #
2 # Copyright (C) 2007-2011 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.1.0
13 PKG_RELEASE:=1
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:=f15019e559e378c6e9d5d6299a00df21
18
19 PKG_BUILD_DEPENDS:=PACKAGE_python-smbus: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   URL:=http://www.lm-sensors.org/wiki/I2CTools
29 endef
30
31 define Package/python-smbus
32   SUBMENU:=Python
33   SECTION:=lang
34   CATEGORY:=Languages
35   TITLE:=Python bindings for the SMBUS
36   URL:=http://www.lm-sensors.org/wiki/I2CTools
37   DEPENDS:= +PACKAGE_python-smbus:python-mini +i2c-tools
38 endef
39
40 define Package/i2c-tools/description
41  This package contains an heterogeneous set of I2C tools for Linux. These tools
42  were originally part of the lm-sensors package.
43  Includes:
44  - i2cdetect
45  - i2cdump
46  - i2cget
47  - i2cset
48 endef
49
50 define Package/python-smbus/description
51  This package contains an heterogeneous set of I2C tools for Linux.
52
53  This package contain the python bindings for Linux SMBus access through i2c-dev.
54 endef
55
56 TARGET_CPPFLAGS += -I$(LINUX_DIR)/include
57
58 ifdef CONFIG_PACKAGE_python-smbus
59   define Build/Compile/python-smbus
60         $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
61         $(call Build/Compile/PyMod,./py-smbus/, \
62                 install --prefix="$(PKG_INSTALL_DIR)/usr", \
63         )
64   endef
65 endif
66
67 define Build/Compile
68         $(MAKE) -C $(PKG_BUILD_DIR) \
69                 LINUX="$(LINUX_DIR)" \
70                 CC="$(TARGET_CC)" \
71                 STAGING_DIR="$(STAGING_DIR)" \
72                 LDFLAGS="$(TARGET_LDFLAGS)"
73         $(Build/Compile/python-smbus)
74 endef
75
76 define Package/i2c-tools/install
77         $(INSTALL_DIR) $(1)/usr/sbin
78         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
79         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
80         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
81         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
82 endef
83
84 define PyPackage/python-smbus/filespec
85 +|$(PYTHON_PKG_DIR)/smbus.so
86 endef
87
88 $(eval $(call BuildPackage,i2c-tools))
89 $(eval $(call PyPackage,python-smbus))
90 $(eval $(call BuildPackage,python-smbus))