luajit.mk 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ################################################################################
  2. #
  3. # luajit
  4. #
  5. ################################################################################
  6. LUAJIT_VERSION = 2.1.2
  7. LUAJIT_SITE = $(call github,moonjit,moonjit,$(LUAJIT_VERSION))
  8. LUAJIT_LICENSE = MIT
  9. LUAJIT_LICENSE_FILES = COPYRIGHT
  10. LUAJIT_INSTALL_STAGING = YES
  11. LUAJIT_PROVIDES = luainterpreter
  12. ifeq ($(BR2_PACKAGE_LUAJIT_COMPAT52),y)
  13. LUAJIT_XCFLAGS += -DLUAJIT_ENABLE_LUA52COMPAT
  14. endif
  15. ifeq ($(BR2_STATIC_LIBS),y)
  16. LUAJIT_BUILDMODE = static
  17. else
  18. LUAJIT_BUILDMODE = dynamic
  19. endif
  20. # The luajit build procedure requires the host compiler to have the
  21. # same bitness as the target compiler. Therefore, on a x86 build
  22. # machine, we can't build luajit for x86_64, which is checked in
  23. # Config.in. When the target is a 32 bits target, we pass -m32 to
  24. # ensure that even on 64 bits build machines, a compiler of the same
  25. # bitness is used. Of course, this assumes that the 32 bits multilib
  26. # libraries are installed.
  27. ifeq ($(BR2_ARCH_IS_64),y)
  28. LUAJIT_HOST_CC = $(HOSTCC)
  29. else
  30. LUAJIT_HOST_CC = $(HOSTCC) -m32
  31. endif
  32. # We unfortunately can't use TARGET_CONFIGURE_OPTS, because the luajit
  33. # build system uses non conventional variable names.
  34. define LUAJIT_BUILD_CMDS
  35. $(TARGET_MAKE_ENV) $(MAKE) PREFIX="/usr" \
  36. STATIC_CC="$(TARGET_CC)" \
  37. DYNAMIC_CC="$(TARGET_CC) -fPIC" \
  38. TARGET_LD="$(TARGET_CC)" \
  39. TARGET_AR="$(TARGET_AR) rcus" \
  40. TARGET_STRIP=true \
  41. TARGET_CFLAGS="$(TARGET_CFLAGS)" \
  42. TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
  43. HOST_CC="$(LUAJIT_HOST_CC)" \
  44. HOST_CFLAGS="$(HOST_CFLAGS)" \
  45. HOST_LDFLAGS="$(HOST_LDFLAGS)" \
  46. BUILDMODE=$(LUAJIT_BUILDMODE) \
  47. XCFLAGS=$(LUAJIT_XCFLAGS) \
  48. -C $(@D) amalg
  49. endef
  50. define LUAJIT_INSTALL_STAGING_CMDS
  51. $(TARGET_MAKE_ENV) $(MAKE) PREFIX="/usr" DESTDIR="$(STAGING_DIR)" LDCONFIG=true -C $(@D) install
  52. endef
  53. define LUAJIT_INSTALL_TARGET_CMDS
  54. $(TARGET_MAKE_ENV) $(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" LDCONFIG=true -C $(@D) install
  55. endef
  56. define LUAJIT_INSTALL_SYMLINK
  57. ln -fs luajit $(TARGET_DIR)/usr/bin/lua
  58. endef
  59. LUAJIT_POST_INSTALL_TARGET_HOOKS += LUAJIT_INSTALL_SYMLINK
  60. # host-efl package needs host-luajit to be linked dynamically.
  61. define HOST_LUAJIT_BUILD_CMDS
  62. $(HOST_MAKE_ENV) $(MAKE) PREFIX="$(HOST_DIR)" BUILDMODE=dynamic \
  63. TARGET_LDFLAGS="$(HOST_LDFLAGS)" \
  64. XCFLAGS=$(LUAJIT_XCFLAGS) \
  65. -C $(@D) amalg
  66. endef
  67. define HOST_LUAJIT_INSTALL_CMDS
  68. $(HOST_MAKE_ENV) $(MAKE) PREFIX="$(HOST_DIR)" LDCONFIG=true -C $(@D) install
  69. endef
  70. $(eval $(generic-package))
  71. $(eval $(host-generic-package))