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.

141 lines
3.6 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.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/software/utils/i2c-tools
  13. PKG_HASH:=d900ca1c11c51ea20caa50b096f948008b8a7ad832311b23353e21baa7af28d6
  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:=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. endef
  32. define Package/i2c-tools
  33. $(call Package/i2c/Default)
  34. SECTION:=utils
  35. CATEGORY:=Utilities
  36. TITLE+=tools for Linux
  37. DEPENDS:=+libi2c
  38. endef
  39. define Package/python-smbus
  40. $(call Package/i2c/Default)
  41. SUBMENU:=Python
  42. SECTION:=lang
  43. CATEGORY:=Languages
  44. TITLE:=Python bindings for the SMBUS
  45. DEPENDS:=+libi2c +python-light
  46. endef
  47. define Package/python3-smbus
  48. $(call Package/i2c/Default)
  49. SUBMENU:=Python
  50. SECTION:=lang
  51. CATEGORY:=Languages
  52. TITLE:=Python bindings for the SMBUS
  53. DEPENDS:=+libi2c +python3-light
  54. endef
  55. define Package/libi2c/description
  56. This package contains i2c functionality needed by i2c-tools.
  57. endef
  58. define Package/i2c-tools/description
  59. This package contains an heterogeneous set of I2C tools for Linux. These tools
  60. were originally part of the lm-sensors package.
  61. endef
  62. define Package/python-smbus/description
  63. This package contain the python bindings for Linux SMBus access through i2c-dev.
  64. endef
  65. define Package/python3-smbus/description
  66. This package contain the python bindings for Linux SMBus access through i2c-dev.
  67. endef
  68. TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include
  69. ifdef CONFIG_PACKAGE_python-smbus
  70. define Build/Compile/python-smbus
  71. $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
  72. $(call Build/Compile/PyMod,./py-smbus/, \
  73. install --prefix="$(PKG_INSTALL_DIR)/usr", \
  74. )
  75. endef
  76. endif
  77. ifdef CONFIG_PACKAGE_python3-smbus
  78. define Build/Compile/python3-smbus
  79. $(if $(Build/Compile/Py3Mod),,@echo Python3 packaging code not found.; false)
  80. $(call Build/Compile/Py3Mod,./py-smbus/, \
  81. install --prefix="$(PKG_INSTALL_DIR)/usr", \
  82. )
  83. endef
  84. endif
  85. define Build/Compile
  86. $(MAKE) -C $(PKG_BUILD_DIR) \
  87. LINUX="$(LINUX_DIR)" \
  88. CC="$(TARGET_CC)" \
  89. STAGING_DIR="$(STAGING_DIR)" \
  90. LDFLAGS="$(TARGET_LDFLAGS)" \
  91. CFLAGS="$(TARGET_CFLAGS)"
  92. $(Build/Compile/python-smbus)
  93. $(Build/Compile/python3-smbus)
  94. endef
  95. define Package/libi2c/install
  96. $(INSTALL_DIR) $(1)/usr/lib
  97. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/libi2c.so* $(1)/usr/lib/
  98. endef
  99. define Package/i2c-tools/install
  100. $(INSTALL_DIR) $(1)/usr/sbin
  101. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
  102. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
  103. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
  104. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
  105. endef
  106. define PyPackage/python-smbus/filespec
  107. +|$(PYTHON_PKG_DIR)
  108. endef
  109. define PyPackage/python3-smbus/filespec
  110. +|$(PYTHON3_PKG_DIR)
  111. endef
  112. $(eval $(call BuildPackage,libi2c))
  113. $(eval $(call BuildPackage,i2c-tools))
  114. $(eval $(call PyPackage,python-smbus))
  115. $(eval $(call BuildPackage,python-smbus))
  116. $(eval $(call PyPackage,python3-smbus))
  117. $(eval $(call BuildPackage,python3-smbus))