micropython.mk 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. # Set GIT_DIR so package won't use buildroot's version number
  16. MICROPYTHON_MAKE_ENV = \
  17. $(TARGET_MAKE_ENV) \
  18. GIT_DIR=.
  19. # Use fallback implementation for exception handling on architectures that don't
  20. # have explicit support.
  21. ifeq ($(BR2_i386)$(BR2_x86_64)$(BR2_arm)$(BR2_armeb),)
  22. MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
  23. endif
  24. # xtensa has problems with nlr_push, use setjmp based implementation instead
  25. ifeq ($(BR2_xtensa),y)
  26. MICROPYTHON_CFLAGS = -DMICROPY_NLR_SETJMP=1
  27. endif
  28. # When building from a tarball we don't have some of the dependencies that are in
  29. # the git repository as submodules
  30. MICROPYTHON_MAKE_OPTS += \
  31. MICROPY_PY_BTREE=0 \
  32. MICROPY_PY_USSL=0 \
  33. CROSS_COMPILE=$(TARGET_CROSS) \
  34. CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
  35. LDFLAGS_EXTRA="$(TARGET_LDFLAGS)" \
  36. CWARN=
  37. define MICROPYTHON_BUILD_CMDS
  38. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/mpy-cross
  39. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
  40. $(MICROPYTHON_MAKE_OPTS)
  41. endef
  42. define MICROPYTHON_INSTALL_TARGET_CMDS
  43. $(MICROPYTHON_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
  44. $(MICROPYTHON_MAKE_OPTS) \
  45. DESTDIR=$(TARGET_DIR) \
  46. PREFIX=/usr \
  47. install
  48. endef
  49. $(eval $(generic-package))