First Commit
[librecmc/package-feed.git] / utils / i2c-tools / Makefile
1 #
2 # Copyright (C) 2007-2015 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
10 PKG_NAME:=i2c-tools
11 PKG_VERSION:=3.1.2
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_URL:=http://dl.lm-sensors.org/i2c-tools/releases/ \
15                 http://fossies.org/linux/misc/
16
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
18 PKG_MD5SUM:=7104a1043d11a5e2c7b131614eb1b962
19
20 PKG_BUILD_PARALLEL:=1
21 PKG_BUILD_DEPENDS:=PACKAGE_python-smbus:python
22
23 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
24 PKG_LICENSE:=GPLv2
25 PKG_LICENSE_FILES:=COPYING
26
27 include $(INCLUDE_DIR)/package.mk
28 $(call include_mk, python-package.mk)
29 $(call include_mk, python3-package.mk)
30
31 define Package/i2c/Default
32   URL:=http://lm-sensors.org/wiki/I2CTools
33   TITLE:=I2C
34 endef
35
36 define Package/i2c-tools
37   $(call Package/i2c/Default)
38   SECTION:=utils
39   CATEGORY:=Utilities
40   TITLE+=tools for Linux
41 endef
42
43 define Package/python-smbus
44   $(call Package/i2c/Default)
45   SUBMENU:=Python
46   SECTION:=lang
47   CATEGORY:=Languages
48   TITLE:=Python bindings for the SMBUS
49   DEPENDS:=+python-light
50 endef
51
52 define Package/python3-smbus
53   $(call Package/i2c/Default)
54   SUBMENU:=Python
55   SECTION:=lang
56   CATEGORY:=Languages
57   TITLE:=Python bindings for the SMBUS
58   DEPENDS:=+python3-light
59 endef
60
61 define Package/i2c-tools/description
62  This package contains an heterogeneous set of I2C tools for Linux. These tools
63  were originally part of the lm-sensors package.
64 endef
65
66 define Package/python-smbus/description
67  This package contain the python bindings for Linux SMBus access through i2c-dev.
68 endef
69
70 define Package/python3-smbus/description
71  This package contain the python bindings for Linux SMBus access through i2c-dev.
72 endef
73
74 TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include
75
76 ifdef CONFIG_PACKAGE_python-smbus
77   define Build/Compile/python-smbus
78         $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
79         $(call Build/Compile/PyMod,./py-smbus/, \
80                 install --prefix="$(PKG_INSTALL_DIR)/usr", \
81         )
82   endef
83 endif
84
85 ifdef CONFIG_PACKAGE_python3-smbus
86   define Build/Compile/python3-smbus
87         $(if $(Build/Compile/Py3Mod),,@echo Python3 packaging code not found.; false)
88         $(call Build/Compile/Py3Mod,./py-smbus/, \
89                 install --prefix="$(PKG_INSTALL_DIR)/usr", \
90         )
91   endef
92 endif
93
94 define Build/Compile
95         $(MAKE) -C $(PKG_BUILD_DIR) \
96                 LINUX="$(LINUX_DIR)" \
97                 CC="$(TARGET_CC)" \
98                 STAGING_DIR="$(STAGING_DIR)" \
99                 LDFLAGS="$(TARGET_LDFLAGS)" \
100                 CFLAGS="$(TARGET_CFLAGS)"
101         $(Build/Compile/python-smbus)
102         $(Build/Compile/python3-smbus)
103 endef
104
105 define Package/i2c-tools/install
106         $(INSTALL_DIR) $(1)/usr/sbin
107         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
108         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
109         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
110         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
111 endef
112
113 define PyPackage/python-smbus/filespec
114 +|$(PYTHON_PKG_DIR)
115 endef
116
117 define PyPackage/python3-smbus/filespec
118 +|$(PYTHON3_PKG_DIR)
119 endef
120
121 $(eval $(call BuildPackage,i2c-tools))
122 $(eval $(call PyPackage,python-smbus))
123 $(eval $(call BuildPackage,python-smbus))
124 $(eval $(call PyPackage,python3-smbus))
125 $(eval $(call BuildPackage,python3-smbus))