Files
buildroot/package/micropython/micropython.mk
Daniel Houck 28eeca9a98 package/micropython: bump to version 1.28.0
This allows us to fix packaging issue with micropython-lib, which was
not packaging the correct versions of some libraries.  The new version
makes changes to the `manifestfile` tool/library used by our
collect_micropython_libs.py script, which makes it easier to collect the
correct library version.  This fixes #166.

To better support alternate use cases, the option to package the modules
in unix-ffi has been split into a separate option, instead of assuming
it's needed if and only if libffi is selected.

Both the upstream changes and the unix-ffi split require changes to
collect_micropython_libs.py.  First, since we might not want the
unix-ffi libraries, the script takes an extra argument for whether or
not to include them.  Next, since the manifest.require function no
longer takes a unix_ffi optional parameter, we use manifest.add_library
as recommended in the micropython-lib/unix-ffi directory README, if we
are are actually packaging those libraries.

All of the patches we have been maintaining have also been merged upstream
by 1.28.0, so they are removed.  Their respective Upstream: trailers all
point to the relevant commits, except for
0003-Fixes-for-GCC-15-1-unterminated-string-literal-warning.patch, from
ae6062a45a

The LICENSE hash has been updated, as the year and the licenses used for
the ports and libraries have also been updated in the LICENSE file.

For more details on the version bump, see the release notes:
  - https://github.com/micropython/micropython/releases/tag/v1.23.0
  - https://github.com/micropython/micropython/releases/tag/v1.24.0
  - https://github.com/micropython/micropython/releases/tag/v1.24.1
  - https://github.com/micropython/micropython/releases/tag/v1.25.0
  - https://github.com/micropython/micropython/releases/tag/v1.26.0
  - https://github.com/micropython/micropython/releases/tag/v1.26.1
  - https://github.com/micropython/micropython/releases/tag/v1.27.0
  - https://github.com/micropython/micropython/releases/tag/v1.28.0

Signed-off-by: Daniel Houck <Software@DRHouck.me>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2026-06-12 18:55:30 +02:00

82 lines
2.6 KiB
Makefile

################################################################################
#
# micropython
#
################################################################################
MICROPYTHON_VERSION = 1.28.0
MICROPYTHON_SITE = https://micropython.org/resources/source
MICROPYTHON_SOURCE = micropython-$(MICROPYTHON_VERSION).tar.xz
# Micropython has a lot of code copied from other projects, and also a number
# of submodules for various libs. However, we don't even clone the submodules,
# and most of the copied code is not used in the unix build.
MICROPYTHON_LICENSE = MIT, BSD-1-Clause, BSD-3-Clause, Zlib
MICROPYTHON_LICENSE_FILES = LICENSE
MICROPYTHON_DEPENDENCIES = host-python3
MICROPYTHON_CPE_ID_VENDOR = micropython
# 0004-py-objarray-fix-use-after-free-if-extending-a-bytearray-from-itself.patch
MICROPYTHON_IGNORE_CVES += CVE-2024-8947
# Use fallback implementation for exception handling on architectures that don't
# have explicit support.
ifeq ($(BR2_i386)$(BR2_x86_64)$(BR2_arm)$(BR2_armeb),)
MICROPYTHON_CFLAGS += -DMICROPY_GCREGS_SETJMP=1
endif
# xtensa has problems with nlr_push, use setjmp based implementation instead
ifeq ($(BR2_xtensa),y)
MICROPYTHON_CFLAGS += -DMICROPY_NLR_SETJMP=1
endif
# When building from a tarball we don't have some of the dependencies that are in
# the git repository as submodules
MICROPYTHON_MAKE_OPTS += \
MICROPY_PY_BTREE=0 \
MICROPY_PY_USSL=0 \
CROSS_COMPILE=$(TARGET_CROSS) \
CFLAGS_EXTRA="$(MICROPYTHON_CFLAGS)" \
LDFLAGS_EXTRA="$(TARGET_LDFLAGS)" \
CWARN=
# Support libffi in MicroPython itself; separate from unix-ffi libraries
ifeq ($(BR2_PACKAGE_LIBFFI),y)
MICROPYTHON_DEPENDENCIES += host-pkgconf libffi
MICROPYTHON_MAKE_OPTS += MICROPY_PY_FFI=1
else
MICROPYTHON_MAKE_OPTS += MICROPY_PY_FFI=0
endif
define MICROPYTHON_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/mpy-cross
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
$(MICROPYTHON_MAKE_OPTS)
endef
define MICROPYTHON_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
$(MICROPYTHON_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
PREFIX=/usr \
install
endef
ifeq ($(BR2_PACKAGE_MICROPYTHON_LIB),y)
define MICROPYTHON_COLLECT_LIBS
$(EXTRA_ENV) PYTHONPATH=$(@D)/tools \
package/micropython/collect_micropython_lib.py \
$(@D) $(@D)/.built_pylib \
$(if $(BR2_PACKAGE_MICROPYTHON_LIB_UNIXFFI),--ffi,--no-ffi)
endef
define MICROPYTHON_INSTALL_LIBS
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/lib/micropython
cp -a $(@D)/.built_pylib/* $(TARGET_DIR)/usr/lib/micropython
endef
MICROPYTHON_POST_BUILD_HOOKS += MICROPYTHON_COLLECT_LIBS
MICROPYTHON_POST_INSTALL_TARGET_HOOKS += MICROPYTHON_INSTALL_LIBS
endif
$(eval $(generic-package))