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.

123 lines
3.1 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:=@KERNEL/software/utils/i2c-tools
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. PKG_HASH:=6d6079153cd49a62d4addacef4c092db1a46ba60b2807070a3fbe050262aef87
  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. include ../../lang/python/python-package.mk
  21. include ../../lang/python/python3-package.mk
  22. define Package/i2c/Default
  23. URL:=http://lm-sensors.org/wiki/I2CTools
  24. TITLE:=I2C
  25. endef
  26. define Package/i2c-tools
  27. $(call Package/i2c/Default)
  28. SECTION:=utils
  29. CATEGORY:=Utilities
  30. TITLE+=tools for Linux
  31. endef
  32. define Package/python-smbus
  33. $(call Package/i2c/Default)
  34. SUBMENU:=Python
  35. SECTION:=lang
  36. CATEGORY:=Languages
  37. TITLE:=Python bindings for the SMBUS
  38. DEPENDS:=+python-light
  39. endef
  40. define Package/python3-smbus
  41. $(call Package/i2c/Default)
  42. SUBMENU:=Python
  43. SECTION:=lang
  44. CATEGORY:=Languages
  45. TITLE:=Python bindings for the SMBUS
  46. DEPENDS:=+python3-light
  47. endef
  48. define Package/i2c-tools/description
  49. This package contains an heterogeneous set of I2C tools for Linux. These tools
  50. were originally part of the lm-sensors package.
  51. endef
  52. define Package/python-smbus/description
  53. This package contain the python bindings for Linux SMBus access through i2c-dev.
  54. endef
  55. define Package/python3-smbus/description
  56. This package contain the python bindings for Linux SMBus access through i2c-dev.
  57. endef
  58. TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include
  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. ifdef CONFIG_PACKAGE_python3-smbus
  68. define Build/Compile/python3-smbus
  69. $(if $(Build/Compile/Py3Mod),,@echo Python3 packaging code not found.; false)
  70. $(call Build/Compile/Py3Mod,./py-smbus/, \
  71. install --prefix="$(PKG_INSTALL_DIR)/usr", \
  72. )
  73. endef
  74. endif
  75. define Build/Compile
  76. $(MAKE) -C $(PKG_BUILD_DIR) \
  77. LINUX="$(LINUX_DIR)" \
  78. CC="$(TARGET_CC)" \
  79. STAGING_DIR="$(STAGING_DIR)" \
  80. LDFLAGS="$(TARGET_LDFLAGS)" \
  81. CFLAGS="$(TARGET_CFLAGS)"
  82. $(Build/Compile/python-smbus)
  83. $(Build/Compile/python3-smbus)
  84. endef
  85. define Package/i2c-tools/install
  86. $(INSTALL_DIR) $(1)/usr/sbin
  87. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
  88. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
  89. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
  90. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
  91. endef
  92. define PyPackage/python-smbus/filespec
  93. +|$(PYTHON_PKG_DIR)
  94. endef
  95. define PyPackage/python3-smbus/filespec
  96. +|$(PYTHON3_PKG_DIR)
  97. endef
  98. $(eval $(call BuildPackage,i2c-tools))
  99. $(eval $(call PyPackage,python-smbus))
  100. $(eval $(call BuildPackage,python-smbus))
  101. $(eval $(call PyPackage,python3-smbus))
  102. $(eval $(call BuildPackage,python3-smbus))