micropython.mk 1.8 KB

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