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.

114 lines
2.9 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/python3-package.mk
  21. PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xJf $(DL_DIR)/$(PKG_SOURCE)
  22. define Package/i2c/Default
  23. URL:=https://i2c.wiki.kernel.org/index.php/I2C_Tools
  24. TITLE:=I2C
  25. endef
  26. define Package/libi2c
  27. $(call Package/i2c/Default)
  28. SECTION:=libs
  29. CATEGORY:=Libraries
  30. TITLE+=library for i2c-tools
  31. VARIANT:=bin
  32. endef
  33. define Package/i2c-tools
  34. $(call Package/i2c/Default)
  35. SECTION:=utils
  36. CATEGORY:=Utilities
  37. TITLE+=tools for Linux
  38. DEPENDS:=+libi2c
  39. VARIANT:=bin
  40. endef
  41. define Package/python3-smbus
  42. $(call Package/i2c/Default)
  43. SUBMENU:=Python
  44. SECTION:=lang
  45. CATEGORY:=Languages
  46. TITLE:=Python bindings for the SMBUS
  47. DEPENDS:=+libi2c +python3-light
  48. VARIANT:=python3
  49. endef
  50. define Package/libi2c/description
  51. This package contains i2c functionality needed by i2c-tools.
  52. endef
  53. define Package/i2c-tools/description
  54. This package contains an heterogeneous set of I2C tools for Linux. These tools
  55. were originally part of the lm-sensors package.
  56. endef
  57. define Package/python3-smbus/description
  58. This package contain the Python3 bindings for Linux SMBus access through i2c-dev.
  59. endef
  60. ifeq ($(BUILD_VARIANT),bin)
  61. define Build/Compile
  62. $(MAKE) -C $(PKG_BUILD_DIR) \
  63. LINUX="$(LINUX_DIR)" \
  64. CC="$(TARGET_CC)" \
  65. STAGING_DIR="$(STAGING_DIR)" \
  66. LDFLAGS="$(TARGET_LDFLAGS)" \
  67. CFLAGS="$(TARGET_CFLAGS)"
  68. endef
  69. define Build/InstallDev
  70. $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib
  71. $(CP) $(PKG_BUILD_DIR)/include/i2c $(1)/usr/include/
  72. $(CP) $(PKG_BUILD_DIR)/lib/libi2c.{a,so*} $(1)/usr/lib/
  73. endef
  74. endif # ifeq
  75. PYTHON3_PKG_SETUP_ARGS:=
  76. PYTHON3_PKG_SETUP_DIR:=py-smbus
  77. define Package/libi2c/install
  78. $(INSTALL_DIR) $(1)/usr/lib
  79. $(CP) $(PKG_BUILD_DIR)/lib/libi2c.so* $(1)/usr/lib/
  80. endef
  81. define Package/i2c-tools/install
  82. $(INSTALL_DIR) $(1)/usr/sbin
  83. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
  84. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
  85. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
  86. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
  87. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2ctransfer $(1)/usr/sbin/
  88. endef
  89. $(eval $(call BuildPackage,libi2c))
  90. $(eval $(call BuildPackage,i2c-tools))
  91. $(eval $(call Py3Package,python3-smbus))
  92. $(eval $(call BuildPackage,python3-smbus))