micropython: Update to 1.20.0, refresh/rework patches

Patches 000-Makefile-no-errors.patch and 020-mpy-cross-fix-flags.patch
are no longer necessary.

This also adds a Build/InstallDev recipe to install files necessary for
micropython-lib.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To 2023-05-30 02:22:30 +08:00
parent d717bace8d
commit a4ae38494f
No known key found for this signature in database
GPG Key ID: C616D9E719E868E4
6 changed files with 51 additions and 63 deletions

View File

@ -8,23 +8,25 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=micropython
PKG_VERSION:=1.18
PKG_VERSION:=1.20.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/micropython/micropython/releases/download/v$(PKG_VERSION)
PKG_HASH:=96fc71b42ed331c64e1adc5a830ec4f29f2975c23e8751109c03f32b80fa3eb4
PKG_HASH:=098ef8e40abdc62551b5460d0ffe9489074240c0cb5589ca3c3a425551beb9bf
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=python3/host
PKG_BUILD_FLAGS:=no-mips16
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
define Package/micropython/default
define Package/micropython/Default
SUBMENU:=Python
SECTION:=lang
CATEGORY:=Languages
@ -35,36 +37,37 @@ define Package/micropython/default
endef
define Package/micropython-mbedtls
$(call Package/micropython/default)
$(call Package/micropython/Default)
TITLE+= (mbedtls)
DEPENDS+= +libmbedtls
DEPENDS+= +PACKAGE_micropython-mbedtls:libmbedtls
CONFLICTS:=micropython-nossl
VARIANT:=mbedtls
DEFAULT_VARIANT:=1
endef
define Package/micropython-nossl
$(call Package/micropython/default)
$(call Package/micropython/Default)
TITLE+= (nossl)
VARIANT:=nossl
endef
define Package/micropython/default/description
MicroPython is a lean and efficient implementation of the Python 3
programming language that includes a small subset of the Python
standard library and is optimised to run on microcontrollers and in
constrained environments.
define Package/micropython/Default/description
MicroPython is a lean and efficient implementation of the Python 3
programming language that includes a small subset of the Python standard
library and is optimised to run on microcontrollers and in constrained
environments.
endef
define Package/micropython-mbedtls/description
$(call Package/micropython/default/description)
$(call Package/micropython/Default/description)
This version uses the Mbed TLS library.
This version uses the Mbed TLS library.
endef
define Package/micropython-nossl/description
$(call Package/micropython/default/description)
$(call Package/micropython/Default/description)
This version is built without TLS and upip.
This version is built without TLS and mip.
endef
MAKE_FLAGS += BUILD_VERBOSE=1
@ -73,30 +76,42 @@ ifneq ($(CONFIG_DEBUG),)
MAKE_FLAGS += DEBUG=1
endif
ifeq ($(BUILD_VARIANT),mbedtls)
MAKE_FLAGS += MICROPY_SSL_AXTLS=0 MICROPY_SSL_MBEDTLS=1
endif
ifeq ($(BUILD_VARIANT),nossl)
MAKE_FLAGS += MICROPY_PY_USSL=0 FROZEN_MANIFEST=
MAKE_FLAGS += MICROPY_PY_USSL=0 FROZEN_MANIFEST=variants/standard/manifest-nossl.py
endif
MAKE_PATH = ports/unix
define Build/Compile
define Build/Configure
+$(HOST_MAKE_VARS) \
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/mpy-cross \
$(HOST_MAKE_FLAGS) BUILD_VERBOSE=1
$(call Build/Compile/Default)
endef
define Package/micropython/default/install
define Build/InstallDev
$(INSTALL_DIR) $(2)/lib/micropython-$(PKG_VERSION)/mpy-cross
$(CP) \
$(PKG_BUILD_DIR)/mpy-cross/mpy_cross \
$(2)/lib/micropython-$(PKG_VERSION)/mpy-cross/
$(INSTALL_DIR) $(2)/lib/micropython-$(PKG_VERSION)/mpy-cross/build
$(INSTALL_BIN) \
$(PKG_BUILD_DIR)/mpy-cross/build/mpy-cross \
$(2)/lib/micropython-$(PKG_VERSION)/mpy-cross/build/
$(INSTALL_DIR) $(2)/lib/micropython-$(PKG_VERSION)/tools
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/tools/manifestfile.py \
$(2)/lib/micropython-$(PKG_VERSION)/tools/
endef
define Package/micropython/Default/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ports/unix/micropython $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ports/unix/build-standard/micropython $(1)/usr/bin/
endef
Package/micropython-mbedtls/install = $(Package/micropython/default/install)
Package/micropython-nossl/install = $(Package/micropython/default/install)
Package/micropython-mbedtls/install = $(Package/micropython/Default/install)
Package/micropython-nossl/install = $(Package/micropython/Default/install)
$(eval $(call BuildPackage,micropython-mbedtls))
$(eval $(call BuildPackage,micropython-nossl))

