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.

102 lines
2.5 KiB

  1. #
  2. # Copyright (C) 2008-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:=micropython
  9. PKG_VERSION:=1.18
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=https://github.com/micropython/micropython/releases/download/v$(PKG_VERSION)
  13. PKG_HASH:=96fc71b42ed331c64e1adc5a830ec4f29f2975c23e8751109c03f32b80fa3eb4
  14. PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
  15. PKG_LICENSE:=MIT
  16. PKG_LICENSE_FILES:=LICENSE
  17. PKG_BUILD_PARALLEL:=1
  18. include $(INCLUDE_DIR)/host-build.mk
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/micropython/default
  21. SUBMENU:=Python
  22. SECTION:=lang
  23. CATEGORY:=Languages
  24. TITLE:=MicroPython
  25. URL:=https://micropython.org
  26. DEPENDS:=+libffi
  27. PROVIDES:=micropython
  28. endef
  29. define Package/micropython-mbedtls
  30. $(call Package/micropython/default)
  31. TITLE+= (mbedtls)
  32. DEPENDS+= +libmbedtls
  33. VARIANT:=mbedtls
  34. DEFAULT_VARIANT:=1
  35. endef
  36. define Package/micropython-nossl
  37. $(call Package/micropython/default)
  38. TITLE+= (nossl)
  39. VARIANT:=nossl
  40. endef
  41. define Package/micropython/default/description
  42. MicroPython is a lean and efficient implementation of the Python 3
  43. programming language that includes a small subset of the Python
  44. standard library and is optimised to run on microcontrollers and in
  45. constrained environments.
  46. endef
  47. define Package/micropython-mbedtls/description
  48. $(call Package/micropython/default/description)
  49. This version uses the Mbed TLS library.
  50. endef
  51. define Package/micropython-nossl/description
  52. $(call Package/micropython/default/description)
  53. This version is built without TLS and upip.
  54. endef
  55. MAKE_FLAGS += BUILD_VERBOSE=1
  56. ifneq ($(CONFIG_DEBUG),)
  57. MAKE_FLAGS += DEBUG=1
  58. endif
  59. ifeq ($(BUILD_VARIANT),mbedtls)
  60. MAKE_FLAGS += MICROPY_SSL_AXTLS=0 MICROPY_SSL_MBEDTLS=1
  61. endif
  62. ifeq ($(BUILD_VARIANT),nossl)
  63. MAKE_FLAGS += MICROPY_PY_USSL=0 FROZEN_MANIFEST=
  64. endif
  65. MAKE_PATH = ports/unix
  66. define Build/Compile
  67. +$(HOST_MAKE_VARS) \
  68. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/mpy-cross \
  69. $(HOST_MAKE_FLAGS) BUILD_VERBOSE=1
  70. $(call Build/Compile/Default)
  71. endef
  72. define Package/micropython/default/install
  73. $(INSTALL_DIR) $(1)/usr/bin
  74. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ports/unix/micropython $(1)/usr/bin/
  75. endef
  76. Package/micropython-mbedtls/install = $(Package/micropython/default/install)
  77. Package/micropython-nossl/install = $(Package/micropython/default/install)
  78. $(eval $(call BuildPackage,micropython-mbedtls))
  79. $(eval $(call BuildPackage,micropython-nossl))