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