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