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.

134 lines
3.5 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:=4.1
  10. PKG_RELEASE:=3
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/software/utils/i2c-tools
  13. PKG_HASH:=57b219efd183795bd545dd5a60d9eabbe9dcb6f8fb92bc7ba2122b87f98527d5
  14. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  15. PKG_LICENSE:=GPL-2.0-or-later LGPL-2.1-or-later
  16. PKG_LICENSE_FILES:=COPYING COPYING.LGPL
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-i2c-tools-$(PKG_VERSION)
  19. include $(INCLUDE_DIR)/package.mk
  20. include ../../lang/python/python-package.mk
  21. include ../../lang/python/python3-package.mk
  22. PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xJf $(DL_DIR)/$(PKG_SOURCE)
  23. define Package/i2c/Default
  24. URL:=https://i2c.wiki.kernel.org/index.php/I2C_Tools
  25. TITLE:=I2C
  26. endef
  27. define Package/libi2c
  28. $(call Package/i2c/Default)
  29. SECTION:=libs
  30. CATEGORY:=Libraries
  31. TITLE+=library for i2c-tools
  32. VARIANT:=bin
  33. endef
  34. define Package/i2c-tools
  35. $(call Package/i2c/Default)
  36. SECTION:=utils
  37. CATEGORY:=Utilities
  38. TITLE+=tools for Linux
  39. DEPENDS:=+libi2c
  40. VARIANT:=bin
  41. endef
  42. define Package/python-smbus
  43. $(call Package/i2c/Default)
  44. SUBMENU:=Python
  45. SECTION:=lang
  46. CATEGORY:=Languages
  47. TITLE:=Python bindings for the SMBUS
  48. DEPENDS:=+PACKAGE_python-smbus:libi2c +PACKAGE_python-smbus:python-light
  49. VARIANT:=python
  50. endef
  51. define Package/python3-smbus
  52. $(call Package/i2c/Default)
  53. SUBMENU:=Python
  54. SECTION:=lang
  55. CATEGORY:=Languages
  56. TITLE:=Python bindings for the SMBUS
  57. DEPENDS:=+PACKAGE_python3-smbus:libi2c +PACKAGE_python3-smbus:python3-light
  58. VARIANT:=python3
  59. endef
  60. define Package/libi2c/description
  61. This package contains i2c functionality needed by i2c-tools.
  62. endef
  63. define Package/i2c-tools/description
  64. This package contains an heterogeneous set of I2C tools for Linux. These tools
  65. were originally part of the lm-sensors package.
  66. endef
  67. define Package/python-smbus/description
  68. This package contain the python bindings for Linux SMBus access through i2c-dev.
  69. endef
  70. define Package/python3-smbus/description
  71. This package contain the Python3 bindings for Linux SMBus access through i2c-dev.
  72. endef
  73. ifeq ($(BUILD_VARIANT),bin)
  74. define Build/Compile
  75. $(MAKE) -C $(PKG_BUILD_DIR) \
  76. LINUX="$(LINUX_DIR)" \
  77. CC="$(TARGET_CC)" \
  78. STAGING_DIR="$(STAGING_DIR)" \
  79. LDFLAGS="$(TARGET_LDFLAGS)" \
  80. CFLAGS="$(TARGET_CFLAGS)"
  81. endef
  82. define Build/InstallDev
  83. $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib
  84. $(CP) $(PKG_BUILD_DIR)/include/i2c $(1)/usr/include/
  85. $(CP) $(PKG_BUILD_DIR)/lib/libi2c.{a,so*} $(1)/usr/lib/
  86. endef
  87. endif # ifeq
  88. PYTHON_PKG_SETUP_ARGS:=
  89. PYTHON3_PKG_SETUP_ARGS:=
  90. PYTHON_PKG_SETUP_DIR:=py-smbus
  91. PYTHON3_PKG_SETUP_DIR:=py-smbus
  92. define Package/libi2c/install
  93. $(INSTALL_DIR) $(1)/usr/lib
  94. $(CP) $(PKG_BUILD_DIR)/lib/libi2c.so* $(1)/usr/lib/
  95. endef
  96. define Package/i2c-tools/install
  97. $(INSTALL_DIR) $(1)/usr/sbin
  98. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
  99. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
  100. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
  101. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
  102. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2ctransfer $(1)/usr/sbin/
  103. endef
  104. $(eval $(call BuildPackage,libi2c))
  105. $(eval $(call BuildPackage,i2c-tools))
  106. $(eval $(call PyPackage,python-smbus))
  107. $(eval $(call BuildPackage,python-smbus))
  108. $(eval $(call Py3Package,python3-smbus))
  109. $(eval $(call BuildPackage,python3-smbus))