You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.3 KiB

  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. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=i2c-tools
  9. PKG_VERSION:=3.1.2
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_URL:=http://dl.lm-sensors.org/i2c-tools/releases/
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  13. PKG_MD5SUM:=7104a1043d11a5e2c7b131614eb1b962
  14. PKG_BUILD_PARALLEL:=1
  15. PKG_BUILD_DEPENDS:=PACKAGE_python-smbus:python
  16. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  17. PKG_LICENSE:=GPLv2
  18. PKG_LICENSE_FILES:=COPYING
  19. include $(INCLUDE_DIR)/package.mk
  20. $(call include_mk, python-package.mk)
  21. define Package/i2c/Default
  22. URL:=http://lm-sensors.org/wiki/I2CTools
  23. TITLE:=I2C
  24. endef
  25. define Package/i2c-tools
  26. $(call Package/i2c/Default)
  27. SECTION:=utils
  28. CATEGORY:=Utilities
  29. TITLE+=tools for Linux
  30. endef
  31. define Package/python-smbus
  32. $(call Package/i2c/Default)
  33. SUBMENU:=Python
  34. SECTION:=lang
  35. CATEGORY:=Languages
  36. TITLE:=Python bindings for the SMBUS
  37. DEPENDS:=+python-light
  38. endef
  39. define Package/i2c-tools/description
  40. This package contains an heterogeneous set of I2C tools for Linux. These tools
  41. were originally part of the lm-sensors package.
  42. endef
  43. define Package/python-smbus/description
  44. This package contain the python bindings for Linux SMBus access through i2c-dev.
  45. endef
  46. TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include
  47. ifdef CONFIG_PACKAGE_python-smbus
  48. define Build/Compile/python-smbus
  49. $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
  50. $(call Build/Compile/PyMod,./py-smbus/, \
  51. install --prefix="$(PKG_INSTALL_DIR)/usr", \
  52. )
  53. endef
  54. endif
  55. define Build/Compile
  56. $(MAKE) -C $(PKG_BUILD_DIR) \
  57. LINUX="$(LINUX_DIR)" \
  58. CC="$(TARGET_CC)" \
  59. STAGING_DIR="$(STAGING_DIR)" \
  60. LDFLAGS="$(TARGET_LDFLAGS)" \
  61. CFLAGS="$(TARGET_CFLAGS)"
  62. $(Build/Compile/python-smbus)
  63. endef
  64. define Package/i2c-tools/install
  65. $(INSTALL_DIR) $(1)/usr/sbin
  66. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
  67. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
  68. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
  69. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
  70. endef
  71. define PyPackage/python-smbus/filespec
  72. +|$(PYTHON_PKG_DIR)/smbus.so
  73. endef
  74. $(eval $(call BuildPackage,i2c-tools))
  75. $(eval $(call PyPackage,python-smbus))
  76. $(eval $(call BuildPackage,python-smbus))