Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. http://fossies.org/linux/misc/
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  14. PKG_MD5SUM:=7104a1043d11a5e2c7b131614eb1b962
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_BUILD_DEPENDS:=PACKAGE_python-smbus:python
  17. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  18. PKG_LICENSE:=GPLv2
  19. PKG_LICENSE_FILES:=COPYING
  20. include $(INCLUDE_DIR)/package.mk
  21. $(call include_mk, python-package.mk)
  22. $(call include_mk, python3-package.mk)
  23. define Package/i2c/Default
  24. URL:=http://lm-sensors.org/wiki/I2CTools
  25. TITLE:=I2C
  26. endef
  27. define Package/i2c-tools
  28. $(call Package/i2c/Default)
  29. SECTION:=utils
  30. CATEGORY:=Utilities
  31. TITLE+=tools for Linux
  32. endef
  33. define Package/python-smbus
  34. $(call Package/i2c/Default)
  35. SUBMENU:=Python
  36. SECTION:=lang
  37. CATEGORY:=Languages
  38. TITLE:=Python bindings for the SMBUS
  39. DEPENDS:=+python-light
  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:=+python3-light
  48. endef
  49. define Package/i2c-tools/description
  50. This package contains an heterogeneous set of I2C tools for Linux. These tools
  51. were originally part of the lm-sensors package.
  52. endef
  53. define Package/python-smbus/description
  54. This package contain the python bindings for Linux SMBus access through i2c-dev.
  55. endef
  56. define Package/python3-smbus/description
  57. This package contain the python bindings for Linux SMBus access through i2c-dev.
  58. endef
  59. TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include
  60. ifdef CONFIG_PACKAGE_python-smbus
  61. define Build/Compile/python-smbus
  62. $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
  63. $(call Build/Compile/PyMod,./py-smbus/, \
  64. install --prefix="$(PKG_INSTALL_DIR)/usr", \
  65. )
  66. endef
  67. endif
  68. ifdef CONFIG_PACKAGE_python3-smbus
  69. define Build/Compile/python3-smbus
  70. $(if $(Build/Compile/Py3Mod),,@echo Python3 packaging code not found.; false)
  71. $(call Build/Compile/Py3Mod,./py-smbus/, \
  72. install --prefix="$(PKG_INSTALL_DIR)/usr", \
  73. )
  74. endef
  75. endif
  76. define Build/Compile
  77. $(MAKE) -C $(PKG_BUILD_DIR) \
  78. LINUX="$(LINUX_DIR)" \
  79. CC="$(TARGET_CC)" \
  80. STAGING_DIR="$(STAGING_DIR)" \
  81. LDFLAGS="$(TARGET_LDFLAGS)" \
  82. CFLAGS="$(TARGET_CFLAGS)"
  83. $(Build/Compile/python-smbus)
  84. $(Build/Compile/python3-smbus)
  85. endef
  86. define Package/i2c-tools/install
  87. $(INSTALL_DIR) $(1)/usr/sbin
  88. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
  89. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
  90. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
  91. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
  92. endef
  93. define PyPackage/python-smbus/filespec
  94. +|$(PYTHON_PKG_DIR)
  95. endef
  96. define PyPackage/python3-smbus/filespec
  97. +|$(PYTHON3_PKG_DIR)
  98. endef
  99. $(eval $(call BuildPackage,i2c-tools))
  100. $(eval $(call PyPackage,python-smbus))
  101. $(eval $(call BuildPackage,python-smbus))
  102. $(eval $(call PyPackage,python3-smbus))
  103. $(eval $(call BuildPackage,python3-smbus))