1################################################################################ 2# 3# luajit 4# 5################################################################################ 6 7LUAJIT_VERSION = 05f1984e1a862e4b3d3c3b370c773492e2edf84a 8LUAJIT_SITE = $(call github,LuaJIT,LuaJIT,$(LUAJIT_VERSION)) 9LUAJIT_LICENSE = MIT 10LUAJIT_LICENSE_FILES = COPYRIGHT 11 12LUAJIT_INSTALL_STAGING = YES 13 14LUAJIT_PROVIDES = luainterpreter 15 16ifeq ($(BR2_PACKAGE_LUAJIT_COMPAT52),y) 17LUAJIT_XCFLAGS += -DLUAJIT_ENABLE_LUA52COMPAT 18endif 19 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. 27ifeq ($(BR2_ARCH_IS_64),y) 28LUAJIT_HOST_CC = $(HOSTCC) 29# There is no LUAJIT_ENABLE_GC64 option. 30else 31LUAJIT_HOST_CC = $(HOSTCC) -m32 32LUAJIT_XCFLAGS += -DLUAJIT_DISABLE_GC64 33endif 34 35# We unfortunately can't use TARGET_CONFIGURE_OPTS, because the luajit 36# build system uses non conventional variable names. 37define LUAJIT_BUILD_CMDS 38 $(TARGET_MAKE_ENV) $(MAKE) PREFIX="/usr" \ 39 STATIC_CC="$(TARGET_CC)" \ 40 DYNAMIC_CC="$(TARGET_CC) -fPIC" \ 41 TARGET_LD="$(TARGET_CC)" \ 42 TARGET_AR="$(TARGET_AR) rcus" \ 43 TARGET_STRIP=true \ 44 TARGET_CFLAGS="$(TARGET_CFLAGS)" \ 45 TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \ 46 HOST_CC="$(LUAJIT_HOST_CC)" \ 47 HOST_CFLAGS="$(HOST_CFLAGS)" \ 48 HOST_LDFLAGS="$(HOST_LDFLAGS)" \ 49 BUILDMODE=dynamic \ 50 XCFLAGS="$(LUAJIT_XCFLAGS)" \ 51 -C $(@D) amalg 52endef 53 54define LUAJIT_INSTALL_STAGING_CMDS 55 $(TARGET_MAKE_ENV) $(MAKE) PREFIX="/usr" DESTDIR="$(STAGING_DIR)" LDCONFIG=true -C $(@D) install 56endef 57 58define LUAJIT_INSTALL_TARGET_CMDS 59 $(TARGET_MAKE_ENV) $(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" LDCONFIG=true -C $(@D) install 60endef 61 62define LUAJIT_INSTALL_SYMLINK 63 ln -fs luajit $(TARGET_DIR)/usr/bin/lua 64endef 65LUAJIT_POST_INSTALL_TARGET_HOOKS += LUAJIT_INSTALL_SYMLINK 66 67# host-efl package needs host-luajit to be linked dynamically. 68define HOST_LUAJIT_BUILD_CMDS 69 $(HOST_MAKE_ENV) $(MAKE) PREFIX="$(HOST_DIR)" BUILDMODE=dynamic \ 70 TARGET_LDFLAGS="$(HOST_LDFLAGS)" \ 71 XCFLAGS="$(LUAJIT_XCFLAGS)" \ 72 -C $(@D) amalg 73endef 74 75define HOST_LUAJIT_INSTALL_CMDS 76 $(HOST_MAKE_ENV) $(MAKE) PREFIX="$(HOST_DIR)" LDCONFIG=true -C $(@D) install 77endef 78 79$(eval $(generic-package)) 80$(eval $(host-generic-package)) 81