d2119a52eb9d1cc0478261b123f0613808bf75c2
[openwrt/svn-archive/archive.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.0.3
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:=511376eed04455cdb277ef19c5f73bb4
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 DEPENDS:=@!LINUX_2_4
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:= +PACKAGE_python-smbus: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 ifdef CONFIG_PACKAGE_python-smbus
60 define Build/Compile/python-smbus
61 $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
62 $(call Build/Compile/PyMod,./py-smbus/, \
63 install --prefix="$(PKG_INSTALL_DIR)/usr", \
64 )
65 endef
66 endif
67
68 define Build/Compile
69 $(MAKE) -C $(PKG_BUILD_DIR) \
70 LINUX="$(LINUX_DIR)" \
71 CC="$(TARGET_CC)" \
72 STAGING_DIR="$(STAGING_DIR)"
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))