View File

@ -1,11 +0,0 @@
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -36,7 +36,7 @@ INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
-CWARN = -Wall -Werror
+CWARN = -Wall
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)

View File

@ -1,20 +0,0 @@
--- a/mpy-cross/Makefile
+++ b/mpy-cross/Makefile
@@ -19,7 +19,7 @@ INC += -I$(TOP)
# compiler settings
CWARN = -Wall -Werror
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith
-CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
+CFLAGS += $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
# Debugging/Optimization
@@ -42,7 +42,7 @@ else
# Use gcc syntax for map file
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
-LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
+LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
# source files
SRC_C = \

View File

@ -1,6 +1,6 @@
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -24,7 +24,7 @@ QSTR_DEFS = qstrdefsport.h
@@ -31,7 +31,7 @@ QSTR_DEFS = qstrdefsport.h
QSTR_GLOBAL_DEPENDENCIES = $(VARIANT_DIR)/mpconfigvariant.h
# OS name, for simple autoconfig

View File

@ -9,13 +9,17 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
--- a/extmod/extmod.mk
+++ b/extmod/extmod.mk
@@ -66,81 +66,8 @@ SRC_MOD += $(addprefix $(AXTLS_DIR)/,\
@@ -131,84 +131,8 @@ SRC_THIRDPARTY_C += $(addprefix $(AXTLS_
crypto/sha1.c \
)
else ifeq ($(MICROPY_SSL_MBEDTLS),1)
-MBEDTLS_DIR = lib/mbedtls
-CFLAGS_MOD += -DMICROPY_SSL_MBEDTLS=1 -I$(TOP)/$(MBEDTLS_DIR)/include
-SRC_MOD += $(addprefix $(MBEDTLS_DIR)/library/,\
-MBEDTLS_CONFIG_FILE ?= \"mbedtls/mbedtls_config.h\"
-GIT_SUBMODULES += $(MBEDTLS_DIR)
-CFLAGS_EXTMOD += -DMBEDTLS_CONFIG_FILE=$(MBEDTLS_CONFIG_FILE)
-CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1 -I$(TOP)/$(MBEDTLS_DIR)/include
-SRC_THIRDPARTY_C += lib/mbedtls_errors/mp_mbedtls_errors.c
-SRC_THIRDPARTY_C += $(addprefix $(MBEDTLS_DIR)/library/,\
- aes.c \
- aesni.c \
- arc4.c \
@ -43,7 +47,6 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
- ecp_curves.c \
- entropy.c \
- entropy_poll.c \
- error.c \
- gcm.c \
- havege.c \
- hmac_drbg.c \
@ -88,7 +91,7 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
- x509write_csr.c \
- xtea.c \
- )
+CFLAGS_MOD += -DMICROPY_SSL_MBEDTLS=1
+CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1
+LDFLAGS_MOD += -lmbedx509 -lmbedtls -lmbedcrypto
endif
endif

View File

@ -0,0 +1 @@
include("$(MPY_DIR)/extmod/uasyncio")