1SUMMARY = "Just-In-Time Compiler for Lua"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=076b97f5c7e61532f7f6f3865f04da57"
4HOMEPAGE = "http://luajit.org"
5
6SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1 \
7           file://0001-Do-not-strip-automatically-this-leaves-the-stripping.patch \
8           file://0001-Use-builtin-for-clear_cache.patch \
9           "
10
11PV = "2.1"
12SRCREV = "c525bcb9024510cad9e170e12b6209aedb330f83"
13
14S = "${WORKDIR}/git"
15
16inherit pkgconfig binconfig siteinfo
17
18BBCLASSEXTEND = "native"
19
20# http://luajit.org/install.html#cross
21# Host luajit needs to be compiled with the same pointer size
22# If you want to cross-compile to any 32 bit target on an x64 OS,
23# you need to install the multilib development package (e.g.
24# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
25# (HOST_CC="gcc -m32").
26BUILD_CC_ARCH:append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
27
28# The lua makefiles expect the TARGET_SYS to be from uname -s
29# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
30LUA_TARGET_OS = "Unknown"
31LUA_TARGET_OS:darwin = "Darwin"
32LUA_TARGET_OS:linux = "Linux"
33LUA_TARGET_OS:linux-gnueabi = "Linux"
34LUA_TARGET_OS:mingw32 = "Windows"
35
36# We don't want the lua buildsystem's compiler optimizations, or its
37# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
38# to both host and target compiles
39EXTRA_OEMAKE = "\
40    Q= E='@:' \
41    \
42    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
43    \
44    'TARGET_SYS=${LUA_TARGET_OS}' \
45    \
46    'CC=${CC}' \
47    'TARGET_AR=${AR} rcus' \
48    'TARGET_CFLAGS=${CFLAGS}' \
49    'TARGET_LDFLAGS=${LDFLAGS}' \
50    'TARGET_SHLDFLAGS=${LDFLAGS}' \
51    'HOST_CC=${BUILD_CC}' \
52    'HOST_CFLAGS=${BUILD_CFLAGS}' \
53    \
54    'PREFIX=${prefix}' \
55    'MULTILIB=${baselib}' \
56    'LDCONFIG=:' \
57"
58
59do_compile () {
60    oe_runmake
61}
62
63# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
64# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
65# expectations.
66EXTRA_OEMAKEINST = "\
67    'DESTDIR=${D}' \
68    'INSTALL_BIN=${D}${bindir}' \
69    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
70    'INSTALL_MAN=${D}${mandir}/man1' \
71"
72do_install () {
73    oe_runmake ${EXTRA_OEMAKEINST} install
74    rmdir ${D}${datadir}/lua/5.* \
75          ${D}${datadir}/lua \
76          ${D}${libdir}/lua/5.* \
77          ${D}${libdir}/lua
78}
79
80PACKAGES += 'luajit-common'
81
82# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
83# paths are packaged regardless of what the libdir and datadir paths are.
84FILES:${PN} += "${prefix}/${baselib} ${prefix}/share"
85FILES:${PN} += "${libdir}/libluajit-5.1.so.2 \
86    ${libdir}/libluajit-5.1.so.${PV} \
87"
88FILES:${PN}-dev += "${libdir}/libluajit-5.1.a \
89    ${libdir}/libluajit-5.1.so \
90    ${libdir}/pkgconfig/luajit.pc \
91"
92FILES:luajit-common = "${datadir}/${BPN}-${PV}"
93
94# ppc64/riscv64/riscv32 is not supported in this release
95COMPATIBLE_HOST:powerpc64 = "null"
96COMPATIBLE_HOST:powerpc64le = "null"
97COMPATIBLE_HOST:riscv64 = "null"
98COMPATIBLE_HOST:riscv32 = "null"
99