pkg-luarocks.mk 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ################################################################################
  2. # LuaRocks package infrastructure
  3. # see http://luarocks.org/
  4. #
  5. # This file implements an infrastructure that eases development of
  6. # package .mk files for LuaRocks packages.
  7. # LuaRocks supports various build.type : builtin, make, cmake.
  8. # This luarocks infrastructure supports only the builtin mode,
  9. # the make & cmake modes could be directly handled by generic & cmake infrastructure.
  10. #
  11. # See the Buildroot documentation for details on the usage of this
  12. # infrastructure
  13. #
  14. # In terms of implementation, this LuaRocks infrastructure requires
  15. # the .mk file to only specify metadata information about the
  16. # package: name, version, etc.
  17. #
  18. ################################################################################
  19. ################################################################################
  20. # inner-luarocks-package -- defines how the configuration, compilation and
  21. # installation of a LuaRocks package should be done, implements a few hooks to
  22. # tune the build process and calls the generic package infrastructure to
  23. # generate the necessary make targets
  24. #
  25. # argument 1 is the lowercase package name
  26. # argument 2 is the uppercase package name, including a HOST_ prefix
  27. # for host packages
  28. # argument 3 is the uppercase package name, without the HOST_ prefix
  29. # for host packages
  30. # argument 4 is the type (target or host)
  31. ################################################################################
  32. define inner-luarocks-package
  33. $(2)_BUILD_OPT ?=
  34. $(2)_SUBDIR ?= $(1)-$$(shell echo "$$($(3)_VERSION)" | sed -e "s/-[0-9]$$$$//")
  35. $(2)_ROCKSPEC ?= $(1)-$$($(3)_VERSION).rockspec
  36. $(2)_SOURCE ?= $(1)-$$($(3)_VERSION).src.rock
  37. $(2)_SITE ?= $$(call qstrip,$$(BR2_LUAROCKS_MIRROR))
  38. # Since we do not support host-luarocks-package, we know this is
  39. # a target package, and can just add the required dependencies
  40. $(2)_DEPENDENCIES += host-luarocks luainterpreter
  41. #
  42. # Extract step
  43. #
  44. ifndef $(2)_EXTRACT_CMDS
  45. define $(2)_EXTRACT_CMDS
  46. cd $$($(2)_DIR)/.. && \
  47. $$(LUAROCKS_RUN) unpack --force $$(DL_DIR)/$$($(2)_SOURCE)
  48. endef
  49. endif
  50. #
  51. # Build/install step.
  52. #
  53. ifndef $(2)_INSTALL_TARGET_CMDS
  54. define $(2)_INSTALL_TARGET_CMDS
  55. cd $$($(2)_SRCDIR) && \
  56. $$(LUAROCKS_RUN) make --deps-mode=none --keep $$($(2)_ROCKSPEC) $$($(2)_BUILD_OPT)
  57. endef
  58. endif
  59. # Call the generic package infrastructure to generate the necessary
  60. # make targets
  61. $(call inner-generic-package,$(1),$(2),$(3),$(4))
  62. # $(2)_DEPENDENCIES are handled for configure step (too late)
  63. # but host-luarocks is required to do the extract
  64. $$($(2)_TARGET_EXTRACT): | host-luarocks
  65. endef
  66. ################################################################################
  67. # luarocks-package -- the target generator macro for LuaRocks packages
  68. ################################################################################
  69. luarocks-package = $(call inner-luarocks-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
  70. # host-luarocks-package not supported