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