micropython.mk 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ################################################################################
  2. #
  3. # micropython
  4. #
  5. ################################################################################
  6. MICROPYTHON_VERSION = 1.22.0
  7. MICROPYTHON_SITE = https://micropython.org/resources/source
  8. MICROPYTHON_SOURCE = micropython-$(MICROPYTHON_VERSION).tar.xz
  9. # Micropython has a lot of code copied from other projects, and also a number
  10. # of submodules for various libs. However, we don't even clone the submodules,
  11. # and most of the copied code is not used in the unix build.
  12. MICROPYTHON_LICENSE = MIT, BSD-1-Clause, BSD-3-Clause, Zlib
  13. MICROPYTHON_LICENSE_FILES = LICENSE
  14. MICROPYTHON_DEPENDENCIES = host-pkgconf libffi host-python3
  15. # Use fallback implementation for exception handling on architectures that don't
  16. # have explicit support.
  17. ifeq ($(BR2_i386)$(BR2_x86_64)$(BR2_arm)$(BR2_armeb),)
  18. MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
  19. endif
  20. # xtensa has problems with nlr_push, use setjmp based implementation instead
  21. ifeq ($(BR2_xtensa),y)
  22. MICROPYTHON_CFLAGS = -DMICROPY_NLR_SETJMP=1
  23. endif
  24. # When building from a tarball we don't have some of the dependencies that are in
  25. # the git repository as submodules
  26. MICROPYTHON_MAKE_OPTS += \
  27. MICROPY_PY_BTREE=0 \
  28. MICROPY_PY_USSL=0 \
  29. CROSS_COMPILE=$(TARGET_CROSS) \
  30. CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
  31. LDFLAGS_EXTRA="$(TARGET_LDFLAGS)" \
  32. CWARN=
  33. define MICROPYTHON_BUILD_CMDS
  34. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/mpy-cross
  35. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
  36. $(MICROPYTHON_MAKE_OPTS)
  37. endef
  38. define MICROPYTHON_INSTALL_TARGET_CMDS
  39. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
  40. $(MICROPYTHON_MAKE_OPTS) \
  41. DESTDIR=$(TARGET_DIR) \
  42. PREFIX=/usr \
  43. install
  44. endef
  45. $(eval $(generic-package))