micropython.mk 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ################################################################################
  2. #
  3. # micropython
  4. #
  5. ################################################################################
  6. MICROPYTHON_VERSION = 1.19.1
  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. LDFLAGS_EXTRA="$(TARGET_LDFLAGS)" \
  35. CWARN=
  36. define MICROPYTHON_BUILD_CMDS
  37. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/mpy-cross
  38. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
  39. $(MICROPYTHON_MAKE_OPTS)
  40. endef
  41. define MICROPYTHON_INSTALL_TARGET_CMDS
  42. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
  43. $(MICROPYTHON_MAKE_OPTS) \
  44. DESTDIR=$(TARGET_DIR) \
  45. PREFIX=/usr \
  46. install
  47. endef
  48. $(eval $(generic-package))